You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Eduardo Ponce (Jira)" <ji...@apache.org> on 2021/12/30 09:37:00 UTC
[jira] [Created] (ARROW-15220) [C++] Remove bool specializations of bit block counter operations
Eduardo Ponce created ARROW-15220:
-------------------------------------
Summary: [C++] Remove bool specializations of bit block counter operations
Key: ARROW-15220
URL: https://issues.apache.org/jira/browse/ARROW-15220
Project: Apache Arrow
Issue Type: Improvement
Components: C++
Reporter: Eduardo Ponce
Assignee: Eduardo Ponce
Fix For: 7.0.0
We can simplify the [logical bit operations in util/bit_block_counter.h|https://github.com/apache/arrow/blob/master/cpp/src/arrow/util/bit_block_counter.h#L53] so that the specializations for {{bool}} and {{T}} can be merged because C++ guarantees that for boolean types: {{(bool)(a & b) == a && b}}. Note the explicit cast which corresponds to the return type {{T}} in these functions.
{code}
// Works correctly for bool and integer types
template <typename T>
T bit_and(T x, T y) {
return x & y;
}
{code}
This change has a higher impact for ternary bitwise versions, see for example [here|https://github.com/apache/arrow/pull/11882/files#diff-fd2cb2745dc0cc2a84f7cd46cba410ef26f48abaf80e0fe3cc6c8657ab42a743R93]
--
This message was sent by Atlassian Jira
(v8.20.1#820001)