Skip to content

Unsigned N-bit Buffer: A structure that holds a fixed buffer of `bits`-sized unsigned integer elements.

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

Longor1996/unthbuf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

UnthBuf

Note: While tested and usable, this library is not quite ready; expect breaking changes with any update until 1.0.0.

The UnthBuf is a structure that stores a given fixed amount of unsigned integers, like Box<[usize]>... except that the bit-size can be freely chosen from 0 to 64 bits, and the alignment of the stored values is a const-generic bool, effectively making it a Box<[uN]>.

For example:

let buf = UnthBuf::<true>::new(4096, 5);
buf.set(21, 5).unwrap();

Will, if ALIGNED == true, result in this bit-pattern:

0101101101101101101101101101101101101101101101101101101101101101
0000000000000000000000000000000000000000000000000000000000000101

Or, if ALIGNED == false:

1101101101101101101101101101101101101101101101101101101101101101
0000000000000000000000000000000000000000000000000000000000000010

About

Unsigned N-bit Buffer: A structure that holds a fixed buffer of `bits`-sized unsigned integer elements.

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Languages