#ifndef FASTFLOAT_ASCII_NUMBER_H
#define FASTFLOAT_ASCII_NUMBER_H
#include <cctype>
#include <cstdint>
#include <cstring>
#include <iterator>
#include <limits>
#include <type_traits>
#include "float_common.h"
#ifdef FASTFLOAT_SSE2
#include <emmintrin.h>
#endif
#ifdef FASTFLOAT_NEON
#include <arm_neon.h>
#endif
namespace fast_float {
template <typename UC> fastfloat_really_inline constexpr bool has_simd_opt() { … }
template <typename UC>
fastfloat_really_inline constexpr bool is_integer(UC c) noexcept { … }
fastfloat_really_inline constexpr uint64_t byteswap(uint64_t val) { … }
template <typename UC>
fastfloat_really_inline FASTFLOAT_CONSTEXPR20 uint64_t
read8_to_u64(const UC *chars) { … }
#ifdef FASTFLOAT_SSE2
fastfloat_really_inline uint64_t simd_read8_to_u64(const __m128i data) { … }
fastfloat_really_inline uint64_t simd_read8_to_u64(const char16_t *chars) { … }
#elif defined(FASTFLOAT_NEON)
fastfloat_really_inline uint64_t simd_read8_to_u64(const uint16x8_t data) {
FASTFLOAT_SIMD_DISABLE_WARNINGS
uint8x8_t utf8_packed = vmovn_u16(data);
return vget_lane_u64(vreinterpret_u64_u8(utf8_packed), 0);
FASTFLOAT_SIMD_RESTORE_WARNINGS
}
fastfloat_really_inline uint64_t simd_read8_to_u64(const char16_t *chars) {
FASTFLOAT_SIMD_DISABLE_WARNINGS
return simd_read8_to_u64(
vld1q_u16(reinterpret_cast<const uint16_t *>(chars)));
FASTFLOAT_SIMD_RESTORE_WARNINGS
}
#endif
#if defined(_MSC_VER) && _MSC_VER <= 1900
template <typename UC>
#else
template <typename UC, FASTFLOAT_ENABLE_IF(!has_simd_opt<UC>()) = 0>
#endif
uint64_t simd_read8_to_u64(UC const *) { … }
fastfloat_really_inline FASTFLOAT_CONSTEXPR14 uint32_t
parse_eight_digits_unrolled(uint64_t val) { … }
template <typename UC>
fastfloat_really_inline FASTFLOAT_CONSTEXPR20 uint32_t
parse_eight_digits_unrolled(UC const *chars) noexcept { … }
fastfloat_really_inline constexpr bool
is_made_of_eight_digits_fast(uint64_t val) noexcept { … }
#ifdef FASTFLOAT_HAS_SIMD
fastfloat_really_inline FASTFLOAT_CONSTEXPR20 bool
simd_parse_if_eight_digits_unrolled(const char16_t *chars,
uint64_t &i) noexcept { … }
#endif
#if defined(_MSC_VER) && _MSC_VER <= 1900
template <typename UC>
#else
template <typename UC, FASTFLOAT_ENABLE_IF(!has_simd_opt<UC>()) = 0>
#endif
bool simd_parse_if_eight_digits_unrolled(UC const *, uint64_t &) { … }
template <typename UC, FASTFLOAT_ENABLE_IF(!std::is_same<UC, char>::value) = 0>
fastfloat_really_inline FASTFLOAT_CONSTEXPR20 void
loop_parse_if_eight_digits(const UC *&p, const UC *const pend, uint64_t &i) { … }
fastfloat_really_inline FASTFLOAT_CONSTEXPR20 void
loop_parse_if_eight_digits(const char *&p, const char *const pend,
uint64_t &i) { … }
enum class parse_error { … };
template <typename UC> struct parsed_number_string_t { … };
byte_span;
parsed_number_string;
template <typename UC>
fastfloat_really_inline FASTFLOAT_CONSTEXPR20 parsed_number_string_t<UC>
report_parse_error(UC const *p, parse_error error) { … }
template <typename UC>
fastfloat_really_inline FASTFLOAT_CONSTEXPR20 parsed_number_string_t<UC>
parse_number_string(UC const *p, UC const *pend,
parse_options_t<UC> options) noexcept { … }
template <typename T, typename UC>
fastfloat_really_inline FASTFLOAT_CONSTEXPR20 from_chars_result_t<UC>
parse_int_string(UC const *p, UC const *pend, T &value, int base) { … }
}
#endif