From: khizmax Date: Sun, 30 Nov 2014 13:36:23 +0000 (+0300) Subject: Replacing some integral typedefs with standard types X-Git-Tag: v2.0.0~24 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=e26dd6a9f661131fa49d07e1f98a73bee0583eb4;p=libcds.git Replacing some integral typedefs with standard types --- diff --git a/cds/algo/bitop.h b/cds/algo/bitop.h index 2ab7a5ef..de9ba52f 100644 --- a/cds/algo/bitop.h +++ b/cds/algo/bitop.h @@ -27,7 +27,7 @@ namespace cds { // 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 ); } diff --git a/cds/compiler/gcc/amd64/bitop.h b/cds/compiler/gcc/amd64/bitop.h index b83384cf..5edd78fd 100644 --- a/cds/compiler/gcc/amd64/bitop.h +++ b/cds/compiler/gcc/amd64/bitop.h @@ -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 - static inline int msb32( atomic32u_t nArg ) + static inline int msb32( uint32_t nArg ) { int nRet; __asm__ __volatile__ ( @@ -26,7 +26,7 @@ namespace cds { } # define cds_bitop_msb32nz_DEFINED - static inline int msb32nz( atomic32u_t nArg ) + static inline int msb32nz( uint32_t nArg ) { 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 - static inline int lsb32( atomic32u_t nArg ) + static inline int lsb32( uint32_t nArg ) { 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 - static inline int lsb32nz( atomic32u_t nArg ) + static inline int lsb32nz( uint32_t nArg ) { assert( nArg != 0 ); int nRet; diff --git a/cds/compiler/gcc/ia64/bitop.h b/cds/compiler/gcc/ia64/bitop.h index 64e21e1c..35608c3a 100644 --- a/cds/compiler/gcc/ia64/bitop.h +++ b/cds/compiler/gcc/ia64/bitop.h @@ -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 - static inline int msb32( atomic32u_t nArg ) + static inline int msb32( uint32_t nArg ) { 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 - static inline int msb32nz( atomic32u_t nArg ) + static inline int msb32nz( uint32_t nArg ) { assert( nArg != 0 ); long double d = nArg; diff --git a/cds/compiler/gcc/sparc/bitop.h b/cds/compiler/gcc/sparc/bitop.h index 632b4018..9fedde66 100644 --- a/cds/compiler/gcc/sparc/bitop.h +++ b/cds/compiler/gcc/sparc/bitop.h @@ -27,7 +27,7 @@ namespace cds { } // 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 ); } diff --git a/cds/compiler/gcc/x86/bitop.h b/cds/compiler/gcc/x86/bitop.h index 3982fb94..dbe5f3d8 100644 --- a/cds/compiler/gcc/x86/bitop.h +++ b/cds/compiler/gcc/x86/bitop.h @@ -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 - static inline int msb32( atomic32u_t nArg ) + static inline int msb32( uint32_t nArg ) { int nRet; __asm__ __volatile__ ( @@ -26,7 +26,7 @@ namespace cds { } # define cds_bitop_msb32nz_DEFINED - static inline int msb32nz( atomic32u_t nArg ) + static inline int msb32nz( uint32_t nArg ) { 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 - static inline int lsb32( atomic32u_t nArg ) + static inline int lsb32( uint32_t nArg ) { 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 - static inline int lsb32nz( atomic32u_t nArg ) + static inline int lsb32nz( uint32_t nArg ) { assert( nArg != 0 ); int nRet; diff --git a/cds/compiler/vc/amd64/bitop.h b/cds/compiler/vc/amd64/bitop.h index ee143d6f..a7edfb9e 100644 --- a/cds/compiler/vc/amd64/bitop.h +++ b/cds/compiler/vc/amd64/bitop.h @@ -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 - static inline int msb32( atomic32u_t nArg ) + static inline int msb32( uint32_t nArg ) { unsigned long nIndex; if ( _BitScanReverse( &nIndex, nArg )) @@ -39,7 +39,7 @@ namespace cds { } # 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; @@ -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 - static inline int lsb32( atomic32u_t nArg ) + static inline int lsb32( uint32_t nArg ) { unsigned long nIndex; if ( _BitScanForward( &nIndex, nArg )) @@ -58,7 +58,7 @@ namespace cds { } # 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; @@ -104,7 +104,7 @@ namespace cds { } # 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( pArg ), nBit ) != 0; } diff --git a/cds/compiler/vc/x86/bitop.h b/cds/compiler/vc/x86/bitop.h index f2772005..64827c60 100644 --- a/cds/compiler/vc/x86/bitop.h +++ b/cds/compiler/vc/x86/bitop.h @@ -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 - static inline int msb32( atomic32u_t nArg ) + static inline int msb32( uint32_t nArg ) { unsigned long nIndex; if ( _BitScanReverse( &nIndex, nArg )) @@ -21,7 +21,7 @@ namespace cds { } # 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; @@ -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 - static inline int lsb32( atomic32u_t nArg ) + static inline int lsb32( uint32_t nArg ) { unsigned long nIndex; if ( _BitScanForward( &nIndex, nArg )) @@ -40,7 +40,7 @@ namespace cds { } # 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; @@ -50,7 +50,7 @@ namespace cds { // 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; @@ -59,7 +59,7 @@ namespace cds { } # 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( pArg ), nBit ) != 0; } diff --git a/cds/details/bitop_generic.h b/cds/details/bitop_generic.h index 6fd1a07b..184945af 100644 --- a/cds/details/bitop_generic.h +++ b/cds/details/bitop_generic.h @@ -8,7 +8,7 @@ namespace cds { 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; } @@ -29,7 +29,7 @@ namespace cds { // 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; @@ -60,7 +60,7 @@ namespace cds { #endif #ifndef cds_bitop_msb32nz_DEFINED - static inline int msb32nz( atomic32u_t x ) + static inline int msb32nz( uint32_t x ) { return msb32( x ) - 1; } @@ -69,10 +69,10 @@ namespace cds { #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; - return msb32( (atomic32u_t) x ); + return msb32( (uint32_t) x ); } #endif @@ -91,7 +91,7 @@ namespace cds { // 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; @@ -122,7 +122,7 @@ namespace cds { #endif #ifndef cds_bitop_lsb32nz_DEFINED - static inline int lsb32nz( atomic32u_t x ) + static inline int lsb32nz( uint32_t x ) { return lsb32( x ) - 1; } @@ -134,8 +134,8 @@ namespace cds { 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 @@ -150,7 +150,7 @@ namespace cds { // 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); @@ -169,7 +169,7 @@ namespace cds { 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 @@ -177,7 +177,7 @@ namespace cds { // 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 ); @@ -196,7 +196,7 @@ namespace cds { # 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 @@ -205,7 +205,7 @@ namespace cds { // 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 ); } @@ -220,10 +220,10 @@ namespace cds { // 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 ); - atomic32u_t nVal = *pArg & (1 << nBit); + uint32_t nVal = *pArg & (1 << nBit); *pArg ^= 1 << nBit; return nVal != 0; } @@ -246,8 +246,8 @@ namespace cds { */ 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; diff --git a/cds/details/defs.h b/cds/details/defs.h index b9e51a0f..93ea0a23 100644 --- a/cds/details/defs.h +++ b/cds/details/defs.h @@ -347,9 +347,6 @@ namespace cds {} //@cond // typedefs for back compatibility namespace cds { - /// Atomic pointer - typedef void * pointer_t; - /// 64bit unaligned int typedef int64_t atomic64_unaligned; @@ -367,24 +364,6 @@ namespace cds { /// 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 diff --git a/cds/details/is_aligned.h b/cds/details/is_aligned.h index f50b899f..b514fac5 100644 --- a/cds/details/is_aligned.h +++ b/cds/details/is_aligned.h @@ -16,7 +16,7 @@ namespace cds { namespace details { template 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 @@ -28,7 +28,7 @@ namespace cds { namespace details { template 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 diff --git a/cds/intrusive/tsigas_cycle_queue.h b/cds/intrusive/tsigas_cycle_queue.h index 202feb12..42349395 100644 --- a/cds/intrusive/tsigas_cycle_queue.h +++ b/cds/intrusive/tsigas_cycle_queue.h @@ -226,7 +226,7 @@ namespace cds { namespace intrusive { bool enqueue( value_type& data ) { value_type * pNewNode = &data; - assert( (reinterpret_cast( pNewNode ) & 1) == 0 ); + assert( (reinterpret_cast(pNewNode) & 1) == 0 ); back_off bkoff; const index_type nModulo = modulo(); @@ -323,7 +323,7 @@ namespace cds { namespace intrusive { continue; } - pNull = reinterpret_cast((reinterpret_cast(tt) & 1) ? free0 : free1 ); + pNull = reinterpret_cast((reinterpret_cast(tt) & 1) ? free0 : free1); if ( th != m_nHead.load(memory_model::memory_order_relaxed) ) continue; diff --git a/cds/lock/spinlock.h b/cds/lock/spinlock.h index 80460a82..e9db002b 100644 --- a/cds/lock/spinlock.h +++ b/cds/lock/spinlock.h @@ -346,14 +346,14 @@ namespace cds { } }; - /// Recursive spin-lock based on atomic32u_t - typedef ReentrantSpinT ReentrantSpin32; + /// Recursive 32bit spin-lock + typedef ReentrantSpinT ReentrantSpin32; - /// Recursive spin-lock based on atomic64u_t type - typedef ReentrantSpinT ReentrantSpin64; + /// Recursive 64bit spin-lock + typedef ReentrantSpinT ReentrantSpin64; - /// Recursive spin-lock based on atomic32_t type - typedef ReentrantSpin32 ReentrantSpin; + /// Default recursive spin-lock type + typedef ReentrantSpin32 ReentrantSpin; } // namespace lock diff --git a/cds/memory/michael/allocator.h b/cds/memory/michael/allocator.h index 4ddfb1b3..08a738a3 100644 --- a/cds/memory/michael/allocator.h +++ b/cds/memory/michael/allocator.h @@ -830,12 +830,12 @@ namespace michael { 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: - void set( superblock_desc * pdesc, atomic32u_t isAligned ) + void set( superblock_desc * pdesc, uint32_t isAligned ) { pDesc = pdesc; nFlags = isAligned ? bitAligned : 0; @@ -889,7 +889,7 @@ namespace michael { // 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 ); } @@ -924,7 +924,7 @@ namespace michael { size_t getOSAllocSize() const { assert( isOSAllocated() ); - return reinterpret_cast( pDesc.ptr() ) >> 2; + return reinterpret_cast( pDesc.ptr() ) >> 2; } }; @@ -957,7 +957,7 @@ namespace michael { class active_tag { //@cond superblock_desc * pDesc; - atomic32u_t nCredits; + uint32_t nCredits; public: static const unsigned int c_nMaxCredits = 0 - 1; @@ -1041,7 +1041,7 @@ namespace michael { void ptr( superblock_desc * p ) { - assert( (reinterpret_cast(p) & c_nMaxCredits) == 0 ); + assert( (reinterpret_cast(p) & c_nMaxCredits) == 0 ); pDesc = marked_desc_ptr( p, pDesc.bits()); } @@ -1063,7 +1063,7 @@ namespace michael { void set( superblock_desc * pSB, unsigned int n ) { - assert( (reinterpret_cast(pSB) & c_nMaxCredits) == 0 ); + assert( (reinterpret_cast(pSB) & c_nMaxCredits) == 0 ); pDesc = marked_desc_ptr( pSB, n ); } @@ -1101,7 +1101,7 @@ namespace michael { , pSizeClass( nullptr ) , pPartial( nullptr ) { - assert( (reinterpret_cast(this) & (c_nAlignment - 1)) == 0 ); + assert( (reinterpret_cast(this) & (c_nAlignment - 1)) == 0 ); } //@endcond @@ -1459,8 +1459,8 @@ namespace michael { // initialize processor heaps pDesc->arrProcHeap = reinterpret_cast( - reinterpret_cast(reinterpret_cast(pDesc + 1) + sizeof(pDesc->pageHeaps[0]) * nPageHeapCount + c_nAlignment - 1) - & ~(uptr_atomic_t(c_nAlignment) - 1) + reinterpret_cast(reinterpret_cast(pDesc + 1) + sizeof(pDesc->pageHeaps[0]) * nPageHeapCount + c_nAlignment - 1) + & ~(uintptr_t(c_nAlignment) - 1) ); 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; - 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; @@ -1830,19 +1830,19 @@ namespace michael { { if ( nAlignment <= c_nDefaultBlockAlignment ) { void * p = alloc( nSize ); - assert( (reinterpret_cast(p) & (nAlignment - 1)) == 0 ); + assert( (reinterpret_cast(p) & (nAlignment - 1)) == 0 ); return p; } block_header * pBlock = int_alloc( nSize + nAlignment + sizeof(block_header) + bound_checker::trailer_size ); block_header * pRedirect; - if ( (reinterpret_cast( pBlock + 1) & (nAlignment - 1)) != 0 ) { - pRedirect = reinterpret_cast( (reinterpret_cast( pBlock ) & ~(nAlignment - 1)) + nAlignment ) - 1; + if ( (reinterpret_cast( pBlock + 1) & (nAlignment - 1)) != 0 ) { + pRedirect = reinterpret_cast( (reinterpret_cast( pBlock ) & ~(nAlignment - 1)) + nAlignment ) - 1; assert( pRedirect != pBlock ); pRedirect->set( reinterpret_cast(pBlock), 1 ); - assert( (reinterpret_cast(pRedirect + 1) & (nAlignment - 1)) == 0 ); + assert( (reinterpret_cast(pRedirect + 1) & (nAlignment - 1)) == 0 ); } else pRedirect = pBlock; diff --git a/cds/memory/michael/bound_check.h b/cds/memory/michael/bound_check.h index 06cb843f..aa9734ca 100644 --- a/cds/memory/michael/bound_check.h +++ b/cds/memory/michael/bound_check.h @@ -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 - assert( (reinterpret_cast(pEndBlock) & (sizeof(size_t) - 1)) == 0 ); + assert( (reinterpret_cast(pEndBlock) & (sizeof(size_t) - 1)) == 0 ); *(reinterpret_cast( pEndBlock ) - 1) = nAllocSize; } diff --git a/tests/test-hdr/misc/bitop_st.cpp b/tests/test-hdr/misc/bitop_st.cpp index 391a2a70..e224b627 100644 --- a/tests/test-hdr/misc/bitop_st.cpp +++ b/tests/test-hdr/misc/bitop_st.cpp @@ -10,7 +10,7 @@ class bitop_ST : public CppUnitMini::TestCase 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 ); diff --git a/tests/unit/alloc/hoard_threadtest.cpp b/tests/unit/alloc/hoard_threadtest.cpp index df2f807c..26c4f218 100644 --- a/tests/unit/alloc/hoard_threadtest.cpp +++ b/tests/unit/alloc/hoard_threadtest.cpp @@ -86,7 +86,7 @@ namespace memory { memset( ((char *)(*pCell)) + nSize * sizeof(value_type) - 16, 0, 16 ); } - CPPUNIT_ASSERT( (reinterpret_cast(*pCell) & (ALLOC::alignment - 1)) == 0 ); + CPPUNIT_ASSERT( (reinterpret_cast(*pCell) & (ALLOC::alignment - 1)) == 0 ); } pCell = m_arr; for ( size_t i = 0; i < s_nBlockCount; ++i, ++pCell ) { diff --git a/tests/unit/alloc/larson.cpp b/tests/unit/alloc/larson.cpp index 92388f54..c230a4cb 100644 --- a/tests/unit/alloc/larson.cpp +++ b/tests/unit/alloc/larson.cpp @@ -81,7 +81,7 @@ namespace memory { size_t nItem = m_rndGen( size_t(1), s_nBlocksPerThread ) - 1; m_Alloc.deallocate( reinterpret_cast(m_arr[nItem]), 1 ); m_arr[nItem] = reinterpret_cast(m_Alloc.allocate( m_rndGen( s_nMinBlockSize, s_nMaxBlockSize ), nullptr )); - CPPUNIT_ASSERT( (reinterpret_cast(m_arr[nItem]) & (ALLOC::alignment - 1)) == 0 ); + CPPUNIT_ASSERT( (reinterpret_cast(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(alloc.allocate( rndGen( s_nMinBlockSize, s_nMaxBlockSize ), nullptr )); - CPPUNIT_ASSERT( (reinterpret_cast(thData[i]) & (ALLOC::alignment - 1)) == 0 ); + CPPUNIT_ASSERT( (reinterpret_cast(thData[i]) & (ALLOC::alignment - 1)) == 0 ); } } CPPUNIT_MSG("Initializatin done" ); diff --git a/tests/unit/alloc/linux_scale.cpp b/tests/unit/alloc/linux_scale.cpp index bf05807b..c6507d6d 100644 --- a/tests/unit/alloc/linux_scale.cpp +++ b/tests/unit/alloc/linux_scale.cpp @@ -65,7 +65,7 @@ namespace memory { memset( p, 0, 16 ); memset( ((char *)p) + m_nSize * sizeof(*p) - 16, 0, 16 ); } - CPPUNIT_ASSERT( (reinterpret_cast(p) & (ALLOC::alignment - 1)) == 0 ); + CPPUNIT_ASSERT( (reinterpret_cast(p) & (ALLOC::alignment - 1)) == 0 ); m_Alloc.deallocate( p, 1 ); } }