crumb

Crates.iocrumb
lib.rscrumb
version0.2.1
sourcesrc
created_at2021-02-07 02:29:05.624825
updated_at2022-02-07 06:44:28.951572
descriptionEncode a nibble from a u64 as a u8.
homepage
repositoryhttps://github.com/mriise/crumb
max_upload_size
id351768
size4,630
Melanie Riise (mriise)

documentation

README

License Crates.io Documentation

Encode an index of a nibble from a u64 as a u8.

| 4 bits | 4 bits |

| index of nibble | nibble of data |

Usage

use crumb::Crumb;

fn main() {
	let crumb = Crumb::new(1, 0b11111111).unwrap();
	assert_eq!(0b11110000u64, crumb.get_u64()); // external bits are discarded
}

Name

A nibble of something is about the size of a crumb or something like that...

Why?

Was doing some research on variable length integers and realized how nicely this fits.

For What?

Not sure!

I don't think there are too many applications for this.

Commit count: 13

cargo fmt