1#ifndef FASTFLOAT_ASCII_NUMBER_H
2#define FASTFLOAT_ASCII_NUMBER_H
18 return (val & 0xFF00000000000000) >> 56
19 | (val & 0x00FF000000000000) >> 40
20 | (val & 0x0000FF0000000000) >> 24
21 | (val & 0x000000FF00000000) >> 8
22 | (val & 0x00000000FF000000) << 8
23 | (val & 0x0000000000FF0000) << 24
24 | (val & 0x000000000000FF00) << 40
25 | (val & 0x00000000000000FF) << 56;
30 ::memcpy(&val, chars,
sizeof(uint64_t));
31#if FASTFLOAT_IS_BIG_ENDIAN == 1
39#if FASTFLOAT_IS_BIG_ENDIAN == 1
43 ::memcpy(chars, &val,
sizeof(uint64_t));
48 const uint64_t mask = 0x000000FF000000FF;
49 const uint64_t mul1 = 0x000F424000000064;
50 const uint64_t mul2 = 0x0000271000000001;
51 val -= 0x3030303030303030;
52 val = (val * 10) + (val >> 8);
53 val = (((val & mask) * mul1) + (((val >> 16) & mask) * mul2)) >> 32;
63 return !((((val + 0x4646464646464646) | (val - 0x3030303030303030)) &
90 const char decimal_point = options.decimal_point;
101 if (!
is_integer(*p) && (*p != decimal_point)) {
105 const char *
const start_digits = p;
120 const char *
const end_of_integer_part = p;
121 int64_t digit_count = int64_t(end_of_integer_part - start_digits);
123 int64_t exponent = 0;
124 if ((p != pend) && (*p == decimal_point)) {
126 const char* before = p;
134 uint8_t digit = uint8_t(*p -
'0');
138 exponent = before - p;
140 digit_count -= exponent;
143 if (digit_count == 0) {
146 int64_t exp_number = 0;
148 const char * location_of_e = p;
150 bool neg_exp =
false;
151 if ((p != pend) && (
'-' == *p)) {
154 }
else if ((p != pend) && (
'+' == *p)) {
166 uint8_t digit = uint8_t(*p -
'0');
167 if (exp_number < 0x10000000) {
168 exp_number = 10 * exp_number + digit;
172 if(neg_exp) { exp_number = - exp_number; }
173 exponent += exp_number;
187 if (digit_count > 19) {
192 const char *start = start_digits;
193 while ((start != pend) && (*start ==
'0' || *start == decimal_point)) {
194 if(*start ==
'0') { digit_count --; }
197 if (digit_count > 19) {
204 const char* int_end = p + answer.
integer.
len();
205 const uint64_t minimal_nineteen_digit_integer{1000000000000000000};
206 while((i < minimal_nineteen_digit_integer) && (p != int_end)) {
207 i = i * 10 + uint64_t(*p -
'0');
210 if (i >= minimal_nineteen_digit_integer) {
211 exponent = end_of_integer_part - p + exp_number;
215 while((i < minimal_nineteen_digit_integer) && (p != frac_end)) {
216 i = i * 10 + uint64_t(*p -
'0');
#define fastfloat_really_inline
fastfloat_really_inline uint32_t parse_eight_digits_unrolled(uint64_t val)
fastfloat_really_inline uint64_t byteswap(uint64_t val)
span< const char > byte_span
fastfloat_really_inline void write_u64(uint8_t *chars, uint64_t val)
fastfloat_really_inline parsed_number_string parse_number_string(const char *p, const char *pend, parse_options options) noexcept
fastfloat_really_inline uint64_t read_u64(const char *chars)
fastfloat_really_inline bool is_integer(char c) noexcept
fastfloat_really_inline bool is_made_of_eight_digits_fast(uint64_t val) noexcept
constexpr size_t len() const noexcept