Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- typedef boost::dynamic_bitset<> Bits;
- Bits concatenateBitsets(const Bits& first, const Bits& second)
- {
- Bits firstCopy(first);
- Bits secondCopy(second);
- //Increase the size of the bit buffer to fit the data being placed in it
- firstCopy.resize(first.size() + second.size());
- secondCopy.resize(first.size() + second.size());
- //shift the bits in the firstCopy to the left
- firstCopy <<= second.size();
- //"copy" the bits from the secondCopy into the firstCopy
- firstCopy |= secondCopy;
- return firstCopy;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement