edponce commented on a change in pull request #12052:
URL: https://github.com/apache/arrow/pull/12052#discussion_r776835494
##########
File path: cpp/src/arrow/util/bit_block_counter.h
##########
@@ -48,43 +48,33 @@ inline uint64_t ShiftWord(uint64_t current, uint64_t next,
int64_t shift) {
// These templates are here to help with unit tests
template <typename T>
-struct BitBlockAnd {
- static T Call(T left, T right) { return left & right; }
-};
+inline T BitNot(T x) {
+ return ~x;
+}
template <>
-struct BitBlockAnd<bool> {
- static bool Call(bool left, bool right) { return left && right; }
-};
+inline bool BitNot(bool x) {
+ return !x;
+}
template <typename T>
-struct BitBlockAndNot {
- static T Call(T left, T right) { return left & ~right; }
+struct BitBlockAnd {
Review comment:
`BitNot` was not an existing operator, I added it because negation is
the only bitwise operation where C++ behaves different between bool and
integral types, so I specialized it as a helper function.
`~(bool)x != !(bool)x`, the former always returns true.
--
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]