I have a char*
buffer, that I want to append integers of various bit sizes (between 1
and 32
) to.
Thus, I need a function:
void addBits(char *buffer, int bits_appended_so_far, int object, int object_bit_size);
that can move an object of, say, 13
bits to the 470
th bit position of buffer.
I could of course shift the bits onto the buffer one by one, but speed is of the essence so it seems like it should be possible to move larger chunks at a time. Is there a standard method to do this? Seems like there should be a standard method, but some googling and SO searching has not given me what I want.