You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/10/19 02:21:13 UTC

[GitHub] [arrow] cyb70289 commented on a diff in pull request #14442: ARROW-18081: [Go] Add Scalar Boolean functions

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


##########
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:
   Nit: since we still have to check `mode` explicitly in later code, looks `if else` is simpler here?



-- 
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-unsubscribe@arrow.apache.org

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