i64.popcnt
Pops an i64 value off the stack, counts the number of bits that have the value 1, and then pushes the result back on to the stack. This is the number of 1 bits in the value (0b01100100 has a population count of 3).

Syntax

i64.popcnt

Stack In

i64 The value to workout the population count for.

Stack Out

i64 The number of bits that are set to 1 in the value.

Example

;; Push the i64 value 0b01101011 (107) onto the stack
i64.const 107

;; Pop the i64 value off the stack, count the number of bits that are 1
;; and push the result back onto the stack
i64.popcnt

;; The stack contains an i64 value of 5