@@ -45,7 +45,7 @@ fastfloat_really_inline constexpr uint64_t byteswap(uint64_t val) {
4545// Read 8 UC into a u64. Truncates UC if not char.
4646template <typename UC>
4747fastfloat_really_inline FASTFLOAT_CONSTEXPR20 uint64_t
48- read8_to_u64 (const UC *chars) {
48+ read8_to_u64 (UC const *chars) {
4949 if (cpp20_and_in_constexpr () || !std::is_same<UC, char >::value) {
5050 uint64_t val = 0 ;
5151 for (int i = 0 ; i < 8 ; ++i) {
@@ -65,9 +65,9 @@ read8_to_u64(const UC *chars) {
6565
6666#ifdef FASTFLOAT_SSE2
6767
68- fastfloat_really_inline uint64_t simd_read8_to_u64 (const __m128i data) {
68+ fastfloat_really_inline uint64_t simd_read8_to_u64 (__m128i const data) {
6969 FASTFLOAT_SIMD_DISABLE_WARNINGS
70- const __m128i packed = _mm_packus_epi16 (data, data);
70+ __m128i const packed = _mm_packus_epi16 (data, data);
7171#ifdef FASTFLOAT_64BIT
7272 return uint64_t (_mm_cvtsi128_si64 (packed));
7373#else
@@ -79,26 +79,26 @@ fastfloat_really_inline uint64_t simd_read8_to_u64(const __m128i data) {
7979 FASTFLOAT_SIMD_RESTORE_WARNINGS
8080}
8181
82- fastfloat_really_inline uint64_t simd_read8_to_u64 (const char16_t *chars) {
82+ fastfloat_really_inline uint64_t simd_read8_to_u64 (char16_t const *chars) {
8383 FASTFLOAT_SIMD_DISABLE_WARNINGS
8484 return simd_read8_to_u64 (
85- _mm_loadu_si128 (reinterpret_cast <const __m128i *>(chars)));
85+ _mm_loadu_si128 (reinterpret_cast <__m128i const *>(chars)));
8686 FASTFLOAT_SIMD_RESTORE_WARNINGS
8787}
8888
8989#elif defined(FASTFLOAT_NEON)
9090
91- fastfloat_really_inline uint64_t simd_read8_to_u64 (const uint16x8_t data) {
91+ fastfloat_really_inline uint64_t simd_read8_to_u64 (uint16x8_t const data) {
9292 FASTFLOAT_SIMD_DISABLE_WARNINGS
9393 uint8x8_t utf8_packed = vmovn_u16 (data);
9494 return vget_lane_u64 (vreinterpret_u64_u8 (utf8_packed), 0 );
9595 FASTFLOAT_SIMD_RESTORE_WARNINGS
9696}
9797
98- fastfloat_really_inline uint64_t simd_read8_to_u64 (const char16_t *chars) {
98+ fastfloat_really_inline uint64_t simd_read8_to_u64 (char16_t const *chars) {
9999 FASTFLOAT_SIMD_DISABLE_WARNINGS
100100 return simd_read8_to_u64 (
101- vld1q_u16 (reinterpret_cast <const uint16_t *>(chars)));
101+ vld1q_u16 (reinterpret_cast <uint16_t const *>(chars)));
102102 FASTFLOAT_SIMD_RESTORE_WARNINGS
103103}
104104
@@ -118,9 +118,9 @@ uint64_t simd_read8_to_u64(UC const *) {
118118// credit @aqrit
119119fastfloat_really_inline FASTFLOAT_CONSTEXPR14 uint32_t
120120parse_eight_digits_unrolled (uint64_t val) {
121- const uint64_t mask = 0x000000FF000000FF ;
122- const uint64_t mul1 = 0x000F424000000064 ; // 100 + (1000000ULL << 32)
123- const uint64_t mul2 = 0x0000271000000001 ; // 1 + (10000ULL << 32)
121+ uint64_t const mask = 0x000000FF000000FF ;
122+ uint64_t const mul1 = 0x000F424000000064 ; // 100 + (1000000ULL << 32)
123+ uint64_t const mul2 = 0x0000271000000001 ; // 1 + (10000ULL << 32)
124124 val -= 0x3030303030303030 ;
125125 val = (val * 10 ) + (val >> 8 ); // val = (val * 2561) >> 8;
126126 val = (((val & mask) * mul1) + (((val >> 16 ) & mask) * mul2)) >> 32 ;
@@ -150,20 +150,20 @@ is_made_of_eight_digits_fast(uint64_t val) noexcept {
150150// Using this style (instead of is_made_of_eight_digits_fast() then
151151// parse_eight_digits_unrolled()) ensures we don't load SIMD registers twice.
152152fastfloat_really_inline FASTFLOAT_CONSTEXPR20 bool
153- simd_parse_if_eight_digits_unrolled (const char16_t *chars,
153+ simd_parse_if_eight_digits_unrolled (char16_t const *chars,
154154 uint64_t &i) noexcept {
155155 if (cpp20_and_in_constexpr ()) {
156156 return false ;
157157 }
158158#ifdef FASTFLOAT_SSE2
159159 FASTFLOAT_SIMD_DISABLE_WARNINGS
160- const __m128i data =
161- _mm_loadu_si128 (reinterpret_cast <const __m128i *>(chars));
160+ __m128i const data =
161+ _mm_loadu_si128 (reinterpret_cast <__m128i const *>(chars));
162162
163163 // (x - '0') <= 9
164164 // http://0x80.pl/articles/simd-parsing-int-sequences.html
165- const __m128i t0 = _mm_add_epi16 (data, _mm_set1_epi16 (32720 ));
166- const __m128i t1 = _mm_cmpgt_epi16 (t0, _mm_set1_epi16 (-32759 ));
165+ __m128i const t0 = _mm_add_epi16 (data, _mm_set1_epi16 (32720 ));
166+ __m128i const t1 = _mm_cmpgt_epi16 (t0, _mm_set1_epi16 (-32759 ));
167167
168168 if (_mm_movemask_epi8 (t1) == 0 ) {
169169 i = i * 100000000 + parse_eight_digits_unrolled (simd_read8_to_u64 (data));
@@ -173,12 +173,12 @@ simd_parse_if_eight_digits_unrolled(const char16_t *chars,
173173 FASTFLOAT_SIMD_RESTORE_WARNINGS
174174#elif defined(FASTFLOAT_NEON)
175175 FASTFLOAT_SIMD_DISABLE_WARNINGS
176- const uint16x8_t data = vld1q_u16 (reinterpret_cast <const uint16_t *>(chars));
176+ uint16x8_t const data = vld1q_u16 (reinterpret_cast <uint16_t const *>(chars));
177177
178178 // (x - '0') <= 9
179179 // http://0x80.pl/articles/simd-parsing-int-sequences.html
180- const uint16x8_t t0 = vsubq_u16 (data, vmovq_n_u16 (' 0' ));
181- const uint16x8_t mask = vcltq_u16 (t0, vmovq_n_u16 (' 9' - ' 0' + 1 ));
180+ uint16x8_t const t0 = vsubq_u16 (data, vmovq_n_u16 (' 0' ));
181+ uint16x8_t const mask = vcltq_u16 (t0, vmovq_n_u16 (' 9' - ' 0' + 1 ));
182182
183183 if (vminvq_u16 (mask) == 0xFFFF ) {
184184 i = i * 100000000 + parse_eight_digits_unrolled (simd_read8_to_u64 (data));
@@ -208,7 +208,7 @@ bool simd_parse_if_eight_digits_unrolled(UC const *, uint64_t &) {
208208
209209template <typename UC, FASTFLOAT_ENABLE_IF(!std::is_same<UC, char >::value) = 0 >
210210fastfloat_really_inline FASTFLOAT_CONSTEXPR20 void
211- loop_parse_if_eight_digits (const UC *&p, const UC *const pend, uint64_t &i) {
211+ loop_parse_if_eight_digits (UC const *&p, UC const *const pend, uint64_t &i) {
212212 if (!has_simd_opt<UC>()) {
213213 return ;
214214 }
@@ -220,7 +220,7 @@ loop_parse_if_eight_digits(const UC *&p, const UC *const pend, uint64_t &i) {
220220}
221221
222222fastfloat_really_inline FASTFLOAT_CONSTEXPR20 void
223- loop_parse_if_eight_digits (const char *&p, const char *const pend,
223+ loop_parse_if_eight_digits (char const *&p, char const *const pend,
224224 uint64_t &i) {
225225 // optimizes better than parse_if_eight_digits_unrolled() for UC = char.
226226 while ((std::distance (p, pend) >= 8 ) &&
@@ -259,12 +259,12 @@ template <typename UC> struct parsed_number_string_t {
259259 bool valid{false };
260260 bool too_many_digits{false };
261261 // contains the range of the significant digits
262- span<const UC > integer{}; // non-nullable
263- span<const UC > fraction{}; // nullable
262+ span<UC const > integer{}; // non-nullable
263+ span<UC const > fraction{}; // nullable
264264 parse_error error{parse_error::no_error};
265265};
266266
267- using byte_span = span<const char >;
267+ using byte_span = span<char const >;
268268using parsed_number_string = parsed_number_string_t <char >;
269269
270270template <typename UC>
@@ -328,7 +328,7 @@ parse_number_string(UC const *p, UC const *pend,
328328 }
329329 UC const *const end_of_integer_part = p;
330330 int64_t digit_count = int64_t (end_of_integer_part - start_digits);
331- answer.integer = span<const UC >(start_digits, size_t (digit_count));
331+ answer.integer = span<UC const >(start_digits, size_t (digit_count));
332332 if (uint64_t (fmt & detail::basic_json_fmt)) {
333333 // at least 1 digit in integer part, without leading zeros
334334 if (digit_count == 0 ) {
@@ -341,7 +341,7 @@ parse_number_string(UC const *p, UC const *pend,
341341 }
342342
343343 int64_t exponent = 0 ;
344- const bool has_decimal_point = (p != pend) && (*p == decimal_point);
344+ bool const has_decimal_point = (p != pend) && (*p == decimal_point);
345345 if (has_decimal_point) {
346346 ++p;
347347 UC const *before = p;
@@ -355,7 +355,7 @@ parse_number_string(UC const *p, UC const *pend,
355355 i = i * 10 + digit; // in rare cases, this will overflow, but that's ok
356356 }
357357 exponent = before - p;
358- answer.fraction = span<const UC >(before, size_t (p - before));
358+ answer.fraction = span<UC const >(before, size_t (p - before));
359359 digit_count -= exponent;
360360 }
361361 if (uint64_t (fmt & detail::basic_json_fmt)) {
@@ -446,7 +446,7 @@ parse_number_string(UC const *p, UC const *pend,
446446 i = 0 ;
447447 p = answer.integer .ptr ;
448448 UC const *int_end = p + answer.integer .len ();
449- const uint64_t minimal_nineteen_digit_integer{1000000000000000000 };
449+ uint64_t const minimal_nineteen_digit_integer{1000000000000000000 };
450450 while ((i < minimal_nineteen_digit_integer) && (p != int_end)) {
451451 i = i * 10 + uint64_t (*p - UC (' 0' ));
452452 ++p;
@@ -498,7 +498,7 @@ parse_int_string(UC const *p, UC const *pend, T &value,
498498 ++p;
499499 }
500500
501- const bool has_leading_zeros = p > start_num;
501+ bool const has_leading_zeros = p > start_num;
502502
503503 UC const *const start_digits = p;
504504
0 commit comments