Skip to content

Commit 59531cf

Browse files
authored
[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.
1 parent b143b24 commit 59531cf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

flang/runtime/edit-input.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ static RT_API_ATTRS bool EditBOZInput(
119119
std::memset(n, 0, bytes);
120120
int increment{isHostLittleEndian ? -1 : 1};
121121
auto *data{reinterpret_cast<unsigned char *>(n) +
122-
(isHostLittleEndian ? significantBytes - 1 : 0)};
122+
(isHostLittleEndian ? significantBytes - 1 : bytes - significantBytes)};
123123
int shift{((digits - 1) * LOG2_BASE) & 7};
124124
while (digits > 0) {
125125
char32_t ch{*io.NextInField(remaining, edit)};

0 commit comments

Comments
 (0)