mirror of
https://github.com/fastfloat/fast_float.git
synced 2026-02-08 10:46:52 +08:00
fix for is_space for wchar_t and larger char types
This commit is contained in:
parent
3e26cf4cea
commit
7ff885d45c
@ -699,7 +699,9 @@ template <typename T> constexpr bool space_lut<T>::value[];
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
inline constexpr bool is_space(uint8_t c) { return space_lut<>::value[c]; }
|
template <typename UC> constexpr bool is_space(UC c) {
|
||||||
|
return c < 256 && space_lut<>::value[uint8_t(c)];
|
||||||
|
}
|
||||||
|
|
||||||
template <typename UC> static constexpr uint64_t int_cmp_zeros() {
|
template <typename UC> static constexpr uint64_t int_cmp_zeros() {
|
||||||
static_assert((sizeof(UC) == 1) || (sizeof(UC) == 2) || (sizeof(UC) == 4),
|
static_assert((sizeof(UC) == 1) || (sizeof(UC) == 2) || (sizeof(UC) == 4),
|
||||||
|
|||||||
@ -294,7 +294,7 @@ from_chars_float_advanced(UC const *first, UC const *last, T &value,
|
|||||||
|
|
||||||
from_chars_result_t<UC> answer;
|
from_chars_result_t<UC> answer;
|
||||||
if (uint64_t(fmt & chars_format::skip_white_space)) {
|
if (uint64_t(fmt & chars_format::skip_white_space)) {
|
||||||
while ((first != last) && fast_float::is_space(uint8_t(*first))) {
|
while ((first != last) && fast_float::is_space(*first)) {
|
||||||
first++;
|
first++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -346,7 +346,7 @@ from_chars_int_advanced(UC const *first, UC const *last, T &value,
|
|||||||
|
|
||||||
from_chars_result_t<UC> answer;
|
from_chars_result_t<UC> answer;
|
||||||
if (uint64_t(fmt & chars_format::skip_white_space)) {
|
if (uint64_t(fmt & chars_format::skip_white_space)) {
|
||||||
while ((first != last) && fast_float::is_space(uint8_t(*first))) {
|
while ((first != last) && fast_float::is_space(*first)) {
|
||||||
first++;
|
first++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -75,7 +75,7 @@ bool eddelbuettel() {
|
|||||||
// check that there is no content left
|
// check that there is no content left
|
||||||
for (const char *leftover = answer.ptr;
|
for (const char *leftover = answer.ptr;
|
||||||
leftover != input.data() + input.size(); leftover++) {
|
leftover != input.data() + input.size(); leftover++) {
|
||||||
if (!fast_float::is_space(uint8_t(*leftover))) {
|
if (!fast_float::is_space(*leftover)) {
|
||||||
non_space_trailing_content = true;
|
non_space_trailing_content = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user