Simplify PackedInts#longCount (#13256)

This commit is contained in:
Zhang Chao 2024-04-03 16:46:53 +08:00 committed by GitHub
parent 07d3be59af
commit 9c9f934a7c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 5 deletions

View File

@ -149,11 +149,7 @@ public class PackedInts {
assert bitsPerValue >= 0 && bitsPerValue <= 64 : bitsPerValue;
final long byteCount = byteCount(packedIntsVersion, valueCount, bitsPerValue);
assert byteCount < 8L * Integer.MAX_VALUE;
if ((byteCount % 8) == 0) {
return (int) (byteCount / 8);
} else {
return (int) (byteCount / 8 + 1);
}
return (int) ((byteCount + 7) >>> 3);
}
/** Tests whether the provided number of bits per value is supported by the format. */