Skip to content

Commit 093b7a4

Browse files
committed
Use UNSAFE.getLong() to speed up BitSetMethods#anySet()
1 parent 63ee050 commit 093b7a4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

unsafe/src/main/java/org/apache/spark/unsafe/bitset/BitSetMethods.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public static boolean isSet(Object baseObject, long baseOffset, int index) {
7272
* Returns {@code true} if any bit is set.
7373
*/
7474
public static boolean anySet(Object baseObject, long baseOffset, long bitSetWidthInBytes) {
75-
long widthInLong = bitSetWidthInBytes / SIZE_OF_LONG;
75+
int widthInLong = (int)(bitSetWidthInBytes / SIZE_OF_LONG);
7676
for (int i = 0; i <= widthInLong; i++) {
7777
if (PlatformDependent.UNSAFE.getLong(baseObject, baseOffset + i) != 0) {
7878
return true;

0 commit comments

Comments
 (0)