| @@ -307,7 +307,7 @@ void BigInteger::negate() noexcept | |||
| negative = (! negative) && ! isZero(); | |||
| } | |||
| #if JUCE_USE_MSVC_INTRINSICS && ! defined (__INTEL_COMPILER) | |||
| #if JUCE_MSVC && ! defined (__INTEL_COMPILER) | |||
| #pragma intrinsic (_BitScanReverse) | |||
| #endif | |||
| @@ -317,7 +317,7 @@ inline static int highestBitInInt (uint32 n) noexcept | |||
| #if JUCE_GCC || JUCE_CLANG | |||
| return 31 - __builtin_clz (n); | |||
| #elif JUCE_USE_MSVC_INTRINSICS | |||
| #elif JUCE_MSVC | |||
| unsigned long highest; | |||
| _BitScanReverse (&highest, n); | |||
| return (int) highest; | |||
| @@ -202,27 +202,17 @@ private: | |||
| #else | |||
| #define JUCE_ATOMICS_WINDOWS 1 // Windows with intrinsics | |||
| #if JUCE_USE_MSVC_INTRINSICS | |||
| #ifndef __INTEL_COMPILER | |||
| #pragma intrinsic (_InterlockedExchange, _InterlockedIncrement, _InterlockedDecrement, _InterlockedCompareExchange, \ | |||
| _InterlockedCompareExchange64, _InterlockedExchangeAdd, _ReadWriteBarrier) | |||
| #endif | |||
| #define juce_InterlockedExchange(a, b) _InterlockedExchange(a, b) | |||
| #define juce_InterlockedIncrement(a) _InterlockedIncrement(a) | |||
| #define juce_InterlockedDecrement(a) _InterlockedDecrement(a) | |||
| #define juce_InterlockedExchangeAdd(a, b) _InterlockedExchangeAdd(a, b) | |||
| #define juce_InterlockedCompareExchange(a, b, c) _InterlockedCompareExchange(a, b, c) | |||
| #define juce_InterlockedCompareExchange64(a, b, c) _InterlockedCompareExchange64(a, b, c) | |||
| #define juce_MemoryBarrier _ReadWriteBarrier | |||
| #else | |||
| long juce_InterlockedExchange (volatile long* a, long b) noexcept; | |||
| long juce_InterlockedIncrement (volatile long* a) noexcept; | |||
| long juce_InterlockedDecrement (volatile long* a) noexcept; | |||
| long juce_InterlockedExchangeAdd (volatile long* a, long b) noexcept; | |||
| long juce_InterlockedCompareExchange (volatile long* a, long b, long c) noexcept; | |||
| __int64 juce_InterlockedCompareExchange64 (volatile __int64* a, __int64 b, __int64 c) noexcept; | |||
| inline void juce_MemoryBarrier() noexcept { long x = 0; juce_InterlockedIncrement (&x); } | |||
| #ifndef __INTEL_COMPILER | |||
| #pragma intrinsic (_InterlockedExchange, _InterlockedIncrement, _InterlockedDecrement, _InterlockedCompareExchange, \ | |||
| _InterlockedCompareExchange64, _InterlockedExchangeAdd, _ReadWriteBarrier) | |||
| #endif | |||
| #define juce_InterlockedExchange(a, b) _InterlockedExchange(a, b) | |||
| #define juce_InterlockedIncrement(a) _InterlockedIncrement(a) | |||
| #define juce_InterlockedDecrement(a) _InterlockedDecrement(a) | |||
| #define juce_InterlockedExchangeAdd(a, b) _InterlockedExchangeAdd(a, b) | |||
| #define juce_InterlockedCompareExchange(a, b, c) _InterlockedCompareExchange(a, b, c) | |||
| #define juce_InterlockedCompareExchange64(a, b, c) _InterlockedCompareExchange64(a, b, c) | |||
| #define juce_MemoryBarrier _ReadWriteBarrier | |||
| #if JUCE_64BIT | |||
| #ifndef __INTEL_COMPILER | |||
| @@ -140,17 +140,13 @@ private: | |||
| //============================================================================== | |||
| #if JUCE_USE_MSVC_INTRINSICS && ! defined (__INTEL_COMPILER) | |||
| #if JUCE_MSVC && ! defined (__INTEL_COMPILER) | |||
| #pragma intrinsic (_byteswap_ulong) | |||
| #endif | |||
| inline uint16 ByteOrder::swap (uint16 n) noexcept | |||
| { | |||
| #if JUCE_USE_MSVC_INTRINSICSxxx // agh - the MS compiler has an internal error when you try to use this intrinsic! | |||
| return static_cast<uint16> (_byteswap_ushort (n)); | |||
| #else | |||
| return static_cast<uint16> ((n << 8) | (n >> 8)); | |||
| #endif | |||
| } | |||
| inline uint32 ByteOrder::swap (uint32 n) noexcept | |||
| @@ -160,15 +156,8 @@ inline uint32 ByteOrder::swap (uint32 n) noexcept | |||
| #elif (JUCE_GCC || JUCE_CLANG) && JUCE_INTEL && ! JUCE_NO_INLINE_ASM | |||
| asm("bswap %%eax" : "=a"(n) : "a"(n)); | |||
| return n; | |||
| #elif JUCE_USE_MSVC_INTRINSICS | |||
| #elif JUCE_MSVC | |||
| return _byteswap_ulong (n); | |||
| #elif JUCE_MSVC && ! JUCE_NO_INLINE_ASM | |||
| __asm { | |||
| mov eax, n | |||
| bswap eax | |||
| mov n, eax | |||
| } | |||
| return n; | |||
| #elif JUCE_ANDROID | |||
| return bswap_32 (n); | |||
| #else | |||
| @@ -180,7 +169,7 @@ inline uint64 ByteOrder::swap (uint64 value) noexcept | |||
| { | |||
| #if JUCE_MAC || JUCE_IOS | |||
| return OSSwapInt64 (value); | |||
| #elif JUCE_USE_MSVC_INTRINSICS | |||
| #elif JUCE_MSVC | |||
| return _byteswap_uint64 (value); | |||
| #else | |||
| return (((uint64) swap ((uint32) value)) << 32) | swap ((uint32) (value >> 32)); | |||
| @@ -38,10 +38,6 @@ void Logger::outputDebugString (const String& text) | |||
| #endif | |||
| //============================================================================== | |||
| #if JUCE_USE_MSVC_INTRINSICS | |||
| // CPU info functions using intrinsics... | |||
| #pragma intrinsic (__cpuid) | |||
| #pragma intrinsic (__rdtsc) | |||
| @@ -50,37 +46,6 @@ static void callCPUID (int result[4], int infoType) | |||
| __cpuid (result, infoType); | |||
| } | |||
| #else | |||
| static void callCPUID (int result[4], int infoType) | |||
| { | |||
| #if ! JUCE_MINGW | |||
| __try | |||
| #endif | |||
| { | |||
| #if JUCE_GCC || JUCE_CLANG | |||
| __asm__ __volatile__ ("cpuid" : "=a" (result[0]), "=b" (result[1]), "=c" (result[2]),"=d" (result[3]) : "a" (infoType)); | |||
| #else | |||
| __asm | |||
| { | |||
| mov esi, result | |||
| mov eax, infoType | |||
| xor ecx, ecx | |||
| cpuid | |||
| mov dword ptr [esi + 0], eax | |||
| mov dword ptr [esi + 4], ebx | |||
| mov dword ptr [esi + 8], ecx | |||
| mov dword ptr [esi + 12], edx | |||
| } | |||
| #endif | |||
| } | |||
| #if ! JUCE_MINGW | |||
| __except (EXCEPTION_EXECUTE_HANDLER) {} | |||
| #endif | |||
| } | |||
| #endif | |||
| String SystemStats::getCpuVendor() | |||
| { | |||
| int info[4] = { 0 }; | |||
| @@ -327,7 +292,7 @@ double Time::getMillisecondCounterHiRes() noexcept { return hiResCounterHa | |||
| //============================================================================== | |||
| static int64 juce_getClockCycleCounter() noexcept | |||
| { | |||
| #if JUCE_USE_MSVC_INTRINSICS | |||
| #if JUCE_MSVC | |||
| // MS intrinsics version... | |||
| return (int64) __rdtsc(); | |||
| @@ -348,19 +313,7 @@ static int64 juce_getClockCycleCounter() noexcept | |||
| return (int64) ((((uint64) hi) << 32) | lo); | |||
| #else | |||
| // MSVC inline asm version... | |||
| unsigned int hi = 0, lo = 0; | |||
| __asm | |||
| { | |||
| xor eax, eax | |||
| xor edx, edx | |||
| rdtsc | |||
| mov lo, eax | |||
| mov hi, edx | |||
| } | |||
| return (int64) ((((uint64) hi) << 32) | lo); | |||
| #error "unknown compiler?" | |||
| #endif | |||
| } | |||
| @@ -35,38 +35,11 @@ void* getUser32Function (const char* functionName) | |||
| return (void*) GetProcAddress (module, functionName); | |||
| } | |||
| //============================================================================== | |||
| #if ! JUCE_USE_MSVC_INTRINSICS | |||
| // In newer compilers, the inline versions of these are used (in juce_Atomic.h), but in | |||
| // older ones we have to actually call the ops as win32 functions.. | |||
| long juce_InterlockedExchange (volatile long* a, long b) noexcept { return InterlockedExchange (a, b); } | |||
| long juce_InterlockedIncrement (volatile long* a) noexcept { return InterlockedIncrement (a); } | |||
| long juce_InterlockedDecrement (volatile long* a) noexcept { return InterlockedDecrement (a); } | |||
| long juce_InterlockedExchangeAdd (volatile long* a, long b) noexcept { return InterlockedExchangeAdd (a, b); } | |||
| long juce_InterlockedCompareExchange (volatile long* a, long b, long c) noexcept { return InterlockedCompareExchange (a, b, c); } | |||
| __int64 juce_InterlockedCompareExchange64 (volatile __int64* value, __int64 newValue, __int64 valueToCompare) noexcept | |||
| { | |||
| jassertfalse; // This operation isn't available in old MS compiler versions! | |||
| __int64 oldValue = *value; | |||
| if (oldValue == valueToCompare) | |||
| *value = newValue; | |||
| return oldValue; | |||
| } | |||
| #endif | |||
| //============================================================================== | |||
| CriticalSection::CriticalSection() noexcept | |||
| { | |||
| // (just to check the MS haven't changed this structure and broken things...) | |||
| #if JUCE_VC7_OR_EARLIER | |||
| static_jassert (sizeof (CRITICAL_SECTION) <= 24); | |||
| #else | |||
| static_jassert (sizeof (CRITICAL_SECTION) <= sizeof (lock)); | |||
| #endif | |||
| InitializeCriticalSection ((CRITICAL_SECTION*) lock); | |||
| } | |||
| @@ -68,7 +68,7 @@ | |||
| @see jassert() | |||
| */ | |||
| #define JUCE_BREAK_IN_DEBUGGER { ::kill (0, SIGTRAP); } | |||
| #elif JUCE_USE_MSVC_INTRINSICS | |||
| #elif JUCE_MSVC | |||
| #ifndef __INTEL_COMPILER | |||
| #pragma intrinsic (__debugbreak) | |||
| #endif | |||
| @@ -66,9 +66,6 @@ | |||
| #if JUCE_MSVC | |||
| #pragma warning (push) | |||
| #pragma warning (disable: 4514 4245 4100) | |||
| #endif | |||
| #if JUCE_USE_MSVC_INTRINSICS | |||
| #include <intrin.h> | |||
| #endif | |||
| @@ -190,7 +190,7 @@ | |||
| // Compiler type macros. | |||
| #ifdef __clang__ | |||
| #define JUCE_CLANG 1 | |||
| #define JUCE_CLANG 1 | |||
| #elif defined (__GNUC__) | |||
| #define JUCE_GCC 1 | |||
| #elif defined (_MSC_VER) | |||
| @@ -200,17 +200,9 @@ | |||
| #define JUCE_VC8_OR_EARLIER 1 | |||
| #if _MSC_VER < 1400 | |||
| #define JUCE_VC7_OR_EARLIER 1 | |||
| #if _MSC_VER < 1300 | |||
| #warning "MSVC 6.0 is no longer supported!" | |||
| #endif | |||
| #error "Visual Studio 2003 and earlier are no longer supported!" | |||
| #endif | |||
| #endif | |||
| #if JUCE_64BIT || ! JUCE_VC7_OR_EARLIER | |||
| #define JUCE_USE_MSVC_INTRINSICS 1 | |||
| #endif | |||
| #else | |||
| #error unknown compiler | |||
| #endif | |||