This library allows you to read/write "bits" into file streams - via buffers. This means you can pack date into files like never before. Just as buffers allow you to read and write bytes, shorts, integers with ease, now you can add to that and write individual bits while not having to lose the space in between.
Only need to write a true/false? then writing a boolean will write a single bit rather than a whole byte. a number under 16? then write 4 bits - halving the storage required. But by far the best, is that you can mix and match - write a bit, then 5 bits (0 to 31) then a floating point number (32 bits), then 2 bits (0-3) then 7 bits (0 to 128).
What this means is you can write a sequence of bits - as shown below, and take up ONLY what you require, possibly compressing your file data down to tiny amounts.
bit_stream_write_boolean( handle, active_flag); bit_stream_write( handle, 2, object_state); bit_stream_write_boolean( handle, object_damaged); bit_stream_write( handle, 3, player_direction); bit_stream_write_boolean( handle, player_sleeping);
All this data would take up just 1 byte of storage, where as using a standard buffer it could take as much as 11 bytes!