We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6dc5ba4 commit e5639ecCopy full SHA for e5639ec
flang/runtime/edit-input.cpp
@@ -244,7 +244,15 @@ bool EditIntegerInput(
244
value = -value;
245
}
246
if (any || !io.GetConnectionState().IsAtEOF()) {
247
- std::memcpy(n, &value, kind); // a blank field means zero
+ // For integer kind <= 4, the value is stored in the lower order bits on
248
+ // the big endian platform. When memcpy the value, shift the value, shift
249
+ // the value to the higher order bit.
250
+ if (!isHostLittleEndian && kind <= 4) {
251
+ auto l{value.low() << (8 * (sizeof(value.low()) - kind))};
252
+ std::memcpy(n, &l, kind);
253
+ } else {
254
+ std::memcpy(n, &value, kind); // a blank field means zero
255
+ }
256
257
return any;
258
0 commit comments