You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2021/12/30 10:49:00 UTC

[jira] [Updated] (ARROW-15220) [C++] Remove bool specializations of bit block counter operations

     [ https://issues.apache.org/jira/browse/ARROW-15220?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

ASF GitHub Bot updated ARROW-15220:
-----------------------------------
    Labels: good-first-issue pull-request-available  (was: good-first-issue)

> [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
>            Priority: Minor
>              Labels: good-first-issue, pull-request-available
>             Fix For: 7.0.0
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> 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)