Apache Lucene open-source search software
Simplify PackedInts#longCount (#13256)
Zhang Chao9c9f934a7c45
diff --git a/lucene/core/src/java/org/apache/lucene/util/packed/PackedInts.java b/lucene/core/src/java/org/apache/lucene/util/packed/PackedInts.javaindex 230e6c894f6..dc9f22531dc 100644--- a/lucene/core/src/java/org/apache/lucene/util/packed/PackedInts.java+++ b/lucene/core/src/java/org/apache/lucene/util/packed/PackedInts.java@@ -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. */