~/bend-docscommunity

lib.bend checks

raw source on the hub · import 0x3b8f9f546e51ef5efc252d01094290fb/lib.bend as Lib

BitSet — a small packed bit set for natural-number indices.

Words are stored little-endian in a List of U32 values: bit 0 is the low bit of the first word. The list is canonical (zero words at the high end are removed), while the public representation remains simple and inspectable. Base already provides Word and U32 bit operations; this package only wraps them in a growable List facade.

1 import
import Base

Types

type BitSet source · line 10 · raw

Data

Definitions

def BitSet.trim.arm source · line 15 · raw

@+h:U32 -> @t:List<&2, U32> -> List<&2, U32>

def BitSet.trim source · line 22 · raw

@xs:List<&2, U32> -> List<&2, U32>

def BitSet.word.got source · line 29 · raw

@got:Maybe<&2, U32> -> U32

def BitSet.word source · line 36 · raw

@xs:List<&2, U32> -> @n:Nat -> U32

def BitSet.mask source · line 39 · raw

@n:Nat -> U32

def BitSet.location source · line 42 · raw

@i:Nat -> Pair(Nat, Nat)

def BitSet.empty source · line 47 · raw

BitSet

def BitSet.from_words source · line 50 · raw

@xs:List<&2, U32> -> BitSet

def BitSet.to_words source · line 53 · raw

@bs:BitSet -> List<&2, U32>

def BitSet.contains.loc source · line 60 · raw

@xs:List<&2, U32> -> @loc:Pair(Nat, Nat) -> Bool

def BitSet.contains source · line 64 · raw

@bs:BitSet -> @i:Nat -> Bool

def BitSet.contains_u32 source · line 69 · raw

@bs:BitSet -> @i:U32 -> Bool

def BitSet.insert.go source · line 72 · raw

@xs:List<&2, U32> -> @n:Nat -> @mask:U32 -> List<&2, U32>

def BitSet.insert.loc source · line 85 · raw

@xs:List<&2, U32> -> @loc:Pair(Nat, Nat) -> BitSet

def BitSet.insert source · line 89 · raw

@bs:BitSet -> @i:Nat -> BitSet

def BitSet.insert_u32 source · line 94 · raw

@bs:BitSet -> @i:U32 -> BitSet

def BitSet.singleton source · line 97 · raw

@i:Nat -> BitSet

def BitSet.singleton_u32 source · line 100 · raw

@i:U32 -> BitSet

def BitSet.remove.go source · line 103 · raw

@xs:List<&2, U32> -> @n:Nat -> @mask:U32 -> List<&2, U32>

def BitSet.remove.loc source · line 114 · raw

@xs:List<&2, U32> -> @loc:Pair(Nat, Nat) -> BitSet

def BitSet.remove source · line 118 · raw

@bs:BitSet -> @i:Nat -> BitSet

def BitSet.remove_u32 source · line 123 · raw

@bs:BitSet -> @i:U32 -> BitSet

def BitSet.union.go source · line 128 · raw

@xs:List<&2, U32> -> @ys:List<&2, U32> -> List<&2, U32>

def BitSet.union source · line 139 · raw

@a:BitSet -> @b:BitSet -> BitSet

def BitSet.intersect.go source · line 144 · raw

@xs:List<&2, U32> -> @ys:List<&2, U32> -> List<&2, U32>

def BitSet.intersect source · line 155 · raw

@a:BitSet -> @b:BitSet -> BitSet

def BitSet.word_size.word source · line 162 · raw

@n:Nat -> @w:Word(n) -> @acc:Nat -> Nat

def BitSet.word_size source · line 173 · raw

@w:U32 -> Nat

def BitSet.size.go source · line 178 · raw

@xs:List<&2, U32> -> @acc:Nat -> Nat

def BitSet.size source · line 185 · raw

@bs:BitSet -> Nat

def BitSet.is_empty.go source · line 190 · raw

@xs:List<&2, U32> -> Bool

def BitSet.is_empty source · line 197 · raw

@bs:BitSet -> Bool

def BitSet.to_list.word source · line 202 · raw

@n:Nat -> @+base:Nat -> @w:Word(n) -> List<&2, Nat>

def BitSet.to_list.u32 source · line 213 · raw

@base:Nat -> @w:U32 -> List<&2, Nat>

def BitSet.to_list.go source · line 218 · raw

@xs:List<&2, U32> -> @+base:Nat -> List<&2, Nat>

def BitSet.to_list source · line 226 · raw

@bs:BitSet -> List<&2, Nat>