Skip to content

mriise/crumb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

License Crates.io Documentation

Encode an index and value of a 4 bit 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.

About

Encoding a nibble(u4) of a u64 into a u8

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages