From: khizmax Date: Thu, 16 Feb 2017 17:31:27 +0000 (+0300) Subject: Fixed some minor compiler warnings X-Git-Tag: v2.3.0~173 X-Git-Url: http://plrg.eecs.uci.edu/git/?p=libcds.git;a=commitdiff_plain;h=9444ef82aee828d74d509ebc0f06a11fe6fc6c17 Fixed some minor compiler warnings --- diff --git a/cds/algo/split_bitstring.h b/cds/algo/split_bitstring.h index 3c250f2b..4f56fc56 100644 --- a/cds/algo/split_bitstring.h +++ b/cds/algo/split_bitstring.h @@ -116,25 +116,25 @@ namespace cds { namespace algo { # endif uint_type result; - uint_type const nRest = c_nBitPerInt - m_offset % c_nBitPerInt; + size_t const nRest = c_nBitPerInt - m_offset % c_nBitPerInt; m_offset += nBits; if ( nBits < nRest ) { - result = *m_ptr << ( nRest - nBits ); - result = result >> ( c_nBitPerInt - nBits ); + result = static_cast( *m_ptr << ( nRest - nBits )); + result = static_cast( result >> ( c_nBitPerInt - nBits )); } else if ( nBits == nRest ) { - result = *m_ptr >> ( c_nBitPerInt - nRest ); + result = static_cast( *m_ptr >> ( c_nBitPerInt - nRest )); ++m_ptr; assert( m_offset % c_nBitPerInt == 0 ); } else { - uint_type const lsb = *m_ptr >> ( c_nBitPerInt - nRest ); + uint_type const lsb = static_cast( *m_ptr >> ( c_nBitPerInt - nRest )); nBits -= nRest; ++m_ptr; - result = *m_ptr << ( c_nBitPerInt - nBits ); - result = result >> ( c_nBitPerInt - nBits ); - result = (result << nRest) + lsb; + result = static_cast( *m_ptr << ( c_nBitPerInt - nBits )); + result = static_cast( result >> ( c_nBitPerInt - nBits )); + result = static_cast( (result << nRest) + lsb ); } assert( m_offset <= c_nBitPerHash ); diff --git a/cds/details/allocator.h b/cds/details/allocator.h index ee7f0302..78b1d459 100644 --- a/cds/details/allocator.h +++ b/cds/details/allocator.h @@ -70,20 +70,20 @@ namespace cds { template value_type * New( S const&... src ) { - return Construct( allocator_type::allocate(1), src... ); + return Construct( allocator_type::allocate( 1, nullptr ), src... ); } /// Analogue of operator new T( std::forward(args)... ) (move semantics) template value_type * MoveNew( Args&&... args ) { - return MoveConstruct( allocator_type::allocate(1), std::forward(args)... ); + return MoveConstruct( allocator_type::allocate( 1, nullptr ), std::forward(args)... ); } /// Analogue of operator new T[\p nCount ] value_type * NewArray( size_t nCount ) { - value_type * p = allocator_type::allocate( nCount ); + value_type * p = allocator_type::allocate( nCount, nullptr ); for ( size_t i = 0; i < nCount; ++i ) Construct( p + i ); return p; @@ -96,7 +96,7 @@ namespace cds { template value_type * NewArray( size_t nCount, S const& src ) { - value_type * p = allocator_type::allocate( nCount ); + value_type * p = allocator_type::allocate( nCount, nullptr ); for ( size_t i = 0; i < nCount; ++i ) Construct( p + i, src ); return p; diff --git a/cds/gc/dhp.h b/cds/gc/dhp.h index 2cf4645e..755e051e 100644 --- a/cds/gc/dhp.h +++ b/cds/gc/dhp.h @@ -194,10 +194,10 @@ namespace cds { namespace gc { cur->clear(); // free all extended blocks - hp_allocator& alloc = hp_allocator::instance(); + hp_allocator& a = hp_allocator::instance(); for ( guard_block* p = extended_list_; p; ) { guard_block* next = p->next_; - alloc.free( p ); + a.free( p ); p = next; } diff --git a/cds/intrusive/details/split_list_base.h b/cds/intrusive/details/split_list_base.h index 76b76913..65420bd5 100644 --- a/cds/intrusive/details/split_list_base.h +++ b/cds/intrusive/details/split_list_base.h @@ -708,7 +708,7 @@ namespace cds { namespace intrusive { // Calculate m_nSegmentSize and m_nSegmentCount by nItemCount m.nLoadFactor = nLoadFactor > 0 ? nLoadFactor : 1; - size_t nBucketCount = (size_t)(((float)nItemCount) / m.nLoadFactor); + size_t nBucketCount = ( nItemCount + m.nLoadFactor - 1 ) / m.nLoadFactor; if ( nBucketCount <= 2 ) { m.nSegmentCount = 1; m.nSegmentSize = 2; diff --git a/cds/intrusive/impl/iterable_list.h b/cds/intrusive/impl/iterable_list.h index 33a99054..d34264be 100644 --- a/cds/intrusive/impl/iterable_list.h +++ b/cds/intrusive/impl/iterable_list.h @@ -212,7 +212,7 @@ namespace cds { namespace intrusive { for ( node_type* p = m_pNode->next.load( memory_model::memory_order_relaxed ); p != m_pNode; p = p->next.load( memory_model::memory_order_relaxed )) { m_pNode = p; - if ( m_Guard.protect( p->data, []( marked_data_ptr p ) { return p.ptr(); }).ptr()) + if ( m_Guard.protect( p->data, []( marked_data_ptr ptr ) { return ptr.ptr(); }).ptr()) return; } m_Guard.clear(); diff --git a/cds/os/linux/timer.h b/cds/os/linux/timer.h index b1d3ffb7..f23e0dfa 100644 --- a/cds/os/linux/timer.h +++ b/cds/os/linux/timer.h @@ -72,7 +72,7 @@ namespace cds { namespace OS { { native_timer_type ts; current( ts ); - double dblRet = ( ts.tv_sec - m_tmStart.tv_sec ) + ( ts.tv_nsec - m_tmStart.tv_nsec ) / 1.0E9; + double dblRet = double( ( ts.tv_sec - m_tmStart.tv_sec ) + ( ts.tv_nsec - m_tmStart.tv_nsec )) / 1.0E9; m_tmStart = ts; return dblRet; } diff --git a/src/topology_linux.cpp b/src/topology_linux.cpp index a37e51e9..10b5c79f 100644 --- a/src/topology_linux.cpp +++ b/src/topology_linux.cpp @@ -43,7 +43,7 @@ namespace cds { namespace OS { CDS_CXX11_INLINE_NAMESPACE namespace Linux { { long n = ::sysconf( _SC_NPROCESSORS_ONLN ); if ( n > 0 ) - s_nProcessorCount = n; + s_nProcessorCount = static_cast( n ); else { try { std::ifstream cpuinfo("/proc/cpuinfo"); diff --git a/test/stress/framework/city.cpp b/test/stress/framework/city.cpp index aeac8e5d..26c53cbe 100644 --- a/test/stress/framework/city.cpp +++ b/test/stress/framework/city.cpp @@ -145,7 +145,7 @@ static uint32 Hash32Len13to24(const char *s, size_t len) { uint32 d = Fetch32(s + (len >> 1)); uint32 e = Fetch32(s); uint32 f = Fetch32(s + len - 4); - uint32 h = len; + uint32 h = static_cast( len ); return fmix(Mur(f, Mur(e, Mur(d, Mur(c, Mur(b, Mur(a, h))))))); } @@ -158,11 +158,11 @@ static uint32 Hash32Len0to4(const char *s, size_t len) { b = b * c1 + v; c ^= b; } - return fmix(Mur(b, Mur(len, c))); + return fmix(Mur(b, Mur(static_cast( len ), c))); } static uint32 Hash32Len5to12(const char *s, size_t len) { - uint32 a = len, b = len * 5, c = 9, d = b; + uint32 a = static_cast( len ), b = static_cast( len ) * 5, c = 9, d = b; a += Fetch32(s); b += Fetch32(s + len - 4); c += Fetch32(s + ((len >> 1) & 4)); @@ -177,7 +177,7 @@ uint32 CityHash32(const char *s, size_t len) { } // len > 24 - uint32 h = len, g = c1 * len, f = g; + uint32 h = static_cast( len ), g = static_cast( c1 * len ), f = g; uint32 a0 = Rotate32(Fetch32(s + len - 4) * c1, 17) * c2; uint32 a1 = Rotate32(Fetch32(s + len - 8) * c1, 17) * c2; uint32 a2 = Rotate32(Fetch32(s + len - 16) * c1, 17) * c2; @@ -282,7 +282,7 @@ static uint64 HashLen0to16(const char *s, size_t len) { uint8 b = s[len >> 1]; uint8 c = s[len - 1]; uint32 y = static_cast(a) + (static_cast(b) << 8); - uint32 z = len + (static_cast(c) << 2); + uint32 z = static_cast( len + (static_cast(c) << 2)); return ShiftMix(y * k2 ^ z * k0) * k2; } return k2; diff --git a/test/unit/intrusive-list/test_intrusive_iterable_list.h b/test/unit/intrusive-list/test_intrusive_iterable_list.h index 9dad1190..2dc23805 100644 --- a/test/unit/intrusive-list/test_intrusive_iterable_list.h +++ b/test/unit/intrusive-list/test_intrusive_iterable_list.h @@ -253,24 +253,24 @@ namespace cds_test { break; case 1: EXPECT_EQ( i.s.nInsertCall, 0 ); - EXPECT_TRUE( l.insert( i, []( value_type& i ) { ++i.s.nInsertCall; } )); + EXPECT_TRUE( l.insert( i, []( value_type& v ) { ++v.s.nInsertCall; } )); EXPECT_EQ( i.s.nInsertCall, 1 ); break; case 2: { - std::pair ret = l.update( i, []( value_type& i, value_type * old ) { + std::pair ret = l.update( i, []( value_type& v, value_type * old ) { EXPECT_TRUE( old == nullptr ); - EXPECT_EQ( i.s.nUpdateNewCall, 0 ); - ++i.s.nUpdateNewCall; + EXPECT_EQ( v.s.nUpdateNewCall, 0 ); + ++v.s.nUpdateNewCall; }, false ); EXPECT_EQ( i.s.nUpdateNewCall, 0 ); EXPECT_EQ( ret.first, false ); EXPECT_EQ( ret.second, false ); - ret = l.update( i, []( value_type& i, value_type * old ) { + ret = l.update( i, []( value_type& v, value_type * old ) { EXPECT_TRUE( old == nullptr ); - EXPECT_EQ( i.s.nUpdateNewCall, 0 ); - ++i.s.nUpdateNewCall; + EXPECT_EQ( v.s.nUpdateNewCall, 0 ); + ++v.s.nUpdateNewCall; }, true ); EXPECT_EQ( i.s.nUpdateNewCall, 1 ); EXPECT_EQ( ret.first, true ); @@ -364,10 +364,10 @@ namespace cds_test { for ( auto& i : arr ) { EXPECT_EQ( i.s.nUpdateExistsCall, 0 ); - std::pair ret = l.update( i, []( value_type& i, value_type * old ) { + std::pair ret = l.update( i, []( value_type& v, value_type * old ) { EXPECT_FALSE( old == nullptr ); - EXPECT_EQ( i.s.nUpdateExistsCall, 0 ); - ++i.s.nUpdateExistsCall; + EXPECT_EQ( v.s.nUpdateExistsCall, 0 ); + ++v.s.nUpdateExistsCall; }); EXPECT_TRUE( ret.first ); EXPECT_FALSE( ret.second ); diff --git a/test/unit/intrusive-list/test_intrusive_list.h b/test/unit/intrusive-list/test_intrusive_list.h index 2a5825f1..11fac913 100644 --- a/test/unit/intrusive-list/test_intrusive_list.h +++ b/test/unit/intrusive-list/test_intrusive_list.h @@ -288,7 +288,7 @@ namespace cds_test { EXPECT_TRUE( l.insert( i )); else { EXPECT_EQ( i.s.nInsertCall, 0 ); - EXPECT_TRUE( l.insert( i, []( value_type& i ) { ++i.s.nInsertCall; } )); + EXPECT_TRUE( l.insert( i, []( value_type& v ) { ++v.s.nInsertCall; } )); EXPECT_EQ( i.s.nInsertCall, 1 ); } @@ -330,11 +330,11 @@ namespace cds_test { EXPECT_FALSE( ret.second ); EXPECT_EQ( i.s.nUpdateExistsCall, 1 ); - ret = l.update( i, []( bool bNew, value_type& i, value_type& arg ) { + ret = l.update( i, []( bool bNew, value_type& v, value_type& arg ) { EXPECT_FALSE( bNew ); - EXPECT_EQ( i.s.nUpdateExistsCall, 1 ); - EXPECT_TRUE( &i == &arg ); - ++i.s.nUpdateExistsCall; + EXPECT_EQ( v.s.nUpdateExistsCall, 1 ); + EXPECT_TRUE( &v == &arg ); + ++v.s.nUpdateExistsCall; }); EXPECT_TRUE( ret.first ); EXPECT_FALSE( ret.second ); diff --git a/test/unit/map/test_feldman_hashmap.h b/test/unit/map/test_feldman_hashmap.h index 2c1524f5..548040fb 100644 --- a/test/unit/map/test_feldman_hashmap.h +++ b/test/unit/map/test_feldman_hashmap.h @@ -51,7 +51,7 @@ namespace cds_test { explicit key_type2( int n ) : nKey( n ) - , subkey( n ) + , subkey( static_cast( n )) {} explicit key_type2( size_t n ) @@ -61,7 +61,7 @@ namespace cds_test { explicit key_type2( std::string const& str ) : nKey( std::stoi( str )) - , subkey( nKey ) + , subkey( static_cast( nKey )) {} key_type2( key_type2 const& s ) diff --git a/test/unit/misc/cxx11_atomic_class.cpp b/test/unit/misc/cxx11_atomic_class.cpp index 9d447a5d..f53bea11 100644 --- a/test/unit/misc/cxx11_atomic_class.cpp +++ b/test/unit/misc/cxx11_atomic_class.cpp @@ -77,7 +77,7 @@ namespace { EXPECT_EQ( a.load(), static_cast( 0 )); for ( size_t nByte = 0; nByte < sizeof(Integral); ++nByte ) { - integral_type n = integral_type(42) << (nByte * 8); + integral_type n = static_cast( integral_type(42) << (nByte * 8)); EXPECT_EQ( a.exchange( n ), static_cast( 0 )); EXPECT_EQ( a.load(), n ); EXPECT_EQ( a.exchange( (integral_type) 0 ), n ); @@ -86,7 +86,7 @@ namespace { integral_type prev = a.load(); for ( size_t nByte = 0; nByte < sizeof(Integral); ++nByte ) { - integral_type n = integral_type(42) << (nByte * 8); + integral_type n = static_cast( integral_type(42) << (nByte * 8)); integral_type expected = prev; EXPECT_TRUE( a.compare_exchange_weak( expected, n)); @@ -102,7 +102,7 @@ namespace { prev = a; for ( size_t nByte = 0; nByte < sizeof(Integral); ++nByte ) { - integral_type n = integral_type(42) << (nByte * 8); + integral_type n = static_cast( integral_type(42) << (nByte * 8)); integral_type expected = prev; EXPECT_TRUE( a.compare_exchange_strong( expected, n)); @@ -131,7 +131,7 @@ namespace { for ( size_t nByte = 0; nByte < sizeof(integral_type); ++nByte ) { integral_type prev = a.load(); - integral_type n = integral_type(42) << (nByte * 8); + integral_type n = static_cast( integral_type(42) << (nByte * 8)); EXPECT_EQ( a.fetch_add(n), prev); } @@ -140,7 +140,7 @@ namespace { for ( size_t nByte = sizeof(integral_type); nByte > 0; --nByte ) { integral_type prev = a.load(); - integral_type n = integral_type(42) << ((nByte - 1) * 8); + integral_type n = static_cast( integral_type(42) << ((nByte - 1) * 8)); EXPECT_EQ( a.fetch_sub(n), prev); } @@ -150,7 +150,7 @@ namespace { for ( size_t nBit = 0; nBit < sizeof(integral_type) * 8; ++nBit ) { integral_type prev = a.load() ;; - integral_type mask = integral_type(1) << nBit; + integral_type mask = static_cast( integral_type(1) << nBit ); EXPECT_EQ( a.fetch_or( mask ), prev ); prev = a.load(); @@ -174,7 +174,7 @@ namespace { for ( size_t nByte = 0; nByte < sizeof(integral_type); ++nByte ) { integral_type prev = a; - integral_type n = integral_type(42) << (nByte * 8); + integral_type n = static_cast( integral_type(42) << (nByte * 8)); EXPECT_EQ( (a += n), (prev + n)); } @@ -183,7 +183,7 @@ namespace { for ( size_t nByte = sizeof(integral_type); nByte > 0; --nByte ) { integral_type prev = a; - integral_type n = integral_type(42) << ((nByte - 1) * 8); + integral_type n = static_cast( integral_type(42) << ((nByte - 1) * 8)); EXPECT_EQ( (a -= n), prev - n ); } @@ -193,7 +193,7 @@ namespace { for ( size_t nBit = 0; nBit < sizeof(integral_type) * 8; ++nBit ) { integral_type prev = a; - integral_type mask = integral_type(1) << nBit; + integral_type mask = static_cast( integral_type(1) << nBit ); EXPECT_EQ( (a |= mask ), (prev | mask )); prev = a; @@ -224,7 +224,7 @@ namespace { EXPECT_EQ( a.load( oLoad ), integral_type( 0 )); for ( size_t nByte = 0; nByte < sizeof(Integral); ++nByte ) { - integral_type n = integral_type(42) << (nByte * 8); + integral_type n = static_cast( integral_type(42) << (nByte * 8)); EXPECT_EQ( a.exchange( n, order ), integral_type( 0 )); EXPECT_EQ( a.load( oLoad ), n ); EXPECT_EQ( a.exchange( (integral_type) 0, order ), n ); @@ -233,7 +233,7 @@ namespace { integral_type prev = a.load( oLoad ); for ( size_t nByte = 0; nByte < sizeof(Integral); ++nByte ) { - integral_type n = integral_type(42) << (nByte * 8); + integral_type n = static_cast( integral_type(42) << (nByte * 8)); integral_type expected = prev; EXPECT_TRUE( a.compare_exchange_weak( expected, n, order, atomics::memory_order_relaxed)); @@ -249,7 +249,7 @@ namespace { prev = a.load( oLoad ); for ( size_t nByte = 0; nByte < sizeof(Integral); ++nByte ) { - integral_type n = integral_type(42) << (nByte * 8); + integral_type n = static_cast( integral_type(42) << (nByte * 8)); integral_type expected = prev; EXPECT_TRUE( a.compare_exchange_strong( expected, n, order, atomics::memory_order_relaxed)); @@ -281,7 +281,7 @@ namespace { for ( size_t nByte = 0; nByte < sizeof(integral_type); ++nByte ) { integral_type prev = a.load( oLoad ); - integral_type n = integral_type(42) << (nByte * 8); + integral_type n = static_cast( integral_type(42) << (nByte * 8)); EXPECT_EQ( a.fetch_add( n, order), prev); } @@ -290,7 +290,7 @@ namespace { for ( size_t nByte = sizeof(integral_type); nByte > 0; --nByte ) { integral_type prev = a.load( oLoad ); - integral_type n = integral_type(42) << ((nByte - 1) * 8); + integral_type n = static_cast( integral_type(42) << ((nByte - 1) * 8)); EXPECT_EQ( a.fetch_sub( n, order ), prev); } @@ -300,7 +300,7 @@ namespace { for ( size_t nBit = 0; nBit < sizeof(integral_type) * 8; ++nBit ) { integral_type prev = a.load( oLoad ) ;; - integral_type mask = integral_type(1) << nBit; + integral_type mask = static_cast( integral_type(1) << nBit ); EXPECT_EQ( a.fetch_or( mask, order ), prev ); prev = a.load( oLoad ); @@ -474,7 +474,7 @@ namespace { char arr[8]; const char aSize = sizeof(arr)/sizeof(arr[0]); for ( char i = 0; i < aSize; ++i ) { - arr[unsigned(i)] = i + 1; + arr[static_cast( i )] = i + 1; } atomic_pointer a; @@ -571,7 +571,7 @@ namespace { integral_type arr[8]; const integral_type aSize = sizeof(arr)/sizeof(arr[0]); for ( integral_type i = 0; i < aSize; ++i ) { - arr[size_t(i)] = i + 1; + arr[static_cast(i)] = i + 1; } atomic_pointer a; diff --git a/test/unit/misc/cxx11_atomic_func.cpp b/test/unit/misc/cxx11_atomic_func.cpp index 8e4713a0..eeaa1951 100644 --- a/test/unit/misc/cxx11_atomic_func.cpp +++ b/test/unit/misc/cxx11_atomic_func.cpp @@ -87,7 +87,7 @@ namespace misc { EXPECT_EQ( atomics::atomic_load( &a ), integral_type( 0 )); for ( size_t nByte = 0; nByte < sizeof(Integral); ++nByte ) { - integral_type n = integral_type(42) << (nByte * 8); + integral_type n = static_cast( integral_type(42) << (nByte * 8)); EXPECT_EQ( atomics::atomic_exchange( &a, n ), (integral_type) 0 ); EXPECT_EQ( atomics::atomic_load( &a ), n ); EXPECT_EQ( atomics::atomic_exchange( &a, (integral_type) 0 ), n ); @@ -96,7 +96,7 @@ namespace misc { integral_type prev = atomics::atomic_load( &a ); for ( size_t nByte = 0; nByte < sizeof(Integral); ++nByte ) { - integral_type n = integral_type(42) << (nByte * 8); + integral_type n = static_cast( integral_type(42) << (nByte * 8)); integral_type expected = prev; EXPECT_TRUE( atomics::atomic_compare_exchange_weak( &a, &expected, n)); @@ -113,7 +113,7 @@ namespace misc { prev = atomics::atomic_load( &a ); for ( size_t nByte = 0; nByte < sizeof(Integral); ++nByte ) { - integral_type n = integral_type(42) << (nByte * 8); + integral_type n = static_cast( integral_type(42) << (nByte * 8)); integral_type expected = prev; EXPECT_TRUE( atomics::atomic_compare_exchange_strong( &a, &expected, n)); @@ -142,7 +142,7 @@ namespace misc { for ( size_t nByte = 0; nByte < sizeof(integral_type); ++nByte ) { integral_type prev = atomics::atomic_load( &a ); - integral_type n = integral_type(42) << (nByte * 8); + integral_type n = static_cast( integral_type(42) << (nByte * 8)); EXPECT_EQ( atomics::atomic_fetch_add( &a, n ), prev ); } @@ -151,7 +151,7 @@ namespace misc { for ( size_t nByte = sizeof(integral_type); nByte > 0; --nByte ) { integral_type prev = atomics::atomic_load( &a ); - integral_type n = integral_type(42) << ((nByte - 1) * 8); + integral_type n = static_cast( integral_type(42) << ((nByte - 1) * 8)); EXPECT_EQ( atomics::atomic_fetch_sub( &a, n ), prev ); } @@ -161,7 +161,7 @@ namespace misc { for ( size_t nBit = 0; nBit < sizeof(integral_type) * 8; ++nBit ) { integral_type prev = atomics::atomic_load( &a ); - integral_type mask = integral_type(1) << nBit; + integral_type mask = static_cast( integral_type(1) << nBit ); EXPECT_EQ( atomics::atomic_fetch_or( &a, mask ), prev ); prev = atomics::atomic_load( &a ); @@ -192,7 +192,7 @@ namespace misc { EXPECT_EQ( atomics::atomic_load_explicit( &a, oLoad ), (integral_type) 0 ); for ( size_t nByte = 0; nByte < sizeof(Integral); ++nByte ) { - integral_type n = integral_type(42) << (nByte * 8); + integral_type n = static_cast( integral_type(42) << (nByte * 8)); EXPECT_EQ( atomics::atomic_exchange_explicit( &a, n, order ), (integral_type) 0 ); EXPECT_EQ( atomics::atomic_load_explicit( &a, oLoad ), n ); EXPECT_EQ( atomics::atomic_exchange_explicit( &a, (integral_type) 0, order ), n ); @@ -201,7 +201,7 @@ namespace misc { integral_type prev = atomics::atomic_load_explicit( &a, oLoad ); for ( size_t nByte = 0; nByte < sizeof(Integral); ++nByte ) { - integral_type n = integral_type(42) << (nByte * 8); + integral_type n = static_cast( integral_type(42) << (nByte * 8)); integral_type expected = prev; EXPECT_TRUE( atomics::atomic_compare_exchange_weak_explicit( &a, &expected, n, order, atomics::memory_order_relaxed)); @@ -217,7 +217,7 @@ namespace misc { prev = atomics::atomic_load_explicit( &a, oLoad ); for ( size_t nByte = 0; nByte < sizeof(Integral); ++nByte ) { - integral_type n = integral_type(42) << (nByte * 8); + integral_type n = static_cast( integral_type(42) << (nByte * 8)); integral_type expected = prev; EXPECT_TRUE( atomics::atomic_compare_exchange_strong_explicit( &a, &expected, n, order, atomics::memory_order_relaxed)); @@ -248,7 +248,7 @@ namespace misc { for ( size_t nByte = 0; nByte < sizeof(integral_type); ++nByte ) { integral_type prev = atomics::atomic_load_explicit( &a, oLoad ); - integral_type n = integral_type(42) << (nByte * 8); + integral_type n = static_cast( integral_type(42) << (nByte * 8)); EXPECT_EQ( atomics::atomic_fetch_add_explicit( &a, n, order), prev); } @@ -257,7 +257,7 @@ namespace misc { for ( size_t nByte = sizeof(integral_type); nByte > 0; --nByte ) { integral_type prev = atomics::atomic_load_explicit( &a, oLoad ); - integral_type n = integral_type(42) << ((nByte - 1) * 8); + integral_type n = static_cast( integral_type(42) << ((nByte - 1) * 8)); EXPECT_EQ( atomics::atomic_fetch_sub_explicit( &a, n, order ), prev); } @@ -267,7 +267,7 @@ namespace misc { for ( size_t nBit = 0; nBit < sizeof(integral_type) * 8; ++nBit ) { integral_type prev = atomics::atomic_load_explicit( &a, oLoad ) ;; - integral_type mask = integral_type(1) << nBit; + integral_type mask = static_cast( integral_type(1) << nBit ); EXPECT_EQ( atomics::atomic_fetch_or_explicit( &a, mask, order ), prev ); prev = atomics::atomic_load_explicit( &a, oLoad ); @@ -439,7 +439,7 @@ namespace misc { integral_type arr[8]; const integral_type aSize = sizeof(arr)/sizeof(arr[0]); for ( integral_type i = 0; i < aSize; ++i ) { - arr[size_t(i)] = i + 1; + arr[static_cast(i)] = i + 1; } atomic_pointer a; @@ -535,7 +535,7 @@ namespace misc { char arr[8]; const char aSize = sizeof(arr)/sizeof(arr[0]); for ( char i = 0; i < aSize; ++i ) { - arr[unsigned(i)] = i + 1; + arr[static_cast(i)] = i + 1; } atomic_pointer a;