1
0
Fork 0
forked from lthn/blockchain

added std analog of __builtin_popcount poor performance, but good compability

This commit is contained in:
cryptozoidberg 2019-07-16 21:14:21 +02:00
parent 41aa0932ce
commit 0b1c1de8a8
No known key found for this signature in database
GPG key ID: 22DEB97A54C6FDEC

View file

@ -9,6 +9,7 @@
#include "support/attributes.h"
#include <stdint.h>
#include <bitset>
#ifdef __cplusplus
extern "C" {
@ -39,7 +40,7 @@ static inline uint32_t clz32(uint32_t x)
static inline uint32_t popcount32(uint32_t x)
{
return (uint32_t)__builtin_popcount(x);
return std::bitset<32>(x).count();
}
static inline uint32_t mul_hi32(uint32_t x, uint32_t y)