Language:
C++
Task:
Packing the required number of bits of all the given data, which can be of any valid C++ Datatype, in a given char*.
I have successfully completed packing of required number of bits of the following Datatypes:
1. Integer
2. Short
3. Character
4. Character array
Pending Datatypes:
1. Float
2. Structures, Enum, Union.
I don't have a clear idea how Structures and Floating points should be packed ?
I posted a question in Stackoverflow and the people there told me about
bitset and
Boost Serialization library.
While Googling further, I found
BitMagic Library !
- Can someone throw some light on the above two findings w.r.t Structures ?
- (Little Endian machine) Which 5 digits from this number should be packed in a char*: 234.21234567 ?
- Are there some standard algorithms for this type of bit packing ? I looked at Huffman Coding algorithm, but I am not sure whether it is meant for such kind of tasks !
I need guidance.