Bitset.word_count: def of bend-collections@1.0.0.0 Import: import bend-collections@1.0.0.0/src/containers/bitset.bend as Bitset Lines 102-108 of bend-collections@1.0.0.0/src/containers/bitset.bend: https://jend.leeeet.dev/read.txt?path=bend-collections@1.0.0.0/src/containers/bitset.bend&start_line=102&end_line=108 import Base # Number of set bits among the low m bits of w. def word_count(m: Nat, +w: U32) -> Nat: match m: case 0n: 0n case 1n+p: Nat.add(bit_value(low(w)), word_count(p, U32.shr(w))) Uses (6): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.add https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.shr https://jend.leeeet.dev/definition.txt?path=bend-collections@1.0.0.0/src/containers/bitset.bend&name=bit_value https://jend.leeeet.dev/definition.txt?path=bend-collections@1.0.0.0/src/containers/bitset.bend&name=low