summaryrefslogtreecommitdiff
path: root/boost/spirit/home/qi/numeric/detail/numeric_utils.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/spirit/home/qi/numeric/detail/numeric_utils.hpp')
-rw-r--r--boost/spirit/home/qi/numeric/detail/numeric_utils.hpp37
1 files changed, 3 insertions, 34 deletions
diff --git a/boost/spirit/home/qi/numeric/detail/numeric_utils.hpp b/boost/spirit/home/qi/numeric/detail/numeric_utils.hpp
index 7f466ee65b..f1154dc92a 100644
--- a/boost/spirit/home/qi/numeric/detail/numeric_utils.hpp
+++ b/boost/spirit/home/qi/numeric/detail/numeric_utils.hpp
@@ -101,11 +101,9 @@ namespace boost { namespace spirit { namespace qi { namespace detail
template <typename Char>
inline static bool is_valid(Char ch)
{
- if (Radix <= 10)
- return (ch >= '0' && ch <= static_cast<Char>('0' + Radix -1));
- return (ch >= '0' && ch <= '9')
- || (ch >= 'a' && ch <= static_cast<Char>('a' + Radix -10 -1))
- || (ch >= 'A' && ch <= static_cast<Char>('A' + Radix -10 -1));
+ return (ch >= '0' && ch <= (Radix > 10 ? '9' : static_cast<Char>('0' + Radix -1)))
+ || (Radix > 10 && ch >= 'a' && ch <= static_cast<Char>('a' + Radix -10 -1))
+ || (Radix > 10 && ch >= 'A' && ch <= static_cast<Char>('A' + Radix -10 -1));
}
template <typename Char>
@@ -506,35 +504,6 @@ namespace boost { namespace spirit { namespace qi { namespace detail
};
#undef SPIRIT_NUMERIC_INNER_LOOP
-
- ///////////////////////////////////////////////////////////////////////////
- // Cast an signed integer to an unsigned integer
- ///////////////////////////////////////////////////////////////////////////
- template <typename T,
- bool force_unsigned
- = mpl::and_<is_integral<T>, is_signed<T> >::value>
- struct cast_unsigned;
-
- template <typename T>
- struct cast_unsigned<T, true>
- {
- typedef typename make_unsigned<T>::type unsigned_type;
- typedef typename make_unsigned<T>::type& unsigned_type_ref;
-
- inline static unsigned_type_ref call(T& n)
- {
- return unsigned_type_ref(n);
- }
- };
-
- template <typename T>
- struct cast_unsigned<T, false>
- {
- inline static T& call(T& n)
- {
- return n;
- }
- };
}}}}
#if defined(BOOST_MSVC)