提交 329ae063 编写于 作者: B Behdad Esfahbod

Use __builtin_clzl if element is long

Change-Id: I50a112739847fa826088854f6d172a188ff4cfb3
上级 f8134eff
......@@ -105,9 +105,9 @@ void SparseBitSet::initFromRanges(const uint32_t* ranges, size_t nRanges) {
}
}
// Note: this implementation depends on GCC builtin, and also assumes 32-bit elements.
int SparseBitSet::CountLeadingZeros(element x) {
return __builtin_clz(x);
// Note: GCC / clang builtin
return sizeof(element) <= sizeof(int) ? __builtin_clz(x) : __builtin_clzl(x);
}
uint32_t SparseBitSet::nextSetBit(uint32_t fromIndex) const {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册