zeroshade commented on code in PR #14442:
URL: https://github.com/apache/arrow/pull/14442#discussion_r999592878


##########
go/arrow/bitutil/bitmaps.go:
##########
@@ -390,15 +396,26 @@ func CopyBitmap(src []byte, srcOffset, length int, dst 
[]byte, dstOffset int) {
                rdr := NewBitmapWordReader(src, srcOffset, length)
                wr := NewBitmapWordWriter(dst, dstOffset, length)
 
+               var modify func(in uint64) uint64
+               switch mode {
+               case transferCopy:
+                       modify = func(in uint64) uint64 { return in }
+               case transferInvert:
+                       modify = func(in uint64) uint64 { return ^in }
+               }
+
                nwords := rdr.Words()
                for nwords > 0 {
                        nwords--
-                       wr.PutNextWord(rdr.NextWord())
+                       wr.PutNextWord(modify(rdr.NextWord()))

Review Comment:
   simpler? yes. But i was trying to avoid an if branch in a tight loop.... I 
should benchmark this and see if there's any actual difference.



-- 
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]

Reply via email to