Apache Lucene open-source search software
add comment; use BLOCK_SIZE static import not blockSize
Michael McCandless98ae806ba66d
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/block/BlockPostingsFormat.java b/lucene/core/src/java/org/apache/lucene/codecs/block/BlockPostingsFormat.javaindex 1ae3829edb7..6628bc35383 100644--- a/lucene/core/src/java/org/apache/lucene/codecs/block/BlockPostingsFormat.java+++ b/lucene/core/src/java/org/apache/lucene/codecs/block/BlockPostingsFormat.java@@ -42,6 +42,8 @@ public final class BlockPostingsFormat extends PostingsFormat {private final int minTermBlockSize;private final int maxTermBlockSize;+ // nocommit is this right?:+ // NOTE: must be factor of .... 32?public final static int BLOCK_SIZE = 128;public BlockPostingsFormat() {diff --git a/lucene/core/src/java/org/apache/lucene/codecs/block/ForUtil.java b/lucene/core/src/java/org/apache/lucene/codecs/block/ForUtil.javaindex 84985278d73..96c6bbe33e3 100644--- a/lucene/core/src/java/org/apache/lucene/codecs/block/ForUtil.java+++ b/lucene/core/src/java/org/apache/lucene/codecs/block/ForUtil.java@@ -18,6 +18,8 @@ package org.apache.lucene.codecs.block;import java.nio.IntBuffer;+import static org.apache.lucene.codecs.block.BlockPostingsFormat.BLOCK_SIZE;+/*** Encode all values in normal area with fixed bit width,* which is determined by the max value in this block.@@ -31,8 +33,6 @@ public final class ForUtil {0x01ffffff, 0x03ffffff, 0x07ffffff, 0x0fffffff, 0x1fffffff, 0x3fffffff,0x7fffffff, 0xffffffff};- final static int blockSize = BlockPostingsFormat.BLOCK_SIZE;-/** Compress given int[] into Integer buffer, with For format** @param data uncompressed data@@ -45,7 +45,7 @@ public final class ForUtil {return compressDuplicateBlock(data, intBuffer);}- for (int i=0; i<blockSize; ++i) {+ for (int i=0; i<BLOCK_SIZE; ++i) {assert data[i] >= 0;encodeNormalValue(intBuffer, i, data[i], numBits);}@@ -170,6 +170,7 @@ public final class ForUtil {* Expert: get compressed block size(in byte)*/static int getEncodedSize(int numBits) {- return numBits == 0 ? 4 : numBits*blockSize/8;+ // NOTE: works only because BLOCK_SIZE is 0 mod 8:+ return numBits == 0 ? 4 : numBits*BLOCK_SIZE/8;}}