15#ifndef RAPIDJSON_CLZLL_H_
16#define RAPIDJSON_CLZLL_H_
20#if defined(_MSC_VER) && !defined(UNDER_CE)
23#pragma intrinsic(_BitScanReverse64)
25#pragma intrinsic(_BitScanReverse)
38#if defined(_MSC_VER) && !defined(UNDER_CE)
41 _BitScanReverse64(&r, x);
44 if(_BitScanReverse(&r,
static_cast<uint32_t>(x >> 32)))
48 _BitScanReverse(&r,
static_cast<uint32_t>(x & 0xFFFFFFFF));
52#elif(defined(__GNUC__) && __GNUC__ >= 4) || RAPIDJSON_HAS_BUILTIN(__builtin_clzll)
54 return static_cast<uint32_t>(__builtin_clzll(x));
58 while(!(x & (
static_cast<uint64_t>(1) << 63)))
68#define RAPIDJSON_CLZLL RAPIDJSON_NAMESPACE::internal::clzll
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition rapidjson.h:451
#define RAPIDJSON_NAMESPACE_BEGIN
provide custom rapidjson namespace (opening expression)
Definition rapidjson.h:121
#define RAPIDJSON_NAMESPACE_END
provide custom rapidjson namespace (closing expression)
Definition rapidjson.h:124
Definition allocators.h:459
uint32_t clzll(uint64_t x)
Definition clzll.h:32
common definitions and configuration
unsigned int uint32_t
Definition stdint.h:126
unsigned __int64 uint64_t
Definition stdint.h:136