From a2f5834b1b0611a7bb4ebf4e9f7f5838260cc747 Mon Sep 17 00:00:00 2001 From: khizmax Date: Sat, 27 Sep 2014 23:38:03 +0400 Subject: [PATCH] Remove cds/details/numtraits.h header --- cds/details/defs.h | 2 - cds/details/numtraits.h | 222 -------------------------- projects/Win/vc12/cds.vcxproj | 1 - projects/Win/vc12/cds.vcxproj.filters | 3 - 4 files changed, 228 deletions(-) delete mode 100644 cds/details/numtraits.h diff --git a/cds/details/defs.h b/cds/details/defs.h index a69848ea..97d046b4 100644 --- a/cds/details/defs.h +++ b/cds/details/defs.h @@ -393,8 +393,6 @@ namespace cds { Common things **************************************************************************/ -#include - namespace cds { /// Base of all exceptions in the library diff --git a/cds/details/numtraits.h b/cds/details/numtraits.h deleted file mode 100644 index a84a55f7..00000000 --- a/cds/details/numtraits.h +++ /dev/null @@ -1,222 +0,0 @@ -//$$CDS-header$$ - -#ifndef __CDS_DETAILS_NUMERIC_TRAITS_H -#define __CDS_DETAILS_NUMERIC_TRAITS_H - -/* - Filename: numtraits.h - Created 2007.04.22 by Maxim.Khiszinsky - - Description: - Various numeric constants and algorithms - Many algorithms are static (compile-time) - Result of static algorithm is the constant (enum) called "result". - - Editions: - 2007.04.22 Maxim.Khiszinsky Created - 2007.07.20 Maxim.Khiszinsky Added functions: exponent2, exp2Ceil -*/ - -namespace cds { - /// Some helper compile-time tricks - namespace beans { - - // @cond details - namespace details { - template struct Exponent2Helper; - template struct Exponent2Helper< N, 0 > { - enum { result = Exponent2Helper< N / 2, N % 2 >::result + 1 }; - }; - template <> struct Exponent2Helper< 1, 0 > { - enum { result = 0 }; - }; - } - // @endcond - - /*! Compile-time computing of log2(N) - - If N = 2**k for some natural k then Exponent2::result = k - If N != 2**k for any natural k then compile-time error has been encountered - */ - template struct Exponent2 { - enum { - native = N, - base = 2, - result = details::Exponent2Helper< N / 2, N % 2 >::result + 1 - }; - }; - //@cond details - template <> struct Exponent2<1> { - enum { - native = 1, - base = 2, - result = 0 - }; - }; - //@endcond - - /// Returns @a N: 2**N is nearest to @p nNumber, 2**N < nNumber - static inline size_t exp2Ceil( size_t nNumber ) - { - static_assert( sizeof(size_t) == (CDS_BUILD_BITS / 8), "Internal assumption error" ); - - size_t nExp = 0; - size_t nBit = CDS_BUILD_BITS - 1; -#if CDS_BUILD_BITS == 32 - size_t nMask = 0x80000000; -#else - size_t nMask = 0x8000000000000000; -#endif - while ( nMask != 0 ) { - if ( nNumber & nMask ) { - nExp = nBit; - break; - } - nMask = nMask >> 1; - --nBit; - } - if ( ( nNumber % ( ((size_t) 1) << nExp )) > ( ((size_t) 1) << (nExp - 1)) ) - ++nExp; - return nExp; - } - - /* ExponentN< int BASE, int N > - Exponent - If N = BASE**k then the algorithm returns k - Else compile-time error is encountered - */ - //@cond details - namespace details { - template struct ExponentNHelper; - template struct ExponentNHelper< N, BASE, 0 > { - enum { result = ExponentNHelper< N / BASE, BASE, N % BASE >::result + 1 }; - }; - template struct ExponentNHelper< 1, BASE, 0 > { - enum { result = 0 }; - }; - } - //@endcond - - /// Compile-time computing log(@p N) based @p BASE. Result in @a Exponent::result - template struct ExponentN { - enum { - native = N, - base = BASE, - result = details::ExponentNHelper< N / BASE, BASE, N % BASE >::result + 1 - }; - }; - //@cond - template struct ExponentN< BASE, 1 > { - enum { - native = 1, - base = BASE, - result = 0 - }; - }; - template struct ExponentN< BASE, 0 >; - //@endcond - - //@cond none - template struct Power2 { - enum { - exponent = N, - result = 1 << N - }; - }; - template <> struct Power2<0> { - enum { - exponent = 0, - result = 1 - }; - }; - //@endcond - - //@cond none - template struct PowerN { - enum { - exponent = N, - base = BASE, - result = PowerN< BASE, N - 1 >::result * BASE - }; - }; - template struct PowerN { - enum { - exponent = 0, - base = BASE, - result = 1 - }; - }; - //@endcond - - //@cond none - namespace details { - template struct NearestCeilHelper { - enum { result = N + ALIGN - MOD }; - }; - template struct NearestCeilHelper< N, ALIGN, 0> { - enum { result = N }; - }; - } - template struct NearestCeil { - enum { - native = N, - align = ALIGN, - result = details::NearestCeilHelper< N, ALIGN, N % ALIGN >::result - }; - }; - //@endcond - - //@cond none - template struct AlignedSize { - typedef T NativeType; - enum { - nativeSize = sizeof(T), - result = NearestCeil< sizeof(T), ALIGN >::result, - alignBytes = result - nativeSize, - alignedSize = result - }; - }; - //@endcond - - //@cond none - namespace details { - template < int N1, int N2, bool LESS > struct Max; - template < int N1, int N2 > - struct Max< N1, N2, true > { - enum { result = N2 }; - }; - - template < int N1, int N2 > - struct Max< N1, N2, false > { - enum { result = N1 }; - }; - - template < int N1, int N2, bool LESS > struct Min; - template < int N1, int N2 > - struct Min< N1, N2, true > { - enum { result = N1 }; - }; - - template < int N1, int N2 > - struct Min< N1, N2, false > { - enum { result = N2 }; - }; - } - //@endcond - - /// Returns max(N1, N2) as Max::result - template - struct Max { - enum { result = details::Max< N1, N2, N1 < N2 >::result }; - }; - - /// Returns min(N1, N2) as Min::result - template - struct Min { - enum { result = details::Min< N1, N2, N1 < N2 >::result }; - }; - - } // namespace beans -} // namespace cds - -#endif // __CDS_DETAILS_NUMERIC_TRAITS_H diff --git a/projects/Win/vc12/cds.vcxproj b/projects/Win/vc12/cds.vcxproj index 49031a1a..9a5ab508 100644 --- a/projects/Win/vc12/cds.vcxproj +++ b/projects/Win/vc12/cds.vcxproj @@ -732,7 +732,6 @@ - diff --git a/projects/Win/vc12/cds.vcxproj.filters b/projects/Win/vc12/cds.vcxproj.filters index 37c948f5..88b2f14d 100644 --- a/projects/Win/vc12/cds.vcxproj.filters +++ b/projects/Win/vc12/cds.vcxproj.filters @@ -1172,9 +1172,6 @@ Header Files\cds\algo - - Header Files\cds\details - Header Files\cds\algo -- 2.34.1