Module trie_db::nibble_ops

source ·
Expand description

Utility methods to work on radix 16 nibble.

Constants

Single nibble length in bit.
Size of header.
Number of child for a branch (trie radix).
Number of nibble per byte.
Nibble (half a byte).
The nibble shifts needed to align. We use two value, one is a left shift and the other is a right shift.

Functions

Get u8 nibble value at a given index in a NibbleSlice.
Get u8 nibble value at a given index of a byte.
Count the biggest common depth between two left aligned packed nibble slice.
Calculate the number of common nibble between two left aligned bytes.
Get u8 nibble value at a given index in a left aligned array.
Calculate the number of needed padding a array of nibble length i.
Mask a byte, keeping left nibble.
Mask a byte, keeping right byte.
Push u8 nibble value at a given index into an existing byte.
Shifts right aligned key to add a given left offset. Resulting in possibly padding at both left and right (example usage when combining two keys).