mirror of
https://codeberg.org/icewind/bitbuffer.git
synced 2026-06-03 16:44:06 +02:00
Reading and writing data types of arbitrary bit length that might not be byte-aligned
- Rust 99.8%
- Nix 0.2%
| src | ||
| .gitignore | ||
| bitbuffer.iml | ||
| Cargo.toml | ||
| LICENSE | ||
| README.md | ||
bitstream_reader
Reading bit sequences from a byte slice in rust
Example
use bitstream_reader::{BitBuffer, LittleEndian};
let bytes: &[u8] = &[
0b1011_0101, 0b0110_1010, 0b1010_1100, 0b1001_1001,
0b1001_1001, 0b1001_1001, 0b1001_1001, 0b1110_0111
];
let buffer: BitBuffer<LittleEndian> = BitBuffer::new(bytes);
let result = buffer.read::<u16>(10, 9).unwrap();
You can read up to a maximum of 64 bit.