添加函数 MathUtil::popcount,用于计算一个数字中二进制1的个数
This commit is contained in:
@@ -10,6 +10,11 @@ class MathUtil
|
||||
public:
|
||||
static size_t ComponentSize(ComponentType ct);
|
||||
static size_t DataTypeSize(DataType dt);
|
||||
|
||||
//count the number of bits set in v
|
||||
static DV_CORE_API uint32_t popcount(uint8_t v);
|
||||
static DV_CORE_API uint32_t popcount(uint16_t v);
|
||||
static DV_CORE_API uint32_t popcount(uint32_t v);
|
||||
|
||||
static bool floatEqual(float a, float b,
|
||||
float tolerance = std::numeric_limits<float>::epsilon()) {
|
||||
|
||||
Reference in New Issue
Block a user