Skip to content

Commit

Permalink
(contd.) fix: if the max ordinal for a map value is zero then reserve…
Browse files Browse the repository at this point in the history
… 1 bit for it instead of nothing
  • Loading branch information
Sunjeet committed Dec 20, 2024
1 parent 2ba691b commit 400e645
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ private void calculateNumShards() {
}

long bitsPerKeyElement = 64 - Long.numberOfLeadingZeros(maxKeyOrdinal + 1);
long bitsPerValueElement = 64 - Long.numberOfLeadingZeros(maxValueOrdinal);
long bitsPerValueElement = maxValueOrdinal == 0 ? 1 : 64 - Long.numberOfLeadingZeros(maxValueOrdinal);
long bitsPerMapSizeValue = 64 - Long.numberOfLeadingZeros(maxMapSize);
long bitsPerMapPointer = 64 - Long.numberOfLeadingZeros(totalOfMapBuckets);

Expand Down

0 comments on commit 400e645

Please sign in to comment.