[libcxx-commits] [libcxx] 8266eef - [SystemZ][z/OS][libcxx]: fix the mask in stage2_float_loop function
Muiez Ahmed via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Oct 18 12:57:05 PDT 2022
Author: Nancy Wang
Date: 2022-10-18T15:56:18-04:00
New Revision: 8266eefd91dafec10afcd99be0624fb3e2ceb1bb
URL: https://github.com/llvm/llvm-project/commit/8266eefd91dafec10afcd99be0624fb3e2ceb1bb
DIFF: https://github.com/llvm/llvm-project/commit/8266eefd91dafec10afcd99be0624fb3e2ceb1bb.diff
LOG: [SystemZ][z/OS][libcxx]: fix the mask in stage2_float_loop function
This patch is to fix issue related to __stage2_float_loop function, float point value comparison is not working on EBCDIC mode because the mask is hard-coded and assumes character is ASCII, fix is to use toupper function when do the comparison.
Differential Revision: https://reviews.llvm.org/D118930
Added:
Modified:
libcxx/include/locale
Removed:
################################################################################
diff --git a/libcxx/include/locale b/libcxx/include/locale
index 1a1aed010eb5..c9ec7c36f582 100644
--- a/libcxx/include/locale
+++ b/libcxx/include/locale
@@ -553,7 +553,7 @@ __num_get<_CharT>::__stage2_float_loop(_CharT __ct, bool& __in_units, char& __ex
char __x = __src[__f];
if (__x == '-' || __x == '+')
{
- if (__a_end == __a || (__a_end[-1] & 0x5F) == (__exp & 0x7F))
+ if (__a_end == __a || (std::toupper(__a_end[-1]) == std::toupper(__exp)))
{
*__a_end++ = __x;
return 0;
@@ -562,9 +562,9 @@ __num_get<_CharT>::__stage2_float_loop(_CharT __ct, bool& __in_units, char& __ex
}
if (__x == 'x' || __x == 'X')
__exp = 'P';
- else if ((__x & 0x5F) == __exp)
+ else if (std::toupper(__x) == __exp)
{
- __exp |= (char) 0x80;
+ __exp = std::tolower(__exp);
if (__in_units)
{
__in_units = false;
More information about the libcxx-commits
mailing list