From b4d744c2117d36ad8c51afdd2f53eb19fc608435 Mon Sep 17 00:00:00 2001
From: khizmax <khizmax@gmail.com>
Date: Thu, 18 Sep 2014 19:38:50 +0400
Subject: [PATCH] Move cds/int_algo.h to cds/algo/int_algo.h

---
 cds/algo/flat_combining.h             |  2 +-
 cds/{ => algo}/int_algo.h             |  0
 cds/intrusive/segmented_queue.h       |  2 +-
 cds/intrusive/split_list_base.h       |  2 +-
 cds/numtraits.h                       | 25 -------------------------
 cds/opt/buffer.h                      |  2 +-
 projects/Win/vc12/cds.vcxproj         |  1 -
 projects/Win/vc12/cds.vcxproj.filters |  3 ---
 src/ptb_gc.cpp                        |  2 +-
 tests/test-hdr/misc/bitop_st.cpp      |  2 +-
 10 files changed, 6 insertions(+), 35 deletions(-)
 rename cds/{ => algo}/int_algo.h (100%)

diff --git a/cds/algo/flat_combining.h b/cds/algo/flat_combining.h
index 4499dc03..4c707816 100644
--- a/cds/algo/flat_combining.h
+++ b/cds/algo/flat_combining.h
@@ -9,7 +9,7 @@
 #include <cds/lock/spinlock.h>
 #include <cds/details/std/mutex.h>  // lock_guard
 #include <cds/opt/options.h>
-#include <cds/int_algo.h>
+#include <cds/algo/int_algo.h>
 #include <boost/thread/tss.hpp>     // thread_specific_ptr
 
 namespace cds { namespace algo {
diff --git a/cds/int_algo.h b/cds/algo/int_algo.h
similarity index 100%
rename from cds/int_algo.h
rename to cds/algo/int_algo.h
diff --git a/cds/intrusive/segmented_queue.h b/cds/intrusive/segmented_queue.h
index 2fb03952..18a9d45a 100644
--- a/cds/intrusive/segmented_queue.h
+++ b/cds/intrusive/segmented_queue.h
@@ -5,7 +5,7 @@
 
 #include <cds/intrusive/base.h>
 #include <cds/details/marked_ptr.h>
-#include <cds/int_algo.h>
+#include <cds/algo/int_algo.h>
 #include <cds/details/std/mutex.h>
 #include <cds/lock/spinlock.h>
 #include <cds/opt/permutation.h>
diff --git a/cds/intrusive/split_list_base.h b/cds/intrusive/split_list_base.h
index a5365535..a7bc10ab 100644
--- a/cds/intrusive/split_list_base.h
+++ b/cds/intrusive/split_list_base.h
@@ -6,7 +6,7 @@
 #include <cds/intrusive/base.h>
 #include <cds/cxx11_atomic.h>
 #include <cds/details/allocator.h>
-#include <cds/int_algo.h>
+#include <cds/algo/int_algo.h>
 #include <cds/algo/bitop.h>
 #include <cds/details/functor_wrapper.h>
 
diff --git a/cds/numtraits.h b/cds/numtraits.h
index 89f5aa76..df262a0a 100644
--- a/cds/numtraits.h
+++ b/cds/numtraits.h
@@ -55,31 +55,6 @@ namespace cds {
         };
         //@endcond
 
-        //TODO - deprecated. Use is_power2 from int_algo.h
-        /// A tricky runtime algorithm to ensure that @p n is power of 2
-        static inline bool isExp2( size_t n )
-        {
-            return(n & (n - 1)) == 0 && n;
-        }
-
-        //TODO: deprecated. Use log2 from int_algo.h
-        /// Runtime algorithm to compute log2( @p nTest ). If @p nTest is not power of two then -1 returns
-        static inline int exponent2( size_t nTest )
-        {
-            int nExp = -1;
-            size_t nMask = 1;
-            for ( size_t n = 0; n < CDS_BUILD_BITS; n++ ) {
-                if ( nTest & nMask ) {
-                    if ( nExp == -1 )
-                        nExp = (int) n;
-                    else
-                        return -1    ;    // nTest íå ÿâëÿåòñÿ ñòåïåíüþ äâîéêè
-                }
-                nMask = nMask << 1;
-            }
-            return nExp;
-        }
-
         /// Returns @a N: 2**N is nearest to @p nNumber, 2**N < nNumber
         static inline size_t exp2Ceil( size_t nNumber )
         {
diff --git a/cds/opt/buffer.h b/cds/opt/buffer.h
index fe1d0815..71af760d 100644
--- a/cds/opt/buffer.h
+++ b/cds/opt/buffer.h
@@ -6,7 +6,7 @@
 #include <cds/details/defs.h>
 #include <cds/user_setup/allocator.h>
 #include <cds/details/allocator.h>
-#include <cds/int_algo.h>
+#include <cds/algo/int_algo.h>
 
 namespace cds { namespace opt {
 
diff --git a/projects/Win/vc12/cds.vcxproj b/projects/Win/vc12/cds.vcxproj
index 90d9b8c9..2ef5e971 100644
--- a/projects/Win/vc12/cds.vcxproj
+++ b/projects/Win/vc12/cds.vcxproj
@@ -810,7 +810,6 @@
     <ClInclude Include="..\..\..\cds\urcu\signal_threaded.h" />
     <ClInclude Include="..\..\..\src\hzp_const.h" />
     <ClInclude Include="..\..\..\cds\init.h" />
-    <ClInclude Include="..\..\..\cds\int_algo.h" />
     <ClInclude Include="..\..\..\cds\numtraits.h" />
     <ClInclude Include="..\..\..\cds\ref.h" />
     <ClInclude Include="..\..\..\cds\refcounter.h" />
diff --git a/projects/Win/vc12/cds.vcxproj.filters b/projects/Win/vc12/cds.vcxproj.filters
index 9a573f08..3f678be6 100644
--- a/projects/Win/vc12/cds.vcxproj.filters
+++ b/projects/Win/vc12/cds.vcxproj.filters
@@ -197,9 +197,6 @@
     <ClInclude Include="..\..\..\cds\init.h">
       <Filter>Header Files\cds</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\..\cds\int_algo.h">
-      <Filter>Header Files\cds</Filter>
-    </ClInclude>
     <ClInclude Include="..\..\..\cds\numtraits.h">
       <Filter>Header Files\cds</Filter>
     </ClInclude>
diff --git a/src/ptb_gc.cpp b/src/ptb_gc.cpp
index 12ceb7f9..9a11b0bf 100644
--- a/src/ptb_gc.cpp
+++ b/src/ptb_gc.cpp
@@ -3,7 +3,7 @@
 // Pass The Buck (PTB) Memory manager implementation
 
 #include <cds/gc/ptb/ptb.h>
-#include <cds/int_algo.h>
+#include <cds/algo/int_algo.h>
 
 #include <cds/details/hash_functor_selector.h>
 #include <algorithm>   // std::fill
diff --git a/tests/test-hdr/misc/bitop_st.cpp b/tests/test-hdr/misc/bitop_st.cpp
index 01d4de77..391a2a70 100644
--- a/tests/test-hdr/misc/bitop_st.cpp
+++ b/tests/test-hdr/misc/bitop_st.cpp
@@ -2,7 +2,7 @@
 
 #include "cppunit/cppunit_proxy.h"
 
-#include <cds/int_algo.h>
+#include <cds/algo/int_algo.h>
 #include <cds/os/timer.h>
 
 class bitop_ST : public CppUnitMini::TestCase
-- 
2.34.1