mirror of
https://github.com/mhx/dwarfs.git
synced 2025-09-14 14:59:52 -04:00
Use folly::popcount instead of rolling our own logic
This commit is contained in:
parent
38cb73cb53
commit
2df28696b0
@ -26,17 +26,15 @@
|
||||
#include <memory>
|
||||
#include <type_traits>
|
||||
|
||||
#include <folly/lang/Bits.h>
|
||||
|
||||
#include "dwarfs/compiler.h"
|
||||
|
||||
#define DWARFS_NILSIMSA_SIMILARITY(r, a, b) \
|
||||
do { \
|
||||
int bits = 0; \
|
||||
for (int i = 0; i < 4; ++i) { \
|
||||
if constexpr (std::is_same_v<unsigned long, uint64_t>) { \
|
||||
bits += __builtin_popcountl(a[i] ^ b[i]); \
|
||||
} else if constexpr (std::is_same_v<unsigned long long, uint64_t>) { \
|
||||
bits += __builtin_popcountll(a[i] ^ b[i]); \
|
||||
} \
|
||||
bits += folly::popcount(a[i] ^ b[i]); \
|
||||
} \
|
||||
r 255 - bits; \
|
||||
} while (false)
|
||||
|
Loading…
x
Reference in New Issue
Block a user