[llvm-commits] [llvm] r172655 - /llvm/trunk/include/llvm/Support/MathExtras.h

Michael J. Spencer bigcheesegs at gmail.com
Wed Jan 16 12:50:43 PST 2013


Author: mspencer
Date: Wed Jan 16 14:50:43 2013
New Revision: 172655

URL: http://llvm.org/viewvc/llvm-project?rev=172655&view=rev
Log:
[Support] Include the intrisics header and check for definition properly.

Modified:
    llvm/trunk/include/llvm/Support/MathExtras.h

Modified: llvm/trunk/include/llvm/Support/MathExtras.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/MathExtras.h?rev=172655&r1=172654&r2=172655&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/MathExtras.h (original)
+++ llvm/trunk/include/llvm/Support/MathExtras.h Wed Jan 16 14:50:43 2013
@@ -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 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_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);





More information about the llvm-commits mailing list