You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2012/08/09 01:02:59 UTC
svn commit: r1371011 - in
/lucene/dev/branches/pforcodec_3892/lucene/core/src/java/org/apache/lucene/codecs/block:
BlockPostingsFormat.java ForUtil.java
Author: mikemccand
Date: Wed Aug 8 23:02:58 2012
New Revision: 1371011
URL: http://svn.apache.org/viewvc?rev=1371011&view=rev
Log:
add comment; use BLOCK_SIZE static import not blockSize
Modified:
lucene/dev/branches/pforcodec_3892/lucene/core/src/java/org/apache/lucene/codecs/block/BlockPostingsFormat.java
lucene/dev/branches/pforcodec_3892/lucene/core/src/java/org/apache/lucene/codecs/block/ForUtil.java
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/java/org/apache/lucene/codecs/block/BlockPostingsFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/java/org/apache/lucene/codecs/block/BlockPostingsFormat.java?rev=1371011&r1=1371010&r2=1371011&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/java/org/apache/lucene/codecs/block/BlockPostingsFormat.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/java/org/apache/lucene/codecs/block/BlockPostingsFormat.java Wed Aug 8 23:02:58 2012
@@ -42,6 +42,8 @@ public final class BlockPostingsFormat e
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() {
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/java/org/apache/lucene/codecs/block/ForUtil.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/java/org/apache/lucene/codecs/block/ForUtil.java?rev=1371011&r1=1371010&r2=1371011&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/java/org/apache/lucene/codecs/block/ForUtil.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/java/org/apache/lucene/codecs/block/ForUtil.java Wed Aug 8 23:02:58 2012
@@ -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;
}
}