Crates.io | pushbits |
lib.rs | pushbits |
version | 0.1.0 |
source | src |
created_at | 2020-12-27 12:43:48.507563 |
updated_at | 2020-12-27 12:43:48.507563 |
description | Push and pop the bit-packed fields |
homepage | |
repository | https://github.com/HyeonuPark/pushbits |
max_upload_size | |
id | 327812 |
size | 18,979 |
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.
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.