[libc-commits] [libc] [libc][z/OS] Remove ASCII trick to fix EBDIC std::from_char (PR #116078)

Zibi Sarbinowski via libc-commits libc-commits at lists.llvm.org
Wed Nov 13 08:29:14 PST 2024


https://github.com/zibi2 created https://github.com/llvm/llvm-project/pull/116078

This PR will fix the following lit in all EBCDIC variations on z/OS:
`std/utilities/charconv/charconv.from.chars/floating_point.pass.cpp`

The trick to test for `e` and `E` is working only in ASCII.
The fix is to simply test for both lower and upper case exponent letter `e` and `E` respectfully.

>From 0acf7ffa65c41325112c33cb1a6926d86d0ede45 Mon Sep 17 00:00:00 2001
From: Zbigniew Sarbinowski <zibi at ca.ibm.com>
Date: Wed, 13 Nov 2024 16:37:18 +0000
Subject: [PATCH] Remove ASCII trick to fix EBDIC std::from_char

---
 libc/src/__support/high_precision_decimal.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libc/src/__support/high_precision_decimal.h b/libc/src/__support/high_precision_decimal.h
index ac11649d1d1686..20088d6d797910 100644
--- a/libc/src/__support/high_precision_decimal.h
+++ b/libc/src/__support/high_precision_decimal.h
@@ -350,7 +350,8 @@ class HighPrecisionDecimal {
     if (!saw_dot)
       this->decimal_point = total_digits;
 
-    if (num_cur < num_len && ((num_string[num_cur] | 32) == 'e')) {
+    if (num_cur < num_len &&
+        (num_string[num_cur] == 'e' || num_string[num_cur] == 'E')) {
       ++num_cur;
       if (isdigit(num_string[num_cur]) || num_string[num_cur] == '+' ||
           num_string[num_cur] == '-') {



More information about the libc-commits mailing list