Skip to content

Commit

Permalink
Correct offset for UNSAFE.getLong()
Browse files Browse the repository at this point in the history
  • Loading branch information
tedyu committed May 6, 2015
1 parent 855374b commit 75a467b
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ public static boolean isSet(Object baseObject, long baseOffset, int index) {
public static boolean anySet(Object baseObject, long baseOffset, long bitSetWidthInBytes) {
assert bitSetWidthInBytes % SIZE_OF_LONG == 0;
int widthInLong = (int)(bitSetWidthInBytes / SIZE_OF_LONG);
for (int i = 0; i <= widthInLong; i++) {
if (PlatformDependent.UNSAFE.getLong(baseObject, baseOffset + i) != 0) {
long addr = baseOffset;
for (int i = 0; i <= widthInLong; i++, addr += 8) {
if (PlatformDependent.UNSAFE.getLong(baseObject, addr) != 0) {
return true;
}
}
Expand Down

0 comments on commit 75a467b

Please sign in to comment.