4 ms·
Bit population count is useful for many things. MMIX has SADD ("sideways add", which is also a bit population count), and also has MOR ("multiple OR") and MXOR
by zzo38computer 3y ago
Bit population count is useful for many things. MMIX has SADD ("sideways add", which is also a bit population count), and also has MOR ("multiple OR") and MXOR ("multiple XOR"), which are also useful (for many purposes, including endianness conversion (even PDP-endian), reversing the bits in a byte, hashing, and others) but I had not seen on other instruction sets.
In GNU C, you can use the function __builtin_popcount to make bit population count.