mirror of https://github.com/apache/lucene.git
PackedWriter: allow negative values when bitsPerValue=64.
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene4547@1410374 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
881179fead
commit
95fa6a71b1
|
@ -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");
|
||||
|
|
|
@ -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<actualValueCount;i++) {
|
||||
values[i] = _TestUtil.nextLong(random(), 0, maxValue);
|
||||
if (nbits == 64) {
|
||||
values[i] = random().nextLong();
|
||||
} else {
|
||||
values[i] = _TestUtil.nextLong(random(), 0, maxValue);
|
||||
}
|
||||
w.add(values[i]);
|
||||
}
|
||||
w.finish();
|
||||
|
|
Loading…
Reference in New Issue