@@ -84,10 +84,10 @@ fastfloat_really_inline uint64_t simd_read8_to_u64(__m128i const &data) {
8484}
8585
8686fastfloat_really_inline uint64_t simd_read8_to_u64 (char16_t const *chars) {
87- return simd_read8_to_u64 ( _mm_loadu_si128 ( reinterpret_cast <__m128i const *>(
88- chars))); // TODO: V1032 https://pvs-studio.com/en/docs/warnings/v1032/
89- // The pointer ' chars' is cast to a more strictly aligned
90- // pointer type.
87+ FASTFLOAT_SIMD_DISABLE_WARNINGS
88+ return simd_read8_to_u64 (
89+ _mm_loadu_si128 ( reinterpret_cast <__m128i const *>( chars)));
90+ FASTFLOAT_SIMD_RESTORE_WARNINGS
9191}
9292
9393#elif defined(FASTFLOAT_NEON)
@@ -98,8 +98,10 @@ fastfloat_really_inline uint64_t simd_read8_to_u64(uint16x8_t const &data) {
9898}
9999
100100fastfloat_really_inline uint64_t simd_read8_to_u64 (char16_t const *chars) {
101+ FASTFLOAT_SIMD_DISABLE_WARNINGS
101102 return simd_read8_to_u64 (
102103 vld1q_u16 (reinterpret_cast <uint16_t const *>(chars)));
104+ FASTFLOAT_SIMD_RESTORE_WARNINGS
103105}
104106
105107#endif
@@ -118,9 +120,9 @@ uint64_t simd_read8_to_u64(UC const *) {
118120// credit @aqrit
119121fastfloat_really_inline FASTFLOAT_CONSTEXPR14 uint32_t
120122parse_eight_digits_unrolled (uint64_t val) noexcept {
121- constexpr uint64_t mask = 0x000000FF000000FF ;
122- constexpr uint64_t mul1 = 0x000F424000000064 ; // 100 + (1000000ULL << 32)
123- constexpr uint64_t mul2 = 0x0000271000000001 ; // 1 + (10000ULL << 32)
123+ uint64_t const mask = 0x000000FF000000FF ;
124+ uint64_t const mul1 = 0x000F424000000064 ; // 100 + (1000000ULL << 32)
125+ uint64_t const mul2 = 0x0000271000000001 ; // 1 + (10000ULL << 32)
124126 val -= 0x3030303030303030 ;
125127 val = (val * 10 ) + (val >> 8 ); // val = (val * 2561) >> 8;
126128 val = (((val & mask) * mul1) + (((val >> 16 ) & mask) * mul2)) >> 32 ;
@@ -156,11 +158,11 @@ simd_parse_if_eight_digits_unrolled(char16_t const *chars,
156158 return false ;
157159 }
158160#ifdef FASTFLOAT_SSE2
161+ FASTFLOAT_SIMD_DISABLE_WARNINGS
159162 // Load 8 UTF-16 characters (16 bytes)
160- __m128i const data = _mm_loadu_si128 (reinterpret_cast <__m128i const *>(
161- chars)); // TODO: V1032 https://pvs-studio.com/en/docs/warnings/v1032/ The
162- // pointer 'chars' is cast to a more strictly aligned pointer
163- // type.
163+ __m128i const data =
164+ _mm_loadu_si128 (reinterpret_cast <__m128i const *>(chars));
165+ FASTFLOAT_SIMD_RESTORE_WARNINGS
164166
165167 // Branchless "are all digits?" trick from Lemire:
166168 // (x - '0') <= 9 <=> (x + 32720) <= 32729
@@ -175,7 +177,9 @@ simd_parse_if_eight_digits_unrolled(char16_t const *chars,
175177 return true ;
176178 }
177179#elif defined(FASTFLOAT_NEON)
180+ FASTFLOAT_SIMD_DISABLE_WARNINGS
178181 uint16x8_t const data = vld1q_u16 (reinterpret_cast <uint16_t const *>(chars));
182+ FASTFLOAT_SIMD_RESTORE_WARNINGS
179183
180184 // (x - '0') <= 9
181185 // http://0x80.pl/articles/simd-parsing-int-sequences.html
@@ -286,7 +290,7 @@ report_parse_error(UC const *p, parse_error error) noexcept {
286290template <bool basic_json_fmt, typename UC>
287291fastfloat_really_inline FASTFLOAT_CONSTEXPR20 parsed_number_string_t <UC>
288292parse_number_string (UC const *p, UC const *pend,
289- parse_options_t <UC> const & options) noexcept {
293+ parse_options_t <UC> const options) noexcept {
290294 // Cyclomatic complexity https://en.wikipedia.org/wiki/Cyclomatic_complexity
291295 // Consider refactoring the 'parse_number_string' function.
292296 // FASTFLOAT_ONLY_POSITIVE_C_NUMBER_WO_INF_NAN fix this.
@@ -295,8 +299,8 @@ parse_number_string(UC const *p, UC const *pend,
295299 FASTFLOAT_ASSUME (p < pend);
296300#ifndef FASTFLOAT_ONLY_POSITIVE_C_NUMBER_WO_INF_NAN
297301 answer.negative = (*p == UC (' -' ));
302+ // C++17 20.19.3.(7.1) explicitly forbids '+' sign here
298303 if (answer.negative ||
299- // C++17 20.19.3.(7.1) explicitly forbids '+' sign here
300304 ((chars_format_t (options.format & chars_format::allow_leading_plus)) &&
301305 (!basic_json_fmt && *p == UC (' +' )))) {
302306 ++p;
@@ -400,8 +404,11 @@ parse_number_string(UC const *p, UC const *pend,
400404#ifdef FASTFLOAT_ONLY_POSITIVE_C_NUMBER_WO_INF_NAN
401405 ++p;
402406#else
403- if ((UC (' e' ) == *p) || (UC (' E' ) == *p) || (UC (' d' ) == *p) ||
404- (UC (' D' ) == *p)) {
407+ if ((UC (' e' ) == *p) || (UC (' E' ) == *p)
408+ #ifndef FASTFLOAT_ONLY_POSITIVE_C_NUMBER_WO_INF_NAN
409+ || (UC (' d' ) == *p) || (UC (' D' ) == *p)
410+ #endif
411+ ) {
405412 ++p;
406413 }
407414#endif
@@ -483,8 +490,8 @@ parse_number_string(UC const *p, UC const *pend,
483490 p = answer.integer .ptr ;
484491 UC const *int_end = p + answer.integer .len ();
485492 constexpr am_mant_t minimal_nineteen_digit_integer{1000000000000000000 };
486- while ((answer. mantissa < minimal_nineteen_digit_integer ) &&
487- (p != int_end )) {
493+ while ((p != int_end ) &&
494+ (answer. mantissa < minimal_nineteen_digit_integer )) {
488495 answer.mantissa = static_cast <am_mant_t >(
489496 answer.mantissa * 10 + static_cast <am_mant_t >(*p - UC (' 0' )));
490497 ++p;
@@ -496,8 +503,8 @@ parse_number_string(UC const *p, UC const *pend,
496503 // We have a value with a significant fractional component.
497504 p = answer.fraction .ptr ;
498505 UC const *const frac_end = p + answer.fraction .len ();
499- while ((answer. mantissa < minimal_nineteen_digit_integer ) &&
500- (p != frac_end )) {
506+ while ((p != frac_end ) &&
507+ (answer. mantissa < minimal_nineteen_digit_integer )) {
501508 answer.mantissa = static_cast <am_mant_t >(
502509 answer.mantissa * 10 + static_cast <am_mant_t >(*p - UC (' 0' )));
503510 ++p;
@@ -514,7 +521,7 @@ parse_number_string(UC const *p, UC const *pend,
514521template <typename T, typename UC>
515522fastfloat_really_inline FASTFLOAT_CONSTEXPR20 from_chars_result_t <UC>
516523parse_int_string (UC const *p, UC const *pend, T &value,
517- parse_options_t <UC> const & options) noexcept {
524+ parse_options_t <UC> const options) noexcept {
518525
519526 from_chars_result_t <UC> answer;
520527
@@ -645,14 +652,7 @@ parse_int_string(UC const *p, UC const *pend, T &value,
645652 loop_parse_if_eight_digits (p, pend, i); // use SIMD if possible
646653 }
647654 while (p != pend) {
648- #ifdef FASTFLOAT_TABLE_HACK_CHAR_DIGIT_LUT_DISABLED
649- const auto digit = *p;
650- if (!is_integer (digit)) {
651- break ;
652- }
653- #else
654655 auto const digit = ch_to_digit (*p);
655- #endif
656656 if (digit >= options.base ) {
657657 break ;
658658 }
0 commit comments