Skip to content

Commit

Permalink
Use UNSAFE.getLong() to speed up BitSetMethods#anySet()
Browse files Browse the repository at this point in the history
  • Loading branch information
tedyu committed May 5, 2015
1 parent 63ee050 commit 093b7a4
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public static boolean isSet(Object baseObject, long baseOffset, int index) {
* Returns {@code true} if any bit is set.
*/
public static boolean anySet(Object baseObject, long baseOffset, long bitSetWidthInBytes) {
long widthInLong = bitSetWidthInBytes / SIZE_OF_LONG;
int widthInLong = (int)(bitSetWidthInBytes / SIZE_OF_LONG);
for (int i = 0; i <= widthInLong; i++) {
if (PlatformDependent.UNSAFE.getLong(baseObject, baseOffset + i) != 0) {
return true;
Expand Down

0 comments on commit 093b7a4

Please sign in to comment.