21 #ifndef XAPIAN_INCLUDED_PARSEINT_H
22 #define XAPIAN_INCLUDED_PARSEINT_H
33 unsigned char digit = *
p -
'0';
46 typedef typename std::make_unsigned_t<T> unsigned_type;
47 unsigned_type temp = 0;
50 temp <= unsigned_type(std::numeric_limits<T>::min())) {
54 temp <= unsigned_type(std::numeric_limits<T>::max())) {
Negate unsigned integer, avoiding compiler warnings.
constexpr std::enable_if_t< std::is_unsigned_v< T >, T > negate_unsigned(T value)
Arithmetic operations with overflow checks.
std::enable_if_t< std::is_unsigned_v< T1 > &&std::is_unsigned_v< T2 > &&std::is_unsigned_v< R >, bool > add_overflows(T1 a, T2 b, R &res)
Addition with overflow checking.
std::enable_if_t< std::is_unsigned_v< T1 > &&std::is_unsigned_v< T2 > &&std::is_unsigned_v< R >, bool > 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)