cloud-fan commented on code in PR #36659:
URL: https://github.com/apache/spark/pull/36659#discussion_r881218440
##########
common/unsafe/src/main/java/org/apache/spark/unsafe/array/ByteArrayMethods.java:
##########
@@ -39,11 +39,7 @@ public static int roundNumberOfBytesToNearestWord(int
numBytes) {
public static long roundNumberOfBytesToNearestWord(long numBytes) {
long remainder = numBytes & 0x07; // This is equivalent to `numBytes % 8`
- if (remainder == 0) {
- return numBytes;
- } else {
- return numBytes + (8 - remainder);
- }
+ return numBytes + ((8 - remainder) & 0x7);
Review Comment:
why do we need to bit operation? I think we can just `return numBytes + (8 -
remainder);`
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]