~/bend-docscommunity

bitmap.bend checks

raw source on the hub · import bend-osdev-algo@0.1.0.0/bitmap.bend as Bitmap

bend-osdev-algo, bitmaps: a bitmap is a List<&2, U32> of words, bit i in word i / 32 at position i mod 32, as the kernel lays out its bitmaps. next_set and next_clear find the next set or clear bit at or after an index and below a size, and answer the size when there is none (the kernel's find_next_bit and find_next_zero_bit).

2 imports
import Base
import ./algo.bend as A

Definitions

def bitseq.at source · line 12 · raw

@bs:List<&2, Bool> -> @i:Nat -> Bool

bit i (False past the end)

def bitseq.next source · line 23 · raw

@size:Nat -> @start:Nat -> @want:Bool -> @bs:List<&2, Bool> -> Nat

the least i with start <= i < size whose bit is want, or size if there is none (bits past the end of bs are clear)

def bitmap.bits source · line 49 · raw

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

the bits of the words, bit 0 of the first word first

def bitmap.test source · line 57 · raw

@words:List<&2, U32> -> @i:Nat -> Bool

bit i of the bitmap (False past its end)

def bitmap.next_set source · line 61 · raw

@words:List<&2, U32> -> @size:Nat -> @start:Nat -> Nat

the first set bit at or after start and below size, or size

def bitmap.next_clear source · line 65 · raw

@words:List<&2, U32> -> @size:Nat -> @start:Nat -> Nat

the first clear bit at or after start and below size, or size

def bitmap.first_set source · line 68 · raw

@words:List<&2, U32> -> @size:Nat -> Nat

def bitmap.first_clear source · line 71 · raw

@words:List<&2, U32> -> @size:Nat -> Nat