pushbits

Crates.iopushbits
lib.rspushbits
version0.1.0
sourcesrc
created_at2020-12-27 12:43:48.507563
updated_at2020-12-27 12:43:48.507563
descriptionPush and pop the bit-packed fields
homepage
repositoryhttps://github.com/HyeonuPark/pushbits
max_upload_size
id327812
size18,979
sei-core (github:sei-protocol:sei-core)

documentation

https://docs.rs/pushbits

README

Pushbits

https://docs.rs/pushbits/

Push and pop the bit-packed fields.

It's common for network protocols to have bit-packed fields as a fixed width row in its header. Each fields have their own bit width, and its bit offset is defined as a sum of the widths of previous fields of the same row.

Traditionaly to set/extract those fields one should manage both width and offset of the fields. But since all the fields of this row are handled, the offset is a redaundant information we should not care ourselves.

That's where the pushbits came from. This crate provides fixed width bit container where you can push and pop the bits as a integer using bitshift left operation. If the widths are constant, the compiler optimize out all the overheads.

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Commit count: 1

cargo fmt