From 8bd903dd96a39b8b8d9e4dfb399eb91cb4ce94c7 Mon Sep 17 00:00:00 2001 From: frohlich Date: Mon, 28 May 2007 05:06:14 +0000 Subject: [PATCH] Modified Files: SGAtomic.hxx: Also use atomic compiler intrinsics on SGI --- simgear/structure/SGAtomic.hxx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/simgear/structure/SGAtomic.hxx b/simgear/structure/SGAtomic.hxx index 7bf8226f..29c23c25 100644 --- a/simgear/structure/SGAtomic.hxx +++ b/simgear/structure/SGAtomic.hxx @@ -25,6 +25,9 @@ && (defined(__i386__) || defined(__x86_64__)) // No need to include something. Is a Compiler API ... # define SGATOMIC_USE_GCC4_BUILTINS +#elif defined(__sgi) && defined(_COMPILER_VERSION) && (_COMPILER_VERSION>=730) +// No need to include something. Is a Compiler API ... +# define SGATOMIC_USE_MIPSPRO_BUILTINS #elif defined(WIN32) # include # define SGATOMIC_USE_WIN32_INTERLOCKED @@ -42,6 +45,8 @@ public: { #if defined(SGATOMIC_USE_GCC4_BUILTINS) return __sync_add_and_fetch(&mValue, 1); +#elif defined(SGATOMIC_USE_MIPOSPRO_BUILTINS) + return __add_and_fetch(&mValue, 1); #elif defined(SGATOMIC_USE_WIN32_INTERLOCKED) return InterlockedIncrement(reinterpret_cast(&mValue)); #else @@ -53,6 +58,8 @@ public: { #if defined(SGATOMIC_USE_GCC4_BUILTINS) return __sync_sub_and_fetch(&mValue, 1); +#elif defined(SGATOMIC_USE_MIPOSPRO_BUILTINS) + return __sub_and_fetch(&mValue, 1); #elif defined(SGATOMIC_USE_WIN32_INTERLOCKED) return InterlockedDecrement(reinterpret_cast(&mValue)); #else @@ -65,6 +72,9 @@ public: #if defined(SGATOMIC_USE_GCC4_BUILTINS) __sync_synchronize(); return mValue; +#elif defined(SGATOMIC_USE_MIPOSPRO_BUILTINS) + __synchronize(); + return mValue; #elif defined(SGATOMIC_USE_WIN32_INTERLOCKED) return static_cast(mValue); #else @@ -78,6 +88,7 @@ private: SGAtomic& operator=(const SGAtomic&); #if !defined(SGATOMIC_USE_GCC4_BUILTINS) \ + && !defined(SGATOMIC_USE_MIPOSPRO_BUILTINS) \ && !defined(SGATOMIC_USE_WIN32_INTERLOCKED) mutable SGMutex mMutex; #endif -- 2.39.5