hex.count_bits¶

dst[:small_n] = x[:n].#on-bits

x is hex.vec n, and dst is hex.vec small_n.
small_n (it’s 2 for 16-255 bit-numbers) is the smallest number of bits that can hold the number n: ((#(n*4))+3)/4

Signature¶

def count_bits n, dst, x { ... }

Defined in hex/math_basic.fj — lines 82–85 (view on GitHub).

Complexity¶

  • Time: n(2.27@-1)

  • Space: n(3.5@+135)    // on 16-255 bit-numbers. (a bit bigger on bigger numbers).

See the complexity glossary for what @, w, dw, dbit, n mean.

Depends on¶

Used by¶