fallback to the naive version for CE6
This commit is contained in:
parent
6364c8e5ab
commit
91940e84b1
@ -34,31 +34,10 @@ inline uint32_t clzll(uint64_t x) {
|
|||||||
// infinite loop in the software implementation.
|
// infinite loop in the software implementation.
|
||||||
RAPIDJSON_ASSERT(x != 0);
|
RAPIDJSON_ASSERT(x != 0);
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER) && !defined(UNDER_CE)
|
||||||
unsigned long r = 0;
|
unsigned long r = 0;
|
||||||
#if defined(_WIN64)
|
#if defined(_WIN64)
|
||||||
_BitScanReverse64(&r, x);
|
_BitScanReverse64(&r, x);
|
||||||
#elif defined(UNDER_CE)
|
|
||||||
// Scan the high 32 bits.
|
|
||||||
uint32_t high = static_cast<uint32_t>(x >> 32);
|
|
||||||
if (high != 0)
|
|
||||||
{
|
|
||||||
unsigned long index = 31;
|
|
||||||
while((high & (1U<<index)) == 0)
|
|
||||||
{
|
|
||||||
--index;
|
|
||||||
}
|
|
||||||
return index;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Scan the low 32 bits.
|
|
||||||
uint32_t low =static_cast<uint32_t>(x & 0xFFFFFFFF);
|
|
||||||
unsigned long index = 31;
|
|
||||||
while((low & (1U<<index)) == 0)
|
|
||||||
{
|
|
||||||
--index;
|
|
||||||
}
|
|
||||||
return index;
|
|
||||||
#else
|
#else
|
||||||
// Scan the high 32 bits.
|
// Scan the high 32 bits.
|
||||||
if (_BitScanReverse(&r, static_cast<uint32_t>(x >> 32)))
|
if (_BitScanReverse(&r, static_cast<uint32_t>(x >> 32)))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user