kou commented on code in PR #48180:
URL: https://github.com/apache/arrow/pull/48180#discussion_r2562026695


##########
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:
   Could you share code you tried?
   
   https://github.com/apache/arrow/pull/48180#pullrequestreview-3496008897 
includes `word |= static_cast<uint64_t>(bytes[num_bytes - 1 - i]) << (8 * i);`.



-- 
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]

Reply via email to