I need to derive bytes from a bit set that may (not) contain multiple bits of CHAR_BIT. I now how many bits in a bitet I need to insert into an array. For instance,
set of bits declared as std::bitset < 40> id;
There is a separate variable nBitshow many bits idcan be used. Now I want to extract these bits in a few CHAR_BIT. I also need to take care of cases when nBits % CHAR_BIT != 0. I can put this in a uint8 array
source
share