Skip to content

Commit

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

bitsPerKeyElement = 64 - Long.numberOfLeadingZeros(maxKeyOrdinal + 1);
bitsPerValueElement = 64 - Long.numberOfLeadingZeros(maxValueOrdinal);
bitsPerValueElement = maxValueOrdinal == 0 ? 1 : 64 - Long.numberOfLeadingZeros(maxValueOrdinal);

bitsPerMapSizeValue = 64 - Long.numberOfLeadingZeros(maxMapSize);

Expand Down

0 comments on commit 2ba691b

Please sign in to comment.