nibble

package
v0.0.0-...-5f8ca62 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2023 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommonPrefixLength

func CommonPrefixLength(node1 []Nibble, node2 []Nibble) int

CommonPrefixLength returns the length of the common prefix shared between two slices of Nibbles

func Equal

func Equal(n1, n2 []Nibble) bool

Equal returns if 2 nibble arrays are equal

func IsLeaf

func IsLeaf(encodedPath []Nibble) bool

IsLeaf checks if the compact-encoded path is of a leaf node

func ToBytes

func ToBytes(ns []Nibble) []byte

ToBytes converts a slice of nibbles to a byte slice

Types

type Nibble

type Nibble byte

func CompactEncoding

func CompactEncoding(ns []Nibble, isLeafNode bool) []Nibble

CompactEncoding adds a nibble prefix to a slice of nibbles to indicate its type and make its length even

func FromBytes

func FromBytes(bytes []byte) []Nibble

FromBytes converts a byte slice to a slice of Nibbles.

func RemoveCompactEncoding

func RemoveCompactEncoding(encodedPath []Nibble) []Nibble

RemoveCompactEncoding removes the compact encoding from the nibble slice

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL