Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-15220

[C++] Remove bool specializations of bit block counter operations

    XMLWordPrintableJSON

Details

    Description

      We can simplify the logical bit operations in util/bit_block_counter.h 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.

      // Works correctly for bool and integer types
      template <typename T>
      T bit_and(T x, T y) {
        return x & y;
      }
      

      This change has a higher impact for ternary bitwise versions, see for example here

      Attachments

        Issue Links

          Activity

            People

              edponce Eduardo Ponce
              edponce Eduardo Ponce
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 2h 40m
                  2h 40m