From 072130c774324f00ec70a921dec3f0daaeca7840 Mon Sep 17 00:00:00 2001 From: tevador Date: Tue, 20 Nov 2018 22:41:34 +0100 Subject: [PATCH] ALU/FPU test: Fixed MSVC x86 build --- tests/test_alu_fpu/InstructionsPortable.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/tests/test_alu_fpu/InstructionsPortable.cpp b/tests/test_alu_fpu/InstructionsPortable.cpp index 7c8835a..36fb5ad 100644 --- a/tests/test_alu_fpu/InstructionsPortable.cpp +++ b/tests/test_alu_fpu/InstructionsPortable.cpp @@ -20,14 +20,16 @@ #endif #if defined(_MSC_VER) + #define HAS_VALUE(X) X ## 0 + #define EVAL_DEFINE(X) HAS_VALUE(X) #include #include #define ror64 _rotr64 #define rol64 _rotl64 - #ifdef __MACHINEARM64_X64 + #if EVAL_DEFINE(__MACHINEARM64_X64(1)) #define umulhi64 __umulh #endif - #ifdef __MACHINEX64 + #if EVAL_DEFINE(__MACHINEX64(1)) static inline uint64_t __imulhi64(int64_t a, int64_t b) { int64_t hi; _mul128(a, b, &hi); @@ -35,9 +37,6 @@ } #define imulhi64 __imulhi64 #endif - #ifdef __MACHINEX86_X64 - #define sar64 __ll_rshift - #endif #endif #ifndef ror64 @@ -60,11 +59,11 @@ return value >> shift; } - struct usesArithmeticShift : std::integral_constant { + struct UsesArithmeticShift : std::integral_constant { }; static inline int64_t __sar64(int64_t a, int b) { - return usesArithmeticShift::value ? builtintShr64(a, b) : (a < 0 ? ~(~a >> b) : a >> b); + return UsesArithmeticShift::value ? builtintShr64(a, b) : (a < 0 ? ~(~a >> b) : a >> b); } #define sar64 __sar64 #endif