summaryrefslogtreecommitdiff
path: root/boost/spirit/home/qi/numeric/detail/numeric_utils.hpp
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2019-12-05 15:12:59 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2019-12-05 15:12:59 +0900
commitb8cf34c691623e4ec329053cbbf68522a855882d (patch)
tree34da08632a99677f6b79ecb65e5b655a5b69a67f /boost/spirit/home/qi/numeric/detail/numeric_utils.hpp
parent3fdc3e5ee96dca5b11d1694975a65200787eab86 (diff)
downloadboost-b8cf34c691623e4ec329053cbbf68522a855882d.tar.gz
boost-b8cf34c691623e4ec329053cbbf68522a855882d.tar.bz2
boost-b8cf34c691623e4ec329053cbbf68522a855882d.zip
Imported Upstream version 1.67.0upstream/1.67.0
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)