Crate u4

Source
Expand description

A deep nibble (4-bit integer) library.

U4 is the actual nibble type, and offers common integer operations.

U4x2 packs two U4s in a u8, useful for building your own primitives.

AsNibbles allows you to view e.g [u8] as a slice of U4s.

Stack is Heap-optimised stack of U4 which uses a packed representation to half the memory usage of the equivalent Vec<U4>, but with a less powerful API.

Re-exports§

pub use stack::Stack;alloc

Modules§

stackalloc
Heap-optimised stack of U4 which uses a packed representation to store two U4s per heap-allocated byte.

Macros§

u4
Create a U4 from a const-evaluable expression.

Structs§

AsNibbles
A wrapper around an AsRef<[u8]> which interprets the underlying bytes as a sequence of U4.
IntoIter
Iterator of U4s in an AsNibbles.
Iter
Returned by AsNibbles::iter.
U4x2
Packed representation of two U4s in a single byte.

Enums§

U4
A 4-bit unsigned integer, which can store numbers 0..16.