21 #ifndef XAPIAN_INCLUDED_PARSEINT_H
22 #define XAPIAN_INCLUDED_PARSEINT_H
32 unsigned char digit = *p -
'0';
45 typedef typename std::make_unsigned<T>::type unsigned_type;
46 unsigned_type temp = 0;
49 temp <= unsigned_type(std::numeric_limits<T>::min())) {
53 temp <= unsigned_type(std::numeric_limits<T>::max())) {
Arithmetic operations with overflow checks.
std::enable_if< std::is_unsigned< T1 >::value &&std::is_unsigned< T2 >::value &&std::is_unsigned< R >::value, bool >::type add_overflows(T1 a, T2 b, R &res)
Addition with overflow checking.
std::enable_if< std::is_unsigned< T1 >::value &&std::is_unsigned< T2 >::value &&std::is_unsigned< R >::value, bool >::type mul_overflows(T1 a, T2 b, R &res)
Multiplication with overflow checking.
bool parse_signed(const char *p, T &res)
bool parse_unsigned(const char *p, T &res)