(file) Return to atomic.cpp CVS log (file) (dir) Up to [OMI] / omi / micxx

Diff for /omi/micxx/atomic.cpp between version 1.2 and 1.3

version 1.2, 2015/04/20 18:10:13 version 1.3, 2015/04/20 18:19:52
Line 23 
Line 23 
 */ */
  
 #include "atomic.h" #include "atomic.h"
 #include <base/atomic.h>  #include <pal/atomic.h>
  
 MI_BEGIN_NAMESPACE MI_BEGIN_NAMESPACE
  
Line 33 
Line 33 
 // //
 //============================================================================== //==============================================================================
  
 inline AtomicInt& AtomicRef(AtomicType& x)  
 {  
     return *((AtomicInt*)&x);  
 }  
   
 inline const AtomicInt& AtomicRef(const AtomicType& x)  
 {  
     return *((const AtomicInt*)&x);  
 }  
   
 unsigned int AtomicGet(const AtomicType& x) unsigned int AtomicGet(const AtomicType& x)
 { {
     return AtomicRef(x);      return (unsigned int)Atomic_Read((ptrdiff_t*)&x.__opaque);
 } }
  
 void AtomicSet(AtomicType& x, unsigned int n) void AtomicSet(AtomicType& x, unsigned int n)
 { {
     AtomicRef(x) = n;      *((ptrdiff_t*)&x.__opaque) = (ptrdiff_t)n;
 } }
  
 void AtomicInc(AtomicType& x) void AtomicInc(AtomicType& x)
 { {
     ::AtomicInc(&AtomicRef(x));      Atomic_Inc((ptrdiff_t*)&x.__opaque);
 } }
  
 bool AtomicDec(AtomicType& x) bool AtomicDec(AtomicType& x)
 { {
     return ::AtomicDec(&AtomicRef(x)) ? true : false;      return Atomic_Dec((ptrdiff_t*)&x.__opaque) == 0 ? true : false;
 } }
  
 MI_END_NAMESPACE MI_END_NAMESPACE


Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

ViewCVS 0.9.2