mirror of
https://github.com/fastfloat/fast_float.git
synced 2025-12-06 16:56:57 +08:00
fix for fastfloat_strncasecmp for wchar_t and larger char types
This commit is contained in:
parent
7ff885d45c
commit
50ee38af65
@ -222,12 +222,15 @@ fastfloat_really_inline constexpr bool is_supported_char_type() {
|
|||||||
// Compares two ASCII strings in a case insensitive manner.
|
// Compares two ASCII strings in a case insensitive manner.
|
||||||
template <typename UC>
|
template <typename UC>
|
||||||
inline FASTFLOAT_CONSTEXPR14 bool
|
inline FASTFLOAT_CONSTEXPR14 bool
|
||||||
fastfloat_strncasecmp(UC const *input1, UC const *input2, size_t length) {
|
fastfloat_strncasecmp(UC const *actual_mixedcase, UC const *expected_lowercase,
|
||||||
char running_diff{0};
|
size_t length) {
|
||||||
for (size_t i = 0; i < length; ++i) {
|
for (size_t i = 0; i < length; ++i) {
|
||||||
running_diff |= (char(input1[i]) ^ char(input2[i]));
|
UC const actual = actual_mixedcase[i];
|
||||||
|
if ((actual < 256 ? actual | 32 : actual) != expected_lowercase[i]) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return (running_diff == 0) || (running_diff == 32);
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef FLT_EVAL_METHOD
|
#ifndef FLT_EVAL_METHOD
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user