mapleFU commented on code in PR #40915:
URL: https://github.com/apache/arrow/pull/40915#discussion_r1545721595


##########
cpp/src/arrow/util/bit_util.h:
##########
@@ -366,5 +367,18 @@ void PackBits(const uint32_t* values, uint8_t* out) {
   }
 }
 
+/// Determine if a word has a zero byte
+/// The subexpression (v - 0x01010101UL), evaluates to a high bit set in any 
byte whenever
+/// the corresponding byte in v is zero or greater than 0x80. The 
sub-expression ~v &
+/// 0x80808080UL evaluates to high bits set in bytes where the byte of v 
doesn't have its
+/// high bit set (so the byte was less than 0x80). Finally, by ANDing these two
+/// sub-expressions the result is the high bits set where the bytes in v were 
zero, since
+/// the high bits set due to a value greater than 0x80 in the first 
sub-expression are
+/// masked off by the second.
+uint64_t HasZeroByte(uint64_t value) {

Review Comment:
   Since it's a "has" return `bool`?



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