zeroshade commented on a change in pull request #11146:
URL: https://github.com/apache/arrow/pull/11146#discussion_r725208507



##########
File path: go/parquet/internal/bmi/bmi.go
##########
@@ -254,7 +254,7 @@ func extractBitsGo(bitmap, selectBitmap uint64) uint64 {
        for selectBitmap != 0 {
                maskLen := bits.OnesCount32(uint32(selectBitmap & lookupMask))
                value := pextTable[selectBitmap&lookupMask][bitmap&lookupMask]
-               bitValue |= uint64(value << bitLen)
+               bitValue |= uint64(value) << bitLen

Review comment:
       this was needed because of the way Go handles types. Because value was a 
uint8, it was shifting according to `bitLen` *before* it casted to a uint64 so 
the result was incorrect since if `bitLen` was more than 8 it just became 0. 
Casting to a uint64 before shifting was necessary. I'm not sure if C++ will 
promote value before the shift correctly or if it has the same bug.




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