diff --git a/lucene/core/src/java/org/apache/lucene/util/packed/PackedWriter.java b/lucene/core/src/java/org/apache/lucene/util/packed/PackedWriter.java index bf8660979d1..ba4efa8c91c 100644 --- a/lucene/core/src/java/org/apache/lucene/util/packed/PackedWriter.java +++ b/lucene/core/src/java/org/apache/lucene/util/packed/PackedWriter.java @@ -56,7 +56,7 @@ final class PackedWriter extends PackedInts.Writer { @Override public void add(long v) throws IOException { - assert v >= 0 && v <= PackedInts.maxValue(bitsPerValue); + assert bitsPerValue == 64 || (v >= 0 && v <= PackedInts.maxValue(bitsPerValue)) : bitsPerValue; assert !finished; if (valueCount != -1 && written >= valueCount) { throw new EOFException("Writing past end of stream"); diff --git a/lucene/core/src/test/org/apache/lucene/util/packed/TestPackedInts.java b/lucene/core/src/test/org/apache/lucene/util/packed/TestPackedInts.java index 7f3f182774f..dd72fd4f4c8 100644 --- a/lucene/core/src/test/org/apache/lucene/util/packed/TestPackedInts.java +++ b/lucene/core/src/test/org/apache/lucene/util/packed/TestPackedInts.java @@ -102,7 +102,11 @@ public class TestPackedInts extends LuceneTestCase { final int actualValueCount = random().nextBoolean() ? valueCount : _TestUtil.nextInt(random(), 0, valueCount); final long[] values = new long[valueCount]; for(int i=0;i