67 #if (ZCONFIG_Compiler_CodeWarrior == ZCONFIG_Compiler) && (ZCONFIG_Processor_68K == ZCONFIG_Processor) 69 #pragma mark * CodeWarrior/68K 72 {
return inValueAddress->
fValue; }
99 #pragma mark * CodeWarrior/PPC
107 {
return inValueAddress->
fValue; }
121 #elif (ZCONFIG_Compiler_CodeWarrior == ZCONFIG_Compiler) && (ZCONFIG_Processor_x86 == ZCONFIG_Processor) 123 #pragma mark * CodeWarrior/Intel x86 131 {
return inValueAddress->
fValue; }
145 #elif (ZCONFIG_Compiler_GCC == ZCONFIG_Compiler) && (ZCONFIG_Processor_x86 == ZCONFIG_Processor) 146 #if 0 // denis 2005/12/09 this causes warnings and is unused by gcc4 148 #pragma mark * GCC/Intel x86 155 #if defined(__i486__) || defined(__i586__) || defined(__i686__) 156 # define ZAtomic_cmpxchg "lock; cmpxchg %%ecx, (%%esi)\n" 158 # define ZAtomic_cmpxchg ".byte 0xF0, 0x0F, 0xB1, 0x0E\n" // (which is lock; cmpxchg %ecx, (%esi) 161 #define ZAtomic_Op_Macro(theOp) \ 162 int oldValue, dummy1, dummy2; \ 165 "1: mov (%1), %0\n" \ 167 #theOp" %2, %%ecx\n" \ 170 : "=a" (oldValue), "=&S" (dummy1), "=&d" (dummy2) \ 171 : "1" (inValueAddress), "2" (inParam) \ 177 {
return inValueAddress->
fValue; }
183 "lock; xchg %0, (%1)" 185 :
"q" (inValueAddress)
195 "lock; xadd %0, (%1)" 197 :
"q" (inValueAddress)
205 ZAtomic_Op_Macro(and)
215 ZAtomic_Op_Macro(xor)
226 :
"q" (inValueAddress)
238 :
"q" (inValueAddress)
249 :
"q" (inValueAddress)
254 #undef ZAtomic_cmpxchg 255 #undef ZAtomic_Op_Macro 258 #elif (ZCONFIG_Compiler_GCC == ZCONFIG_Compiler) && (ZCONFIG_Processor_PPC == ZCONFIG_Processor) 260 #pragma mark * GCC/PPC 262 #define ZAtomic_Op_Macro(theOp) \ 267 "1: lwarx %1, 0, %4\n" \ 268 #theOp" %0, %1, %3\n" \ 269 "stwcx. %0, 0, %4\n" \ 271 : "=&r" (newValue), "=&r" (oldValue), "=m" (*inValueAddress) \ 272 : "r" (inParam), "r" (inValueAddress) \ 278 {
return inValueAddress->
fValue; }
285 "1: lwarx %0, 0, %3\n" 288 :
"=&r" (oldValue),
"=m" (*inValueAddress)
289 :
"r" (inParam),
"r" (inValueAddress)
297 ZAtomic_Op_Macro(add)
302 ZAtomic_Op_Macro(and)
312 ZAtomic_Op_Macro(xor)
331 #elif (ZCONFIG_Compiler_MSVC == ZCONFIG_Compiler) && (ZCONFIG_Processor_x86 == ZCONFIG_Processor) 333 #pragma mark * MSVC/Intel x86 339 {
return inValueAddress->
fValue; }
354 #else // ZCONFIG_Compiler/ZCONFIG_Processor 356 #pragma mark * Dumb version 362 {
return inValueAddress->
fValue; }
375 #endif // ZCONFIG_Compiler/ZCONFIG_Processor 381 #endif // __ZAtomic__ ZAssertCompile(sizeof(ZAtomic_t)==sizeof(int))
int ZAtomic_Get(const ZAtomic_t *inValueAddress)
bool ZAtomic_DecAndTest(ZAtomic_t *inValueAddress)
void ZAtomic_Inc(ZAtomic_t *inValueAddress)
void ZAtomic_Dec(ZAtomic_t *inValueAddress)
#define ZCONFIG_Compiler_CodeWarrior
int ZAtomic_Set(register ZAtomic_t *inValueAddress, int inParam)
int ZAtomic_And(ZAtomic_t *inValueAddress, int inParam)
int ZAtomic_Xor(ZAtomic_t *inValueAddress, int inParam)
#define ZCONFIG_Processor_PPC
int ZAtomic_Or(ZAtomic_t *inValueAddress, int inParam)
int ZAtomic_Add(ZAtomic_t *inValueAddress, int inParam)