mirror of https://github.com/apache/lucene.git
LUCENE-3892: use vInt to store the fixed value for entire block
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/pforcodec_3892@1372357 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
423354db48
commit
91a4425f79
|
@ -151,7 +151,7 @@ final class ForUtil {
|
||||||
void writeBlock(int[] data, byte[] encoded, IndexOutput out) throws IOException {
|
void writeBlock(int[] data, byte[] encoded, IndexOutput out) throws IOException {
|
||||||
if (isAllEqual(data)) {
|
if (isAllEqual(data)) {
|
||||||
out.writeVInt(ALL_VALUES_EQUAL);
|
out.writeVInt(ALL_VALUES_EQUAL);
|
||||||
out.writeInt(data[0]);
|
out.writeVInt(data[0]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ final class ForUtil {
|
||||||
assert numBits <= 32 : numBits;
|
assert numBits <= 32 : numBits;
|
||||||
|
|
||||||
if (numBits == ALL_VALUES_EQUAL) {
|
if (numBits == ALL_VALUES_EQUAL) {
|
||||||
final int value = in.readInt();
|
final int value = in.readVInt();
|
||||||
Arrays.fill(decoded, 0, BLOCK_SIZE, value);
|
Arrays.fill(decoded, 0, BLOCK_SIZE, value);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -206,7 +206,7 @@ final class ForUtil {
|
||||||
void skipBlock(IndexInput in) throws IOException {
|
void skipBlock(IndexInput in) throws IOException {
|
||||||
final int numBits = in.readVInt();
|
final int numBits = in.readVInt();
|
||||||
if (numBits == ALL_VALUES_EQUAL) {
|
if (numBits == ALL_VALUES_EQUAL) {
|
||||||
in.seek(in.getFilePointer() + 4);
|
in.readVInt();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
assert numBits > 0 && numBits <= 32 : numBits;
|
assert numBits > 0 && numBits <= 32 : numBits;
|
||||||
|
|
Loading…
Reference in New Issue