determine if any non-zero digits were truncated. all characters must be valid digits.
| 2862 | // determine if any non-zero digits were truncated. |
| 2863 | // all characters must be valid digits. |
| 2864 | fastfloat_really_inline FASTFLOAT_CONSTEXPR20 |
| 2865 | bool is_truncated(const char* first, const char* last) noexcept { |
| 2866 | // do 8-bit optimizations, can just compare to 8 literal 0s. |
| 2867 | uint64_t val; |
| 2868 | while (!cpp20_and_in_constexpr() && std::distance(first, last) >= 8) { |
| 2869 | ::memcpy(&val, first, sizeof(uint64_t)); |
| 2870 | if (val != 0x3030303030303030) { |
| 2871 | return true; |
| 2872 | } |
| 2873 | first += 8; |
| 2874 | } |
| 2875 | while (first != last) { |
| 2876 | if (*first != '0') { |
| 2877 | return true; |
| 2878 | } |
| 2879 | first++; |
| 2880 | } |
| 2881 | return false; |
| 2882 | } |
| 2883 | |
| 2884 | fastfloat_really_inline FASTFLOAT_CONSTEXPR20 |
| 2885 | bool is_truncated(byte_span s) noexcept { |
no test coverage detected