aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorlloyd <[email protected]>2009-10-25 22:29:12 +0000
committerlloyd <[email protected]>2009-10-25 22:29:12 +0000
commit059e215aa10c0c69ea52fb787b8b2e7ea3d1ea01 (patch)
tree586ade24a8d7d3326d52c634048b2066a170eef7 /src
parent1bbab4ef0544388a46f02ab2985ada55a82c0e9d (diff)
Cast the u32bit output array to an int* when calling the VC++ intrinsic,
since it passes signed ints for whatever reason. Ensure CALL_CPUID is always defined (previously, it would not be if on an x86 but compiled with something other than GCC, ICC, VC++).
Diffstat (limited to 'src')
-rw-r--r--src/utils/cpuid.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/utils/cpuid.cpp b/src/utils/cpuid.cpp
index 63edd2737..b92afbde3 100644
--- a/src/utils/cpuid.cpp
+++ b/src/utils/cpuid.cpp
@@ -15,7 +15,7 @@
#if defined(BOTAN_BUILD_COMPILER_IS_MSVC)
#include <intrin.h>
- #define CALL_CPUID(type, out) do { __cpuid(out, type) } while(0)
+ #define CALL_CPUID(type, out) do { __cpuid((int*)out, type) } while(0)
#elif defined(BOTAN_BUILD_COMPILER_IS_ICC)
@@ -30,9 +30,12 @@
#endif
-#else
+#endif
+
+#ifndef CALL_CPUID
// In all other cases, just zeroize the supposed cpuid output
- #define CALL_CPUID(type, out) out[0] = out[1] = out[2] = out[3] = 0;
+ #define CALL_CPUID(type, out) \
+ do { out[0] = out[1] = out[2] = out[3] = 0; } while(0);
#endif
namespace Botan {