Vishwanatha-HD commented on code in PR #48180:
URL: https://github.com/apache/arrow/pull/48180#discussion_r2559822759
##########
cpp/src/arrow/compute/util.cc:
##########
@@ -299,7 +313,17 @@ void bytes_to_bits(int64_t hardware_flags, const int
num_bits, const uint8_t* by
}
int tail = num_bits % unroll;
if (tail) {
- uint64_t bytes_next = SafeLoadUpTo8Bytes(bytes + num_bits - tail, tail);
+ uint64_t bytes_next;
+#if ARROW_LITTLE_ENDIAN
+ bytes_next = SafeLoadUpTo8Bytes(bytes + num_bits - tail, tail);
+#else
+ // On Big-endian systems, for bytes_to_bits, load all tail bytes in
little-endian
+ // order to ensure compatibility with subsequent bit operations
+ bytes_next = 0;
+ for (int i = 0; i < tail; ++i) {
+ bytes_next |= static_cast<uint64_t>((bytes + num_bits - tail)[i]) << (8
* i);
+ }
+#endif
Review Comment:
@kou.. I tried doing that but the testcase failed on s390x.. We need the
"bytes_next |= static_cast<uint64_t>((bytes + num_bits - tail)[i]) << (8 * i);"
on big-endian, which we dont get it when we directly call the
SafeLoadUpTo8Bytes()..
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]