Skip to content

Commit 471c817

Browse files
GH-48151: [C++][Parquet] Fix arrow-acero-asof-join-node-test failures on s390x
1 parent d168c0c commit 471c817

File tree

2 files changed

+6
-17
lines changed

2 files changed

+6
-17
lines changed

cpp/src/arrow/compute/util.cc

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,9 @@ inline uint64_t SafeLoadUpTo8Bytes(const uint8_t* bytes, int num_bytes) {
3535
return util::SafeLoad(reinterpret_cast<const uint64_t*>(bytes));
3636
} else {
3737
uint64_t word = 0;
38-
#if ARROW_LITTLE_ENDIAN
3938
for (int i = 0; i < num_bytes; ++i) {
4039
word |= static_cast<uint64_t>(bytes[i]) << (8 * i);
4140
}
42-
#else
43-
// Big-endian: most significant byte first
44-
for (int i = 0; i < num_bytes; ++i) {
45-
word |= static_cast<uint64_t>(bytes[i]) << (8 * (num_bytes - 1 - i));
46-
}
47-
#endif
4841
return word;
4942
}
5043
}
@@ -324,15 +317,11 @@ void bytes_to_bits(int64_t hardware_flags, const int num_bits, const uint8_t* by
324317
#if ARROW_LITTLE_ENDIAN
325318
bytes_next = SafeLoadUpTo8Bytes(bytes + num_bits - tail, tail);
326319
#else
327-
if (tail == 8) {
328-
bytes_next = util::SafeLoad(reinterpret_cast<const uint64_t*>(bytes + num_bits - tail));
329-
} else {
330-
// On Big-endian systems, for bytes_to_bits, load all tail bytes in little-endian order
331-
// to ensure compatibility with subsequent bit operations
332-
bytes_next = 0;
333-
for (int i = 0; i < tail; ++i) {
334-
bytes_next |= static_cast<uint64_t>((bytes + num_bits - tail)[i]) << (8 * i);
335-
}
320+
// On Big-endian systems, for bytes_to_bits, load all tail bytes in little-endian
321+
// order to ensure compatibility with subsequent bit operations
322+
bytes_next = 0;
323+
for (int i = 0; i < tail; ++i) {
324+
bytes_next |= static_cast<uint64_t>((bytes + num_bits - tail)[i]) << (8 * i);
336325
}
337326
#endif
338327
bytes_next &= 0x0101010101010101ULL;

0 commit comments

Comments
 (0)