00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef META_MATH_LOG_2_INCLUDE
00013 #define META_MATH_LOG_2_INCLUDE
00014
00015 #include <boost/numeric/meta_math/is_power_of_2.hpp>
00016
00017 namespace meta_math {
00018
00019
00020
00021 template <unsigned long X>
00022 struct log_2
00023 {
00024
00025 static const unsigned long tmp= X >> 1, value= log_2<tmp>::value + 1;
00026 };
00027
00028 template <> struct log_2<1>
00029 {
00030 static const unsigned long value= 0;
00031 };
00032
00033 template <> struct log_2<0>
00034 {
00035
00036 BOOST_STATIC_ASSERT(true);
00037 };
00038
00039
00040 }
00041
00042 #endif // META_MATH_LOG_2_INCLUDE