1
0
Fork 0
mirror of https://codeberg.org/icewind/bitbuffer.git synced 2026-06-03 08:34:07 +02:00
Reading and writing data types of arbitrary bit length that might not be byte-aligned
  • Rust 99.8%
  • Nix 0.2%
Find a file
2019-02-22 22:47:56 +01:00
src make usable with rust stable 2019-02-22 22:40:45 +01:00
.gitignore basics 2019-02-12 21:22:24 +01:00
bitbuffer.iml basics 2019-02-12 21:22:24 +01:00
Cargo.toml switch licence to apache/mit 2019-02-22 22:47:56 +01:00
LICENSE-APACHE switch licence to apache/mit 2019-02-22 22:47:56 +01:00
LICENSE-MIT switch licence to apache/mit 2019-02-22 22:47:56 +01:00
README.md rename to bitstream_reader 2019-02-21 22:54:32 +01:00

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.