diff --git a/include/fast_float/ascii_number.h b/include/fast_float/ascii_number.h index 84bce47..0338b22 100644 --- a/include/fast_float/ascii_number.h +++ b/include/fast_float/ascii_number.h @@ -10,7 +10,7 @@ namespace fast_float { -fastfloat_really_inline bool is_integer(char c) noexcept { return (c >= '0' && c <= '9'); } +fastfloat_really_inline bool is_integer(char c) noexcept { return (c & 0x30) == 0x30; } // credit: https://johnnylee-sde.github.io/Fast-numeric-string-to-int/ @@ -163,7 +163,7 @@ parsed_number_string parse_number_string(const char *p, const char *pend, chars_ // This function could be optimized. In particular, we could stop after 19 digits // and try to bail out. Furthermore, we should be able to recover the computed // exponent from the pass in parse_number_string. -decimal parse_decimal(const char *p, const char *pend) noexcept { +fastfloat_really_inline decimal parse_decimal(const char *p, const char *pend) noexcept { decimal answer; answer.num_digits = 0; answer.decimal_point = 0; diff --git a/include/fast_float/float_common.h b/include/fast_float/float_common.h index f09d29b..27a3c72 100644 --- a/include/fast_float/float_common.h +++ b/include/fast_float/float_common.h @@ -30,7 +30,7 @@ inline bool fastfloat_strncasecmp(const char *input1, const char *input2, #error "FLT_EVAL_METHOD should be defined, please include cfloat." #endif -bool is_space(uint8_t c) { +inline bool is_space(uint8_t c) { static const bool table[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -281,7 +281,7 @@ constexpr float binary_format::exact_power_of_ten(int64_t power) { // for convenience: #include -std::ostream &operator<<(std::ostream &out, const fast_float::decimal &d) { +inline std::ostream &operator<<(std::ostream &out, const fast_float::decimal &d) { out << "0."; for (size_t i = 0; i < d.num_digits; i++) { out << int32_t(d.digits[i]); diff --git a/include/fast_float/simple_decimal_conversion.h b/include/fast_float/simple_decimal_conversion.h index 97fad93..f87dbb3 100644 --- a/include/fast_float/simple_decimal_conversion.h +++ b/include/fast_float/simple_decimal_conversion.h @@ -123,8 +123,6 @@ uint32_t number_of_digits_decimal_left_shift(const decimal &h, uint32_t shift) { return num_new_digits; } -} // end of anonymous namespace - uint64_t round(decimal &h) { if ((h.num_digits == 0) || (h.decimal_point < 0)) { return 0; @@ -240,6 +238,7 @@ void decimal_right_shift(decimal &h, uint32_t shift) { trim(h); } +} // end of anonymous namespace template adjusted_mantissa compute_float(decimal &d) {