diff options
author | Michael J. Spencer <bigcheesegs@gmail.com> | 2013-01-16 20:50:43 +0000 |
---|---|---|
committer | Michael J. Spencer <bigcheesegs@gmail.com> | 2013-01-16 20:50:43 +0000 |
commit | c8b909ae499e5b0d7e38ba5c54c35e98c936300b (patch) | |
tree | 4c9da807b46d888ef28718dee7ba0edba62946ec /include | |
parent | 4f3b323f8d83d2d474436bd86e1ab5581a6cf79c (diff) | |
download | external_llvm-c8b909ae499e5b0d7e38ba5c54c35e98c936300b.zip external_llvm-c8b909ae499e5b0d7e38ba5c54c35e98c936300b.tar.gz external_llvm-c8b909ae499e5b0d7e38ba5c54c35e98c936300b.tar.bz2 |
[Support] Include the intrisics header and check for definition properly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172655 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Support/MathExtras.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/include/llvm/Support/MathExtras.h b/include/llvm/Support/MathExtras.h index 10911ea..eaab8ab 100644 --- a/include/llvm/Support/MathExtras.h +++ b/include/llvm/Support/MathExtras.h @@ -16,6 +16,10 @@ #include "llvm/Support/SwapByteOrder.h" +#ifdef _MSC_VER +# include <intrin.h> +#endif + namespace llvm { // NOTE: The following support functions use the _32/_64 extensions instead of @@ -299,7 +303,7 @@ inline unsigned CountTrailingOnes_64(uint64_t Value) { inline unsigned CountPopulation_32(uint32_t Value) { #if __GNUC__ >= 4 return __builtin_popcount(Value); -#elif _MSC_VER +#elif defined(_MSC_VER) return __popcnt(Value); #else uint32_t v = Value - ((Value >> 1) & 0x55555555); @@ -313,7 +317,7 @@ inline unsigned CountPopulation_32(uint32_t Value) { inline unsigned CountPopulation_64(uint64_t Value) { #if __GNUC__ >= 4 return __builtin_popcountll(Value); -#elif _MSC_VER +#elif defined(_MSC_VER) return __popcnt64(Value); #else uint64_t v = Value - ((Value >> 1) & 0x5555555555555555ULL); |