Module imhamt::bitmap

source ·
Expand description

helpers and type for the HAMT bitmap

The bitmap map a index into the sparse array index

The number of bits set represent the number of elements currently present in the array

e.g for the following elements and their indices:

    [ (0b0010_0000, x) ]

will map into this bitmap:

    0b0010_0000 (1 bit set)

and a vector of 1 element containing x

    | x |

or the following elements and their indices:

    [ (0b0010_0000, x), (0b1000_0000, y), (0b0000_0010, z) ]

will map into this bitmap:

    0b1010_0010 (3 bit set)

and a vector of 3 elements containing x, y, z in the following order:

    | z | x | y |

Structs

  • Sparse index in the array.
  • This is a node size bitmap to allow to find element in the node’s array