Replacing some integral typedefs with standard types
authorkhizmax <libcds.dev@gmail.com>
Sun, 30 Nov 2014 13:36:23 +0000 (16:36 +0300)
committerkhizmax <libcds.dev@gmail.com>
Sun, 30 Nov 2014 13:36:23 +0000 (16:36 +0300)
18 files changed:
cds/algo/bitop.h
cds/compiler/gcc/amd64/bitop.h
cds/compiler/gcc/ia64/bitop.h
cds/compiler/gcc/sparc/bitop.h
cds/compiler/gcc/x86/bitop.h
cds/compiler/vc/amd64/bitop.h
cds/compiler/vc/x86/bitop.h
cds/details/bitop_generic.h
cds/details/defs.h
cds/details/is_aligned.h
cds/intrusive/tsigas_cycle_queue.h
cds/lock/spinlock.h
cds/memory/michael/allocator.h
cds/memory/michael/bound_check.h
tests/test-hdr/misc/bitop_st.cpp
tests/unit/alloc/hoard_threadtest.cpp
tests/unit/alloc/larson.cpp
tests/unit/alloc/linux_scale.cpp

index 2ab7a5ef5a5955aecc9c1738538bfa92ea098b76..de9ba52f639e04f6cc113fb2bf36fc2d76371eab 100644 (file)
@@ -27,7 +27,7 @@ namespace cds {
 
             // 32-bit bit ops
             template <> struct BitOps<4> {
 
             // 32-bit bit ops
             template <> struct BitOps<4> {
-                typedef atomic32u_t        TUInt;
+                typedef uint32_t        TUInt;
 
                 static int      MSB( TUInt x )      { return bitop::platform::msb32( x );   }
                 static int      LSB( TUInt x )      { return bitop::platform::lsb32( x );   }
 
                 static int      MSB( TUInt x )      { return bitop::platform::msb32( x );   }
                 static int      LSB( TUInt x )      { return bitop::platform::lsb32( x );   }
index b83384cf803f6cf655190d9e2cc653691575e148..5edd78fd952778d4475c8af862bc4a31b6adb08f 100644 (file)
@@ -8,7 +8,7 @@ namespace cds {
     namespace bitop { namespace platform { namespace gcc { namespace amd64 {
         // MSB - return index (1..32) of most significant bit in nArg. If nArg == 0 return 0
 #        define cds_bitop_msb32_DEFINED
     namespace bitop { namespace platform { namespace gcc { namespace amd64 {
         // MSB - return index (1..32) of most significant bit in nArg. If nArg == 0 return 0
 #        define cds_bitop_msb32_DEFINED
-        static inline int msb32( atomic32u_t nArg )
+        static inline int msb32( uint32_t nArg )
         {
             int        nRet;
             __asm__ __volatile__ (
         {
             int        nRet;
             __asm__ __volatile__ (
@@ -26,7 +26,7 @@ namespace cds {
         }
 
 #        define cds_bitop_msb32nz_DEFINED
         }
 
 #        define cds_bitop_msb32nz_DEFINED
-        static inline int msb32nz( atomic32u_t nArg )
+        static inline int msb32nz( uint32_t nArg )
         {
             assert( nArg != 0 );
             int        nRet;
         {
             assert( nArg != 0 );
             int        nRet;
@@ -41,7 +41,7 @@ namespace cds {
 
         // LSB - return index (0..31) of least significant bit in nArg. If nArg == 0 return -1U
 #        define cds_bitop_lsb32_DEFINED
 
         // LSB - return index (0..31) of least significant bit in nArg. If nArg == 0 return -1U
 #        define cds_bitop_lsb32_DEFINED
-        static inline int lsb32( atomic32u_t nArg )
+        static inline int lsb32( uint32_t nArg )
         {
 
             int        nRet;
         {
 
             int        nRet;
@@ -63,7 +63,7 @@ namespace cds {
         // LSB - return index (0..31) of least significant bit in nArg.
         // Condition: nArg != 0
 #        define cds_bitop_lsb32nz_DEFINED
         // LSB - return index (0..31) of least significant bit in nArg.
         // Condition: nArg != 0
 #        define cds_bitop_lsb32nz_DEFINED
-        static inline int lsb32nz( atomic32u_t nArg )
+        static inline int lsb32nz( uint32_t nArg )
         {
             assert( nArg != 0 );
             int        nRet;
         {
             assert( nArg != 0 );
             int        nRet;
index 64e21e1cf1a71e4c9cad4e42784be32287a36121..35608c3a57a5f812aecc50174664e4fd3fb06176 100644 (file)
@@ -9,7 +9,7 @@ namespace cds {
 
         // MSB - return index (1..32) of most significant bit in x. If x == 0 return 0
 #        define cds_bitop_msb32_DEFINED
 
         // MSB - return index (1..32) of most significant bit in x. If x == 0 return 0
 #        define cds_bitop_msb32_DEFINED
-        static inline int msb32( atomic32u_t nArg )
+        static inline int msb32( uint32_t nArg )
         {
             if ( !nArg )
                 return 0;
         {
             if ( !nArg )
                 return 0;
@@ -30,7 +30,7 @@ namespace cds {
         // MSB - return index (0..31) of most significant bit in nArg.
         // !!! nArg != 0
 #        define cds_bitop_msb32nz_DEFINED
         // MSB - return index (0..31) of most significant bit in nArg.
         // !!! nArg != 0
 #        define cds_bitop_msb32nz_DEFINED
-        static inline int msb32nz( atomic32u_t nArg )
+        static inline int msb32nz( uint32_t nArg )
         {
             assert( nArg != 0 );
             long double d = nArg;
         {
             assert( nArg != 0 );
             long double d = nArg;
index 632b401830c04118a82af80a0c95549443ff0bda..9fedde66a54490f0107cf422c9777dd32e993512 100644 (file)
@@ -27,7 +27,7 @@ namespace cds {
         }
 
         // MSB - return index (1..32) of most significant bit in nArg. If nArg == 0 return 0
         }
 
         // MSB - return index (1..32) of most significant bit in nArg. If nArg == 0 return 0
-        static inline int sparc_msb32( atomic32u_t nArg )
+        static inline int sparc_msb32( uint32_t nArg )
         {
             return sparc_msb64( (atomic64u_t) nArg );
         }
         {
             return sparc_msb64( (atomic64u_t) nArg );
         }
index 3982fb94173ae52ed62c0220ec70aff3bfccabf0..dbe5f3d8d5fa7ed5cd476a4a150e0abb91e70904 100644 (file)
@@ -8,7 +8,7 @@ namespace cds {
     namespace bitop { namespace platform { namespace gcc { namespace x86 {
         // MSB - return index (1..32) of most significant bit in nArg. If nArg == 0 return 0
 #        define cds_bitop_msb32_DEFINED
     namespace bitop { namespace platform { namespace gcc { namespace x86 {
         // MSB - return index (1..32) of most significant bit in nArg. If nArg == 0 return 0
 #        define cds_bitop_msb32_DEFINED
-        static inline int msb32( atomic32u_t nArg )
+        static inline int msb32( uint32_t nArg )
         {
             int        nRet;
             __asm__ __volatile__ (
         {
             int        nRet;
             __asm__ __volatile__ (
@@ -26,7 +26,7 @@ namespace cds {
         }
 
 #        define cds_bitop_msb32nz_DEFINED
         }
 
 #        define cds_bitop_msb32nz_DEFINED
-        static inline int msb32nz( atomic32u_t nArg )
+        static inline int msb32nz( uint32_t nArg )
         {
             assert( nArg != 0 );
             int        nRet;
         {
             assert( nArg != 0 );
             int        nRet;
@@ -41,7 +41,7 @@ namespace cds {
 
         // LSB - return index (0..31) of least significant bit in nArg. If nArg == 0 return -1U
 #        define cds_bitop_lsb32_DEFINED
 
         // LSB - return index (0..31) of least significant bit in nArg. If nArg == 0 return -1U
 #        define cds_bitop_lsb32_DEFINED
-        static inline int lsb32( atomic32u_t nArg )
+        static inline int lsb32( uint32_t nArg )
         {
 
             int        nRet;
         {
 
             int        nRet;
@@ -63,7 +63,7 @@ namespace cds {
         // LSB - return index (0..31) of least significant bit in nArg.
         // Condition: nArg != 0
 #        define cds_bitop_lsb32nz_DEFINED
         // LSB - return index (0..31) of least significant bit in nArg.
         // Condition: nArg != 0
 #        define cds_bitop_lsb32nz_DEFINED
-        static inline int lsb32nz( atomic32u_t nArg )
+        static inline int lsb32nz( uint32_t nArg )
         {
             assert( nArg != 0 );
             int        nRet;
         {
             assert( nArg != 0 );
             int        nRet;
index ee143d6f890c59d58c2da36c301a5575c2e3a4f9..a7edfb9efc9b3919d5452d4880474e1d3797b638 100644 (file)
@@ -30,7 +30,7 @@ namespace cds {
 
         // MSB - return index (1..32) of most significant bit in nArg. If nArg == 0 return 0
 #        define cds_bitop_msb32_DEFINED
 
         // MSB - return index (1..32) of most significant bit in nArg. If nArg == 0 return 0
 #        define cds_bitop_msb32_DEFINED
-        static inline int msb32( atomic32u_t nArg )
+        static inline int msb32( uint32_t nArg )
         {
             unsigned long nIndex;
             if ( _BitScanReverse( &nIndex, nArg ))
         {
             unsigned long nIndex;
             if ( _BitScanReverse( &nIndex, nArg ))
@@ -39,7 +39,7 @@ namespace cds {
         }
 
 #        define cds_bitop_msb32nz_DEFINED
         }
 
 #        define cds_bitop_msb32nz_DEFINED
-        static inline int msb32nz( atomic32u_t nArg )
+        static inline int msb32nz( uint32_t nArg )
         {
             assert( nArg != 0 );
             unsigned long nIndex;
         {
             assert( nArg != 0 );
             unsigned long nIndex;
@@ -49,7 +49,7 @@ namespace cds {
 
         // LSB - return index (1..32) of least significant bit in nArg. If nArg == 0 return -1U
 #        define cds_bitop_lsb32_DEFINED
 
         // LSB - return index (1..32) of least significant bit in nArg. If nArg == 0 return -1U
 #        define cds_bitop_lsb32_DEFINED
-        static inline int lsb32( atomic32u_t nArg )
+        static inline int lsb32( uint32_t nArg )
         {
             unsigned long nIndex;
             if ( _BitScanForward( &nIndex, nArg ))
         {
             unsigned long nIndex;
             if ( _BitScanForward( &nIndex, nArg ))
@@ -58,7 +58,7 @@ namespace cds {
         }
 
 #        define cds_bitop_lsb32nz_DEFINED
         }
 
 #        define cds_bitop_lsb32nz_DEFINED
-        static inline int lsb32nz( atomic32u_t nArg )
+        static inline int lsb32nz( uint32_t nArg )
         {
             assert( nArg != 0 );
             unsigned long nIndex;
         {
             assert( nArg != 0 );
             unsigned long nIndex;
@@ -104,7 +104,7 @@ namespace cds {
         }
 
 #       define cds_bitop_complement32_DEFINED
         }
 
 #       define cds_bitop_complement32_DEFINED
-        static inline bool complement32( atomic32u_t * pArg, unsigned int nBit )
+        static inline bool complement32( uint32_t * pArg, unsigned int nBit )
         {
             return _bittestandcomplement( reinterpret_cast<long *>( pArg ), nBit ) != 0;
         }
         {
             return _bittestandcomplement( reinterpret_cast<long *>( pArg ), nBit ) != 0;
         }
index f27720059b332cdd6903d8873b26af8112d5548c..64827c60bfc2f9306ec621fbcfe75857fcfe1c6b 100644 (file)
@@ -12,7 +12,7 @@ namespace cds {
     namespace bitop { namespace platform { namespace vc { namespace x86 {
         // MSB - return index (1..32) of most significant bit in nArg. If nArg == 0 return 0
 #        define cds_bitop_msb32_DEFINED
     namespace bitop { namespace platform { namespace vc { namespace x86 {
         // MSB - return index (1..32) of most significant bit in nArg. If nArg == 0 return 0
 #        define cds_bitop_msb32_DEFINED
-        static inline int msb32( atomic32u_t nArg )
+        static inline int msb32( uint32_t nArg )
         {
             unsigned long nIndex;
             if ( _BitScanReverse( &nIndex, nArg ))
         {
             unsigned long nIndex;
             if ( _BitScanReverse( &nIndex, nArg ))
@@ -21,7 +21,7 @@ namespace cds {
         }
 
 #        define cds_bitop_msb32nz_DEFINED
         }
 
 #        define cds_bitop_msb32nz_DEFINED
-        static inline int msb32nz( atomic32u_t nArg )
+        static inline int msb32nz( uint32_t nArg )
         {
             assert( nArg != 0 );
             unsigned long nIndex;
         {
             assert( nArg != 0 );
             unsigned long nIndex;
@@ -31,7 +31,7 @@ namespace cds {
 
         // LSB - return index (1..32) of least significant bit in nArg. If nArg == 0 return -1U
 #        define cds_bitop_lsb32_DEFINED
 
         // LSB - return index (1..32) of least significant bit in nArg. If nArg == 0 return -1U
 #        define cds_bitop_lsb32_DEFINED
-        static inline int lsb32( atomic32u_t nArg )
+        static inline int lsb32( uint32_t nArg )
         {
             unsigned long nIndex;
             if ( _BitScanForward( &nIndex, nArg ))
         {
             unsigned long nIndex;
             if ( _BitScanForward( &nIndex, nArg ))
@@ -40,7 +40,7 @@ namespace cds {
         }
 
 #        define cds_bitop_lsb32nz_DEFINED
         }
 
 #        define cds_bitop_lsb32nz_DEFINED
-        static inline int lsb32nz( atomic32u_t nArg )
+        static inline int lsb32nz( uint32_t nArg )
         {
             assert( nArg != 0 );
             unsigned long nIndex;
         {
             assert( nArg != 0 );
             unsigned long nIndex;
@@ -50,7 +50,7 @@ namespace cds {
 
         // bswap - Reverses the byte order of a 32-bit word
 #        define cds_bitop_bswap32_DEFINED
 
         // bswap - Reverses the byte order of a 32-bit word
 #        define cds_bitop_bswap32_DEFINED
-        static inline atomic32u_t bswap32( atomic32u_t nArg )
+        static inline uint32_t bswap32( uint32_t nArg )
         {
             __asm {
                 mov    eax, nArg;
         {
             __asm {
                 mov    eax, nArg;
@@ -59,7 +59,7 @@ namespace cds {
         }
 
 #       define cds_bitop_complement32_DEFINED
         }
 
 #       define cds_bitop_complement32_DEFINED
-        static inline bool complement32( atomic32u_t * pArg, unsigned int nBit )
+        static inline bool complement32( uint32_t * pArg, unsigned int nBit )
         {
             return _bittestandcomplement( reinterpret_cast<long *>( pArg ), nBit ) != 0;
         }
         {
             return _bittestandcomplement( reinterpret_cast<long *>( pArg ), nBit ) != 0;
         }
index 6fd1a07bfb8c83edbf5a78bba975cd2aa9e8d9ba..184945af54cf9f9d9a78743bbfc4af7cdcc719c1 100644 (file)
@@ -8,7 +8,7 @@ namespace cds {
     namespace bitop { namespace platform {
         // Return true if x = 2 ** k, k >= 0
 #ifndef cds_bitop_isPow2_32_DEFINED
     namespace bitop { namespace platform {
         // Return true if x = 2 ** k, k >= 0
 #ifndef cds_bitop_isPow2_32_DEFINED
-        static inline bool isPow2_32( atomic32u_t x )
+        static inline bool isPow2_32( uint32_t x )
         {
             return (x & ( x - 1 )) == 0    && x;
         }
         {
             return (x & ( x - 1 )) == 0    && x;
         }
@@ -29,7 +29,7 @@ namespace cds {
         // Return number (1..32) of most significant bit
         // Return 0 if x == 0
         // Source: Linux kernel
         // Return number (1..32) of most significant bit
         // Return 0 if x == 0
         // Source: Linux kernel
-        static inline int msb32( atomic32u_t x )
+        static inline int msb32( uint32_t x )
         {
             int r = 32;
 
         {
             int r = 32;
 
@@ -60,7 +60,7 @@ namespace cds {
 #endif
 
 #ifndef cds_bitop_msb32nz_DEFINED
 #endif
 
 #ifndef cds_bitop_msb32nz_DEFINED
-        static inline int msb32nz( atomic32u_t x )
+        static inline int msb32nz( uint32_t x )
         {
             return msb32( x ) - 1;
         }
         {
             return msb32( x ) - 1;
         }
@@ -69,10 +69,10 @@ namespace cds {
 #ifndef cds_bitop_msb64_DEFINED
         static inline int msb64( atomic64u_unaligned x )
         {
 #ifndef cds_bitop_msb64_DEFINED
         static inline int msb64( atomic64u_unaligned x )
         {
-            atomic32u_t h = (atomic32u_t) (x >> 32);
+            uint32_t h = (uint32_t) (x >> 32);
             if ( h )
                 return msb32( h ) + 32;
             if ( h )
                 return msb32( h ) + 32;
-            return msb32( (atomic32u_t) x );
+            return msb32( (uint32_t) x );
         }
 #endif
 
         }
 #endif
 
@@ -91,7 +91,7 @@ namespace cds {
         // Return number (1..32) of least significant bit
         // Return 0 if x == 0
         // Source: Linux kernel
         // Return number (1..32) of least significant bit
         // Return 0 if x == 0
         // Source: Linux kernel
-        static inline int lsb32( atomic32u_t x )
+        static inline int lsb32( uint32_t x )
         {
             int r = 1;
 
         {
             int r = 1;
 
@@ -122,7 +122,7 @@ namespace cds {
 #endif
 
 #ifndef cds_bitop_lsb32nz_DEFINED
 #endif
 
 #ifndef cds_bitop_lsb32nz_DEFINED
-        static inline int lsb32nz( atomic32u_t x )
+        static inline int lsb32nz( uint32_t x )
         {
             return lsb32( x ) - 1;
         }
         {
             return lsb32( x ) - 1;
         }
@@ -134,8 +134,8 @@ namespace cds {
             if ( !x )
                 return 0;
             if ( x & 0xffffffffu )
             if ( !x )
                 return 0;
             if ( x & 0xffffffffu )
-                return lsb32( (atomic32u_t) x );
-            return lsb32( (atomic32u_t) (x >> 32) ) + 32;
+                return lsb32( (uint32_t) x );
+            return lsb32( (uint32_t) (x >> 32) ) + 32;
         }
 #endif
 
         }
 #endif
 
@@ -150,7 +150,7 @@ namespace cds {
         // Reverse bit order
         //******************************************************
 #ifndef cds_bitop_rbo32_DEFINED
         // Reverse bit order
         //******************************************************
 #ifndef cds_bitop_rbo32_DEFINED
-        static inline atomic32u_t rbo32( atomic32u_t x )
+        static inline uint32_t rbo32( uint32_t x )
         {
             // swap odd and even bits
             x = ((x >> 1) & 0x55555555) | ((x & 0x55555555) << 1);
         {
             // swap odd and even bits
             x = ((x >> 1) & 0x55555555) | ((x & 0x55555555) << 1);
@@ -169,7 +169,7 @@ namespace cds {
         static inline atomic64u_t rbo64( atomic64u_unaligned x )
         {
             //                      Low 32bit                                          Hight 32bit
         static inline atomic64u_t rbo64( atomic64u_unaligned x )
         {
             //                      Low 32bit                                          Hight 32bit
-            return ( ((atomic64u_t) rbo32( (atomic32u_t) x )) << 32 ) | ((atomic64u_t) rbo32( (atomic32u_t) (x >> 32) ));
+            return ( ((atomic64u_t) rbo32( (uint32_t) x )) << 32 ) | ((atomic64u_t) rbo32( (uint32_t) (x >> 32) ));
         }
 #endif
 
         }
 #endif
 
@@ -177,7 +177,7 @@ namespace cds {
         // Set bit count. Return count of non-zero bits in word
         //******************************************************
 #ifndef cds_bitop_sbc32_DEFINED
         // Set bit count. Return count of non-zero bits in word
         //******************************************************
 #ifndef cds_bitop_sbc32_DEFINED
-        static inline int sbc32( atomic32u_t x )
+        static inline int sbc32( uint32_t x )
         {
 #        ifdef cds_beans_zbc32_DEFINED
             return 32 - zbc32( x );
         {
 #        ifdef cds_beans_zbc32_DEFINED
             return 32 - zbc32( x );
@@ -196,7 +196,7 @@ namespace cds {
 #        ifdef cds_beans_zbc64_DEFINED
             return 64 - zbc64( x );
 #        else
 #        ifdef cds_beans_zbc64_DEFINED
             return 64 - zbc64( x );
 #        else
-            return sbc32( (atomic32u_t) (x >> 32) ) + sbc32( (atomic32u_t) x );
+            return sbc32( (uint32_t) (x >> 32) ) + sbc32( (uint32_t) x );
 #        endif
         }
 #endif
 #        endif
         }
 #endif
@@ -205,7 +205,7 @@ namespace cds {
         // Zero bit count. Return count of zero bits in word
         //******************************************************
 #ifndef cds_bitop_zbc32_DEFINED
         // Zero bit count. Return count of zero bits in word
         //******************************************************
 #ifndef cds_bitop_zbc32_DEFINED
-        static inline int zbc32( atomic32u_t x )
+        static inline int zbc32( uint32_t x )
         {
             return 32 - sbc32( x );
         }
         {
             return 32 - sbc32( x );
         }
@@ -220,10 +220,10 @@ namespace cds {
 
         // Bit complement
 #ifndef cds_bitop_complement32_DEFINED
 
         // Bit complement
 #ifndef cds_bitop_complement32_DEFINED
-        static inline bool complement32( atomic32u_t * pArg, unsigned int nBit )
+        static inline bool complement32( uint32_t * pArg, unsigned int nBit )
         {
             assert( pArg );
         {
             assert( pArg );
-            atomic32u_t nVal = *pArg & (1 << nBit);
+            uint32_t nVal = *pArg & (1 << nBit);
             *pArg ^= 1 << nBit;
             return nVal != 0;
         }
             *pArg ^= 1 << nBit;
             return nVal != 0;
         }
@@ -246,8 +246,8 @@ namespace cds {
         */
         static inline uint32_t RandXorShift32(uint32_t x)
         {
         */
         static inline uint32_t RandXorShift32(uint32_t x)
         {
-            //static atomic32u_t xRandom = 2463534242UL    ;    //rand() | 0x0100    ;    // must be nonzero
-            //atomic32u_t x = xRandom;
+            //static uint32_t xRandom = 2463534242UL    ;    //rand() | 0x0100    ;    // must be nonzero
+            //uint32_t x = xRandom;
             if ( !x )
                 x = ((rand() + 1) << 16) + rand() + 1;
             x ^= x << 13;
             if ( !x )
                 x = ((rand() + 1) << 16) + rand() + 1;
             x ^= x << 13;
index b9e51a0f5812bbc28ed6a037d3748079af36dd72..93ea0a236153aefb2c597a951e1ea4cd392c5cf8 100644 (file)
@@ -347,9 +347,6 @@ namespace cds {}
 //@cond
 // typedefs for back compatibility
 namespace cds {
 //@cond
 // typedefs for back compatibility
 namespace cds {
-    /// Atomic pointer
-    typedef void *            pointer_t;
-
     /// 64bit unaligned int
     typedef int64_t     atomic64_unaligned;
 
     /// 64bit unaligned int
     typedef int64_t     atomic64_unaligned;
 
@@ -367,24 +364,6 @@ namespace cds {
 
     /// 64bit atomic unsigned int (aligned)
     typedef atomic64u_aligned   atomic64u_t;
 
     /// 64bit atomic unsigned int (aligned)
     typedef atomic64u_aligned   atomic64u_t;
-
-    /// 32bit atomic int
-    typedef int32_t     atomic32_t;
-
-    /// 32bit atomic unsigned int
-    typedef uint32_t    atomic32u_t;
-
-    /// atomic int
-    typedef atomic32_t          atomic_t;
-
-    /// atomic unsigned int
-    typedef atomic32u_t         unsigned_atomic_t;
-
-    /// atomic int sized as pointer
-    typedef intptr_t ptr_atomic_t;
-
-    /// atomic unsigned int sized as pointer
-    typedef uintptr_t uptr_atomic_t;
 } // namespace cds
 //@endcond
 
 } // namespace cds
 //@endcond
 
index f50b899ffd2d10632b3a2f5dab73b6999eb1bee1..b514fac5cb5aca43451ef70c2dc722a56869b588 100644 (file)
@@ -16,7 +16,7 @@ namespace cds { namespace details {
     template <int ALIGN, typename T>
     static inline bool is_aligned(T const * p)
     {
     template <int ALIGN, typename T>
     static inline bool is_aligned(T const * p)
     {
-        return (((uptr_atomic_t)p) & uptr_atomic_t(ALIGN - 1)) == 0;
+        return (((uintptr_t)p) & uintptr_t(ALIGN - 1)) == 0;
     }
 
     /// Checks if the pointer \p p has \p nAlign byte alignment
     }
 
     /// Checks if the pointer \p p has \p nAlign byte alignment
@@ -28,7 +28,7 @@ namespace cds { namespace details {
     template <typename T>
     static inline bool is_aligned(T const * p, size_t nAlign)
     {
     template <typename T>
     static inline bool is_aligned(T const * p, size_t nAlign)
     {
-        return (((uptr_atomic_t)p) & uptr_atomic_t(nAlign - 1)) == 0;
+        return (((uintptr_t)p) & uintptr_t(nAlign - 1)) == 0;
     }
 
 }} // namespace cds::details
     }
 
 }} // namespace cds::details
index 202feb12aa549dd616f5a53bd7165a4eda899f91..42349395208c7a49a5a0f26cfca81f4aa06fbcd3 100644 (file)
@@ -226,7 +226,7 @@ namespace cds { namespace intrusive {
         bool enqueue( value_type& data )
         {
             value_type * pNewNode  = &data;
         bool enqueue( value_type& data )
         {
             value_type * pNewNode  = &data;
-            assert( (reinterpret_cast<ptr_atomic_t>( pNewNode ) & 1) == 0 );
+            assert( (reinterpret_cast<uintptr_t>(pNewNode) & 1) == 0 );
             back_off bkoff;
 
             const index_type nModulo = modulo();
             back_off bkoff;
 
             const index_type nModulo = modulo();
@@ -323,7 +323,7 @@ namespace cds { namespace intrusive {
                     continue;
                 }
 
                     continue;
                 }
 
-                pNull = reinterpret_cast<value_type *>((reinterpret_cast<ptr_atomic_t>(tt) & 1) ? free0 : free1 );
+                pNull = reinterpret_cast<value_type *>((reinterpret_cast<uintptr_t>(tt) & 1) ? free0 : free1);
 
                 if ( th != m_nHead.load(memory_model::memory_order_relaxed) )
                     continue;
 
                 if ( th != m_nHead.load(memory_model::memory_order_relaxed) )
                     continue;
index 80460a82758b8cf607823917ff2095622eef151a..e9db002bb4832b96b312f34a02856e8670638702 100644 (file)
@@ -346,14 +346,14 @@ namespace cds {
             }
         };
 
             }
         };
 
-        /// Recursive spin-lock based on atomic32u_t
-        typedef ReentrantSpinT<uint32_t, backoff::LockDefault>   ReentrantSpin32;
+        /// Recursive 32bit spin-lock
+        typedef ReentrantSpinT<uint32_t, backoff::LockDefault> ReentrantSpin32;
 
 
-        /// Recursive spin-lock based on atomic64u_t type
-        typedef ReentrantSpinT<uint64_t, backoff::LockDefault>   ReentrantSpin64;
+        /// Recursive 64bit spin-lock
+        typedef ReentrantSpinT<uint64_t, backoff::LockDefault> ReentrantSpin64;
 
 
-        /// Recursive spin-lock based on atomic32_t type
-        typedef ReentrantSpin32                                     ReentrantSpin;
+        /// Default recursive spin-lock type
+        typedef ReentrantSpin32 ReentrantSpin;
 
     }    // namespace lock
 
 
     }    // namespace lock
 
index 4ddfb1b34a401d363dd3f2fc88f0df3e74b4425b..08a738a3cea3f8d6690e22c809ddb218a571666b 100644 (file)
@@ -830,12 +830,12 @@ namespace michael {
 
             union {
                 superblock_desc *   pDesc       ;   // pointer to superblock descriptor
 
             union {
                 superblock_desc *   pDesc       ;   // pointer to superblock descriptor
-                atomic32u_t         nSize       ;   // block size (allocated form OS)
+                uint32_t         nSize       ;   // block size (allocated form OS)
             };
             };
-            atomic32u_t         nFlags;
+            uint32_t         nFlags;
 
         public:
 
         public:
-            void  set( superblock_desc * pdesc, atomic32u_t isAligned )
+            void  set( superblock_desc * pdesc, uint32_t isAligned )
             {
                 pDesc = pdesc;
                 nFlags = isAligned ? bitAligned : 0;
             {
                 pDesc = pdesc;
                 nFlags = isAligned ? bitAligned : 0;
@@ -889,7 +889,7 @@ namespace michael {
             // allocated from OS
             marked_desc_ptr     pDesc;
         public:
             // allocated from OS
             marked_desc_ptr     pDesc;
         public:
-            void  set( superblock_desc * pdesc, atomic32u_t isAligned )
+            void  set( superblock_desc * pdesc, uint32_t isAligned )
             {
                 pDesc = marked_desc_ptr( pdesc, isAligned );
             }
             {
                 pDesc = marked_desc_ptr( pdesc, isAligned );
             }
@@ -924,7 +924,7 @@ namespace michael {
             size_t getOSAllocSize() const
             {
                 assert( isOSAllocated() );
             size_t getOSAllocSize() const
             {
                 assert( isOSAllocated() );
-                return reinterpret_cast<uptr_atomic_t>( pDesc.ptr() ) >> 2;
+                return reinterpret_cast<uintptr_t>( pDesc.ptr() ) >> 2;
             }
 
         };
             }
 
         };
@@ -957,7 +957,7 @@ namespace michael {
         class active_tag {
         //@cond
             superblock_desc *       pDesc;
         class active_tag {
         //@cond
             superblock_desc *       pDesc;
-            atomic32u_t             nCredits;
+            uint32_t             nCredits;
 
         public:
             static const unsigned int c_nMaxCredits = 0 - 1;
 
         public:
             static const unsigned int c_nMaxCredits = 0 - 1;
@@ -1041,7 +1041,7 @@ namespace michael {
 
             void ptr( superblock_desc * p )
             {
 
             void ptr( superblock_desc * p )
             {
-                assert( (reinterpret_cast<uptr_atomic_t>(p) & c_nMaxCredits) == 0 );
+                assert( (reinterpret_cast<uintptr_t>(p) & c_nMaxCredits) == 0 );
                 pDesc = marked_desc_ptr( p, pDesc.bits());
             }
 
                 pDesc = marked_desc_ptr( p, pDesc.bits());
             }
 
@@ -1063,7 +1063,7 @@ namespace michael {
 
             void set( superblock_desc * pSB, unsigned int n )
             {
 
             void set( superblock_desc * pSB, unsigned int n )
             {
-                assert( (reinterpret_cast<uptr_atomic_t>(pSB) & c_nMaxCredits) == 0 );
+                assert( (reinterpret_cast<uintptr_t>(pSB) & c_nMaxCredits) == 0 );
                 pDesc = marked_desc_ptr( pSB, n );
             }
 
                 pDesc = marked_desc_ptr( pSB, n );
             }
 
@@ -1101,7 +1101,7 @@ namespace michael {
                 , pSizeClass( nullptr )
                 , pPartial( nullptr )
             {
                 , pSizeClass( nullptr )
                 , pPartial( nullptr )
             {
-                assert( (reinterpret_cast<uptr_atomic_t>(this) & (c_nAlignment - 1)) == 0 );
+                assert( (reinterpret_cast<uintptr_t>(this) & (c_nAlignment - 1)) == 0 );
             }
             //@endcond
 
             }
             //@endcond
 
@@ -1459,8 +1459,8 @@ namespace michael {
             // initialize processor heaps
             pDesc->arrProcHeap =
                 reinterpret_cast<processor_heap *>(
             // initialize processor heaps
             pDesc->arrProcHeap =
                 reinterpret_cast<processor_heap *>(
-                    reinterpret_cast<uptr_atomic_t>(reinterpret_cast<byte *>(pDesc + 1) + sizeof(pDesc->pageHeaps[0]) * nPageHeapCount + c_nAlignment - 1)
-                    & ~(uptr_atomic_t(c_nAlignment) - 1)
+                    reinterpret_cast<uintptr_t>(reinterpret_cast<byte *>(pDesc + 1) + sizeof(pDesc->pageHeaps[0]) * nPageHeapCount + c_nAlignment - 1)
+                    & ~(uintptr_t(c_nAlignment) - 1)
                 );
 
             processor_heap * pProcHeap = pDesc->arrProcHeap;
                 );
 
             processor_heap * pProcHeap = pDesc->arrProcHeap;
@@ -1552,7 +1552,7 @@ namespace michael {
             superblock_desc * pDesc = pProcHeap->pProcDesc->listSBDescFree.pop();
             if ( pDesc == nullptr ) {
                 pDesc = new( m_AlignedHeap.alloc(sizeof(superblock_desc), c_nAlignment ) ) superblock_desc;
             superblock_desc * pDesc = pProcHeap->pProcDesc->listSBDescFree.pop();
             if ( pDesc == nullptr ) {
                 pDesc = new( m_AlignedHeap.alloc(sizeof(superblock_desc), c_nAlignment ) ) superblock_desc;
-                assert( (uptr_atomic_t(pDesc) & (c_nAlignment - 1)) == 0 );
+                assert( (uintptr_t(pDesc) & (c_nAlignment - 1)) == 0 );
 
                 anchor = pDesc->anchor.load( atomics::memory_order_relaxed );
                 anchor.tag = 0;
 
                 anchor = pDesc->anchor.load( atomics::memory_order_relaxed );
                 anchor.tag = 0;
@@ -1830,19 +1830,19 @@ namespace michael {
         {
             if ( nAlignment <= c_nDefaultBlockAlignment ) {
                 void * p = alloc( nSize );
         {
             if ( nAlignment <= c_nDefaultBlockAlignment ) {
                 void * p = alloc( nSize );
-                assert( (reinterpret_cast<uptr_atomic_t>(p) & (nAlignment - 1)) == 0 );
+                assert( (reinterpret_cast<uintptr_t>(p) & (nAlignment - 1)) == 0 );
                 return p;
             }
 
             block_header * pBlock = int_alloc( nSize + nAlignment + sizeof(block_header) + bound_checker::trailer_size );
 
             block_header * pRedirect;
                 return p;
             }
 
             block_header * pBlock = int_alloc( nSize + nAlignment + sizeof(block_header) + bound_checker::trailer_size );
 
             block_header * pRedirect;
-            if ( (reinterpret_cast<uptr_atomic_t>( pBlock + 1) & (nAlignment - 1)) != 0 ) {
-                pRedirect = reinterpret_cast<block_header *>( (reinterpret_cast<uptr_atomic_t>( pBlock ) & ~(nAlignment - 1)) + nAlignment ) - 1;
+            if ( (reinterpret_cast<uintptr_t>( pBlock + 1) & (nAlignment - 1)) != 0 ) {
+                pRedirect = reinterpret_cast<block_header *>( (reinterpret_cast<uintptr_t>( pBlock ) & ~(nAlignment - 1)) + nAlignment ) - 1;
                 assert( pRedirect != pBlock );
                 pRedirect->set( reinterpret_cast<superblock_desc *>(pBlock), 1 );
 
                 assert( pRedirect != pBlock );
                 pRedirect->set( reinterpret_cast<superblock_desc *>(pBlock), 1 );
 
-                assert( (reinterpret_cast<uptr_atomic_t>(pRedirect + 1) & (nAlignment - 1)) == 0 );
+                assert( (reinterpret_cast<uintptr_t>(pRedirect + 1) & (nAlignment - 1)) == 0 );
             }
             else
                 pRedirect = pBlock;
             }
             else
                 pRedirect = pBlock;
index 06cb843fd4d6d6dec87621e9c87caaf82f5df896..aa9734ca50d7d6f33535463b193536856c358e63 100644 (file)
@@ -31,7 +31,7 @@ namespace cds { namespace memory { namespace michael {
                 memcpy( pArea + nAllocSize, &trailer, sizeof(trailer) );
 
                 // the next assignment is correct because pBlock is at least sizeof(size_t)-byte aligned
                 memcpy( pArea + nAllocSize, &trailer, sizeof(trailer) );
 
                 // the next assignment is correct because pBlock is at least sizeof(size_t)-byte aligned
-                assert( (reinterpret_cast<uptr_atomic_t>(pEndBlock) & (sizeof(size_t) - 1)) == 0 );
+                assert( (reinterpret_cast<uintptr_t>(pEndBlock) & (sizeof(size_t) - 1)) == 0 );
                 *(reinterpret_cast<size_t *>( pEndBlock ) - 1) = nAllocSize;
             }
 
                 *(reinterpret_cast<size_t *>( pEndBlock ) - 1) = nAllocSize;
             }
 
index 391a2a7024247f9f07864f22c9f16e5b720f2995..e224b627f7f0e4f033c0aaf79d65a3a33fa3fb26 100644 (file)
@@ -10,7 +10,7 @@ class bitop_ST : public CppUnitMini::TestCase
 protected:
     void bitop32()
     {
 protected:
     void bitop32()
     {
-        cds::atomic32u_t    n;
+        uint32_t    n;
         n = 0;
         CPPUNIT_ASSERT_EX( cds::bitop::MSB(n) == 0, "n=" << n );
         CPPUNIT_ASSERT_EX( cds::bitop::LSB(n) == 0, "n=" << n );
         n = 0;
         CPPUNIT_ASSERT_EX( cds::bitop::MSB(n) == 0, "n=" << n );
         CPPUNIT_ASSERT_EX( cds::bitop::LSB(n) == 0, "n=" << n );
index df2f807c1cb44af7083258ef08c6a25993f0c26d..26c4f2188435ec97acbb212d46531df935c24c03 100644 (file)
@@ -86,7 +86,7 @@ namespace memory {
                             memset( ((char *)(*pCell)) + nSize * sizeof(value_type) - 16, 0, 16 );
                         }
 
                             memset( ((char *)(*pCell)) + nSize * sizeof(value_type) - 16, 0, 16 );
                         }
 
-                        CPPUNIT_ASSERT( (reinterpret_cast<cds::uptr_atomic_t>(*pCell) & (ALLOC::alignment - 1)) == 0 );
+                        CPPUNIT_ASSERT( (reinterpret_cast<uintptr_t>(*pCell) & (ALLOC::alignment - 1)) == 0 );
                     }
                     pCell = m_arr;
                     for ( size_t i = 0; i < s_nBlockCount; ++i, ++pCell ) {
                     }
                     pCell = m_arr;
                     for ( size_t i = 0; i < s_nBlockCount; ++i, ++pCell ) {
index 92388f54e460c6efc3a60aa0b1a27937da4987fa..c230a4cb55e32bd181881977f138bb804cb0d6c7 100644 (file)
@@ -81,7 +81,7 @@ namespace memory {
                     size_t nItem = m_rndGen( size_t(1), s_nBlocksPerThread ) - 1;
                     m_Alloc.deallocate( reinterpret_cast<value_type *>(m_arr[nItem]), 1 );
                     m_arr[nItem] = reinterpret_cast<char *>(m_Alloc.allocate( m_rndGen( s_nMinBlockSize, s_nMaxBlockSize ), nullptr ));
                     size_t nItem = m_rndGen( size_t(1), s_nBlocksPerThread ) - 1;
                     m_Alloc.deallocate( reinterpret_cast<value_type *>(m_arr[nItem]), 1 );
                     m_arr[nItem] = reinterpret_cast<char *>(m_Alloc.allocate( m_rndGen( s_nMinBlockSize, s_nMaxBlockSize ), nullptr ));
-                    CPPUNIT_ASSERT( (reinterpret_cast<cds::uptr_atomic_t>(m_arr[nItem]) & (ALLOC::alignment - 1)) == 0 );
+                    CPPUNIT_ASSERT( (reinterpret_cast<uintptr_t>(m_arr[nItem]) & (ALLOC::alignment - 1)) == 0 );
                 }
             }
         };
                 }
             }
         };
@@ -106,7 +106,7 @@ namespace memory {
                     = new char *[ s_nBlocksPerThread ];
                     for ( size_t i = 0; i < s_nBlocksPerThread; ++i ) {
                         thData[i] = reinterpret_cast<char *>(alloc.allocate( rndGen( s_nMinBlockSize, s_nMaxBlockSize ), nullptr ));
                     = new char *[ s_nBlocksPerThread ];
                     for ( size_t i = 0; i < s_nBlocksPerThread; ++i ) {
                         thData[i] = reinterpret_cast<char *>(alloc.allocate( rndGen( s_nMinBlockSize, s_nMaxBlockSize ), nullptr ));
-                        CPPUNIT_ASSERT( (reinterpret_cast<cds::uptr_atomic_t>(thData[i]) & (ALLOC::alignment - 1)) == 0 );
+                        CPPUNIT_ASSERT( (reinterpret_cast<uintptr_t>(thData[i]) & (ALLOC::alignment - 1)) == 0 );
                     }
             }
             CPPUNIT_MSG("Initializatin done" );
                     }
             }
             CPPUNIT_MSG("Initializatin done" );
index bf05807b2f8865b0abc1e1c859f84eb8f44b5359..c6507d6d80b1ef7530f97f5747ee09ce3d81bd12 100644 (file)
@@ -65,7 +65,7 @@ namespace memory {
                         memset( p, 0, 16 );
                         memset( ((char *)p) + m_nSize * sizeof(*p) - 16, 0, 16 );
                     }
                         memset( p, 0, 16 );
                         memset( ((char *)p) + m_nSize * sizeof(*p) - 16, 0, 16 );
                     }
-                    CPPUNIT_ASSERT( (reinterpret_cast<cds::uptr_atomic_t>(p) & (ALLOC::alignment - 1)) == 0 );
+                    CPPUNIT_ASSERT( (reinterpret_cast<uintptr_t>(p) & (ALLOC::alignment - 1)) == 0 );
                     m_Alloc.deallocate( p, 1 );
                 }
             }
                     m_Alloc.deallocate( p, 1 );
                 }
             }