Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Equal ¶
Equal returns true if the two nibble arrays are equal [0x1, 0x2, 0x3], [0x1, 0x2, 0x3] -> true [0x1, 0x2, 0x3], [0x1, 0x2, 0x4] -> false [0x1, 0x2, 0x3], [0x1] -> false [0x1, 0x2, 0x3], [0x1, 0x2, 0x3, 0x4] -> false [], [] -> true [], [0x1] -> false
func Pack ¶
Pack the nibble array into a byte array. Return the byte array and a bool indicating if the last byte is a full byte or only the high 4 bits are part of the encoding the last four bits of a oddLength byte encoding will always be zero. Allocates a new byte slice.
[0x1, 0x2, 0x3] -> [0x12, 0x30], true [0x1, 0x2, 0x3, 0x4] -> [0x12, 0x34], false [0x1] -> [0x10], true [] -> [], false
Types ¶
type Nibbles ¶
type Nibbles []byte
Nibbles are 4-bit values stored in an 8-bit byte arrays
func Deserialize ¶
Deserialize returns a nibble array from the byte array.
func SharedPrefix ¶
SharedPrefix returns a slice from nyb1 that contains the shared prefix between nyb1 and nyb2