[flang-commits] [flang] 59531cf - [flang] Set the offset based on the significant bytes in the boz input in big endian (#102334)

via flang-commits flang-commits at lists.llvm.org
Thu Aug 8 06:45:57 PDT 2024


Author: Kelvin Li
Date: 2024-08-08T09:45:51-04:00
New Revision: 59531cf01eb791f4cef88c2757d399eb3d90a086

URL: https://github.com/llvm/llvm-project/commit/59531cf01eb791f4cef88c2757d399eb3d90a086
DIFF: https://github.com/llvm/llvm-project/commit/59531cf01eb791f4cef88c2757d399eb3d90a086.diff

LOG: [flang] Set the offset based on the significant bytes in the boz input in big endian (#102334)

The offset to the input data should be counted from most significant bit
instead of zero in the big endian environment.

Added: 
    

Modified: 
    flang/runtime/edit-input.cpp

Removed: 
    


################################################################################
diff  --git a/flang/runtime/edit-input.cpp b/flang/runtime/edit-input.cpp
index 37989bbcee0ab..71021dd8a0158 100644
--- a/flang/runtime/edit-input.cpp
+++ b/flang/runtime/edit-input.cpp
@@ -119,7 +119,7 @@ static RT_API_ATTRS bool EditBOZInput(
   std::memset(n, 0, bytes);
   int increment{isHostLittleEndian ? -1 : 1};
   auto *data{reinterpret_cast<unsigned char *>(n) +
-      (isHostLittleEndian ? significantBytes - 1 : 0)};
+      (isHostLittleEndian ? significantBytes - 1 : bytes - significantBytes)};
   int shift{((digits - 1) * LOG2_BASE) & 7};
   while (digits > 0) {
     char32_t ch{*io.NextInField(remaining, edit)};


        


More information about the flang-commits mailing list