forked from OSchip/llvm-project
Use gnu style builtins in MathExtras.h with clang on Windows
Clang does not provide BitScan* intrinsic implementations yet. llvm-svn: 187813
This commit is contained in:
parent
b75e0c92f3
commit
1c767e6076
|
@ -80,7 +80,7 @@ inline std::size_t countTrailingZeros<uint32_t>(uint32_t Val, ZeroBehavior ZB) {
|
||||||
if (ZB != ZB_Undefined && Val == 0)
|
if (ZB != ZB_Undefined && Val == 0)
|
||||||
return 32;
|
return 32;
|
||||||
|
|
||||||
#if __GNUC__ >= 4
|
#if __has_builtin(__builtin_ctz) || __GNUC_PREREQ(4, 0)
|
||||||
return __builtin_ctz(Val);
|
return __builtin_ctz(Val);
|
||||||
#elif _MSC_VER
|
#elif _MSC_VER
|
||||||
unsigned long Index;
|
unsigned long Index;
|
||||||
|
@ -95,7 +95,7 @@ inline std::size_t countTrailingZeros<uint64_t>(uint64_t Val, ZeroBehavior ZB) {
|
||||||
if (ZB != ZB_Undefined && Val == 0)
|
if (ZB != ZB_Undefined && Val == 0)
|
||||||
return 64;
|
return 64;
|
||||||
|
|
||||||
#if __GNUC__ >= 4
|
#if __has_builtin(__builtin_ctzll) || __GNUC_PREREQ(4, 0)
|
||||||
return __builtin_ctzll(Val);
|
return __builtin_ctzll(Val);
|
||||||
#elif _MSC_VER
|
#elif _MSC_VER
|
||||||
unsigned long Index;
|
unsigned long Index;
|
||||||
|
@ -146,7 +146,7 @@ inline std::size_t countLeadingZeros<uint32_t>(uint32_t Val, ZeroBehavior ZB) {
|
||||||
if (ZB != ZB_Undefined && Val == 0)
|
if (ZB != ZB_Undefined && Val == 0)
|
||||||
return 32;
|
return 32;
|
||||||
|
|
||||||
#if __GNUC__ >= 4
|
#if __has_builtin(__builtin_clz) || __GNUC_PREREQ(4, 0)
|
||||||
return __builtin_clz(Val);
|
return __builtin_clz(Val);
|
||||||
#elif _MSC_VER
|
#elif _MSC_VER
|
||||||
unsigned long Index;
|
unsigned long Index;
|
||||||
|
@ -161,7 +161,7 @@ inline std::size_t countLeadingZeros<uint64_t>(uint64_t Val, ZeroBehavior ZB) {
|
||||||
if (ZB != ZB_Undefined && Val == 0)
|
if (ZB != ZB_Undefined && Val == 0)
|
||||||
return 64;
|
return 64;
|
||||||
|
|
||||||
#if __GNUC__ >= 4
|
#if __has_builtin(__builtin_clzll) || __GNUC_PREREQ(4, 0)
|
||||||
return __builtin_clzll(Val);
|
return __builtin_clzll(Val);
|
||||||
#elif _MSC_VER
|
#elif _MSC_VER
|
||||||
unsigned long Index;
|
unsigned long Index;
|
||||||
|
|
Loading…
Reference in New Issue