implemented writing access to buffers

* separated bit operations in a new module (bit_util)
* added endianness convertion support
* refactored bit access macros