diff options
author | Jack Lloyd <[email protected]> | 2018-12-06 21:16:14 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-12-06 21:16:14 -0500 |
commit | 7b9908708f22995da33fb26b26e8ed5ba939e943 (patch) | |
tree | 6d1863247e32b6ea0cdf88d87303b1b6080f3f29 /src/lib/utils | |
parent | 81eb78f723f6d80f505d017b57ac409cda85ca44 (diff) |
Remove hamming_weight function
Unused outside of the test code and not really useful there either.
Header is internal so no API breakage.
Diffstat (limited to 'src/lib/utils')
-rw-r--r-- | src/lib/utils/bit_ops.h | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/src/lib/utils/bit_ops.h b/src/lib/utils/bit_ops.h index a9924b232..d781d64d5 100644 --- a/src/lib/utils/bit_ops.h +++ b/src/lib/utils/bit_ops.h @@ -72,23 +72,6 @@ inline size_t significant_bytes(T n) } /** -* Compute Hamming weights -* @param n an integer value -* @return number of bits in n set to 1 -*/ -template<typename T> -inline size_t hamming_weight(T n) - { - const uint8_t NIBBLE_WEIGHTS[] = { - 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4 }; - - size_t weight = 0; - for(size_t i = 0; i != 2*sizeof(T); ++i) - weight += NIBBLE_WEIGHTS[(n >> (4*i)) & 0x0F]; - return weight; - } - -/** * Count the trailing zero bits in n * @param n an integer value * @return maximum x st 2^x divides n |