Crates.io | crumb |
lib.rs | crumb |
version | 0.2.1 |
source | src |
created_at | 2021-02-07 02:29:05.624825 |
updated_at | 2022-02-07 06:44:28.951572 |
description | Encode a nibble from a u64 as a u8. |
homepage | |
repository | https://github.com/mriise/crumb |
max_upload_size | |
id | 351768 |
size | 4,630 |
Encode an index of a nibble from a u64 as a u8.
| 4 bits | 4 bits |
| index of nibble | nibble of data |
use crumb::Crumb;
fn main() {
let crumb = Crumb::new(1, 0b11111111).unwrap();
assert_eq!(0b11110000u64, crumb.get_u64()); // external bits are discarded
}
A nibble of something is about the size of a crumb or something like that...
Was doing some research on variable length integers and realized how nicely this fits.
Not sure!
I don't think there are too many applications for this.