Exemple #1
0
void binary_type::prepend(const binary_type& prior)
{
    shift_right(prior.size());
    data_chunk prior_blocks = prior.blocks();
    for (size_type i = 0; i < prior_blocks.size(); i++)
    {
        blocks_[i] = blocks_[i] | prior_blocks[i];
    }
}
Exemple #2
0
void binary_type::append(const binary_type& post)
{
    const size_type block_offset = size() / bits_per_block;
    const size_type offset = size() % bits_per_block;

    // overkill for byte alignment
    binary_type duplicate(post.size(), post.blocks());
    duplicate.shift_right(offset);

    resize(size() + post.size());
    data_chunk post_shift_blocks = duplicate.blocks();
    for (size_type i = 0; i < post_shift_blocks.size(); i++)
    {
        blocks_[block_offset + i] = blocks_[block_offset + i] | post_shift_blocks[i];
    }
}