From 70c7ae271c64a8f53288e84279017d46461c2cfa Mon Sep 17 00:00:00 2001 From: Gennaro Prota Date: Sun, 9 May 2004 08:58:03 +0000 Subject: [PATCH] added Borland workaround [SVN r22770] --- include/boost/pending/integer_log2.hpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/include/boost/pending/integer_log2.hpp b/include/boost/pending/integer_log2.hpp index 49b97a2..fd8e446 100644 --- a/include/boost/pending/integer_log2.hpp +++ b/include/boost/pending/integer_log2.hpp @@ -19,6 +19,7 @@ #define BOOST_INTEGER_LOG2_HPP_GP_20030301 #include +#include // actually used for Borland only #include "boost/limits.hpp" #include "boost/config.hpp" @@ -67,6 +68,22 @@ namespace boost { BOOST_STATIC_CONSTANT(int, value = 0); }; + // this template is here just for Borland :( + // we could simply rely on numeric_limits but sometimes + // Borland tries to use numeric_limits, because + // of its usual const-related problems in argument deduction + // - gps + template + struct width { + +#ifdef __BORLANDC__ + BOOST_STATIC_CONSTANT(int, value = sizeof(T) * CHAR_BIT); +#else + BOOST_STATIC_CONSTANT(int, value = (std::numeric_limits::digits)); +#endif + + }; + } // detail @@ -80,8 +97,8 @@ namespace boost { assert(x > 0); const int n = detail::max_pow2_less< - std::numeric_limits :: digits, 4 - > :: value; + detail::width :: value, 4 + > :: value; return detail::integer_log2_impl(x, n);