StorageBuffer.significant_bits: def of stelliferous@0.0.2.0 Import: import stelliferous@0.0.2.0/storage_buffer.bend as StorageBuffer Lines 43-51 of stelliferous@0.0.2.0/storage_buffer.bend: https://jend.leeeet.dev/read.txt?path=stelliferous@0.0.2.0/storage_buffer.bend&start_line=43&end_line=51 import Base # Shared runtime depth calculation. The tail call stops at the significant # word bits; allocation_depth remains the arithmetic model used by proofs. def significant_bits(remaining: Nat,+value: U32,+bits: Nat,zero: Bool) -> Nat: match remaining zero: case 0n zero: bits case 1n+rest True{}: bits case 1n+rest False{}: +next = U32.shr(value) significant_bits(rest,next,1n+bits,U32.is_zero(next)) Uses (5): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.is_zero https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.shr