Closed mnm-sys closed 1 year ago
Currently, this commit passes the linker flag LDFLAGS= -mpopcnt
to the compiler to enable hardware support for __builtin_popcountll
function. This linker option will fail on unsupported hardware. So, this needs further checks for portability before enabling this flag.
Use GCC
__builtin_popcountll()
function, if available, to count set bits. Appropriate changes has to be made in configure scripts to detect support for__builtin_popcountll()
. If support is not available, then fallback to an efficient software based implementation, like Brain Kernighan's algorithm to count set bits using (n &= n-1
).