allot

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package allot provides precalculated bitsets that map baseIndex values to all longer (more specific) prefixes covered within the same stride.

Each baseIndex corresponds to a prefix in the complete binary tree formed by all possible 8-bit stride prefixes. The associated BitSet represents the subtree of that prefix, including all more specific baseIndices (deeper in the trie).

These precomputed sets allow efficient, branchless lookups and fast set comparisons using bitwise operations.

For background on the baseIndex algorithm and its trie structure, see the ART paper at: ./doc/artlookup.pdf

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IdxToFringeRoutes

func IdxToFringeRoutes(idx uint8) *bitset.BitSet256

IdxToFringeRoutes returns the precomputed BitSet for a base index, representing all more specific baseIndices (i.e., subprefixes) covered by this index in the binary prefix tree.

This structure is functionally identical to IdxToPrefixRoutes, but applies only to the fringe part of the trie.

func IdxToPrefixRoutes

func IdxToPrefixRoutes(idx uint8) *bitset.BitSet256

IdxToPrefixRoutes returns the precalculated BitSet for a given base index.

A prefix with baseIndex idx covers all baseIndices that represent longer, more specific prefixes within the same stride (i.e., subtree of the binary prefix trie).

This lookup returns a BitSet that contains those indices.

Example:

  • prefix 0b10/2 -> baseIndex 6
  • it covers: 0b100/3 (index 12), 0b101/3 (index 13), 0b1000/4 (24), etc.

Only the first 256 baseIndex values (1 to 255) are included here. For indices >= 256 (i.e., full 8-bit prefixes), see fringeRoutesLookupTbl.

This function is used for fast prefix set comparisons using bitwise intersection instead of scanning or looping over ranges.

Types

This section is empty.

Jump to

Keyboard shortcuts

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