Skip to content

Commit

Permalink
refactor: minor optimization in free space map logic
Browse files Browse the repository at this point in the history
  • Loading branch information
tglman committed Aug 2, 2023
1 parent 21c49f9 commit 416876a
Showing 1 changed file with 1 addition and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ public int findPage(int requiredSize) {
return -1;
}

final int rightNodeOffset = nodeOffset(level, rightNodeIndex);
assert (0xFF & getByteValue(rightNodeOffset)) >= requiredSize;
assert (0xFF & getByteValue(nodeOffset(level, rightNodeIndex))) >= requiredSize;
nodeIndex = (nodeIndex << 1) + 1;
}
}
Expand All @@ -77,8 +76,6 @@ public int updatePageMaxFreeSpace(final int pageIndex, final int freeSpace) {
int nodeIndex = pageIndex;
int nodeValue = freeSpace;

final int oldFreeSpace = 0xFF & getByteValue(nodeOffset);

for (int level = LEVELS; level > 0; level--) {
final int prevValue = 0xFF & getByteValue(nodeOffset);
if (prevValue == nodeValue) {
Expand Down

0 comments on commit 416876a

Please sign in to comment.