def bv8

bend-collections@1.0.0.0 · src/containers/bitset.bend:242

import bend-collections@1.0.0.0/src/containers/bitset.bend as Bitset
import Base

242# Sum of the populations of words q, q+1, ... (m of them).
243# Eight bits per iteration: word_count_t unrolled (the same shifts and adds).
244def bv8(+w: U32) -> Nat:
245  Nat.add(bit_value(low(w)), Nat.add(bit_value(low(U32.shr(w))), Nat.add(bit_value(low(U32.shr(U32.shr(w)))), Nat.add(bit_value(low(U32.shr(U32.shr(U32.shr(w))))), Nat.add(bit_value(low(U32.shr(U32.shr(U32.shr(U32.shr(w)))))), Nat.add(bit_value(low(U32.shr(U32.shr(U32.shr(U32.shr(U32.shr(w))))))), Nat.add(bit_value(low(U32.shr(U32.shr(U32.shr(U32.shr(U32.shr(U32.shr(w)))))))), bit_value(low(U32.shr(U32.shr(U32.shr(U32.shr(U32.shr(U32.shr(U32.shr(w))))))))))))))))

Uses (6)

Used by (1)