nirandaperera commented on pull request #10846:
URL: https://github.com/apache/arrow/pull/10846#issuecomment-890546943


   @cyb70289 this was discussed in this PR #10679. The idea came from @wesm. 
   Ref: 
https://graphics.stanford.edu/~seander/bithacks.html#ConditionalSetOrClearBitsWithoutBranching
   
   The idea is to check if these two methods have any performance implications. 
   ```c++
   void SetBitTo(uint8_t* bits, int64_t i, bool bit_is_set) {
     bits[i / 8] ^= static_cast<uint8_t>(-static_cast<uint8_t>(bit_is_set) ^ 
bits[i / 8]) & kBitmask[i % 8];
   }
   
   void SetBitSuperscalarTo(uint8_t* bits, int64_t i, bool bit_is_set) {
     bits[i / 8] = (bits[i / 8] & ~kBitmask[i % 8]) | 
(-static_cast<uint8_t>(bit_is_set) & kBitmask[i % 8]);
   }
   ```
   
   


-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to