BitOperations is a Julia package for bit and register operations. It is mainly intended for Julia code that needs to communicate with hardware (e.g. with a register-based memory model) or work with intricate binary data formats.
While bit-manipulation operations are typically easy to implement on-the-fly, using a set of library functions (as provided by this package) improves code readability and reduces the potential for errors.
- Bit indices start at zero:
bmask(Int, 0) == 0x01,
bmask(Int, 1) == 0x02.
Basic bit operations:
Zigzag encoding/decoding (Google Protocol Buffers compatible):