mirror of https://github.com/apache/lucene.git
LUCENE-3312: Merge up to trunk
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene3312@1377246 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
commit
2317133ca2
|
@ -265,7 +265,6 @@
|
|||
<param name="tests.jvms" value="1"/>
|
||||
<!-- Also override some other props to be fast, ignoring what's set on command line: -->
|
||||
<param name="tests.multiplier" value="1"/>
|
||||
<param name="tests.slow" value="false"/>
|
||||
<param name="tests.nightly" value="false"/>
|
||||
<param name="tests.weekly" value="false"/>
|
||||
<param name="tests.multiplier" value="1"/>
|
||||
|
@ -276,7 +275,7 @@
|
|||
<!-- we need this extra condition, as we want to match only on "true", not solely if property is set: -->
|
||||
<property name="disable.javadocs-lint" value="false" />
|
||||
<condition property="-disable.javadocs-lint">
|
||||
<equals arg1="${disable.javadocs-lint}" arg2="true"/>
|
||||
<istrue value="${disable.javadocs-lint}"/>
|
||||
</condition>
|
||||
<target name="-jenkins-javadocs-lint" unless="-disable.javadocs-lint">
|
||||
<antcall target="javadocs-lint"/>
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/resources" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test" isTestSource="true" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/resources" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test" isTestSource="true" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
<java.compat.version>1.6</java.compat.version>
|
||||
<jetty.version>8.1.2.v20120308</jetty.version>
|
||||
<slf4j.version>1.6.4</slf4j.version>
|
||||
<tika.version>1.1</tika.version>
|
||||
<tika.version>1.2</tika.version>
|
||||
<httpcomponents.version>4.1.3</httpcomponents.version>
|
||||
|
||||
<!-- RandomizedTesting library system properties -->
|
||||
|
|
|
@ -546,7 +546,7 @@ def testNotice(unpackPath):
|
|||
if solrNotice.find(expected) == -1:
|
||||
raise RuntimeError('Solr\'s NOTICE.txt does not have the verbatim copy, plus header/footer, of Lucene\'s NOTICE.txt')
|
||||
|
||||
def readSolrOutput(p, startupEvent, logFile):
|
||||
def readSolrOutput(p, startupEvent, failureEvent, logFile):
|
||||
f = open(logFile, 'wb')
|
||||
try:
|
||||
while True:
|
||||
|
@ -556,8 +556,13 @@ def readSolrOutput(p, startupEvent, logFile):
|
|||
f.write(line)
|
||||
f.flush()
|
||||
# print 'SOLR: %s' % line.strip()
|
||||
if line.decode('UTF-8').find('Started SocketConnector@0.0.0.0:8983') != -1:
|
||||
if not startupEvent.isSet() and line.find(b'Started SocketConnector@0.0.0.0:8983') != -1:
|
||||
startupEvent.set()
|
||||
except:
|
||||
print()
|
||||
print('Exception reading Solr output:')
|
||||
traceback.print_exc()
|
||||
failureEvent.set()
|
||||
finally:
|
||||
f.close()
|
||||
|
||||
|
@ -572,7 +577,8 @@ def testSolrExample(unpackPath, javaPath, isSrc):
|
|||
server = subprocess.Popen(['java', '-jar', 'start.jar'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env)
|
||||
|
||||
startupEvent = threading.Event()
|
||||
serverThread = threading.Thread(target=readSolrOutput, args=(server.stderr, startupEvent, logFile))
|
||||
failureEvent = threading.Event()
|
||||
serverThread = threading.Thread(target=readSolrOutput, args=(server.stderr, startupEvent, failureEvent, logFile))
|
||||
serverThread.setDaemon(True)
|
||||
serverThread.start()
|
||||
|
||||
|
@ -609,6 +615,9 @@ def testSolrExample(unpackPath, javaPath, isSrc):
|
|||
# Shouldn't happen unless something is seriously wrong...
|
||||
print('***WARNING***: Solr instance didn\'t respond to SIGKILL; ignoring...')
|
||||
|
||||
if failureEvent.isSet():
|
||||
raise RuntimeError('exception while reading Solr output')
|
||||
|
||||
os.chdir('..')
|
||||
|
||||
def checkJavadocpath(path):
|
||||
|
|
|
@ -15,6 +15,15 @@ New Features
|
|||
that you must store term vector positions to store payloads.
|
||||
(Robert Muir)
|
||||
|
||||
* LUCENE-3892: Add a new BlockPostingsFormat that bulk-encodes docs,
|
||||
freqs and positions in large (size 128) packed-int blocks for faster
|
||||
search performance. This was from Han Jiang's 2012 Google Summer of
|
||||
Code project (Han Jiang, Adrien Grand, Robert Muir, Mike McCandless)
|
||||
|
||||
* LUCENE-4323: Added support for an absolute maximum CFS segment size
|
||||
(in MiB) to LogMergePolicy and TieredMergePolicy.
|
||||
(Alexey Lef via Uwe Schindler)
|
||||
|
||||
API Changes
|
||||
|
||||
* LUCENE-4299: Added Terms.hasPositions() and Terms.hasOffsets().
|
||||
|
@ -50,6 +59,24 @@ API Changes
|
|||
* LUCENE-4307: Renamed IndexReader.getTopReaderContext to
|
||||
IndexReader.getContext. (Robert Muir)
|
||||
|
||||
* LUCENE-4316: Deprecate Fields.getUniqueTermCount and remove it from
|
||||
AtomicReader. If you really want the unique term count across all
|
||||
fields, just sum up Terms.size() across those fields. This method
|
||||
only exists so that this statistic can be accessed for Lucene 3.x
|
||||
segments, which don't support Terms.size(). (Uwe Schindler, Robert Muir)
|
||||
|
||||
* LUCENE-4321: Change CharFilter to extend Reader directly, as FilterReader
|
||||
overdelegates (read(), read(char[], int, int), skip, etc). This made it
|
||||
hard to implement CharFilters that were correct. Instead only close() is
|
||||
delegated by default: read(char[], int, int) and correct(int) are abstract
|
||||
so that its obvious which methods you should implement. The protected
|
||||
inner Reader is 'input' like CharFilter in the 3.x series, instead of 'in'.
|
||||
(Dawid Weiss, Uwe Schindler, Robert Muir)
|
||||
|
||||
* LUCENE-3309: The expert FieldSelector API, used to load only certain
|
||||
fields in a stored document, has been replaced with the simpler
|
||||
StoredFieldVisitor API. (Mike McCandless)
|
||||
|
||||
Bug Fixes
|
||||
|
||||
* LUCENE-4297: BooleanScorer2 would multiply the coord() factor
|
||||
|
@ -83,6 +110,14 @@ Bug Fixes
|
|||
containing non-BMP Unicode characters. (Dawid Weiss, Robert Muir,
|
||||
Mike McCandless)
|
||||
|
||||
Optimizations
|
||||
|
||||
* LUCENE-4317: Improve reuse of internal TokenStreams and StringReader
|
||||
in oal.document.Field. (Uwe Schindler, Chris Male, Robert Muir)
|
||||
|
||||
* LUCENE-4327: Support out-of-order scoring in FilteredQuery for higher
|
||||
performance. (Mike McCandless, Robert Muir)
|
||||
|
||||
Build
|
||||
|
||||
* LUCENE-3985: Upgrade to randomizedtesting 2.0.0. Added support for
|
||||
|
|
|
@ -619,3 +619,10 @@ you can now do this:
|
|||
postings in simple arrrays (byte[] for terms, int[] for docs, freqs,
|
||||
positions, offsets). Note that this only covers postings, whereas
|
||||
Instantiated covered all other parts of the index as well.
|
||||
|
||||
* LUCENE-3309: The expert FieldSelector API has been replaced with
|
||||
StoredFieldVisitor. The idea is the same (you have full control
|
||||
over which fields should be loaded). Instead of a single accept
|
||||
method, StoredFieldVisitor has a needsField method: if that method
|
||||
returns true then the field will be loaded and the appropriate
|
||||
type-specific method will be invoked with that fields's value.
|
||||
|
|
|
@ -67,8 +67,8 @@ public class MappingCharFilter extends BaseCharFilter {
|
|||
|
||||
@Override
|
||||
public void reset() throws IOException {
|
||||
super.reset();
|
||||
buffer.reset(in);
|
||||
input.reset();
|
||||
buffer.reset(input);
|
||||
replacement = null;
|
||||
inputOff = 0;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ public class PersianCharFilter extends CharFilter {
|
|||
|
||||
@Override
|
||||
public int read(char[] cbuf, int off, int len) throws IOException {
|
||||
final int charsRead = super.read(cbuf, off, len);
|
||||
final int charsRead = input.read(cbuf, off, len);
|
||||
if (charsRead > 0) {
|
||||
final int end = off + charsRead;
|
||||
while (off < end) {
|
||||
|
@ -45,6 +45,17 @@ public class PersianCharFilter extends CharFilter {
|
|||
}
|
||||
return charsRead;
|
||||
}
|
||||
|
||||
// optimized impl: some other charfilters consume with read()
|
||||
@Override
|
||||
public int read() throws IOException {
|
||||
int ch = input.read();
|
||||
if (ch == '\u200C') {
|
||||
return ' ';
|
||||
} else {
|
||||
return ch;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int correct(int currentOff) {
|
||||
|
|
|
@ -72,7 +72,7 @@ public class PatternReplaceCharFilter extends BaseCharFilter {
|
|||
private void fill() throws IOException {
|
||||
StringBuilder buffered = new StringBuilder();
|
||||
char [] temp = new char [1024];
|
||||
for (int cnt = in.read(temp); cnt > 0; cnt = in.read(temp)) {
|
||||
for (int cnt = input.read(temp); cnt > 0; cnt = input.read(temp)) {
|
||||
buffered.append(temp, 0, cnt);
|
||||
}
|
||||
transformedInput = new StringReader(processPattern(buffered).toString());
|
||||
|
|
|
@ -782,31 +782,51 @@ public class TestRandomChains extends BaseTokenStreamTestCase {
|
|||
@Override
|
||||
public int read(char[] cbuf, int off, int len) throws IOException {
|
||||
readSomething = true;
|
||||
return in.read(cbuf, off, len);
|
||||
return input.read(cbuf, off, len);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read() throws IOException {
|
||||
readSomething = true;
|
||||
return in.read();
|
||||
return input.read();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(CharBuffer target) throws IOException {
|
||||
readSomething = true;
|
||||
return in.read(target);
|
||||
return input.read(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(char[] cbuf) throws IOException {
|
||||
readSomething = true;
|
||||
return in.read(cbuf);
|
||||
return input.read(cbuf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long skip(long n) throws IOException {
|
||||
readSomething = true;
|
||||
return in.skip(n);
|
||||
return input.skip(n);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mark(int readAheadLimit) throws IOException {
|
||||
input.mark(readAheadLimit);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean markSupported() {
|
||||
return input.markSupported();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean ready() throws IOException {
|
||||
return input.ready();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() throws IOException {
|
||||
input.reset();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
package org.apache.lucene.analysis.fa;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import java.io.Reader;
|
||||
|
||||
import org.apache.lucene.analysis.Analyzer;
|
||||
import org.apache.lucene.analysis.BaseTokenStreamTestCase;
|
||||
import org.apache.lucene.analysis.MockTokenizer;
|
||||
|
||||
public class TestPersianCharFilter extends BaseTokenStreamTestCase {
|
||||
private Analyzer analyzer = new Analyzer() {
|
||||
@Override
|
||||
protected TokenStreamComponents createComponents(String fieldName, Reader reader) {
|
||||
return new TokenStreamComponents(new MockTokenizer(reader));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Reader initReader(String fieldName, Reader reader) {
|
||||
return new PersianCharFilter(reader);
|
||||
}
|
||||
};
|
||||
|
||||
public void testBasics() throws Exception {
|
||||
assertAnalyzesTo(analyzer, "this is a\u200Ctest",
|
||||
new String[] { "this", "is", "a", "test" });
|
||||
}
|
||||
|
||||
/** blast some random strings through the analyzer */
|
||||
public void testRandomStrings() throws Exception {
|
||||
checkRandomData(random(), analyzer, 1000*RANDOM_MULTIPLIER);
|
||||
}
|
||||
}
|
|
@ -238,7 +238,7 @@
|
|||
<check-missing-javadocs dir="build/docs/demo" level="class"/>
|
||||
<check-missing-javadocs dir="build/docs/facet" level="class"/>
|
||||
<check-missing-javadocs dir="build/docs/grouping" level="class"/>
|
||||
<!-- highlighter: problems -->
|
||||
<check-missing-javadocs dir="build/docs/highlighter" level="class"/>
|
||||
<check-missing-javadocs dir="build/docs/join" level="class"/>
|
||||
<check-missing-javadocs dir="build/docs/memory" level="class"/>
|
||||
<check-missing-javadocs dir="build/docs/misc" level="class"/>
|
||||
|
|
|
@ -135,7 +135,7 @@
|
|||
<property name="javac.target" value="1.6"/>
|
||||
<property name="javac.source.backwards" value="1.6"/>
|
||||
<property name="javac.target.backwards" value="1.6"/>
|
||||
<property name="javac.args" value="-Xlint -Xlint:-deprecation -Xlint:-serial"/>
|
||||
<property name="javac.args" value="-Xlint -Xlint:-deprecation -Xlint:-serial -Xlint:-options"/>
|
||||
<property name="bootclasspath" value=""/>
|
||||
<property name="javadoc.link" value="http://download.oracle.com/javase/6/docs/api/"/>
|
||||
<property name="javadoc.link.junit" value="http://junit.sourceforge.net/javadoc/"/>
|
||||
|
@ -713,6 +713,7 @@
|
|||
<or>
|
||||
<isset property="tests.class" />
|
||||
<isset property="tests.method" />
|
||||
<istrue value="${tests.showSuccess}"/>
|
||||
</or>
|
||||
</condition>
|
||||
<property name="tests.showOutput" value="onerror"/>
|
||||
|
|
|
@ -62,16 +62,40 @@
|
|||
<sequential>
|
||||
<exec dir="src/java/org/apache/lucene/util/automaton"
|
||||
executable="${python.exe}" failonerror="true">
|
||||
<arg line="createLevAutomata.py @{n} True"/>
|
||||
<arg value="createLevAutomata.py"/>
|
||||
<arg value="@{n}"/>
|
||||
<arg value="True"/>
|
||||
</exec>
|
||||
<exec dir="src/java/org/apache/lucene/util/automaton"
|
||||
executable="${python.exe}" failonerror="true">
|
||||
<arg line="createLevAutomata.py @{n} False"/>
|
||||
<arg value="createLevAutomata.py"/>
|
||||
<arg value="@{n}"/>
|
||||
<arg value="False"/>
|
||||
</exec>
|
||||
<fixcrlf srcdir="src/java/org/apache/lucene/util/automaton" includes="*ParametricDescription.java" encoding="UTF-8"/>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
|
||||
<target name="createPackedIntSources">
|
||||
<exec dir="src/java/org/apache/lucene/util/packed"
|
||||
executable="${python.exe}" failonerror="true">
|
||||
<arg value="gen_BulkOperation.py"/>
|
||||
</exec>
|
||||
<exec dir="src/java/org/apache/lucene/util/packed"
|
||||
executable="${python.exe}" failonerror="true">
|
||||
<arg value="gen_Direct.py"/>
|
||||
</exec>
|
||||
<exec dir="src/java/org/apache/lucene/util/packed"
|
||||
executable="${python.exe}" failonerror="true">
|
||||
<arg value="gen_Packed64SingleBlock.py"/>
|
||||
</exec>
|
||||
<exec dir="src/java/org/apache/lucene/util/packed"
|
||||
executable="${python.exe}" failonerror="true">
|
||||
<arg value="gen_PackedThreeBlocks.py"/>
|
||||
</exec>
|
||||
<fixcrlf srcdir="src/java/org/apache/lucene/util/packed" includes="BulkOperation*.java,Direct*.java,Packed64SingleBlock.java,Packed*ThreeBlocks.py" encoding="UTF-8"/>
|
||||
</target>
|
||||
|
||||
<target name="createLevAutomata" depends="check-moman,clone-moman,pull-moman">
|
||||
<createLevAutomaton n="1"/>
|
||||
<createLevAutomaton n="2"/>
|
||||
|
@ -86,14 +110,21 @@
|
|||
<target name="clone-moman" unless="moman.cloned">
|
||||
<exec dir="src/java/org/apache/lucene/util/automaton"
|
||||
executable="${hg.exe}" failonerror="true">
|
||||
<arg line="clone -r ${moman.rev} ${moman.url} moman"/>
|
||||
<arg value="clone"/>
|
||||
<arg value="-r"/>
|
||||
<arg value="${moman.rev}"/>
|
||||
<arg value="${moman.url}"/>
|
||||
<arg value="moman"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="pull-moman" if="moman.cloned">
|
||||
<exec dir="src/java/org/apache/lucene/util/automaton/moman"
|
||||
executable="${hg.exe}" failonerror="true">
|
||||
<arg line="pull -f -r ${moman.rev}"/>
|
||||
<arg value="pull"/>
|
||||
<arg value="-f"/>
|
||||
<arg value="-r"/>
|
||||
<arg value="${moman.rev}"/>
|
||||
</exec>
|
||||
</target>
|
||||
</project>
|
||||
|
|
|
@ -30,8 +30,42 @@ import java.util.Map;
|
|||
* policy for extracting index terms from text.
|
||||
* <p>
|
||||
* In order to define what analysis is done, subclasses must define their
|
||||
* {@link TokenStreamComponents} in {@link #createComponents(String, Reader)}.
|
||||
* {@link TokenStreamComponents TokenStreamComponents} in {@link #createComponents(String, Reader)}.
|
||||
* The components are then reused in each call to {@link #tokenStream(String, Reader)}.
|
||||
* <p>
|
||||
* Simple example:
|
||||
* <pre class="prettyprint">
|
||||
* Analyzer analyzer = new Analyzer() {
|
||||
* {@literal @Override}
|
||||
* protected TokenStreamComponents createComponents(String fieldName, Reader reader) {
|
||||
* Tokenizer source = new FooTokenizer(reader);
|
||||
* TokenStream filter = new FooFilter(source);
|
||||
* filter = new BarFilter(filter);
|
||||
* return new TokenStreamComponents(source, filter);
|
||||
* }
|
||||
* };
|
||||
* </pre>
|
||||
* For more examples, see the {@link org.apache.lucene.analysis Analysis package documentation}.
|
||||
* <p>
|
||||
* For some concrete implementations bundled with Lucene, look in the analysis modules:
|
||||
* <ul>
|
||||
* <li><a href="{@docRoot}/../analyzers-common/overview-summary.html">Common</a>:
|
||||
* Analyzers for indexing content in different languages and domains.
|
||||
* <li><a href="{@docRoot}/../analyzers-icu/overview-summary.html">ICU</a>:
|
||||
* Exposes functionality from ICU to Apache Lucene.
|
||||
* <li><a href="{@docRoot}/../analyzers-kuromoji/overview-summary.html">Kuromoji</a>:
|
||||
* Morphological analyzer for Japanese text.
|
||||
* <li><a href="{@docRoot}/../analyzers-morfologik/overview-summary.html">Morfologik</a>:
|
||||
* Dictionary-driven lemmatization for the Polish language.
|
||||
* <li><a href="{@docRoot}/../analyzers-phonetic/overview-summary.html">Phonetic</a>:
|
||||
* Analysis for indexing phonetic signatures (for sounds-alike search).
|
||||
* <li><a href="{@docRoot}/../analyzers-smartcn/overview-summary.html">Smart Chinese</a>:
|
||||
* Analyzer for Simplified Chinese, which indexes words.
|
||||
* <li><a href="{@docRoot}/../analyzers-stempel/overview-summary.html">Stempel</a>:
|
||||
* Algorithmic Stemmer for the Polish Language.
|
||||
* <li><a href="{@docRoot}/../analyzers-uima/overview-summary.html">UIMA</a>:
|
||||
* Analysis integration with Apache UIMA.
|
||||
* </ul>
|
||||
*/
|
||||
public abstract class Analyzer {
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ package org.apache.lucene.analysis;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import java.io.FilterReader;
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
|
||||
/**
|
||||
|
@ -25,17 +25,39 @@ import java.io.Reader;
|
|||
* They can be used as {@link java.io.Reader} with additional offset
|
||||
* correction. {@link Tokenizer}s will automatically use {@link #correctOffset}
|
||||
* if a CharFilter subclass is used.
|
||||
* <p>
|
||||
* This class is abstract: at a minimum you must implement {@link #read(char[], int, int)},
|
||||
* transforming the input in some way from {@link #input}, and {@link #correct(int)}
|
||||
* to adjust the offsets to match the originals.
|
||||
* <p>
|
||||
* You can optionally provide more efficient implementations of additional methods
|
||||
* like {@link #read()}, {@link #read(char[])}, {@link #read(java.nio.CharBuffer)},
|
||||
* but this is not required.
|
||||
*/
|
||||
public abstract class CharFilter extends FilterReader {
|
||||
// the way java.io.FilterReader should work!
|
||||
public abstract class CharFilter extends Reader {
|
||||
/**
|
||||
* The underlying character-input stream.
|
||||
*/
|
||||
protected final Reader input;
|
||||
|
||||
/**
|
||||
* Create a new CharFilter wrapping the provided reader.
|
||||
* @param in a Reader, can also be a CharFilter for chaining.
|
||||
* @param input a Reader, can also be a CharFilter for chaining.
|
||||
*/
|
||||
public CharFilter(Reader in) {
|
||||
super(in);
|
||||
public CharFilter(Reader input) {
|
||||
super(input);
|
||||
this.input = input;
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the underlying input stream.
|
||||
*/
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
input.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Subclasses override to correct the current offset.
|
||||
*
|
||||
|
@ -50,6 +72,6 @@ public abstract class CharFilter extends FilterReader {
|
|||
*/
|
||||
public final int correctOffset(int currentOff) {
|
||||
final int corrected = correct(currentOff);
|
||||
return (in instanceof CharFilter) ? ((CharFilter) in).correctOffset(corrected) : corrected;
|
||||
return (input instanceof CharFilter) ? ((CharFilter) input).correctOffset(corrected) : corrected;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ package org.apache.lucene.analysis.tokenattributes;
|
|||
|
||||
import org.apache.lucene.util.Attribute;
|
||||
|
||||
/** The positionIncrement determines the position of this token
|
||||
/** Determines the position of this token
|
||||
* relative to the previous Token in a TokenStream, used in phrase
|
||||
* searching.
|
||||
*
|
||||
|
|
|
@ -20,7 +20,7 @@ package org.apache.lucene.analysis.tokenattributes;
|
|||
import org.apache.lucene.analysis.TokenStream;
|
||||
import org.apache.lucene.util.AttributeImpl;
|
||||
|
||||
/** The positionIncrement determines the position of this token
|
||||
/** Determines the position of this token
|
||||
* relative to the previous Token in a {@link TokenStream}, used in phrase
|
||||
* searching.
|
||||
*
|
||||
|
|
|
@ -19,7 +19,7 @@ package org.apache.lucene.analysis.tokenattributes;
|
|||
|
||||
import org.apache.lucene.util.Attribute;
|
||||
|
||||
/** The positionLength determines how many positions this
|
||||
/** Determines how many positions this
|
||||
* token spans. Very few analyzer components actually
|
||||
* produce this attribute, and indexing ignores it, but
|
||||
* it's useful to express the graph structure naturally
|
||||
|
|
|
@ -18,6 +18,7 @@ package org.apache.lucene.codecs;
|
|||
*/
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Iterator;
|
||||
import java.util.TreeMap;
|
||||
|
@ -39,7 +40,6 @@ import org.apache.lucene.util.ArrayUtil;
|
|||
import org.apache.lucene.util.Bits;
|
||||
import org.apache.lucene.util.BytesRef;
|
||||
import org.apache.lucene.util.DoubleBarrelLRUCache;
|
||||
import org.apache.lucene.util.UnmodifiableIterator;
|
||||
|
||||
/** Handles a terms dict, but decouples all details of
|
||||
* doc/freqs/positions reading to an instance of {@link
|
||||
|
@ -185,7 +185,7 @@ public class BlockTermsReader extends FieldsProducer {
|
|||
|
||||
@Override
|
||||
public Iterator<String> iterator() {
|
||||
return new UnmodifiableIterator<String>(fields.keySet().iterator());
|
||||
return Collections.unmodifiableSet(fields.keySet()).iterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -308,7 +308,7 @@ public class BlockTermsReader extends FieldsProducer {
|
|||
private int metaDataUpto;
|
||||
|
||||
public SegmentTermsEnum() throws IOException {
|
||||
in = (IndexInput) BlockTermsReader.this.in.clone();
|
||||
in = BlockTermsReader.this.in.clone();
|
||||
in.seek(termsStartPointer);
|
||||
indexEnum = indexReader.getFieldEnum(fieldInfo);
|
||||
doOrd = indexReader.supportsOrd();
|
||||
|
|
|
@ -21,6 +21,7 @@ import java.io.ByteArrayOutputStream;
|
|||
import java.io.IOException;
|
||||
import java.io.PrintStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Iterator;
|
||||
import java.util.Locale;
|
||||
|
@ -45,7 +46,6 @@ import org.apache.lucene.util.BytesRef;
|
|||
import org.apache.lucene.util.IOUtils;
|
||||
import org.apache.lucene.util.RamUsageEstimator;
|
||||
import org.apache.lucene.util.StringHelper;
|
||||
import org.apache.lucene.util.UnmodifiableIterator;
|
||||
import org.apache.lucene.util.automaton.CompiledAutomaton;
|
||||
import org.apache.lucene.util.automaton.RunAutomaton;
|
||||
import org.apache.lucene.util.automaton.Transition;
|
||||
|
@ -200,7 +200,7 @@ public class BlockTreeTermsReader extends FieldsProducer {
|
|||
|
||||
@Override
|
||||
public Iterator<String> iterator() {
|
||||
return new UnmodifiableIterator<String>(fields.keySet().iterator());
|
||||
return Collections.unmodifiableSet(fields.keySet()).iterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -400,7 +400,7 @@ public class BlockTreeTermsReader extends FieldsProducer {
|
|||
rootBlockFP = (new ByteArrayDataInput(rootCode.bytes, rootCode.offset, rootCode.length)).readVLong() >>> BlockTreeTermsWriter.OUTPUT_FLAGS_NUM_BITS;
|
||||
|
||||
if (indexIn != null) {
|
||||
final IndexInput clone = (IndexInput) indexIn.clone();
|
||||
final IndexInput clone = indexIn.clone();
|
||||
//System.out.println("start=" + indexStartFP + " field=" + fieldInfo.name);
|
||||
clone.seek(indexStartFP);
|
||||
index = new FST<BytesRef>(clone, ByteSequenceOutputs.getSingleton());
|
||||
|
@ -746,7 +746,7 @@ public class BlockTreeTermsReader extends FieldsProducer {
|
|||
// }
|
||||
runAutomaton = compiled.runAutomaton;
|
||||
compiledAutomaton = compiled;
|
||||
in = (IndexInput) BlockTreeTermsReader.this.in.clone();
|
||||
in = BlockTreeTermsReader.this.in.clone();
|
||||
stack = new Frame[5];
|
||||
for(int idx=0;idx<stack.length;idx++) {
|
||||
stack[idx] = new Frame(idx);
|
||||
|
@ -1236,7 +1236,7 @@ public class BlockTreeTermsReader extends FieldsProducer {
|
|||
// Not private to avoid synthetic access$NNN methods
|
||||
void initIndexInput() {
|
||||
if (this.in == null) {
|
||||
this.in = (IndexInput) BlockTreeTermsReader.this.in.clone();
|
||||
this.in = BlockTreeTermsReader.this.in.clone();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ import org.apache.lucene.util.fst.Util;
|
|||
*/
|
||||
|
||||
/**
|
||||
* block-based terms index and dictionary writer.
|
||||
* Block-based terms index and dictionary writer.
|
||||
* <p>
|
||||
* Writes terms dict and index, block-encoding (column
|
||||
* stride) each term's metadata for each set of terms
|
||||
|
@ -724,7 +724,7 @@ public class BlockTreeTermsWriter extends FieldsConsumer {
|
|||
// Write term stats, to separate byte[] blob:
|
||||
bytesWriter2.writeVInt(term.stats.docFreq);
|
||||
if (fieldInfo.getIndexOptions() != IndexOptions.DOCS_ONLY) {
|
||||
assert term.stats.totalTermFreq >= term.stats.docFreq;
|
||||
assert term.stats.totalTermFreq >= term.stats.docFreq: term.stats.totalTermFreq + " vs " + term.stats.docFreq;
|
||||
bytesWriter2.writeVLong(term.stats.totalTermFreq - term.stats.docFreq);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ import java.io.IOException;
|
|||
|
||||
import org.apache.lucene.index.Fields;
|
||||
|
||||
/** Abstract API that produces terms, doc, freq, prox and
|
||||
/** Abstract API that produces terms, doc, freq, prox, offset and
|
||||
* payloads postings.
|
||||
*
|
||||
* @lucene.experimental
|
||||
|
|
|
@ -34,7 +34,7 @@ import java.io.IOException;
|
|||
import org.apache.lucene.index.IndexFileNames;
|
||||
|
||||
/**
|
||||
* TermsIndexReader for simple every-nth terms indexes.
|
||||
* TermsIndexReader for simple every Nth terms indexes.
|
||||
*
|
||||
* @see FixedGapTermsIndexWriter
|
||||
* @lucene.experimental
|
||||
|
@ -278,7 +278,7 @@ public class FixedGapTermsIndexReader extends TermsIndexReaderBase {
|
|||
this.termsStart = termsStart;
|
||||
termBytesStart = termBytes.getPointer();
|
||||
|
||||
IndexInput clone = (IndexInput) in.clone();
|
||||
IndexInput clone = in.clone();
|
||||
clone.seek(indexStart);
|
||||
|
||||
// -1 is passed to mean "don't load term index", but
|
||||
|
@ -309,8 +309,8 @@ public class FixedGapTermsIndexReader extends TermsIndexReaderBase {
|
|||
}
|
||||
} else {
|
||||
// Get packed iterators
|
||||
final IndexInput clone1 = (IndexInput) in.clone();
|
||||
final IndexInput clone2 = (IndexInput) in.clone();
|
||||
final IndexInput clone1 = in.clone();
|
||||
final IndexInput clone2 = in.clone();
|
||||
|
||||
try {
|
||||
// Subsample the index terms
|
||||
|
|
|
@ -59,30 +59,36 @@ public abstract class MultiLevelSkipListReader {
|
|||
private int skipInterval[]; // skipInterval of each level
|
||||
private int[] numSkipped; // number of docs skipped per level
|
||||
|
||||
private int[] skipDoc; // doc id of current skip entry per level
|
||||
protected int[] skipDoc; // doc id of current skip entry per level
|
||||
private int lastDoc; // doc id of last read skip entry with docId <= target
|
||||
private long[] childPointer; // child pointer of current skip entry per level
|
||||
private long lastChildPointer; // childPointer of last read skip entry with docId <= target
|
||||
|
||||
private boolean inputIsBuffered;
|
||||
|
||||
public MultiLevelSkipListReader(IndexInput skipStream, int maxSkipLevels, int skipInterval) {
|
||||
private final int skipMultiplier;
|
||||
|
||||
protected MultiLevelSkipListReader(IndexInput skipStream, int maxSkipLevels, int skipInterval, int skipMultiplier) {
|
||||
this.skipStream = new IndexInput[maxSkipLevels];
|
||||
this.skipPointer = new long[maxSkipLevels];
|
||||
this.childPointer = new long[maxSkipLevels];
|
||||
this.numSkipped = new int[maxSkipLevels];
|
||||
this.maxNumberOfSkipLevels = maxSkipLevels;
|
||||
this.skipInterval = new int[maxSkipLevels];
|
||||
this.skipMultiplier = skipMultiplier;
|
||||
this.skipStream [0]= skipStream;
|
||||
this.inputIsBuffered = (skipStream instanceof BufferedIndexInput);
|
||||
this.skipInterval[0] = skipInterval;
|
||||
for (int i = 1; i < maxSkipLevels; i++) {
|
||||
// cache skip intervals
|
||||
this.skipInterval[i] = this.skipInterval[i - 1] * skipInterval;
|
||||
this.skipInterval[i] = this.skipInterval[i - 1] * skipMultiplier;
|
||||
}
|
||||
skipDoc = new int[maxSkipLevels];
|
||||
}
|
||||
|
||||
// skipMultiplier and skipInterval are the same:
|
||||
protected MultiLevelSkipListReader(IndexInput skipStream, int maxSkipLevels, int skipInterval) {
|
||||
this(skipStream, maxSkipLevels, skipInterval, skipInterval);
|
||||
}
|
||||
|
||||
/** Returns the id of the doc to which the last call of {@link #skipTo(int)}
|
||||
* has skipped. */
|
||||
|
@ -157,7 +163,7 @@ public abstract class MultiLevelSkipListReader {
|
|||
numSkipped[level] = numSkipped[level + 1] - skipInterval[level + 1];
|
||||
skipDoc[level] = lastDoc;
|
||||
if (level > 0) {
|
||||
childPointer[level] = skipStream[level].readVLong() + skipPointer[level - 1];
|
||||
childPointer[level] = skipStream[level].readVLong() + skipPointer[level - 1];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -187,7 +193,12 @@ public abstract class MultiLevelSkipListReader {
|
|||
|
||||
/** Loads the skip levels */
|
||||
private void loadSkipLevels() throws IOException {
|
||||
numberOfSkipLevels = MathUtil.log(docCount, skipInterval[0]);
|
||||
if (docCount <= skipInterval[0]) {
|
||||
numberOfSkipLevels = 1;
|
||||
} else {
|
||||
numberOfSkipLevels = 1+MathUtil.log(docCount/skipInterval[0], skipMultiplier);
|
||||
}
|
||||
|
||||
if (numberOfSkipLevels > maxNumberOfSkipLevels) {
|
||||
numberOfSkipLevels = maxNumberOfSkipLevels;
|
||||
}
|
||||
|
@ -208,7 +219,7 @@ public abstract class MultiLevelSkipListReader {
|
|||
toBuffer--;
|
||||
} else {
|
||||
// clone this stream, it is already at the start of the current level
|
||||
skipStream[i] = (IndexInput) skipStream[0].clone();
|
||||
skipStream[i] = skipStream[0].clone();
|
||||
if (inputIsBuffered && length < BufferedIndexInput.BUFFER_SIZE) {
|
||||
((BufferedIndexInput) skipStream[i]).setBufferSize((int) length);
|
||||
}
|
||||
|
|
|
@ -26,6 +26,8 @@ import org.apache.lucene.util.MathUtil;
|
|||
/**
|
||||
* This abstract class writes skip lists with multiple levels.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* Example for skipInterval = 3:
|
||||
* c (skip level 2)
|
||||
* c c c (skip level 1)
|
||||
|
@ -45,6 +47,7 @@ import org.apache.lucene.util.MathUtil;
|
|||
*
|
||||
* While this class takes care of writing the different skip levels,
|
||||
* subclasses must define the actual format of the skip data.
|
||||
* </pre>
|
||||
* @lucene.experimental
|
||||
*/
|
||||
|
||||
|
@ -54,15 +57,23 @@ public abstract class MultiLevelSkipListWriter {
|
|||
|
||||
// the skip interval in the list with level = 0
|
||||
private int skipInterval;
|
||||
|
||||
// skipInterval used for level > 0
|
||||
private int skipMultiplier;
|
||||
|
||||
// for every skip level a different buffer is used
|
||||
private RAMOutputStream[] skipBuffer;
|
||||
|
||||
protected MultiLevelSkipListWriter(int skipInterval, int maxSkipLevels, int df) {
|
||||
protected MultiLevelSkipListWriter(int skipInterval, int skipMultiplier, int maxSkipLevels, int df) {
|
||||
this.skipInterval = skipInterval;
|
||||
this.skipMultiplier = skipMultiplier;
|
||||
|
||||
// calculate the maximum number of skip levels for this document frequency
|
||||
numberOfSkipLevels = MathUtil.log(df, skipInterval);
|
||||
if (df <= skipInterval) {
|
||||
numberOfSkipLevels = 1;
|
||||
} else {
|
||||
numberOfSkipLevels = 1+MathUtil.log(df/skipInterval, skipMultiplier);
|
||||
}
|
||||
|
||||
// make sure it does not exceed maxSkipLevels
|
||||
if (numberOfSkipLevels > maxSkipLevels) {
|
||||
|
@ -70,6 +81,11 @@ public abstract class MultiLevelSkipListWriter {
|
|||
}
|
||||
}
|
||||
|
||||
// skipMultiplier and skipInterval are the same:
|
||||
protected MultiLevelSkipListWriter(int skipInterval, int maxSkipLevels, int df) {
|
||||
this(skipInterval, skipInterval, maxSkipLevels, df);
|
||||
}
|
||||
|
||||
protected void init() {
|
||||
skipBuffer = new RAMOutputStream[numberOfSkipLevels];
|
||||
for (int i = 0; i < numberOfSkipLevels; i++) {
|
||||
|
@ -95,7 +111,7 @@ public abstract class MultiLevelSkipListWriter {
|
|||
* @param skipBuffer the skip buffer to write to
|
||||
*/
|
||||
protected abstract void writeSkipData(int level, IndexOutput skipBuffer) throws IOException;
|
||||
|
||||
|
||||
/**
|
||||
* Writes the current skip data to the buffers. The current document frequency determines
|
||||
* the max level is skip data is to be written to.
|
||||
|
@ -104,11 +120,15 @@ public abstract class MultiLevelSkipListWriter {
|
|||
* @throws IOException
|
||||
*/
|
||||
public void bufferSkip(int df) throws IOException {
|
||||
int numLevels;
|
||||
|
||||
assert df % skipInterval == 0;
|
||||
int numLevels = 1;
|
||||
df /= skipInterval;
|
||||
|
||||
// determine max level
|
||||
for (numLevels = 0; (df % skipInterval) == 0 && numLevels < numberOfSkipLevels; df /= skipInterval) {
|
||||
while ((df % skipMultiplier) == 0 && numLevels < numberOfSkipLevels) {
|
||||
numLevels++;
|
||||
df /= skipMultiplier;
|
||||
}
|
||||
|
||||
long childPointer = 0;
|
||||
|
@ -150,5 +170,4 @@ public abstract class MultiLevelSkipListWriter {
|
|||
|
||||
return skipPointer;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,8 +22,8 @@ import java.io.IOException;
|
|||
import org.apache.lucene.index.StoredFieldVisitor;
|
||||
|
||||
/**
|
||||
* Codec API for reading stored fields:
|
||||
*
|
||||
* Codec API for reading stored fields.
|
||||
* <p>
|
||||
* You need to implement {@link #visitDocument(int, StoredFieldVisitor)} to
|
||||
* read the stored fields for a document, implement {@link #clone()} (creating
|
||||
* clones of any IndexInputs used, etc), and {@link #close()}
|
||||
|
|
|
@ -20,6 +20,7 @@ package org.apache.lucene.codecs;
|
|||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
import java.util.Comparator;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.apache.lucene.index.AtomicReader;
|
||||
import org.apache.lucene.index.DocsAndPositionsEnum;
|
||||
|
@ -187,19 +188,21 @@ public abstract class TermVectorsWriter implements Closeable {
|
|||
}
|
||||
|
||||
/** Safe (but, slowish) default method to write every
|
||||
* vector field in the document. This default
|
||||
* implementation requires that the vectors implement
|
||||
* both Fields.size and
|
||||
* Terms.size. */
|
||||
* vector field in the document. */
|
||||
protected final void addAllDocVectors(Fields vectors, MergeState mergeState) throws IOException {
|
||||
if (vectors == null) {
|
||||
startDocument(0);
|
||||
return;
|
||||
}
|
||||
|
||||
final int numFields = vectors.size();
|
||||
int numFields = vectors.size();
|
||||
if (numFields == -1) {
|
||||
throw new IllegalStateException("vectors.size() must be implemented (it returned -1)");
|
||||
// count manually! TODO: Maybe enforce that Fields.size() returns something valid?
|
||||
numFields = 0;
|
||||
for (final Iterator<String> it = vectors.iterator(); it.hasNext(); ) {
|
||||
it.next();
|
||||
numFields++;
|
||||
}
|
||||
}
|
||||
startDocument(numFields);
|
||||
|
||||
|
@ -208,7 +211,9 @@ public abstract class TermVectorsWriter implements Closeable {
|
|||
TermsEnum termsEnum = null;
|
||||
DocsAndPositionsEnum docsAndPositionsEnum = null;
|
||||
|
||||
int fieldCount = 0;
|
||||
for(String fieldName : vectors) {
|
||||
fieldCount++;
|
||||
final FieldInfo fieldInfo = mergeState.fieldInfos.fieldInfo(fieldName);
|
||||
|
||||
assert lastFieldName == null || fieldName.compareTo(lastFieldName) > 0: "lastFieldName=" + lastFieldName + " fieldName=" + fieldName;
|
||||
|
@ -225,9 +230,14 @@ public abstract class TermVectorsWriter implements Closeable {
|
|||
final boolean hasPayloads = terms.hasPayloads();
|
||||
assert !hasPayloads || hasPositions;
|
||||
|
||||
final int numTerms = (int) terms.size();
|
||||
int numTerms = (int) terms.size();
|
||||
if (numTerms == -1) {
|
||||
throw new IllegalStateException("terms.size() must be implemented (it returned -1)");
|
||||
// count manually. It is stupid, but needed, as Terms.size() is not a mandatory statistics function
|
||||
numTerms = 0;
|
||||
termsEnum = terms.iterator(termsEnum);
|
||||
while(termsEnum.next() != null) {
|
||||
numTerms++;
|
||||
}
|
||||
}
|
||||
|
||||
startField(fieldInfo, numTerms, hasPositions, hasOffsets, hasPayloads);
|
||||
|
@ -263,6 +273,7 @@ public abstract class TermVectorsWriter implements Closeable {
|
|||
}
|
||||
assert termCount == numTerms;
|
||||
}
|
||||
assert fieldCount == numFields;
|
||||
}
|
||||
|
||||
/** Return the BytesRef Comparator used to sort terms
|
||||
|
|
|
@ -51,7 +51,7 @@ public abstract class TermsIndexReaderBase implements Closeable {
|
|||
/**
|
||||
* Similar to TermsEnum, except, the only "metadata" it
|
||||
* reports for a given indexed term is the long fileOffset
|
||||
* into the main terms dictionary file:
|
||||
* into the main terms dictionary file.
|
||||
*/
|
||||
public static abstract class FieldIndexEnum {
|
||||
|
||||
|
|
|
@ -170,7 +170,7 @@ public class VariableGapTermsIndexReader extends TermsIndexReaderBase {
|
|||
|
||||
private void loadTermsIndex() throws IOException {
|
||||
if (fst == null) {
|
||||
IndexInput clone = (IndexInput) in.clone();
|
||||
IndexInput clone = in.clone();
|
||||
clone.seek(indexStart);
|
||||
fst = new FST<Long>(clone, fstOutputs);
|
||||
clone.close();
|
||||
|
|
|
@ -0,0 +1,422 @@
|
|||
package org.apache.lucene.codecs.block;
|
||||
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.lucene.codecs.BlockTreeTermsReader;
|
||||
import org.apache.lucene.codecs.BlockTreeTermsWriter;
|
||||
import org.apache.lucene.codecs.CodecUtil;
|
||||
import org.apache.lucene.codecs.FieldsConsumer;
|
||||
import org.apache.lucene.codecs.FieldsProducer;
|
||||
import org.apache.lucene.codecs.MultiLevelSkipListWriter;
|
||||
import org.apache.lucene.codecs.PostingsFormat;
|
||||
import org.apache.lucene.codecs.PostingsReaderBase;
|
||||
import org.apache.lucene.codecs.PostingsWriterBase;
|
||||
import org.apache.lucene.index.DocsEnum;
|
||||
import org.apache.lucene.index.FieldInfo.IndexOptions;
|
||||
import org.apache.lucene.index.SegmentReadState;
|
||||
import org.apache.lucene.index.SegmentWriteState;
|
||||
import org.apache.lucene.store.DataOutput;
|
||||
import org.apache.lucene.util.IOUtils;
|
||||
import org.apache.lucene.util.packed.PackedInts;
|
||||
|
||||
/**
|
||||
* Block postings format, which encodes postings in packed int blocks
|
||||
* for faster decode.
|
||||
*
|
||||
* <p><b>NOTE</b>: this format is still experimental and
|
||||
* subject to change without backwards compatibility.
|
||||
*
|
||||
* <p>
|
||||
* Basic idea:
|
||||
* <ul>
|
||||
* <li>
|
||||
* <b>Packed Block and VInt Block</b>:
|
||||
* <p>In packed block, integers are encoded with the same bit width ({@link PackedInts packed format}),
|
||||
* the block size (i.e. number of integers inside block) is fixed. </p>
|
||||
* <p>In VInt block, integers are encoded as {@link DataOutput#writeVInt VInt},
|
||||
* the block size is variable.</p>
|
||||
* </li>
|
||||
*
|
||||
* <li>
|
||||
* <b>Block structure</b>:
|
||||
* <p>When the postings is long enough, BlockPostingsFormat will try to encode most integer data
|
||||
* as packed block.</p>
|
||||
* <p>Take a term with 259 documents as example, the first 256 document ids are encoded as two packed
|
||||
* blocks, while the remaining 3 as one VInt block. </p>
|
||||
* <p>Different kinds of data are always encoded separately into different packed blocks, but may
|
||||
* possible be encoded into a same VInt block. </p>
|
||||
* <p>This strategy is applied to pairs:
|
||||
* <document number, frequency>,
|
||||
* <position, payload length>,
|
||||
* <position, offset start, offset length>, and
|
||||
* <position, payload length, offsetstart, offset length>.</p>
|
||||
* </li>
|
||||
*
|
||||
* <li>
|
||||
* <b>Skipper setting</b>:
|
||||
* <p>The structure of skip table is quite similar to Lucene40PostingsFormat. Skip interval is the
|
||||
* same as block size, and each skip entry points to the beginning of each block. However, for
|
||||
* the first block, skip data is omitted.</p>
|
||||
* </li>
|
||||
*
|
||||
* <li>
|
||||
* <b>Positions, Payloads, and Offsets</b>:
|
||||
* <p>A position is an integer indicating where the term occurs at within one document.
|
||||
* A payload is a blob of metadata associated with current position.
|
||||
* An offset is a pair of integers indicating the tokenized start/end offsets for given term
|
||||
* in current position. </p>
|
||||
* <p>When payloads and offsets are not omitted, numPositions==numPayloads==numOffsets (assuming a
|
||||
* null payload contributes one count). As mentioned in block structure, it is possible to encode
|
||||
* these three either combined or separately.
|
||||
* <p>For all the cases, payloads and offsets are stored together. When encoded as packed block,
|
||||
* position data is separated out as .pos, while payloads and offsets are encoded in .pay (payload
|
||||
* metadata will also be stored directly in .pay). When encoded as VInt block, all these three are
|
||||
* stored in .pos (so as payload metadata).</p>
|
||||
* <p>With this strategy, the majority of payload and offset data will be outside .pos file.
|
||||
* So for queries that require only position data, running on a full index with payloads and offsets,
|
||||
* this reduces disk pre-fetches.</p>
|
||||
* </li>
|
||||
* </ul>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Files and detailed format:
|
||||
* <ul>
|
||||
* <li><tt>.tim</tt>: <a href="#Termdictionary">Term Dictionary</a></li>
|
||||
* <li><tt>.tip</tt>: <a href="#Termindex">Term Index</a></li>
|
||||
* <li><tt>.doc</tt>: <a href="#Frequencies">Frequencies and Skip Data</a></li>
|
||||
* <li><tt>.pos</tt>: <a href="#Positions">Positions</a></li>
|
||||
* <li><tt>.pay</tt>: <a href="#Payloads">Payloads and Offsets</a></li>
|
||||
* </ul>
|
||||
* </p>
|
||||
*
|
||||
* <a name="Termdictionary" id="Termdictionary"></a>
|
||||
* <dl>
|
||||
* <dd>
|
||||
* <b>Term Dictionary</b>
|
||||
*
|
||||
* <p>The .tim file format is quite similar to Lucene40PostingsFormat,
|
||||
* with minor difference in MetadataBlock</p>
|
||||
*
|
||||
* <ul>
|
||||
* <!-- TODO: expand on this, its not really correct and doesnt explain sub-blocks etc -->
|
||||
* <li>TermDictionary(.tim) --> Header, DirOffset, PostingsHeader, PackedBlockSize,
|
||||
* <Block><sup>NumBlocks</sup>, FieldSummary</li>
|
||||
* <li>Block --> SuffixBlock, StatsBlock, MetadataBlock</li>
|
||||
* <li>SuffixBlock --> EntryCount, SuffixLength, {@link DataOutput#writeByte byte}<sup>SuffixLength</sup></li>
|
||||
* <li>StatsBlock --> StatsLength, <DocFreq, TotalTermFreq><sup>EntryCount</sup></li>
|
||||
* <li>MetadataBlock --> MetaLength, <DocFPDelta,
|
||||
* <PosFPDelta, PosVIntBlockFPDelta?, PayFPDelta?>?,
|
||||
* SkipFPDelta?><sup>EntryCount</sup></li>
|
||||
* <li>FieldSummary --> NumFields, <FieldNumber, NumTerms, RootCodeLength,
|
||||
* {@link DataOutput#writeByte byte}<sup>RootCodeLength</sup>, SumDocFreq, DocCount>
|
||||
* <sup>NumFields</sup></li>
|
||||
* <li>Header, PostingsHeader --> {@link CodecUtil#writeHeader CodecHeader}</li>
|
||||
* <li>DirOffset --> {@link DataOutput#writeLong Uint64}</li>
|
||||
* <li>PackedBlockSize, EntryCount, SuffixLength, StatsLength, DocFreq, MetaLength,
|
||||
* PosVIntBlockFPDelta, SkipFPDelta, NumFields, FieldNumber, RootCodeLength, DocCount -->
|
||||
* {@link DataOutput#writeVInt VInt}</li>
|
||||
* <li>TotalTermFreq, DocFPDelta, PosFPDelta, PayFPDelta, NumTerms, SumTotalTermFreq, SumDocFreq -->
|
||||
* {@link DataOutput#writeVLong VLong}</li>
|
||||
* </ul>
|
||||
* <p>Notes:</p>
|
||||
* <ul>
|
||||
* <li>Here explains MetadataBlock only, other fields are mentioned in
|
||||
* <a href="../lucene40/Lucene40PostingsFormat.html#Termdictionary">Lucene40PostingsFormat:TermDictionary</a>
|
||||
* </li>
|
||||
* <li>PackedBlockSize is the fixed block size for packed blocks. In packed block, bit width is
|
||||
* determined by the largest integer. Smaller block size result in smaller variance among width
|
||||
* of integers hence smaller indexes. Larger block size result in more efficient bulk i/o hence
|
||||
* better acceleration. This value should always be a multiple of 64, currently fixed as 128 as
|
||||
* a tradeoff. It is also the skip interval used to accelerate {@link DocsEnum#advance(int)}.
|
||||
* <li>DocFPDelta determines the position of this term's TermFreqs within the .doc file.
|
||||
* In particular, it is the difference of file offset between this term's
|
||||
* data and previous term's data (or zero, for the first term in the block).On disk it is
|
||||
* stored as the difference from previous value in sequence. </li>
|
||||
* <li>PosFPDelta determines the position of this term's TermPositions within the .pos file.
|
||||
* While PayFPDelta determines the position of this term's <TermPayloads, TermOffsets?> within
|
||||
* the .pay file. Similar to DocFPDelta, it is the difference between two file positions (or
|
||||
* neglected, for fields that omit payloads and offsets).</li>
|
||||
* <li>PosVIntBlockFPDelta determines the position of this term's last TermPosition in last pos packed
|
||||
* block within the .pos file. It is synonym for PayVIntBlockFPDelta or OffsetVIntBlockFPDelta.
|
||||
* This is actually used to indicate whether it is necessary to load following
|
||||
* payloads and offsets from .pos instead of .pay. Every time a new block of positions are to be
|
||||
* loaded, the PostingsReader will use this value to check whether current block is packed format
|
||||
* or VInt. When packed format, payloads and offsets are fetched from .pay, otherwise from .pos.
|
||||
* (this value is neglected when total number of positions i.e. totalTermFreq is less or equal
|
||||
* to PackedBlockSize).
|
||||
* <li>SkipFPDelta determines the position of this term's SkipData within the .doc
|
||||
* file. In particular, it is the length of the TermFreq data.
|
||||
* SkipDelta is only stored if DocFreq is not smaller than SkipMinimum
|
||||
* (i.e. 8 in BlockPostingsFormat).</li>
|
||||
* </ul>
|
||||
* </dd>
|
||||
* </dl>
|
||||
*
|
||||
* <a name="Termindex" id="Termindex"></a>
|
||||
* <dl>
|
||||
* <dd>
|
||||
* <b>Term Index</b>
|
||||
* <p>The .tim file format is mentioned in
|
||||
* <a href="../lucene40/Lucene40PostingsFormat.html#Termindex">Lucene40PostingsFormat:TermIndex</a>
|
||||
* </dd>
|
||||
* </dl>
|
||||
*
|
||||
*
|
||||
* <a name="Frequencies" id="Frequencies"></a>
|
||||
* <dl>
|
||||
* <dd>
|
||||
* <b>Frequencies and Skip Data</b>
|
||||
*
|
||||
* <p>The .doc file contains the lists of documents which contain each term, along
|
||||
* with the frequency of the term in that document (except when frequencies are
|
||||
* omitted: {@link IndexOptions#DOCS_ONLY}). It also saves skip data to the beginning of
|
||||
* each packed or VInt block, when the length of document list is larger than packed block size.</p>
|
||||
*
|
||||
* <ul>
|
||||
* <li>docFile(.doc) --> Header, <TermFreqs, SkipData?><sup>TermCount</sup></li>
|
||||
* <li>Header --> {@link CodecUtil#writeHeader CodecHeader}</li>
|
||||
* <li>TermFreqs --> <PackedBlock> <sup>PackedDocBlockNum</sup>,
|
||||
* VIntBlock? </li>
|
||||
* <li>PackedBlock --> PackedDocDeltaBlock, PackedFreqBlock?
|
||||
* <li>VIntBlock --> <DocDelta[, Freq?]><sup>DocFreq-PackedBlockSize*PackedDocBlockNum</sup>
|
||||
* <li>SkipData --> <<SkipLevelLength, SkipLevel>
|
||||
* <sup>NumSkipLevels-1</sup>, SkipLevel>, SkipDatum?</li>
|
||||
* <li>SkipLevel --> <SkipDatum> <sup>TrimmedDocFreq/(PackedBlockSize^(Level + 1))</sup></li>
|
||||
* <li>SkipDatum --> DocSkip, DocFPSkip, <PosFPSkip, PosBlockOffset, PayLength?,
|
||||
* OffsetStart?, PayFPSkip?>?, SkipChildLevelPointer?</li>
|
||||
* <li>PackedDocDeltaBlock, PackedFreqBlock --> {@link PackedInts PackedInts}</li>
|
||||
* <li>DocDelta, Freq, DocSkip, DocFPSkip, PosFPSkip, PosBlockOffset, PayLength, OffsetStart, PayFPSkip
|
||||
* -->
|
||||
* {@link DataOutput#writeVInt VInt}</li>
|
||||
* <li>SkipChildLevelPointer --> {@link DataOutput#writeVLong VLong}</li>
|
||||
* </ul>
|
||||
* <p>Notes:</p>
|
||||
* <ul>
|
||||
* <li>PackedDocDeltaBlock is theoretically generated from two steps:
|
||||
* <ol>
|
||||
* <li>Calculate the difference between each document number and previous one,
|
||||
* and get a d-gaps list (for the first document, use absolute value); </li>
|
||||
* <li>For those d-gaps from first one to PackedDocBlockNum*PackedBlockSize<sup>th</sup>,
|
||||
* separately encode as packed blocks.</li>
|
||||
* </ol>
|
||||
* If frequencies are not omitted, PackedFreqBlock will be generated without d-gap step.
|
||||
* </li>
|
||||
* <li>VIntBlock stores remaining d-gaps (along with frequencies when possible) with a format
|
||||
* mentioned in
|
||||
* <a href="../lucene40/Lucene40PostingsFormat.html#Frequencies">Lucene40PostingsFormat:Frequencies</a>
|
||||
* </li>
|
||||
* <li>PackedDocBlockNum is the number of packed blocks for current term's docids or frequencies.
|
||||
* In particular, PackedDocBlockNum = floor(DocFreq/PackedBlockSize) </li>
|
||||
* <li>TrimmedDocFreq = DocFreq % PackedBlockSize == 0 ? DocFreq - 1 : DocFreq.
|
||||
* We use this trick since the definition of skip entry is a little different from base interface.
|
||||
* In {@link MultiLevelSkipListWriter}, skip data is assumed to be saved for
|
||||
* skipInterval<sup>th</sup>, 2*skipInterval<sup>th</sup> ... posting in the list. However,
|
||||
* in BlockPostingsFormat, the skip data is saved for skipInterval+1<sup>th</sup>,
|
||||
* 2*skipInterval+1<sup>th</sup> ... posting (skipInterval==PackedBlockSize in this case).
|
||||
* When DocFreq is multiple of PackedBlockSize, MultiLevelSkipListWriter will expect one
|
||||
* more skip data than BlockSkipWriter. </li>
|
||||
* <li>SkipDatum is the metadata of one skip entry.
|
||||
* For the first block (no matter packed or VInt), it is omitted.</li>
|
||||
* <li>DocSkip records the document number of every PackedBlockSize<sup>th</sup> document number in
|
||||
* the postings (i.e. last document number in each packed block). On disk it is stored as the
|
||||
* difference from previous value in the sequence. </li>
|
||||
* <li>DocFPSkip records the file offsets of each block (excluding )posting at
|
||||
* PackedBlockSize+1<sup>th</sup>, 2*PackedBlockSize+1<sup>th</sup> ... , in DocFile.
|
||||
* The file offsets are relative to the start of current term's TermFreqs.
|
||||
* On disk it is also stored as the difference from previous SkipDatum in the sequence.</li>
|
||||
* <li>Since positions and payloads are also block encoded, the skip should skip to related block first,
|
||||
* then fetch the values according to in-block offset. PosFPSkip and PayFPSkip record the file
|
||||
* offsets of related block in .pos and .pay, respectively. While PosBlockOffset indicates
|
||||
* which value to fetch inside the related block (PayBlockOffset is unnecessary since it is always
|
||||
* equal to PosBlockOffset). Same as DocFPSkip, the file offsets are relative to the start of
|
||||
* current term's TermFreqs, and stored as a difference sequence.</li>
|
||||
* <li>PayLength indicates the length of last payload.</li>
|
||||
* <li>OffsetStart indicates the first value of last offset pair.</li>
|
||||
* </ul>
|
||||
* </dd>
|
||||
* </dl>
|
||||
*
|
||||
* <a name="Positions" id="Positions"></a>
|
||||
* <dl>
|
||||
* <dd>
|
||||
* <b>Positions</b>
|
||||
* <p>The .pos file contains the lists of positions that each term occurs at within documents. It also
|
||||
* sometimes stores part of payloads and offsets for speedup.</p>
|
||||
* <ul>
|
||||
* <li>PosFile(.pos) --> Header, <TermPositions> <sup>TermCount</sup></li>
|
||||
* <li>Header --> {@link CodecUtil#writeHeader CodecHeader}</li>
|
||||
* <li>TermPositions --> <PackedPosDeltaBlock> <sup>PackedPosBlockNum</sup>,
|
||||
* VIntBlock? </li>
|
||||
* <li>VIntBlock --> PosVIntCount, <PosDelta[, PayLength?], PayData?,
|
||||
* OffsetStartDelta?, OffsetLength?><sup>PosVIntCount</sup>
|
||||
* <li>PackedPosDeltaBlock --> {@link PackedInts PackedInts}</li>
|
||||
* <li>PosVIntCount, PosDelta, OffsetStartDelta, OffsetLength -->
|
||||
* {@link DataOutput#writeVInt VInt}</li>
|
||||
* <li>PayData --> {@link DataOutput#writeByte byte}<sup>PayLength</sup></li>
|
||||
* </ul>
|
||||
* <p>Notes:</p>
|
||||
* <ul>
|
||||
* <li>TermPositions are order by term (terms are implicit, from the term dictionary), and position
|
||||
* values for each term document pair are incremental, and ordered by document number.</li>
|
||||
* <li>PackedPosBlockNum is the number of packed blocks for current term's positions, payloads or offsets.
|
||||
* In particular, PackedPosBlockNum = floor(totalTermFreq/PackedBlockSize) </li>
|
||||
* <li>PosVIntCount is the number of positions encoded as VInt format. In particular,
|
||||
* PosVIntCount = totalTermFreq - PackedPosBlockNum*PackedBlockSize</li>
|
||||
* <li>The procedure how PackedPosDeltaBlock is generated is the same as PackedDocDeltaBlock
|
||||
* in chapter <a href="#Frequencies">Frequencies and Skip Data</a>.</li>
|
||||
* <li>PosDelta is the same as the format mentioned in
|
||||
* <a href="../lucene40/Lucene40PostingsFormat.html#Positions">Lucene40PostingsFormat:Positions</a>
|
||||
* </li>
|
||||
* <li>OffsetStartDelta is the difference between this position's startOffset from the previous
|
||||
* occurrence (or zero, if this is the first occurrence in this document).</li>
|
||||
* <li>OffsetLength indicates the length of the current offset (endOffset-startOffset).</li>
|
||||
* <li>PayloadData is the blob of metadata associated with current position.</li>
|
||||
* </ul>
|
||||
* </dd>
|
||||
* </dl>
|
||||
*
|
||||
* <a name="Payloads" id="Payloads"></a>
|
||||
* <dl>
|
||||
* <dd>
|
||||
* <b>Payloads and Offsets</b>
|
||||
* <p>The .pay file will store payloads and offsets associated with certain term-document positions.
|
||||
* Some payloads and offsets will be separated out into .pos file, for speedup reason.</p>
|
||||
* <ul>
|
||||
* <li>PayFile(.pay): --> Header, <TermPayloads, TermOffsets?> <sup>TermCount</sup></li>
|
||||
* <li>Header --> {@link CodecUtil#writeHeader CodecHeader}</li>
|
||||
* <li>TermPayloads --> <PackedPayLengthBlock, SumPayLength, PayData> <sup>PackedPayBlockNum</sup>
|
||||
* <li>TermOffsets --> <PackedOffsetStartDeltaBlock, PackedOffsetLengthBlock> <sup>PackedPayBlockNum</sup>
|
||||
* <li>PackedPayLengthBlock, PackedOffsetStartDeltaBlock, PackedOffsetLengthBlock --> {@link PackedInts PackedInts}</li>
|
||||
* <li>SumPayLength --> {@link DataOutput#writeVInt VInt}</li>
|
||||
* <li>PayData --> {@link DataOutput#writeByte byte}<sup>SumPayLength</sup></li>
|
||||
* </ul>
|
||||
* <p>Notes:</p>
|
||||
* <ul>
|
||||
* <li>The order of TermPayloads/TermOffsets will be the same as TermPositions, note that part of
|
||||
* payload/offsets are stored in .pos.</li>
|
||||
* <li>The procedure how PackedPayLengthBlock and PackedOffsetLengthBlock are generated is the
|
||||
* same as PackedFreqBlock in chapter <a href="#Frequencies">Frequencies and Skip Data</a>.
|
||||
* While PackedStartDeltaBlock follows a same procedure as PackedDocDeltaBlock.</li>
|
||||
* <li>PackedPayBlockNum is always equal to PackedPosBlockNum, for the same term. It is also synonym
|
||||
* for PackedOffsetBlockNum.</li>
|
||||
* <li>SumPayLength is the total length of payloads written within one block, should be the sum
|
||||
* of PayLengths in one packed block.</li>
|
||||
* <li>PayLength in PackedPayLengthBlock is the length of each payload, associated with current
|
||||
* position.</li>
|
||||
* </ul>
|
||||
* </dd>
|
||||
* </dl>
|
||||
* </p>
|
||||
*
|
||||
* @lucene.experimental
|
||||
*/
|
||||
|
||||
public final class BlockPostingsFormat extends PostingsFormat {
|
||||
/**
|
||||
* Filename extension for document number, frequencies, and skip data.
|
||||
* See chapter: <a href="#Frequencies">Frequencies and Skip Data</a>
|
||||
*/
|
||||
public static final String DOC_EXTENSION = "doc";
|
||||
|
||||
/**
|
||||
* Filename extension for positions.
|
||||
* See chapter: <a href="#Positions">Positions</a>
|
||||
*/
|
||||
public static final String POS_EXTENSION = "pos";
|
||||
|
||||
/**
|
||||
* Filename extension for payloads and offsets.
|
||||
* See chapter: <a href="#Payloads">Payloads and Offsets</a>
|
||||
*/
|
||||
public static final String PAY_EXTENSION = "pay";
|
||||
|
||||
private final int minTermBlockSize;
|
||||
private final int maxTermBlockSize;
|
||||
|
||||
/**
|
||||
* Fixed packed block size, number of integers encoded in
|
||||
* a single packed block.
|
||||
*/
|
||||
// NOTE: must be multiple of 64 because of PackedInts long-aligned encoding/decoding
|
||||
public final static int BLOCK_SIZE = 128;
|
||||
|
||||
public BlockPostingsFormat() {
|
||||
this(BlockTreeTermsWriter.DEFAULT_MIN_BLOCK_SIZE, BlockTreeTermsWriter.DEFAULT_MAX_BLOCK_SIZE);
|
||||
}
|
||||
|
||||
public BlockPostingsFormat(int minTermBlockSize, int maxTermBlockSize) {
|
||||
super("Block");
|
||||
this.minTermBlockSize = minTermBlockSize;
|
||||
assert minTermBlockSize > 1;
|
||||
this.maxTermBlockSize = maxTermBlockSize;
|
||||
assert minTermBlockSize <= maxTermBlockSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getName() + "(blocksize=" + BLOCK_SIZE + ")";
|
||||
}
|
||||
|
||||
@Override
|
||||
public FieldsConsumer fieldsConsumer(SegmentWriteState state) throws IOException {
|
||||
PostingsWriterBase postingsWriter = new BlockPostingsWriter(state);
|
||||
|
||||
boolean success = false;
|
||||
try {
|
||||
FieldsConsumer ret = new BlockTreeTermsWriter(state,
|
||||
postingsWriter,
|
||||
minTermBlockSize,
|
||||
maxTermBlockSize);
|
||||
success = true;
|
||||
return ret;
|
||||
} finally {
|
||||
if (!success) {
|
||||
IOUtils.closeWhileHandlingException(postingsWriter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public FieldsProducer fieldsProducer(SegmentReadState state) throws IOException {
|
||||
PostingsReaderBase postingsReader = new BlockPostingsReader(state.dir,
|
||||
state.fieldInfos,
|
||||
state.segmentInfo,
|
||||
state.context,
|
||||
state.segmentSuffix);
|
||||
boolean success = false;
|
||||
try {
|
||||
FieldsProducer ret = new BlockTreeTermsReader(state.dir,
|
||||
state.fieldInfos,
|
||||
state.segmentInfo.name,
|
||||
postingsReader,
|
||||
state.context,
|
||||
state.segmentSuffix,
|
||||
state.termsIndexDivisor);
|
||||
success = true;
|
||||
return ret;
|
||||
} finally {
|
||||
if (!success) {
|
||||
IOUtils.closeWhileHandlingException(postingsReader);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,563 @@
|
|||
package org.apache.lucene.codecs.block;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import static org.apache.lucene.codecs.block.BlockPostingsFormat.BLOCK_SIZE;
|
||||
import static org.apache.lucene.codecs.block.ForUtil.MAX_DATA_SIZE;
|
||||
import static org.apache.lucene.codecs.block.ForUtil.MAX_ENCODED_SIZE;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.lucene.codecs.CodecUtil;
|
||||
import org.apache.lucene.codecs.PostingsWriterBase;
|
||||
import org.apache.lucene.codecs.TermStats;
|
||||
import org.apache.lucene.index.CorruptIndexException;
|
||||
import org.apache.lucene.index.FieldInfo;
|
||||
import org.apache.lucene.index.FieldInfo.IndexOptions;
|
||||
import org.apache.lucene.index.IndexFileNames;
|
||||
import org.apache.lucene.index.SegmentWriteState;
|
||||
import org.apache.lucene.store.IndexOutput;
|
||||
import org.apache.lucene.store.RAMOutputStream;
|
||||
import org.apache.lucene.util.ArrayUtil;
|
||||
import org.apache.lucene.util.BytesRef;
|
||||
import org.apache.lucene.util.IOUtils;
|
||||
import org.apache.lucene.util.packed.PackedInts;
|
||||
|
||||
|
||||
/**
|
||||
* Concrete class that writes docId(maybe frq,pos,offset,payloads) list
|
||||
* with postings format.
|
||||
*
|
||||
* Postings list for each term will be stored separately.
|
||||
*
|
||||
* @see BlockSkipWriter for details about skipping setting and postings layout.
|
||||
*
|
||||
*/
|
||||
final class BlockPostingsWriter extends PostingsWriterBase {
|
||||
|
||||
/**
|
||||
* Expert: The maximum number of skip levels. Smaller values result in
|
||||
* slightly smaller indexes, but slower skipping in big posting lists.
|
||||
*/
|
||||
static final int maxSkipLevels = 10;
|
||||
|
||||
final static String TERMS_CODEC = "BlockPostingsWriterTerms";
|
||||
final static String DOC_CODEC = "BlockPostingsWriterDoc";
|
||||
final static String POS_CODEC = "BlockPostingsWriterPos";
|
||||
final static String PAY_CODEC = "BlockPostingsWriterPay";
|
||||
|
||||
// Increment version to change it:
|
||||
final static int VERSION_START = 0;
|
||||
final static int VERSION_CURRENT = VERSION_START;
|
||||
|
||||
final IndexOutput docOut;
|
||||
final IndexOutput posOut;
|
||||
final IndexOutput payOut;
|
||||
|
||||
private IndexOutput termsOut;
|
||||
|
||||
// How current field indexes postings:
|
||||
private boolean fieldHasFreqs;
|
||||
private boolean fieldHasPositions;
|
||||
private boolean fieldHasOffsets;
|
||||
private boolean fieldHasPayloads;
|
||||
|
||||
// Holds starting file pointers for each term:
|
||||
private long docTermStartFP;
|
||||
private long posTermStartFP;
|
||||
private long payTermStartFP;
|
||||
|
||||
final int[] docDeltaBuffer;
|
||||
final int[] freqBuffer;
|
||||
private int docBufferUpto;
|
||||
|
||||
final int[] posDeltaBuffer;
|
||||
final int[] payloadLengthBuffer;
|
||||
final int[] offsetStartDeltaBuffer;
|
||||
final int[] offsetLengthBuffer;
|
||||
private int posBufferUpto;
|
||||
|
||||
private byte[] payloadBytes;
|
||||
private int payloadByteUpto;
|
||||
|
||||
private int lastBlockDocID;
|
||||
private long lastBlockPosFP;
|
||||
private long lastBlockPayFP;
|
||||
private int lastBlockPosBufferUpto;
|
||||
private int lastBlockStartOffset;
|
||||
private int lastBlockPayloadByteUpto;
|
||||
|
||||
private int lastDocID;
|
||||
private int lastPosition;
|
||||
private int lastStartOffset;
|
||||
private int docCount;
|
||||
|
||||
final byte[] encoded;
|
||||
|
||||
private final ForUtil forUtil;
|
||||
private final BlockSkipWriter skipWriter;
|
||||
|
||||
public BlockPostingsWriter(SegmentWriteState state, float acceptableOverheadRatio) throws IOException {
|
||||
super();
|
||||
|
||||
docOut = state.directory.createOutput(IndexFileNames.segmentFileName(state.segmentInfo.name, state.segmentSuffix, BlockPostingsFormat.DOC_EXTENSION),
|
||||
state.context);
|
||||
IndexOutput posOut = null;
|
||||
IndexOutput payOut = null;
|
||||
boolean success = false;
|
||||
try {
|
||||
CodecUtil.writeHeader(docOut, DOC_CODEC, VERSION_CURRENT);
|
||||
forUtil = new ForUtil(acceptableOverheadRatio, docOut);
|
||||
if (state.fieldInfos.hasProx()) {
|
||||
posDeltaBuffer = new int[MAX_DATA_SIZE];
|
||||
posOut = state.directory.createOutput(IndexFileNames.segmentFileName(state.segmentInfo.name, state.segmentSuffix, BlockPostingsFormat.POS_EXTENSION),
|
||||
state.context);
|
||||
CodecUtil.writeHeader(posOut, POS_CODEC, VERSION_CURRENT);
|
||||
|
||||
if (state.fieldInfos.hasPayloads()) {
|
||||
payloadBytes = new byte[128];
|
||||
payloadLengthBuffer = new int[MAX_DATA_SIZE];
|
||||
} else {
|
||||
payloadBytes = null;
|
||||
payloadLengthBuffer = null;
|
||||
}
|
||||
|
||||
if (state.fieldInfos.hasOffsets()) {
|
||||
offsetStartDeltaBuffer = new int[MAX_DATA_SIZE];
|
||||
offsetLengthBuffer = new int[MAX_DATA_SIZE];
|
||||
} else {
|
||||
offsetStartDeltaBuffer = null;
|
||||
offsetLengthBuffer = null;
|
||||
}
|
||||
|
||||
if (state.fieldInfos.hasPayloads() || state.fieldInfos.hasOffsets()) {
|
||||
payOut = state.directory.createOutput(IndexFileNames.segmentFileName(state.segmentInfo.name, state.segmentSuffix, BlockPostingsFormat.PAY_EXTENSION),
|
||||
state.context);
|
||||
CodecUtil.writeHeader(payOut, PAY_CODEC, VERSION_CURRENT);
|
||||
}
|
||||
} else {
|
||||
posDeltaBuffer = null;
|
||||
payloadLengthBuffer = null;
|
||||
offsetStartDeltaBuffer = null;
|
||||
offsetLengthBuffer = null;
|
||||
payloadBytes = null;
|
||||
}
|
||||
this.payOut = payOut;
|
||||
this.posOut = posOut;
|
||||
success = true;
|
||||
} finally {
|
||||
if (!success) {
|
||||
IOUtils.closeWhileHandlingException(docOut, posOut, payOut);
|
||||
}
|
||||
}
|
||||
|
||||
docDeltaBuffer = new int[MAX_DATA_SIZE];
|
||||
freqBuffer = new int[MAX_DATA_SIZE];
|
||||
|
||||
// TODO: should we try skipping every 2/4 blocks...?
|
||||
skipWriter = new BlockSkipWriter(maxSkipLevels,
|
||||
BLOCK_SIZE,
|
||||
state.segmentInfo.getDocCount(),
|
||||
docOut,
|
||||
posOut,
|
||||
payOut);
|
||||
|
||||
encoded = new byte[MAX_ENCODED_SIZE];
|
||||
}
|
||||
|
||||
public BlockPostingsWriter(SegmentWriteState state) throws IOException {
|
||||
this(state, PackedInts.COMPACT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(IndexOutput termsOut) throws IOException {
|
||||
this.termsOut = termsOut;
|
||||
CodecUtil.writeHeader(termsOut, TERMS_CODEC, VERSION_CURRENT);
|
||||
termsOut.writeVInt(BLOCK_SIZE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setField(FieldInfo fieldInfo) {
|
||||
IndexOptions indexOptions = fieldInfo.getIndexOptions();
|
||||
fieldHasFreqs = indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS) >= 0;
|
||||
fieldHasPositions = indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0;
|
||||
fieldHasOffsets = indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
|
||||
fieldHasPayloads = fieldInfo.hasPayloads();
|
||||
skipWriter.setField(fieldHasPositions, fieldHasOffsets, fieldHasPayloads);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startTerm() {
|
||||
docTermStartFP = docOut.getFilePointer();
|
||||
if (fieldHasPositions) {
|
||||
posTermStartFP = posOut.getFilePointer();
|
||||
if (fieldHasPayloads || fieldHasOffsets) {
|
||||
payTermStartFP = payOut.getFilePointer();
|
||||
}
|
||||
}
|
||||
lastDocID = 0;
|
||||
lastBlockDocID = -1;
|
||||
// if (DEBUG) {
|
||||
// System.out.println("FPW.startTerm startFP=" + docTermStartFP);
|
||||
// }
|
||||
skipWriter.resetSkip();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startDoc(int docID, int termDocFreq) throws IOException {
|
||||
// if (DEBUG) {
|
||||
// System.out.println("FPW.startDoc docID["+docBufferUpto+"]=" + docID);
|
||||
// }
|
||||
// Have collected a block of docs, and get a new doc.
|
||||
// Should write skip data as well as postings list for
|
||||
// current block.
|
||||
if (lastBlockDocID != -1 && docBufferUpto == 0) {
|
||||
// if (DEBUG) {
|
||||
// System.out.println(" bufferSkip at writeBlock: lastDocID=" + lastBlockDocID + " docCount=" + (docCount-1));
|
||||
// }
|
||||
skipWriter.bufferSkip(lastBlockDocID, docCount, lastBlockPosFP, lastBlockPayFP, lastBlockPosBufferUpto, lastBlockStartOffset, lastBlockPayloadByteUpto);
|
||||
}
|
||||
|
||||
final int docDelta = docID - lastDocID;
|
||||
|
||||
if (docID < 0 || (docCount > 0 && docDelta <= 0)) {
|
||||
throw new CorruptIndexException("docs out of order (" + docID + " <= " + lastDocID + " ) (docOut: " + docOut + ")");
|
||||
}
|
||||
|
||||
docDeltaBuffer[docBufferUpto] = docDelta;
|
||||
// if (DEBUG) {
|
||||
// System.out.println(" docDeltaBuffer[" + docBufferUpto + "]=" + docDelta);
|
||||
// }
|
||||
if (fieldHasFreqs) {
|
||||
freqBuffer[docBufferUpto] = termDocFreq;
|
||||
}
|
||||
docBufferUpto++;
|
||||
docCount++;
|
||||
|
||||
if (docBufferUpto == BLOCK_SIZE) {
|
||||
// if (DEBUG) {
|
||||
// System.out.println(" write docDelta block @ fp=" + docOut.getFilePointer());
|
||||
// }
|
||||
forUtil.writeBlock(docDeltaBuffer, encoded, docOut);
|
||||
if (fieldHasFreqs) {
|
||||
// if (DEBUG) {
|
||||
// System.out.println(" write freq block @ fp=" + docOut.getFilePointer());
|
||||
// }
|
||||
forUtil.writeBlock(freqBuffer, encoded, docOut);
|
||||
}
|
||||
// NOTE: don't set docBufferUpto back to 0 here;
|
||||
// finishDoc will do so (because it needs to see that
|
||||
// the block was filled so it can save skip data)
|
||||
}
|
||||
|
||||
|
||||
lastDocID = docID;
|
||||
lastPosition = 0;
|
||||
lastStartOffset = 0;
|
||||
}
|
||||
|
||||
/** Add a new position & payload */
|
||||
@Override
|
||||
public void addPosition(int position, BytesRef payload, int startOffset, int endOffset) throws IOException {
|
||||
// if (DEBUG) {
|
||||
// System.out.println("FPW.addPosition pos=" + position + " posBufferUpto=" + posBufferUpto + (fieldHasPayloads ? " payloadByteUpto=" + payloadByteUpto: ""));
|
||||
// }
|
||||
posDeltaBuffer[posBufferUpto] = position - lastPosition;
|
||||
if (fieldHasPayloads) {
|
||||
if (payload == null || payload.length == 0) {
|
||||
// no payload
|
||||
payloadLengthBuffer[posBufferUpto] = 0;
|
||||
} else {
|
||||
payloadLengthBuffer[posBufferUpto] = payload.length;
|
||||
if (payloadByteUpto + payload.length > payloadBytes.length) {
|
||||
payloadBytes = ArrayUtil.grow(payloadBytes, payloadByteUpto + payload.length);
|
||||
}
|
||||
System.arraycopy(payload.bytes, payload.offset, payloadBytes, payloadByteUpto, payload.length);
|
||||
payloadByteUpto += payload.length;
|
||||
}
|
||||
}
|
||||
|
||||
if (fieldHasOffsets) {
|
||||
assert startOffset >= lastStartOffset;
|
||||
assert endOffset >= startOffset;
|
||||
offsetStartDeltaBuffer[posBufferUpto] = startOffset - lastStartOffset;
|
||||
offsetLengthBuffer[posBufferUpto] = endOffset - startOffset;
|
||||
lastStartOffset = startOffset;
|
||||
}
|
||||
|
||||
posBufferUpto++;
|
||||
lastPosition = position;
|
||||
if (posBufferUpto == BLOCK_SIZE) {
|
||||
// if (DEBUG) {
|
||||
// System.out.println(" write pos bulk block @ fp=" + posOut.getFilePointer());
|
||||
// }
|
||||
forUtil.writeBlock(posDeltaBuffer, encoded, posOut);
|
||||
|
||||
if (fieldHasPayloads) {
|
||||
forUtil.writeBlock(payloadLengthBuffer, encoded, payOut);
|
||||
payOut.writeVInt(payloadByteUpto);
|
||||
payOut.writeBytes(payloadBytes, 0, payloadByteUpto);
|
||||
payloadByteUpto = 0;
|
||||
}
|
||||
if (fieldHasOffsets) {
|
||||
forUtil.writeBlock(offsetStartDeltaBuffer, encoded, payOut);
|
||||
forUtil.writeBlock(offsetLengthBuffer, encoded, payOut);
|
||||
}
|
||||
posBufferUpto = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishDoc() throws IOException {
|
||||
// Since we don't know df for current term, we had to buffer
|
||||
// those skip data for each block, and when a new doc comes,
|
||||
// write them to skip file.
|
||||
if (docBufferUpto == BLOCK_SIZE) {
|
||||
lastBlockDocID = lastDocID;
|
||||
if (posOut != null) {
|
||||
if (payOut != null) {
|
||||
lastBlockPayFP = payOut.getFilePointer();
|
||||
}
|
||||
lastBlockPosFP = posOut.getFilePointer();
|
||||
lastBlockPosBufferUpto = posBufferUpto;
|
||||
lastBlockStartOffset = lastStartOffset;
|
||||
lastBlockPayloadByteUpto = payloadByteUpto;
|
||||
}
|
||||
// if (DEBUG) {
|
||||
// System.out.println(" docBufferUpto="+docBufferUpto+" now get lastBlockDocID="+lastBlockDocID+" lastBlockPosFP=" + lastBlockPosFP + " lastBlockPosBufferUpto=" + lastBlockPosBufferUpto + " lastBlockPayloadByteUpto=" + lastBlockPayloadByteUpto);
|
||||
// }
|
||||
docBufferUpto = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private static class PendingTerm {
|
||||
public final long docStartFP;
|
||||
public final long posStartFP;
|
||||
public final long payStartFP;
|
||||
public final int skipOffset;
|
||||
public final int lastPosBlockOffset;
|
||||
|
||||
public PendingTerm(long docStartFP, long posStartFP, long payStartFP, int skipOffset, int lastPosBlockOffset) {
|
||||
this.docStartFP = docStartFP;
|
||||
this.posStartFP = posStartFP;
|
||||
this.payStartFP = payStartFP;
|
||||
this.skipOffset = skipOffset;
|
||||
this.lastPosBlockOffset = lastPosBlockOffset;
|
||||
}
|
||||
}
|
||||
|
||||
private final List<PendingTerm> pendingTerms = new ArrayList<PendingTerm>();
|
||||
|
||||
/** Called when we are done adding docs to this term */
|
||||
@Override
|
||||
public void finishTerm(TermStats stats) throws IOException {
|
||||
assert stats.docFreq > 0;
|
||||
|
||||
// TODO: wasteful we are counting this (counting # docs
|
||||
// for this term) in two places?
|
||||
assert stats.docFreq == docCount: stats.docFreq + " vs " + docCount;
|
||||
|
||||
// if (DEBUG) {
|
||||
// System.out.println("FPW.finishTerm docFreq=" + stats.docFreq);
|
||||
// }
|
||||
|
||||
// if (DEBUG) {
|
||||
// if (docBufferUpto > 0) {
|
||||
// System.out.println(" write doc/freq vInt block (count=" + docBufferUpto + ") at fp=" + docOut.getFilePointer() + " docTermStartFP=" + docTermStartFP);
|
||||
// }
|
||||
// }
|
||||
|
||||
// vInt encode the remaining doc deltas and freqs:
|
||||
for(int i=0;i<docBufferUpto;i++) {
|
||||
final int docDelta = docDeltaBuffer[i];
|
||||
final int freq = freqBuffer[i];
|
||||
if (!fieldHasFreqs) {
|
||||
docOut.writeVInt(docDelta);
|
||||
} else if (freqBuffer[i] == 1) {
|
||||
docOut.writeVInt((docDelta<<1)|1);
|
||||
} else {
|
||||
docOut.writeVInt(docDelta<<1);
|
||||
docOut.writeVInt(freq);
|
||||
}
|
||||
}
|
||||
|
||||
final int lastPosBlockOffset;
|
||||
|
||||
if (fieldHasPositions) {
|
||||
// if (DEBUG) {
|
||||
// if (posBufferUpto > 0) {
|
||||
// System.out.println(" write pos vInt block (count=" + posBufferUpto + ") at fp=" + posOut.getFilePointer() + " posTermStartFP=" + posTermStartFP + " hasPayloads=" + fieldHasPayloads + " hasOffsets=" + fieldHasOffsets);
|
||||
// }
|
||||
// }
|
||||
|
||||
// totalTermFreq is just total number of positions(or payloads, or offsets)
|
||||
// associated with current term.
|
||||
assert stats.totalTermFreq != -1;
|
||||
if (stats.totalTermFreq > BLOCK_SIZE) {
|
||||
// record file offset for last pos in last block
|
||||
lastPosBlockOffset = (int) (posOut.getFilePointer() - posTermStartFP);
|
||||
} else {
|
||||
lastPosBlockOffset = -1;
|
||||
}
|
||||
if (posBufferUpto > 0) {
|
||||
posOut.writeVInt(posBufferUpto);
|
||||
|
||||
// TODO: should we send offsets/payloads to
|
||||
// .pay...? seems wasteful (have to store extra
|
||||
// vLong for low (< BLOCK_SIZE) DF terms = vast vast
|
||||
// majority)
|
||||
|
||||
// vInt encode the remaining positions/payloads/offsets:
|
||||
int lastPayloadLength = -1;
|
||||
int payloadBytesReadUpto = 0;
|
||||
for(int i=0;i<posBufferUpto;i++) {
|
||||
final int posDelta = posDeltaBuffer[i];
|
||||
if (fieldHasPayloads) {
|
||||
final int payloadLength = payloadLengthBuffer[i];
|
||||
if (payloadLength != lastPayloadLength) {
|
||||
lastPayloadLength = payloadLength;
|
||||
posOut.writeVInt((posDelta<<1)|1);
|
||||
posOut.writeVInt(payloadLength);
|
||||
} else {
|
||||
posOut.writeVInt(posDelta<<1);
|
||||
}
|
||||
|
||||
// if (DEBUG) {
|
||||
// System.out.println(" i=" + i + " payloadLen=" + payloadLength);
|
||||
// }
|
||||
|
||||
if (payloadLength != 0) {
|
||||
// if (DEBUG) {
|
||||
// System.out.println(" write payload @ pos.fp=" + posOut.getFilePointer());
|
||||
// }
|
||||
posOut.writeBytes(payloadBytes, payloadBytesReadUpto, payloadLength);
|
||||
payloadBytesReadUpto += payloadLength;
|
||||
}
|
||||
} else {
|
||||
posOut.writeVInt(posDelta);
|
||||
}
|
||||
|
||||
if (fieldHasOffsets) {
|
||||
// if (DEBUG) {
|
||||
// System.out.println(" write offset @ pos.fp=" + posOut.getFilePointer());
|
||||
// }
|
||||
posOut.writeVInt(offsetStartDeltaBuffer[i]);
|
||||
posOut.writeVInt(offsetLengthBuffer[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (fieldHasPayloads) {
|
||||
assert payloadBytesReadUpto == payloadByteUpto;
|
||||
payloadByteUpto = 0;
|
||||
}
|
||||
}
|
||||
// if (DEBUG) {
|
||||
// System.out.println(" totalTermFreq=" + stats.totalTermFreq + " lastPosBlockOffset=" + lastPosBlockOffset);
|
||||
// }
|
||||
} else {
|
||||
lastPosBlockOffset = -1;
|
||||
}
|
||||
|
||||
int skipOffset;
|
||||
if (docCount > BLOCK_SIZE) {
|
||||
skipOffset = (int) (skipWriter.writeSkip(docOut) - docTermStartFP);
|
||||
|
||||
// if (DEBUG) {
|
||||
// System.out.println("skip packet " + (docOut.getFilePointer() - (docTermStartFP + skipOffset)) + " bytes");
|
||||
// }
|
||||
} else {
|
||||
skipOffset = -1;
|
||||
// if (DEBUG) {
|
||||
// System.out.println(" no skip: docCount=" + docCount);
|
||||
// }
|
||||
}
|
||||
|
||||
long payStartFP;
|
||||
if (stats.totalTermFreq >= BLOCK_SIZE) {
|
||||
payStartFP = payTermStartFP;
|
||||
} else {
|
||||
payStartFP = -1;
|
||||
}
|
||||
|
||||
// if (DEBUG) {
|
||||
// System.out.println(" payStartFP=" + payStartFP);
|
||||
// }
|
||||
|
||||
pendingTerms.add(new PendingTerm(docTermStartFP, posTermStartFP, payStartFP, skipOffset, lastPosBlockOffset));
|
||||
docBufferUpto = 0;
|
||||
posBufferUpto = 0;
|
||||
lastDocID = 0;
|
||||
docCount = 0;
|
||||
}
|
||||
|
||||
private final RAMOutputStream bytesWriter = new RAMOutputStream();
|
||||
|
||||
@Override
|
||||
public void flushTermsBlock(int start, int count) throws IOException {
|
||||
|
||||
if (count == 0) {
|
||||
termsOut.writeByte((byte) 0);
|
||||
return;
|
||||
}
|
||||
|
||||
assert start <= pendingTerms.size();
|
||||
assert count <= start;
|
||||
|
||||
final int limit = pendingTerms.size() - start + count;
|
||||
|
||||
long lastDocStartFP = 0;
|
||||
long lastPosStartFP = 0;
|
||||
long lastPayStartFP = 0;
|
||||
for(int idx=limit-count; idx<limit; idx++) {
|
||||
PendingTerm term = pendingTerms.get(idx);
|
||||
|
||||
bytesWriter.writeVLong(term.docStartFP - lastDocStartFP);
|
||||
lastDocStartFP = term.docStartFP;
|
||||
|
||||
if (fieldHasPositions) {
|
||||
bytesWriter.writeVLong(term.posStartFP - lastPosStartFP);
|
||||
lastPosStartFP = term.posStartFP;
|
||||
if (term.lastPosBlockOffset != -1) {
|
||||
bytesWriter.writeVInt(term.lastPosBlockOffset);
|
||||
}
|
||||
if ((fieldHasPayloads || fieldHasOffsets) && term.payStartFP != -1) {
|
||||
bytesWriter.writeVLong(term.payStartFP - lastPayStartFP);
|
||||
lastPayStartFP = term.payStartFP;
|
||||
}
|
||||
}
|
||||
|
||||
if (term.skipOffset != -1) {
|
||||
bytesWriter.writeVInt(term.skipOffset);
|
||||
}
|
||||
}
|
||||
|
||||
termsOut.writeVInt((int) bytesWriter.getFilePointer());
|
||||
bytesWriter.writeTo(termsOut);
|
||||
bytesWriter.reset();
|
||||
|
||||
// Remove the terms we just wrote:
|
||||
pendingTerms.subList(limit-count, limit).clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
IOUtils.close(docOut, posOut, payOut);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,244 @@
|
|||
package org.apache.lucene.codecs.block;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.apache.lucene.codecs.MultiLevelSkipListReader;
|
||||
import org.apache.lucene.store.IndexInput;
|
||||
|
||||
/**
|
||||
* Implements the skip list reader for block postings format
|
||||
* that stores positions and payloads.
|
||||
*
|
||||
* Although this skipper uses MultiLevelSkipListReader as an interface,
|
||||
* its definition of skip position will be a little different.
|
||||
*
|
||||
* For example, when skipInterval = blockSize = 3, df = 2*skipInterval = 6,
|
||||
*
|
||||
* 0 1 2 3 4 5
|
||||
* d d d d d d (posting list)
|
||||
* ^ ^ (skip point in MultiLeveSkipWriter)
|
||||
* ^ (skip point in BlockSkipWriter)
|
||||
*
|
||||
* In this case, MultiLevelSkipListReader will use the last document as a skip point,
|
||||
* while BlockSkipReader should assume no skip point will comes.
|
||||
*
|
||||
* If we use the interface directly in BlockSkipReader, it may silly try to read
|
||||
* another skip data after the only skip point is loaded.
|
||||
*
|
||||
* To illustrate this, we can call skipTo(d[5]), since skip point d[3] has smaller docId,
|
||||
* and numSkipped+blockSize== df, the MultiLevelSkipListReader will assume the skip list
|
||||
* isn't exhausted yet, and try to load a non-existed skip point
|
||||
*
|
||||
* Therefore, we'll trim df before passing it to the interface. see trim(int)
|
||||
*
|
||||
*/
|
||||
final class BlockSkipReader extends MultiLevelSkipListReader {
|
||||
// private boolean DEBUG = BlockPostingsReader.DEBUG;
|
||||
private final int blockSize;
|
||||
|
||||
private long docPointer[];
|
||||
private long posPointer[];
|
||||
private long payPointer[];
|
||||
private int posBufferUpto[];
|
||||
private int startOffset[];
|
||||
private int payloadByteUpto[];
|
||||
|
||||
private long lastPosPointer;
|
||||
private long lastPayPointer;
|
||||
private int lastStartOffset;
|
||||
private int lastPayloadByteUpto;
|
||||
private long lastDocPointer;
|
||||
private int lastPosBufferUpto;
|
||||
|
||||
public BlockSkipReader(IndexInput skipStream, int maxSkipLevels, int blockSize, boolean hasPos, boolean hasOffsets, boolean hasPayloads) {
|
||||
super(skipStream, maxSkipLevels, blockSize, 8);
|
||||
this.blockSize = blockSize;
|
||||
docPointer = new long[maxSkipLevels];
|
||||
if (hasPos) {
|
||||
posPointer = new long[maxSkipLevels];
|
||||
posBufferUpto = new int[maxSkipLevels];
|
||||
if (hasPayloads) {
|
||||
payloadByteUpto = new int[maxSkipLevels];
|
||||
} else {
|
||||
payloadByteUpto = null;
|
||||
}
|
||||
if (hasOffsets) {
|
||||
startOffset = new int[maxSkipLevels];
|
||||
} else {
|
||||
startOffset = null;
|
||||
}
|
||||
if (hasOffsets || hasPayloads) {
|
||||
payPointer = new long[maxSkipLevels];
|
||||
} else {
|
||||
payPointer = null;
|
||||
}
|
||||
} else {
|
||||
posPointer = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Trim original docFreq to tell skipReader read proper number of skip points.
|
||||
*
|
||||
* Since our definition in BlockSkip* is a little different from MultiLevelSkip*
|
||||
* This trimmed docFreq will prevent skipReader from:
|
||||
* 1. silly reading a non-existed skip point after the last block boundary
|
||||
* 2. moving into the vInt block
|
||||
*
|
||||
*/
|
||||
protected int trim(int df) {
|
||||
return df % blockSize == 0? df - 1: df;
|
||||
}
|
||||
|
||||
public void init(long skipPointer, long docBasePointer, long posBasePointer, long payBasePointer, int df) {
|
||||
super.init(skipPointer, trim(df));
|
||||
lastDocPointer = docBasePointer;
|
||||
lastPosPointer = posBasePointer;
|
||||
lastPayPointer = payBasePointer;
|
||||
|
||||
Arrays.fill(docPointer, docBasePointer);
|
||||
if (posPointer != null) {
|
||||
Arrays.fill(posPointer, posBasePointer);
|
||||
if (payPointer != null) {
|
||||
Arrays.fill(payPointer, payBasePointer);
|
||||
}
|
||||
} else {
|
||||
assert posBasePointer == 0;
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns the doc pointer of the doc to which the last call of
|
||||
* {@link MultiLevelSkipListReader#skipTo(int)} has skipped. */
|
||||
public long getDocPointer() {
|
||||
return lastDocPointer;
|
||||
}
|
||||
|
||||
public long getPosPointer() {
|
||||
return lastPosPointer;
|
||||
}
|
||||
|
||||
public int getPosBufferUpto() {
|
||||
return lastPosBufferUpto;
|
||||
}
|
||||
|
||||
public long getPayPointer() {
|
||||
return lastPayPointer;
|
||||
}
|
||||
|
||||
public int getStartOffset() {
|
||||
return lastStartOffset;
|
||||
}
|
||||
|
||||
public int getPayloadByteUpto() {
|
||||
return lastPayloadByteUpto;
|
||||
}
|
||||
|
||||
public int getNextSkipDoc() {
|
||||
return skipDoc[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void seekChild(int level) throws IOException {
|
||||
super.seekChild(level);
|
||||
// if (DEBUG) {
|
||||
// System.out.println("seekChild level=" + level);
|
||||
// }
|
||||
docPointer[level] = lastDocPointer;
|
||||
if (posPointer != null) {
|
||||
posPointer[level] = lastPosPointer;
|
||||
posBufferUpto[level] = lastPosBufferUpto;
|
||||
if (startOffset != null) {
|
||||
startOffset[level] = lastStartOffset;
|
||||
}
|
||||
if (payloadByteUpto != null) {
|
||||
payloadByteUpto[level] = lastPayloadByteUpto;
|
||||
}
|
||||
if (payPointer != null) {
|
||||
payPointer[level] = lastPayPointer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setLastSkipData(int level) {
|
||||
super.setLastSkipData(level);
|
||||
lastDocPointer = docPointer[level];
|
||||
// if (DEBUG) {
|
||||
// System.out.println("setLastSkipData level=" + level);
|
||||
// System.out.println(" lastDocPointer=" + lastDocPointer);
|
||||
// }
|
||||
if (posPointer != null) {
|
||||
lastPosPointer = posPointer[level];
|
||||
lastPosBufferUpto = posBufferUpto[level];
|
||||
// if (DEBUG) {
|
||||
// System.out.println(" lastPosPointer=" + lastPosPointer + " lastPosBUfferUpto=" + lastPosBufferUpto);
|
||||
// }
|
||||
if (payPointer != null) {
|
||||
lastPayPointer = payPointer[level];
|
||||
}
|
||||
if (startOffset != null) {
|
||||
lastStartOffset = startOffset[level];
|
||||
}
|
||||
if (payloadByteUpto != null) {
|
||||
lastPayloadByteUpto = payloadByteUpto[level];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int readSkipData(int level, IndexInput skipStream) throws IOException {
|
||||
// if (DEBUG) {
|
||||
// System.out.println("readSkipData level=" + level);
|
||||
// }
|
||||
int delta = skipStream.readVInt();
|
||||
// if (DEBUG) {
|
||||
// System.out.println(" delta=" + delta);
|
||||
// }
|
||||
docPointer[level] += skipStream.readVInt();
|
||||
// if (DEBUG) {
|
||||
// System.out.println(" docFP=" + docPointer[level]);
|
||||
// }
|
||||
|
||||
if (posPointer != null) {
|
||||
posPointer[level] += skipStream.readVInt();
|
||||
// if (DEBUG) {
|
||||
// System.out.println(" posFP=" + posPointer[level]);
|
||||
// }
|
||||
posBufferUpto[level] = skipStream.readVInt();
|
||||
// if (DEBUG) {
|
||||
// System.out.println(" posBufferUpto=" + posBufferUpto[level]);
|
||||
// }
|
||||
|
||||
if (payloadByteUpto != null) {
|
||||
payloadByteUpto[level] = skipStream.readVInt();
|
||||
}
|
||||
|
||||
if (startOffset != null) {
|
||||
startOffset[level] += skipStream.readVInt();
|
||||
}
|
||||
|
||||
if (payPointer != null) {
|
||||
payPointer[level] += skipStream.readVInt();
|
||||
}
|
||||
}
|
||||
return delta;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,163 @@
|
|||
package org.apache.lucene.codecs.block;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.apache.lucene.store.IndexOutput;
|
||||
import org.apache.lucene.codecs.MultiLevelSkipListWriter;
|
||||
|
||||
/**
|
||||
* Write skip lists with multiple levels, and support skip within block ints.
|
||||
*
|
||||
* Assume that docFreq = 28, skipInterval = blockSize = 12
|
||||
*
|
||||
* | block#0 | | block#1 | |vInts|
|
||||
* d d d d d d d d d d d d d d d d d d d d d d d d d d d d (posting list)
|
||||
* ^ ^ (level 0 skip point)
|
||||
*
|
||||
* Note that skipWriter will ignore first document in block#0, since
|
||||
* it is useless as a skip point. Also, we'll never skip into the vInts
|
||||
* block, only record skip data at the start its start point(if it exist).
|
||||
*
|
||||
* For each skip point, we will record:
|
||||
* 1. docID in former position, i.e. for position 12, record docID[11], etc.
|
||||
* 2. its related file points(position, payload),
|
||||
* 3. related numbers or uptos(position, payload).
|
||||
* 4. start offset.
|
||||
*
|
||||
*/
|
||||
final class BlockSkipWriter extends MultiLevelSkipListWriter {
|
||||
// private boolean DEBUG = BlockPostingsReader.DEBUG;
|
||||
|
||||
private int[] lastSkipDoc;
|
||||
private long[] lastSkipDocPointer;
|
||||
private long[] lastSkipPosPointer;
|
||||
private long[] lastSkipPayPointer;
|
||||
private int[] lastStartOffset;
|
||||
private int[] lastPayloadByteUpto;
|
||||
|
||||
private final IndexOutput docOut;
|
||||
private final IndexOutput posOut;
|
||||
private final IndexOutput payOut;
|
||||
|
||||
private int curDoc;
|
||||
private long curDocPointer;
|
||||
private long curPosPointer;
|
||||
private long curPayPointer;
|
||||
private int curPosBufferUpto;
|
||||
private int curStartOffset;
|
||||
private int curPayloadByteUpto;
|
||||
private boolean fieldHasPositions;
|
||||
private boolean fieldHasOffsets;
|
||||
private boolean fieldHasPayloads;
|
||||
|
||||
public BlockSkipWriter(int maxSkipLevels, int blockSize, int docCount, IndexOutput docOut, IndexOutput posOut, IndexOutput payOut) {
|
||||
super(blockSize, 8, maxSkipLevels, docCount);
|
||||
this.docOut = docOut;
|
||||
this.posOut = posOut;
|
||||
this.payOut = payOut;
|
||||
|
||||
lastSkipDoc = new int[maxSkipLevels];
|
||||
lastSkipDocPointer = new long[maxSkipLevels];
|
||||
if (posOut != null) {
|
||||
lastSkipPosPointer = new long[maxSkipLevels];
|
||||
if (payOut != null) {
|
||||
lastSkipPayPointer = new long[maxSkipLevels];
|
||||
}
|
||||
lastStartOffset = new int[maxSkipLevels];
|
||||
lastPayloadByteUpto = new int[maxSkipLevels];
|
||||
}
|
||||
}
|
||||
|
||||
public void setField(boolean fieldHasPositions, boolean fieldHasOffsets, boolean fieldHasPayloads) {
|
||||
this.fieldHasPositions = fieldHasPositions;
|
||||
this.fieldHasOffsets = fieldHasOffsets;
|
||||
this.fieldHasPayloads = fieldHasPayloads;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetSkip() {
|
||||
super.resetSkip();
|
||||
Arrays.fill(lastSkipDoc, 0);
|
||||
Arrays.fill(lastSkipDocPointer, docOut.getFilePointer());
|
||||
if (fieldHasPositions) {
|
||||
Arrays.fill(lastSkipPosPointer, posOut.getFilePointer());
|
||||
if (fieldHasOffsets) {
|
||||
Arrays.fill(lastStartOffset, 0);
|
||||
}
|
||||
if (fieldHasPayloads) {
|
||||
Arrays.fill(lastPayloadByteUpto, 0);
|
||||
}
|
||||
if (fieldHasOffsets || fieldHasPayloads) {
|
||||
Arrays.fill(lastSkipPayPointer, payOut.getFilePointer());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the values for the current skip data.
|
||||
*/
|
||||
public void bufferSkip(int doc, int numDocs, long posFP, long payFP, int posBufferUpto, int startOffset, int payloadByteUpto) throws IOException {
|
||||
this.curDoc = doc;
|
||||
this.curDocPointer = docOut.getFilePointer();
|
||||
this.curPosPointer = posFP;
|
||||
this.curPayPointer = payFP;
|
||||
this.curPosBufferUpto = posBufferUpto;
|
||||
this.curPayloadByteUpto = payloadByteUpto;
|
||||
this.curStartOffset = startOffset;
|
||||
bufferSkip(numDocs);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeSkipData(int level, IndexOutput skipBuffer) throws IOException {
|
||||
int delta = curDoc - lastSkipDoc[level];
|
||||
// if (DEBUG) {
|
||||
// System.out.println("writeSkipData level=" + level + " lastDoc=" + curDoc + " delta=" + delta + " curDocPointer=" + curDocPointer);
|
||||
// }
|
||||
skipBuffer.writeVInt(delta);
|
||||
lastSkipDoc[level] = curDoc;
|
||||
|
||||
skipBuffer.writeVInt((int) (curDocPointer - lastSkipDocPointer[level]));
|
||||
lastSkipDocPointer[level] = curDocPointer;
|
||||
|
||||
if (fieldHasPositions) {
|
||||
// if (DEBUG) {
|
||||
// System.out.println(" curPosPointer=" + curPosPointer + " curPosBufferUpto=" + curPosBufferUpto);
|
||||
// }
|
||||
skipBuffer.writeVInt((int) (curPosPointer - lastSkipPosPointer[level]));
|
||||
lastSkipPosPointer[level] = curPosPointer;
|
||||
skipBuffer.writeVInt(curPosBufferUpto);
|
||||
|
||||
if (fieldHasPayloads) {
|
||||
skipBuffer.writeVInt(curPayloadByteUpto);
|
||||
}
|
||||
|
||||
if (fieldHasOffsets) {
|
||||
skipBuffer.writeVInt(curStartOffset - lastStartOffset[level]);
|
||||
lastStartOffset[level] = curStartOffset;
|
||||
}
|
||||
|
||||
if (fieldHasOffsets || fieldHasPayloads) {
|
||||
skipBuffer.writeVInt((int) (curPayPointer - lastSkipPayPointer[level]));
|
||||
lastSkipPayPointer[level] = curPayPointer;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,247 @@
|
|||
package org.apache.lucene.codecs.block;
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.apache.lucene.index.CorruptIndexException;
|
||||
import org.apache.lucene.store.DataInput;
|
||||
import org.apache.lucene.store.DataOutput;
|
||||
import org.apache.lucene.store.IndexInput;
|
||||
import org.apache.lucene.store.IndexOutput;
|
||||
import org.apache.lucene.util.packed.PackedInts.Decoder;
|
||||
import org.apache.lucene.util.packed.PackedInts.FormatAndBits;
|
||||
import org.apache.lucene.util.packed.PackedInts;
|
||||
|
||||
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.
|
||||
*/
|
||||
final class ForUtil {
|
||||
|
||||
/**
|
||||
* Special number of bits per value used whenever all values to encode are equal.
|
||||
*/
|
||||
private static final int ALL_VALUES_EQUAL = 0;
|
||||
|
||||
/**
|
||||
* Upper limit of the number of bytes that might be required to stored
|
||||
* <code>BLOCK_SIZE</code> encoded values.
|
||||
*/
|
||||
static final int MAX_ENCODED_SIZE = BLOCK_SIZE * 4;
|
||||
|
||||
/**
|
||||
* Upper limit of the number of values that might be decoded in a single call to
|
||||
* {@link #readBlock(IndexInput, byte[], int[])}. Although values after
|
||||
* <code>BLOCK_SIZE</code> are garbage, it is necessary to allocate value buffers
|
||||
* whose size is >= MAX_DATA_SIZE to avoid {@link ArrayIndexOutOfBoundsException}s.
|
||||
*/
|
||||
static final int MAX_DATA_SIZE;
|
||||
static {
|
||||
int maxDataSize = 0;
|
||||
for(int version=PackedInts.VERSION_START;version<=PackedInts.VERSION_CURRENT;version++) {
|
||||
for (PackedInts.Format format : PackedInts.Format.values()) {
|
||||
for (int bpv = 1; bpv <= 32; ++bpv) {
|
||||
if (!format.isSupported(bpv)) {
|
||||
continue;
|
||||
}
|
||||
final PackedInts.Decoder decoder = PackedInts.getDecoder(format, version, bpv);
|
||||
final int iterations = computeIterations(decoder);
|
||||
maxDataSize = Math.max(maxDataSize, iterations * decoder.valueCount());
|
||||
}
|
||||
}
|
||||
}
|
||||
MAX_DATA_SIZE = maxDataSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute the number of iterations required to decode <code>BLOCK_SIZE</code>
|
||||
* values with the provided {@link Decoder}.
|
||||
*/
|
||||
private static int computeIterations(PackedInts.Decoder decoder) {
|
||||
return (int) Math.ceil((float) BLOCK_SIZE / decoder.valueCount());
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute the number of bytes required to encode a block of values that require
|
||||
* <code>bitsPerValue</code> bits per value with format <code>format</code>.
|
||||
*/
|
||||
private static int encodedSize(PackedInts.Format format, int bitsPerValue) {
|
||||
return format.nblocks(bitsPerValue, BLOCK_SIZE) << 3;
|
||||
}
|
||||
|
||||
private final int[] encodedSizes;
|
||||
private final PackedInts.Encoder[] encoders;
|
||||
private final PackedInts.Decoder[] decoders;
|
||||
private final int[] iterations;
|
||||
|
||||
/**
|
||||
* Create a new {@link ForUtil} instance and save state into <code>out</code>.
|
||||
*/
|
||||
ForUtil(float acceptableOverheadRatio, DataOutput out) throws IOException {
|
||||
out.writeVInt(PackedInts.VERSION_CURRENT);
|
||||
encodedSizes = new int[33];
|
||||
encoders = new PackedInts.Encoder[33];
|
||||
decoders = new PackedInts.Decoder[33];
|
||||
iterations = new int[33];
|
||||
|
||||
for (int bpv = 1; bpv <= 32; ++bpv) {
|
||||
final FormatAndBits formatAndBits = PackedInts.fastestFormatAndBits(
|
||||
BLOCK_SIZE, bpv, acceptableOverheadRatio);
|
||||
assert formatAndBits.format.isSupported(formatAndBits.bitsPerValue);
|
||||
assert formatAndBits.bitsPerValue <= 32;
|
||||
encodedSizes[bpv] = encodedSize(formatAndBits.format, formatAndBits.bitsPerValue);
|
||||
encoders[bpv] = PackedInts.getEncoder(
|
||||
formatAndBits.format, PackedInts.VERSION_CURRENT, formatAndBits.bitsPerValue);
|
||||
decoders[bpv] = PackedInts.getDecoder(
|
||||
formatAndBits.format, PackedInts.VERSION_CURRENT, formatAndBits.bitsPerValue);
|
||||
iterations[bpv] = computeIterations(decoders[bpv]);
|
||||
|
||||
out.writeVInt(formatAndBits.format.getId() << 5 | (formatAndBits.bitsPerValue - 1));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore a {@link ForUtil} from a {@link DataInput}.
|
||||
*/
|
||||
ForUtil(DataInput in) throws IOException {
|
||||
int packedIntsVersion = in.readVInt();
|
||||
if (packedIntsVersion != PackedInts.VERSION_START) {
|
||||
throw new CorruptIndexException("expected version=" + PackedInts.VERSION_START + " but got version=" + packedIntsVersion);
|
||||
}
|
||||
encodedSizes = new int[33];
|
||||
encoders = new PackedInts.Encoder[33];
|
||||
decoders = new PackedInts.Decoder[33];
|
||||
iterations = new int[33];
|
||||
|
||||
for (int bpv = 1; bpv <= 32; ++bpv) {
|
||||
final int code = in.readVInt();
|
||||
final int formatId = code >>> 5;
|
||||
final int bitsPerValue = (code & 31) + 1;
|
||||
|
||||
final PackedInts.Format format = PackedInts.Format.byId(formatId);
|
||||
assert format.isSupported(bitsPerValue);
|
||||
encodedSizes[bpv] = encodedSize(format, bitsPerValue);
|
||||
encoders[bpv] = PackedInts.getEncoder(
|
||||
format, packedIntsVersion, bitsPerValue);
|
||||
decoders[bpv] = PackedInts.getDecoder(
|
||||
format, packedIntsVersion, bitsPerValue);
|
||||
iterations[bpv] = computeIterations(decoders[bpv]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Write a block of data (<code>For</code> format).
|
||||
*
|
||||
* @param data the data to write
|
||||
* @param encoded a buffer to use to encode data
|
||||
* @param out the destination output
|
||||
* @throws IOException
|
||||
*/
|
||||
void writeBlock(int[] data, byte[] encoded, IndexOutput out) throws IOException {
|
||||
if (isAllEqual(data)) {
|
||||
out.writeVInt(ALL_VALUES_EQUAL);
|
||||
out.writeVInt(data[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
final int numBits = bitsRequired(data);
|
||||
assert numBits > 0 && numBits <= 32 : numBits;
|
||||
final PackedInts.Encoder encoder = encoders[numBits];
|
||||
final int iters = iterations[numBits];
|
||||
assert iters * encoder.valueCount() >= BLOCK_SIZE;
|
||||
final int encodedSize = encodedSizes[numBits];
|
||||
assert (iters * encoder.blockCount()) << 3 >= encodedSize;
|
||||
|
||||
out.writeVInt(numBits);
|
||||
|
||||
encoder.encode(data, 0, encoded, 0, iters);
|
||||
out.writeBytes(encoded, encodedSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the next block of data (<code>For</code> format).
|
||||
*
|
||||
* @param in the input to use to read data
|
||||
* @param encoded a buffer that can be used to store encoded data
|
||||
* @param decoded where to write decoded data
|
||||
* @throws IOException
|
||||
*/
|
||||
void readBlock(IndexInput in, byte[] encoded, int[] decoded) throws IOException {
|
||||
final int numBits = in.readVInt();
|
||||
assert numBits <= 32 : numBits;
|
||||
|
||||
if (numBits == ALL_VALUES_EQUAL) {
|
||||
final int value = in.readVInt();
|
||||
Arrays.fill(decoded, 0, BLOCK_SIZE, value);
|
||||
return;
|
||||
}
|
||||
|
||||
final int encodedSize = encodedSizes[numBits];
|
||||
in.readBytes(encoded, 0, encodedSize);
|
||||
|
||||
final PackedInts.Decoder decoder = decoders[numBits];
|
||||
final int iters = iterations[numBits];
|
||||
assert iters * decoder.valueCount() >= BLOCK_SIZE;
|
||||
|
||||
decoder.decode(encoded, 0, decoded, 0, iters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Skip the next block of data.
|
||||
*
|
||||
* @param in the input where to read data
|
||||
* @throws IOException
|
||||
*/
|
||||
void skipBlock(IndexInput in) throws IOException {
|
||||
final int numBits = in.readVInt();
|
||||
if (numBits == ALL_VALUES_EQUAL) {
|
||||
in.readVInt();
|
||||
return;
|
||||
}
|
||||
assert numBits > 0 && numBits <= 32 : numBits;
|
||||
final int encodedSize = encodedSizes[numBits];
|
||||
in.seek(in.getFilePointer() + encodedSize);
|
||||
}
|
||||
|
||||
private static boolean isAllEqual(final int[] data) {
|
||||
final long v = data[0];
|
||||
for (int i = 1; i < BLOCK_SIZE; ++i) {
|
||||
if (data[i] != v) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute the number of bits required to serialize any of the longs in
|
||||
* <code>data</code>.
|
||||
*/
|
||||
private static int bitsRequired(final int[] data) {
|
||||
long or = 0;
|
||||
for (int i = 0; i < BLOCK_SIZE; ++i) {
|
||||
assert data[i] >= 0;
|
||||
or |= data[i];
|
||||
}
|
||||
return PackedInts.bitsRequired(or);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
</head>
|
||||
<body>
|
||||
BlockPostingsFormat file format.
|
||||
</body>
|
||||
</html>
|
|
@ -207,14 +207,10 @@ public class BloomFilteringPostingsFormat extends PostingsFormat {
|
|||
}
|
||||
}
|
||||
|
||||
public int size() throws IOException {
|
||||
public int size() {
|
||||
return delegateFieldsProducer.size();
|
||||
}
|
||||
|
||||
public long getUniqueTermCount() throws IOException {
|
||||
return delegateFieldsProducer.getUniqueTermCount();
|
||||
}
|
||||
|
||||
class BloomFilteredTerms extends Terms {
|
||||
private Terms delegateTerms;
|
||||
private FuzzySet filter;
|
||||
|
|
|
@ -26,7 +26,6 @@ import java.io.IOException;
|
|||
import org.apache.lucene.codecs.sep.IntIndexInput;
|
||||
import org.apache.lucene.store.DataInput;
|
||||
import org.apache.lucene.store.IndexInput;
|
||||
import org.apache.lucene.util.IntsRef;
|
||||
|
||||
/** Abstract base class that reads fixed-size blocks of ints
|
||||
* from an IndexInput. While this is a simple approach, a
|
||||
|
@ -49,7 +48,7 @@ public abstract class FixedIntBlockIndexInput extends IntIndexInput {
|
|||
@Override
|
||||
public Reader reader() throws IOException {
|
||||
final int[] buffer = new int[blockSize];
|
||||
final IndexInput clone = (IndexInput) in.clone();
|
||||
final IndexInput clone = in.clone();
|
||||
// TODO: can this be simplified?
|
||||
return new Reader(clone, buffer, this.getBlockReader(clone, buffer));
|
||||
}
|
||||
|
@ -77,76 +76,48 @@ public abstract class FixedIntBlockIndexInput extends IntIndexInput {
|
|||
|
||||
private static class Reader extends IntIndexInput.Reader {
|
||||
private final IndexInput in;
|
||||
|
||||
protected final int[] pending;
|
||||
int upto;
|
||||
|
||||
private boolean seekPending;
|
||||
private long pendingFP;
|
||||
private int pendingUpto;
|
||||
private long lastBlockFP;
|
||||
private final BlockReader blockReader;
|
||||
private final int blockSize;
|
||||
private final IntsRef bulkResult = new IntsRef();
|
||||
private final int[] pending;
|
||||
|
||||
private int upto;
|
||||
private boolean seekPending;
|
||||
private long pendingFP;
|
||||
private long lastBlockFP = -1;
|
||||
|
||||
public Reader(final IndexInput in, final int[] pending, final BlockReader blockReader) {
|
||||
this.in = in;
|
||||
this.pending = pending;
|
||||
this.blockSize = pending.length;
|
||||
bulkResult.ints = pending;
|
||||
this.blockReader = blockReader;
|
||||
upto = blockSize;
|
||||
}
|
||||
|
||||
void seek(final long fp, final int upto) {
|
||||
pendingFP = fp;
|
||||
pendingUpto = upto;
|
||||
seekPending = true;
|
||||
}
|
||||
|
||||
private void maybeSeek() throws IOException {
|
||||
if (seekPending) {
|
||||
if (pendingFP != lastBlockFP) {
|
||||
// need new block
|
||||
in.seek(pendingFP);
|
||||
lastBlockFP = pendingFP;
|
||||
blockReader.readBlock();
|
||||
}
|
||||
upto = pendingUpto;
|
||||
seekPending = false;
|
||||
assert upto < blockSize;
|
||||
if (seekPending || fp != lastBlockFP) {
|
||||
pendingFP = fp;
|
||||
seekPending = true;
|
||||
}
|
||||
this.upto = upto;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int next() throws IOException {
|
||||
this.maybeSeek();
|
||||
if (upto == blockSize) {
|
||||
if (seekPending) {
|
||||
// Seek & load new block
|
||||
in.seek(pendingFP);
|
||||
lastBlockFP = pendingFP;
|
||||
blockReader.readBlock();
|
||||
seekPending = false;
|
||||
} else if (upto == blockSize) {
|
||||
// Load new block
|
||||
lastBlockFP = in.getFilePointer();
|
||||
blockReader.readBlock();
|
||||
upto = 0;
|
||||
}
|
||||
|
||||
return pending[upto++];
|
||||
}
|
||||
|
||||
@Override
|
||||
public IntsRef read(final int count) throws IOException {
|
||||
this.maybeSeek();
|
||||
if (upto == blockSize) {
|
||||
blockReader.readBlock();
|
||||
upto = 0;
|
||||
}
|
||||
bulkResult.offset = upto;
|
||||
if (upto + count < blockSize) {
|
||||
bulkResult.length = count;
|
||||
upto += count;
|
||||
} else {
|
||||
bulkResult.length = blockSize - upto;
|
||||
upto = blockSize;
|
||||
}
|
||||
|
||||
return bulkResult;
|
||||
}
|
||||
}
|
||||
|
||||
private class Index extends IntIndexInput.Index {
|
||||
|
@ -178,7 +149,7 @@ public abstract class FixedIntBlockIndexInput extends IntIndexInput {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void set(final IntIndexInput.Index other) {
|
||||
public void copyFrom(final IntIndexInput.Index other) {
|
||||
final Index idx = (Index) other;
|
||||
fp = idx.fp;
|
||||
upto = idx.upto;
|
||||
|
|
|
@ -26,7 +26,6 @@ import java.io.IOException;
|
|||
import org.apache.lucene.codecs.sep.IntIndexInput;
|
||||
import org.apache.lucene.store.DataInput;
|
||||
import org.apache.lucene.store.IndexInput;
|
||||
import org.apache.lucene.util.IntsRef;
|
||||
|
||||
// TODO: much of this can be shared code w/ the fixed case
|
||||
|
||||
|
@ -51,7 +50,7 @@ public abstract class VariableIntBlockIndexInput extends IntIndexInput {
|
|||
@Override
|
||||
public Reader reader() throws IOException {
|
||||
final int[] buffer = new int[maxBlockSize];
|
||||
final IndexInput clone = (IndexInput) in.clone();
|
||||
final IndexInput clone = in.clone();
|
||||
// TODO: can this be simplified?
|
||||
return new Reader(clone, buffer, this.getBlockReader(clone, buffer));
|
||||
}
|
||||
|
@ -90,12 +89,10 @@ public abstract class VariableIntBlockIndexInput extends IntIndexInput {
|
|||
private long lastBlockFP;
|
||||
private int blockSize;
|
||||
private final BlockReader blockReader;
|
||||
private final IntsRef bulkResult = new IntsRef();
|
||||
|
||||
public Reader(final IndexInput in, final int[] pending, final BlockReader blockReader) {
|
||||
this.in = in;
|
||||
this.pending = pending;
|
||||
bulkResult.ints = pending;
|
||||
this.blockReader = blockReader;
|
||||
}
|
||||
|
||||
|
@ -146,26 +143,6 @@ public abstract class VariableIntBlockIndexInput extends IntIndexInput {
|
|||
|
||||
return pending[upto++];
|
||||
}
|
||||
|
||||
@Override
|
||||
public IntsRef read(final int count) throws IOException {
|
||||
this.maybeSeek();
|
||||
if (upto == blockSize) {
|
||||
lastBlockFP = in.getFilePointer();
|
||||
blockSize = blockReader.readBlock();
|
||||
upto = 0;
|
||||
}
|
||||
bulkResult.offset = upto;
|
||||
if (upto + count < blockSize) {
|
||||
bulkResult.length = count;
|
||||
upto += count;
|
||||
} else {
|
||||
bulkResult.length = blockSize - upto;
|
||||
upto = blockSize;
|
||||
}
|
||||
|
||||
return bulkResult;
|
||||
}
|
||||
}
|
||||
|
||||
private class Index extends IntIndexInput.Index {
|
||||
|
@ -204,7 +181,7 @@ public abstract class VariableIntBlockIndexInput extends IntIndexInput {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void set(final IntIndexInput.Index other) {
|
||||
public void copyFrom(final IntIndexInput.Index other) {
|
||||
final Index idx = (Index) other;
|
||||
fp = idx.fp;
|
||||
upto = idx.upto;
|
||||
|
|
|
@ -159,7 +159,7 @@ import org.apache.lucene.util.fst.FST; // javadocs
|
|||
* with the frequency of the term in that document (except when frequencies are
|
||||
* omitted: {@link IndexOptions#DOCS_ONLY}).</p>
|
||||
* <ul>
|
||||
* <li>FreqFile (.frq) --> Header, <TermFreqs, SkipData> <sup>TermCount</sup></li>
|
||||
* <li>FreqFile (.frq) --> Header, <TermFreqs, SkipData?> <sup>TermCount</sup></li>
|
||||
* <li>Header --> {@link CodecUtil#writeHeader CodecHeader}</li>
|
||||
* <li>TermFreqs --> <TermFreq> <sup>DocFreq</sup></li>
|
||||
* <li>TermFreq --> DocDelta[, Freq?]</li>
|
||||
|
|
|
@ -325,7 +325,7 @@ public class Lucene40PostingsReader extends PostingsReaderBase {
|
|||
|
||||
SegmentDocsEnumBase(IndexInput startFreqIn, Bits liveDocs) {
|
||||
this.startFreqIn = startFreqIn;
|
||||
this.freqIn = (IndexInput)startFreqIn.clone();
|
||||
this.freqIn = startFreqIn.clone();
|
||||
this.liveDocs = liveDocs;
|
||||
|
||||
}
|
||||
|
@ -474,7 +474,7 @@ public class Lucene40PostingsReader extends PostingsReaderBase {
|
|||
|
||||
if (skipper == null) {
|
||||
// This is the first time this enum has ever been used for skipping -- do lazy init
|
||||
skipper = new Lucene40SkipListReader((IndexInput) freqIn.clone(), maxSkipLevels, skipInterval);
|
||||
skipper = new Lucene40SkipListReader(freqIn.clone(), maxSkipLevels, skipInterval);
|
||||
}
|
||||
|
||||
if (!skipped) {
|
||||
|
@ -705,8 +705,8 @@ public class Lucene40PostingsReader extends PostingsReaderBase {
|
|||
|
||||
public SegmentDocsAndPositionsEnum(IndexInput freqIn, IndexInput proxIn) {
|
||||
startFreqIn = freqIn;
|
||||
this.freqIn = (IndexInput) freqIn.clone();
|
||||
this.proxIn = (IndexInput) proxIn.clone();
|
||||
this.freqIn = freqIn.clone();
|
||||
this.proxIn = proxIn.clone();
|
||||
}
|
||||
|
||||
public SegmentDocsAndPositionsEnum reset(FieldInfo fieldInfo, StandardTermState termState, Bits liveDocs) throws IOException {
|
||||
|
@ -795,7 +795,7 @@ public class Lucene40PostingsReader extends PostingsReaderBase {
|
|||
|
||||
if (skipper == null) {
|
||||
// This is the first time this enum has ever been used for skipping -- do lazy init
|
||||
skipper = new Lucene40SkipListReader((IndexInput) freqIn.clone(), maxSkipLevels, skipInterval);
|
||||
skipper = new Lucene40SkipListReader(freqIn.clone(), maxSkipLevels, skipInterval);
|
||||
}
|
||||
|
||||
if (!skipped) {
|
||||
|
@ -913,8 +913,8 @@ public class Lucene40PostingsReader extends PostingsReaderBase {
|
|||
|
||||
public SegmentFullPositionsEnum(IndexInput freqIn, IndexInput proxIn) {
|
||||
startFreqIn = freqIn;
|
||||
this.freqIn = (IndexInput) freqIn.clone();
|
||||
this.proxIn = (IndexInput) proxIn.clone();
|
||||
this.freqIn = freqIn.clone();
|
||||
this.proxIn = proxIn.clone();
|
||||
}
|
||||
|
||||
public SegmentFullPositionsEnum reset(FieldInfo fieldInfo, StandardTermState termState, Bits liveDocs) throws IOException {
|
||||
|
@ -1009,7 +1009,7 @@ public class Lucene40PostingsReader extends PostingsReaderBase {
|
|||
|
||||
if (skipper == null) {
|
||||
// This is the first time this enum has ever been used for skipping -- do lazy init
|
||||
skipper = new Lucene40SkipListReader((IndexInput) freqIn.clone(), maxSkipLevels, skipInterval);
|
||||
skipper = new Lucene40SkipListReader(freqIn.clone(), maxSkipLevels, skipInterval);
|
||||
}
|
||||
|
||||
if (!skipped) {
|
||||
|
|
|
@ -185,8 +185,6 @@ public final class Lucene40PostingsWriter extends PostingsWriterBase {
|
|||
int lastDocID;
|
||||
int df;
|
||||
|
||||
/** Adds a new doc in this term. If this returns null
|
||||
* then we just skip consuming positions/payloads. */
|
||||
@Override
|
||||
public void startDoc(int docID, int termDocFreq) throws IOException {
|
||||
// if (DEBUG) System.out.println("SPW: startDoc seg=" + segment + " docID=" + docID + " tf=" + termDocFreq + " freqOut.fp=" + freqOut.getFilePointer());
|
||||
|
|
|
@ -61,7 +61,7 @@ public final class Lucene40StoredFieldsReader extends StoredFieldsReader impleme
|
|||
@Override
|
||||
public Lucene40StoredFieldsReader clone() {
|
||||
ensureOpen();
|
||||
return new Lucene40StoredFieldsReader(fieldInfos, numTotalDocs, size, (IndexInput)fieldsStream.clone(), (IndexInput)indexStream.clone());
|
||||
return new Lucene40StoredFieldsReader(fieldInfos, numTotalDocs, size, fieldsStream.clone(), indexStream.clone());
|
||||
}
|
||||
|
||||
// Used only by clone
|
||||
|
|
|
@ -403,7 +403,7 @@ public class Lucene40TermVectorsReader extends TermVectorsReader {
|
|||
// NOTE: tvf is pre-positioned by caller
|
||||
public TVTermsEnum() {
|
||||
this.origTVF = Lucene40TermVectorsReader.this.tvf;
|
||||
tvf = (IndexInput) origTVF.clone();
|
||||
tvf = origTVF.clone();
|
||||
}
|
||||
|
||||
public boolean canReuse(IndexInput tvf) {
|
||||
|
@ -752,9 +752,9 @@ public class Lucene40TermVectorsReader extends TermVectorsReader {
|
|||
// These are null when a TermVectorsReader was created
|
||||
// on a segment that did not have term vectors saved
|
||||
if (tvx != null && tvd != null && tvf != null) {
|
||||
cloneTvx = (IndexInput) tvx.clone();
|
||||
cloneTvd = (IndexInput) tvd.clone();
|
||||
cloneTvf = (IndexInput) tvf.clone();
|
||||
cloneTvx = tvx.clone();
|
||||
cloneTvd = tvd.clone();
|
||||
cloneTvf = tvf.clone();
|
||||
}
|
||||
|
||||
return new Lucene40TermVectorsReader(fieldInfos, cloneTvx, cloneTvd, cloneTvf, size, numTotalDocs);
|
||||
|
|
|
@ -350,7 +350,7 @@ public final class Bytes {
|
|||
*/
|
||||
protected final IndexInput cloneData() {
|
||||
assert datIn != null;
|
||||
return (IndexInput) datIn.clone();
|
||||
return datIn.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -358,7 +358,7 @@ public final class Bytes {
|
|||
*/
|
||||
protected final IndexInput cloneIndex() {
|
||||
assert idxIn != null;
|
||||
return (IndexInput) idxIn.clone();
|
||||
return idxIn.clone();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -187,7 +187,7 @@ class PackedIntValues {
|
|||
final Source source;
|
||||
IndexInput input = null;
|
||||
try {
|
||||
input = (IndexInput) datIn.clone();
|
||||
input = datIn.clone();
|
||||
|
||||
if (values == null) {
|
||||
source = new PackedIntsSource(input, false);
|
||||
|
@ -218,7 +218,7 @@ class PackedIntValues {
|
|||
|
||||
@Override
|
||||
public Source getDirectSource() throws IOException {
|
||||
return values != null ? new FixedStraightBytesImpl.DirectFixedStraightSource((IndexInput) datIn.clone(), 8, Type.FIXED_INTS_64) : new PackedIntsSource((IndexInput) datIn.clone(), true);
|
||||
return values != null ? new FixedStraightBytesImpl.DirectFixedStraightSource(datIn.clone(), 8, Type.FIXED_INTS_64) : new PackedIntsSource(datIn.clone(), true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -211,7 +211,7 @@ final class VarSortedBytesImpl {
|
|||
valueCount = ordToOffsetIndex.size()-1; // the last value here is just a dummy value to get the length of the last value
|
||||
// advance this iterator to the end and clone the stream once it points to the docToOrdIndex header
|
||||
ordToOffsetIndex.get(valueCount);
|
||||
docToOrdIndex = PackedInts.getDirectReader((IndexInput) idxIn.clone()); // read the ords in to prevent too many random disk seeks
|
||||
docToOrdIndex = PackedInts.getDirectReader(idxIn.clone()); // read the ords in to prevent too many random disk seeks
|
||||
basePointer = datIn.getFilePointer();
|
||||
this.datIn = datIn;
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ package org.apache.lucene.codecs.memory;
|
|||
*/
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
@ -43,7 +44,6 @@ import org.apache.lucene.store.RAMOutputStream;
|
|||
import org.apache.lucene.util.ArrayUtil;
|
||||
import org.apache.lucene.util.Bits;
|
||||
import org.apache.lucene.util.BytesRef;
|
||||
import org.apache.lucene.util.UnmodifiableIterator;
|
||||
import org.apache.lucene.util.automaton.CompiledAutomaton;
|
||||
import org.apache.lucene.util.automaton.RunAutomaton;
|
||||
import org.apache.lucene.util.automaton.Transition;
|
||||
|
@ -131,7 +131,7 @@ public class DirectPostingsFormat extends PostingsFormat {
|
|||
|
||||
@Override
|
||||
public Iterator<String> iterator() {
|
||||
return new UnmodifiableIterator<String>(fields.keySet().iterator());
|
||||
return Collections.unmodifiableSet(fields.keySet()).iterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -144,15 +144,6 @@ public class DirectPostingsFormat extends PostingsFormat {
|
|||
return fields.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getUniqueTermCount() {
|
||||
long numTerms = 0;
|
||||
for(DirectField field : fields.values()) {
|
||||
numTerms += field.terms.length;
|
||||
}
|
||||
return numTerms;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ package org.apache.lucene.codecs.memory;
|
|||
*/
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Iterator;
|
||||
import java.util.SortedMap;
|
||||
|
@ -48,7 +49,6 @@ import org.apache.lucene.util.ArrayUtil;
|
|||
import org.apache.lucene.util.Bits;
|
||||
import org.apache.lucene.util.BytesRef;
|
||||
import org.apache.lucene.util.IntsRef;
|
||||
import org.apache.lucene.util.UnmodifiableIterator;
|
||||
import org.apache.lucene.util.fst.Builder;
|
||||
import org.apache.lucene.util.fst.ByteSequenceOutputs;
|
||||
import org.apache.lucene.util.fst.BytesRefFSTEnum;
|
||||
|
@ -863,7 +863,7 @@ public class MemoryPostingsFormat extends PostingsFormat {
|
|||
return new FieldsProducer() {
|
||||
@Override
|
||||
public Iterator<String> iterator() {
|
||||
return new UnmodifiableIterator<String>(fields.keySet().iterator());
|
||||
return Collections.unmodifiableSet(fields.keySet()).iterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.apache.lucene.codecs.perfield;
|
|||
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
@ -34,7 +35,6 @@ import org.apache.lucene.index.SegmentReadState;
|
|||
import org.apache.lucene.index.SegmentWriteState;
|
||||
import org.apache.lucene.index.Terms;
|
||||
import org.apache.lucene.util.IOUtils;
|
||||
import org.apache.lucene.util.UnmodifiableIterator;
|
||||
|
||||
/**
|
||||
* Enables per field format support.
|
||||
|
@ -199,7 +199,7 @@ public abstract class PerFieldPostingsFormat extends PostingsFormat {
|
|||
|
||||
@Override
|
||||
public Iterator<String> iterator() {
|
||||
return new UnmodifiableIterator<String>(fields.keySet().iterator());
|
||||
return Collections.unmodifiableSet(fields.keySet()).iterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -21,7 +21,6 @@ import java.io.Closeable;
|
|||
import java.io.IOException;
|
||||
|
||||
import org.apache.lucene.store.DataInput;
|
||||
import org.apache.lucene.util.IntsRef;
|
||||
|
||||
/** Defines basic API for writing ints to an IndexOutput.
|
||||
* IntBlockCodec interacts with this API. @see
|
||||
|
@ -44,7 +43,7 @@ public abstract class IntIndexInput implements Closeable {
|
|||
/** Seeks primary stream to the last read offset */
|
||||
public abstract void seek(IntIndexInput.Reader stream) throws IOException;
|
||||
|
||||
public abstract void set(Index other);
|
||||
public abstract void copyFrom(Index other);
|
||||
|
||||
@Override
|
||||
public abstract Index clone();
|
||||
|
@ -55,23 +54,5 @@ public abstract class IntIndexInput implements Closeable {
|
|||
|
||||
/** Reads next single int */
|
||||
public abstract int next() throws IOException;
|
||||
|
||||
/** Reads next chunk of ints */
|
||||
private IntsRef bulkResult;
|
||||
|
||||
/** Read up to count ints. */
|
||||
public IntsRef read(int count) throws IOException {
|
||||
if (bulkResult == null) {
|
||||
bulkResult = new IntsRef();
|
||||
bulkResult.ints = new int[count];
|
||||
} else {
|
||||
bulkResult.grow(count);
|
||||
}
|
||||
for(int i=0;i<count;i++) {
|
||||
bulkResult.ints[i] = next();
|
||||
}
|
||||
bulkResult.length = count;
|
||||
return bulkResult;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -160,13 +160,13 @@ public class SepPostingsReader extends PostingsReaderBase {
|
|||
if (docIndex == null) {
|
||||
docIndex = other.docIndex.clone();
|
||||
} else {
|
||||
docIndex.set(other.docIndex);
|
||||
docIndex.copyFrom(other.docIndex);
|
||||
}
|
||||
if (other.freqIndex != null) {
|
||||
if (freqIndex == null) {
|
||||
freqIndex = other.freqIndex.clone();
|
||||
} else {
|
||||
freqIndex.set(other.freqIndex);
|
||||
freqIndex.copyFrom(other.freqIndex);
|
||||
}
|
||||
} else {
|
||||
freqIndex = null;
|
||||
|
@ -175,7 +175,7 @@ public class SepPostingsReader extends PostingsReaderBase {
|
|||
if (posIndex == null) {
|
||||
posIndex = other.posIndex.clone();
|
||||
} else {
|
||||
posIndex.set(other.posIndex);
|
||||
posIndex.copyFrom(other.posIndex);
|
||||
}
|
||||
} else {
|
||||
posIndex = null;
|
||||
|
@ -352,11 +352,11 @@ public class SepPostingsReader extends PostingsReaderBase {
|
|||
|
||||
// TODO: can't we only do this if consumer
|
||||
// skipped consuming the previous docs?
|
||||
docIndex.set(termState.docIndex);
|
||||
docIndex.copyFrom(termState.docIndex);
|
||||
docIndex.seek(docReader);
|
||||
|
||||
if (!omitTF) {
|
||||
freqIndex.set(termState.freqIndex);
|
||||
freqIndex.copyFrom(termState.freqIndex);
|
||||
freqIndex.seek(freqReader);
|
||||
}
|
||||
|
||||
|
@ -418,7 +418,7 @@ public class SepPostingsReader extends PostingsReaderBase {
|
|||
|
||||
if (skipper == null) {
|
||||
// This DocsEnum has never done any skipping
|
||||
skipper = new SepSkipListReader((IndexInput) skipIn.clone(),
|
||||
skipper = new SepSkipListReader(skipIn.clone(),
|
||||
freqIn,
|
||||
docIn,
|
||||
posIn,
|
||||
|
@ -506,7 +506,7 @@ public class SepPostingsReader extends PostingsReaderBase {
|
|||
freqIndex = freqIn.index();
|
||||
posReader = posIn.reader();
|
||||
posIndex = posIn.index();
|
||||
payloadIn = (IndexInput) SepPostingsReader.this.payloadIn.clone();
|
||||
payloadIn = SepPostingsReader.this.payloadIn.clone();
|
||||
}
|
||||
|
||||
SepDocsAndPositionsEnum init(FieldInfo fieldInfo, SepTermState termState, Bits liveDocs) throws IOException {
|
||||
|
@ -516,15 +516,15 @@ public class SepPostingsReader extends PostingsReaderBase {
|
|||
|
||||
// TODO: can't we only do this if consumer
|
||||
// skipped consuming the previous docs?
|
||||
docIndex.set(termState.docIndex);
|
||||
docIndex.copyFrom(termState.docIndex);
|
||||
docIndex.seek(docReader);
|
||||
//System.out.println(" docIndex=" + docIndex);
|
||||
|
||||
freqIndex.set(termState.freqIndex);
|
||||
freqIndex.copyFrom(termState.freqIndex);
|
||||
freqIndex.seek(freqReader);
|
||||
//System.out.println(" freqIndex=" + freqIndex);
|
||||
|
||||
posIndex.set(termState.posIndex);
|
||||
posIndex.copyFrom(termState.posIndex);
|
||||
//System.out.println(" posIndex=" + posIndex);
|
||||
posSeekPending = true;
|
||||
payloadPending = false;
|
||||
|
@ -597,7 +597,7 @@ public class SepPostingsReader extends PostingsReaderBase {
|
|||
if (skipper == null) {
|
||||
//System.out.println(" create skipper");
|
||||
// This DocsEnum has never done any skipping
|
||||
skipper = new SepSkipListReader((IndexInput) skipIn.clone(),
|
||||
skipper = new SepSkipListReader(skipIn.clone(),
|
||||
freqIn,
|
||||
docIn,
|
||||
posIn,
|
||||
|
@ -629,7 +629,7 @@ public class SepPostingsReader extends PostingsReaderBase {
|
|||
// NOTE: don't seek pos here; do it lazily
|
||||
// instead. Eg a PhraseQuery may skip to many
|
||||
// docs before finally asking for positions...
|
||||
posIndex.set(skipper.getPosIndex());
|
||||
posIndex.copyFrom(skipper.getPosIndex());
|
||||
posSeekPending = true;
|
||||
count = newCount;
|
||||
doc = accum = skipper.getDoc();
|
||||
|
|
|
@ -108,12 +108,12 @@ class SepSkipListReader extends MultiLevelSkipListReader {
|
|||
lastPayloadPointer = payloadBasePointer;
|
||||
|
||||
for(int i=0;i<maxNumberOfSkipLevels;i++) {
|
||||
docIndex[i].set(docBaseIndex);
|
||||
docIndex[i].copyFrom(docBaseIndex);
|
||||
if (freqIndex != null) {
|
||||
freqIndex[i].set(freqBaseIndex);
|
||||
freqIndex[i].copyFrom(freqBaseIndex);
|
||||
}
|
||||
if (posBaseIndex != null) {
|
||||
posIndex[i].set(posBaseIndex);
|
||||
posIndex[i].copyFrom(posBaseIndex);
|
||||
}
|
||||
}
|
||||
Arrays.fill(payloadPointer, payloadBasePointer);
|
||||
|
@ -145,20 +145,20 @@ class SepSkipListReader extends MultiLevelSkipListReader {
|
|||
lastPayloadPointer = payloadPointer[level];
|
||||
lastPayloadLength = payloadLength[level];
|
||||
if (freqIndex != null) {
|
||||
lastFreqIndex.set(freqIndex[level]);
|
||||
lastFreqIndex.copyFrom(freqIndex[level]);
|
||||
}
|
||||
lastDocIndex.set(docIndex[level]);
|
||||
lastDocIndex.copyFrom(docIndex[level]);
|
||||
if (lastPosIndex != null) {
|
||||
lastPosIndex.set(posIndex[level]);
|
||||
lastPosIndex.copyFrom(posIndex[level]);
|
||||
}
|
||||
|
||||
if (level > 0) {
|
||||
if (freqIndex != null) {
|
||||
freqIndex[level-1].set(freqIndex[level]);
|
||||
freqIndex[level-1].copyFrom(freqIndex[level]);
|
||||
}
|
||||
docIndex[level-1].set(docIndex[level]);
|
||||
docIndex[level-1].copyFrom(docIndex[level]);
|
||||
if (posIndex != null) {
|
||||
posIndex[level-1].set(posIndex[level]);
|
||||
posIndex[level-1].copyFrom(posIndex[level]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ package org.apache.lucene.codecs.simpletext;
|
|||
*/
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
|
@ -43,7 +44,6 @@ import org.apache.lucene.util.IntsRef;
|
|||
import org.apache.lucene.util.OpenBitSet;
|
||||
import org.apache.lucene.util.StringHelper;
|
||||
import org.apache.lucene.util.UnicodeUtil;
|
||||
import org.apache.lucene.util.UnmodifiableIterator;
|
||||
import org.apache.lucene.util.fst.Builder;
|
||||
import org.apache.lucene.util.fst.BytesRefFSTEnum;
|
||||
import org.apache.lucene.util.fst.FST;
|
||||
|
@ -70,7 +70,7 @@ class SimpleTextFieldsReader extends FieldsProducer {
|
|||
in = state.dir.openInput(SimpleTextPostingsFormat.getPostingsFileName(state.segmentInfo.name, state.segmentSuffix), state.context);
|
||||
|
||||
fieldInfos = state.fieldInfos;
|
||||
fields = readFields((IndexInput)in.clone());
|
||||
fields = readFields(in.clone());
|
||||
}
|
||||
|
||||
private TreeMap<String,Long> readFields(IndexInput in) throws IOException {
|
||||
|
@ -230,7 +230,7 @@ class SimpleTextFieldsReader extends FieldsProducer {
|
|||
|
||||
public SimpleTextDocsEnum() {
|
||||
this.inStart = SimpleTextFieldsReader.this.in;
|
||||
this.in = (IndexInput) this.inStart.clone();
|
||||
this.in = this.inStart.clone();
|
||||
}
|
||||
|
||||
public boolean canReuse(IndexInput in) {
|
||||
|
@ -330,7 +330,7 @@ class SimpleTextFieldsReader extends FieldsProducer {
|
|||
|
||||
public SimpleTextDocsAndPositionsEnum() {
|
||||
this.inStart = SimpleTextFieldsReader.this.in;
|
||||
this.in = (IndexInput) inStart.clone();
|
||||
this.in = inStart.clone();
|
||||
}
|
||||
|
||||
public boolean canReuse(IndexInput in) {
|
||||
|
@ -500,7 +500,7 @@ class SimpleTextFieldsReader extends FieldsProducer {
|
|||
final PairOutputs<Long,PairOutputs.Pair<Long,Long>> outputs = new PairOutputs<Long,PairOutputs.Pair<Long,Long>>(posIntOutputs,
|
||||
outputsInner);
|
||||
b = new Builder<PairOutputs.Pair<Long,PairOutputs.Pair<Long,Long>>>(FST.INPUT_TYPE.BYTE1, outputs);
|
||||
IndexInput in = (IndexInput) SimpleTextFieldsReader.this.in.clone();
|
||||
IndexInput in = SimpleTextFieldsReader.this.in.clone();
|
||||
in.seek(termsStart);
|
||||
final BytesRef lastTerm = new BytesRef(10);
|
||||
long lastDocsStart = -1;
|
||||
|
@ -608,7 +608,7 @@ class SimpleTextFieldsReader extends FieldsProducer {
|
|||
|
||||
@Override
|
||||
public Iterator<String> iterator() {
|
||||
return new UnmodifiableIterator<String>(fields.keySet().iterator());
|
||||
return Collections.unmodifiableSet(fields.keySet()).iterator();
|
||||
}
|
||||
|
||||
private final Map<String,Terms> termsCache = new HashMap<String,Terms>();
|
||||
|
|
|
@ -132,7 +132,7 @@ public class SimpleTextPerDocProducer extends PerDocProducerBase {
|
|||
@Override
|
||||
public Source load() throws IOException {
|
||||
boolean success = false;
|
||||
IndexInput in = (IndexInput) input.clone();
|
||||
IndexInput in = input.clone();
|
||||
try {
|
||||
Source source = null;
|
||||
switch (type) {
|
||||
|
|
|
@ -163,7 +163,7 @@ public class SimpleTextStoredFieldsReader extends StoredFieldsReader {
|
|||
if (in == null) {
|
||||
throw new AlreadyClosedException("this FieldsReader is closed");
|
||||
}
|
||||
return new SimpleTextStoredFieldsReader(offsets, (IndexInput) in.clone(), fieldInfos);
|
||||
return new SimpleTextStoredFieldsReader(offsets, in.clone(), fieldInfos);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.apache.lucene.codecs.simpletext;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
@ -44,8 +45,6 @@ import org.apache.lucene.util.CharsRef;
|
|||
import org.apache.lucene.util.IOUtils;
|
||||
import org.apache.lucene.util.StringHelper;
|
||||
import org.apache.lucene.util.UnicodeUtil;
|
||||
import org.apache.lucene.util.UnmodifiableIterator;
|
||||
|
||||
import static org.apache.lucene.codecs.simpletext.SimpleTextTermVectorsWriter.*;
|
||||
|
||||
/**
|
||||
|
@ -205,7 +204,7 @@ public class SimpleTextTermVectorsReader extends TermVectorsReader {
|
|||
if (in == null) {
|
||||
throw new AlreadyClosedException("this TermVectorsReader is closed");
|
||||
}
|
||||
return new SimpleTextTermVectorsReader(offsets, (IndexInput) in.clone());
|
||||
return new SimpleTextTermVectorsReader(offsets, in.clone());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -241,7 +240,7 @@ public class SimpleTextTermVectorsReader extends TermVectorsReader {
|
|||
|
||||
@Override
|
||||
public Iterator<String> iterator() {
|
||||
return new UnmodifiableIterator<String>(fields.keySet().iterator());
|
||||
return Collections.unmodifiableSet(fields.keySet()).iterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -250,7 +249,7 @@ public class SimpleTextTermVectorsReader extends TermVectorsReader {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int size() throws IOException {
|
||||
public int size() {
|
||||
return fields.size();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,8 @@ import org.apache.lucene.index.StoredFieldVisitor;
|
|||
|
||||
/** A {@link StoredFieldVisitor} that creates a {@link
|
||||
* Document} containing all stored fields, or only specific
|
||||
* requested fields provided to {@link #DocumentStoredFieldVisitor(Set)}
|
||||
* requested fields provided to {@link #DocumentStoredFieldVisitor(Set)}.
|
||||
* <p>
|
||||
* This is used by {@link IndexReader#document(int)} to load a
|
||||
* document.
|
||||
*
|
||||
|
|
|
@ -19,7 +19,6 @@ package org.apache.lucene.document;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
import java.io.StringReader;
|
||||
|
||||
import org.apache.lucene.analysis.Analyzer;
|
||||
import org.apache.lucene.analysis.NumericTokenStream;
|
||||
|
@ -74,7 +73,8 @@ public class Field implements IndexableField, StorableField {
|
|||
// customize how it's tokenized:
|
||||
protected TokenStream tokenStream;
|
||||
|
||||
protected transient NumericTokenStream numericTokenStream;
|
||||
private transient TokenStream internalTokenStream;
|
||||
private transient ReusableStringReader internalReader;
|
||||
|
||||
protected float boost = 1.0f;
|
||||
|
||||
|
@ -284,9 +284,6 @@ public class Field implements IndexableField, StorableField {
|
|||
if (!(fieldsData instanceof Byte)) {
|
||||
throw new IllegalArgumentException("cannot change value type from " + fieldsData.getClass().getSimpleName() + " to Byte");
|
||||
}
|
||||
if (numericTokenStream != null) {
|
||||
numericTokenStream.setIntValue(value);
|
||||
}
|
||||
fieldsData = Byte.valueOf(value);
|
||||
}
|
||||
|
||||
|
@ -294,9 +291,6 @@ public class Field implements IndexableField, StorableField {
|
|||
if (!(fieldsData instanceof Short)) {
|
||||
throw new IllegalArgumentException("cannot change value type from " + fieldsData.getClass().getSimpleName() + " to Short");
|
||||
}
|
||||
if (numericTokenStream != null) {
|
||||
numericTokenStream.setIntValue(value);
|
||||
}
|
||||
fieldsData = Short.valueOf(value);
|
||||
}
|
||||
|
||||
|
@ -304,9 +298,6 @@ public class Field implements IndexableField, StorableField {
|
|||
if (!(fieldsData instanceof Integer)) {
|
||||
throw new IllegalArgumentException("cannot change value type from " + fieldsData.getClass().getSimpleName() + " to Integer");
|
||||
}
|
||||
if (numericTokenStream != null) {
|
||||
numericTokenStream.setIntValue(value);
|
||||
}
|
||||
fieldsData = Integer.valueOf(value);
|
||||
}
|
||||
|
||||
|
@ -314,9 +305,6 @@ public class Field implements IndexableField, StorableField {
|
|||
if (!(fieldsData instanceof Long)) {
|
||||
throw new IllegalArgumentException("cannot change value type from " + fieldsData.getClass().getSimpleName() + " to Long");
|
||||
}
|
||||
if (numericTokenStream != null) {
|
||||
numericTokenStream.setLongValue(value);
|
||||
}
|
||||
fieldsData = Long.valueOf(value);
|
||||
}
|
||||
|
||||
|
@ -324,9 +312,6 @@ public class Field implements IndexableField, StorableField {
|
|||
if (!(fieldsData instanceof Float)) {
|
||||
throw new IllegalArgumentException("cannot change value type from " + fieldsData.getClass().getSimpleName() + " to Float");
|
||||
}
|
||||
if (numericTokenStream != null) {
|
||||
numericTokenStream.setFloatValue(value);
|
||||
}
|
||||
fieldsData = Float.valueOf(value);
|
||||
}
|
||||
|
||||
|
@ -334,9 +319,6 @@ public class Field implements IndexableField, StorableField {
|
|||
if (!(fieldsData instanceof Double)) {
|
||||
throw new IllegalArgumentException("cannot change value type from " + fieldsData.getClass().getSimpleName() + " to Double");
|
||||
}
|
||||
if (numericTokenStream != null) {
|
||||
numericTokenStream.setDoubleValue(value);
|
||||
}
|
||||
fieldsData = Double.valueOf(value);
|
||||
}
|
||||
|
||||
|
@ -434,62 +416,44 @@ public class Field implements IndexableField, StorableField {
|
|||
|
||||
final NumericType numericType = fieldType().numericType();
|
||||
if (numericType != null) {
|
||||
if (numericTokenStream == null) {
|
||||
if (!(internalTokenStream instanceof NumericTokenStream)) {
|
||||
// lazy init the TokenStream as it is heavy to instantiate
|
||||
// (attributes,...) if not needed (stored field loading)
|
||||
numericTokenStream = new NumericTokenStream(type.numericPrecisionStep());
|
||||
// initialize value in TokenStream
|
||||
final Number val = (Number) fieldsData;
|
||||
switch (numericType) {
|
||||
case INT:
|
||||
numericTokenStream.setIntValue(val.intValue());
|
||||
break;
|
||||
case LONG:
|
||||
numericTokenStream.setLongValue(val.longValue());
|
||||
break;
|
||||
case FLOAT:
|
||||
numericTokenStream.setFloatValue(val.floatValue());
|
||||
break;
|
||||
case DOUBLE:
|
||||
numericTokenStream.setDoubleValue(val.doubleValue());
|
||||
break;
|
||||
default:
|
||||
assert false : "Should never get here";
|
||||
}
|
||||
} else {
|
||||
// OK -- previously cached and we already updated if
|
||||
// setters were called.
|
||||
internalTokenStream = new NumericTokenStream(type.numericPrecisionStep());
|
||||
}
|
||||
|
||||
return numericTokenStream;
|
||||
final NumericTokenStream nts = (NumericTokenStream) internalTokenStream;
|
||||
// initialize value in TokenStream
|
||||
final Number val = (Number) fieldsData;
|
||||
switch (numericType) {
|
||||
case INT:
|
||||
nts.setIntValue(val.intValue());
|
||||
break;
|
||||
case LONG:
|
||||
nts.setLongValue(val.longValue());
|
||||
break;
|
||||
case FLOAT:
|
||||
nts.setFloatValue(val.floatValue());
|
||||
break;
|
||||
case DOUBLE:
|
||||
nts.setDoubleValue(val.doubleValue());
|
||||
break;
|
||||
default:
|
||||
assert false : "Should never get here";
|
||||
}
|
||||
return internalTokenStream;
|
||||
}
|
||||
|
||||
if (!fieldType().tokenized()) {
|
||||
if (stringValue() == null) {
|
||||
throw new IllegalArgumentException("Non-Tokenized Fields must have a String value");
|
||||
}
|
||||
|
||||
return new TokenStream() {
|
||||
CharTermAttribute termAttribute = addAttribute(CharTermAttribute.class);
|
||||
OffsetAttribute offsetAttribute = addAttribute(OffsetAttribute.class);
|
||||
boolean used;
|
||||
|
||||
@Override
|
||||
public boolean incrementToken() {
|
||||
if (used) {
|
||||
return false;
|
||||
}
|
||||
termAttribute.setEmpty().append(stringValue());
|
||||
offsetAttribute.setOffset(0, stringValue().length());
|
||||
used = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
used = false;
|
||||
}
|
||||
};
|
||||
if (!(internalTokenStream instanceof StringTokenStream)) {
|
||||
// lazy init the TokenStream as it is heavy to instantiate
|
||||
// (attributes,...) if not needed (stored field loading)
|
||||
internalTokenStream = new StringTokenStream();
|
||||
}
|
||||
((StringTokenStream) internalTokenStream).setValue(stringValue());
|
||||
return internalTokenStream;
|
||||
}
|
||||
|
||||
if (tokenStream != null) {
|
||||
|
@ -497,11 +461,102 @@ public class Field implements IndexableField, StorableField {
|
|||
} else if (readerValue() != null) {
|
||||
return analyzer.tokenStream(name(), readerValue());
|
||||
} else if (stringValue() != null) {
|
||||
return analyzer.tokenStream(name(), new StringReader(stringValue()));
|
||||
if (internalReader == null) {
|
||||
internalReader = new ReusableStringReader();
|
||||
}
|
||||
internalReader.setValue(stringValue());
|
||||
return analyzer.tokenStream(name(), internalReader);
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException("Field must have either TokenStream, String, Reader or Number value");
|
||||
}
|
||||
|
||||
static final class ReusableStringReader extends Reader {
|
||||
private int pos = 0, size = 0;
|
||||
private String s = null;
|
||||
|
||||
void setValue(String s) {
|
||||
this.s = s;
|
||||
this.size = s.length();
|
||||
this.pos = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read() {
|
||||
if (pos < size) {
|
||||
return s.charAt(pos++);
|
||||
} else {
|
||||
s = null;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(char[] c, int off, int len) {
|
||||
if (pos < size) {
|
||||
len = Math.min(len, size-pos);
|
||||
s.getChars(pos, pos+len, c, off);
|
||||
pos += len;
|
||||
return len;
|
||||
} else {
|
||||
s = null;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
pos = size; // this prevents NPE when reading after close!
|
||||
s = null;
|
||||
}
|
||||
}
|
||||
|
||||
static final class StringTokenStream extends TokenStream {
|
||||
private final CharTermAttribute termAttribute = addAttribute(CharTermAttribute.class);
|
||||
private final OffsetAttribute offsetAttribute = addAttribute(OffsetAttribute.class);
|
||||
private boolean used = false;
|
||||
private String value = null;
|
||||
|
||||
/** Creates a new TokenStream that returns a String as single token.
|
||||
* <p>Warning: Does not initialize the value, you must call
|
||||
* {@link #setValue()} afterwards!
|
||||
*/
|
||||
StringTokenStream() {
|
||||
}
|
||||
|
||||
/** Sets the string value. */
|
||||
void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean incrementToken() {
|
||||
if (used) {
|
||||
return false;
|
||||
}
|
||||
clearAttributes();
|
||||
termAttribute.append(value);
|
||||
offsetAttribute.setOffset(0, value.length());
|
||||
used = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void end() {
|
||||
final int finalOffset = value.length();
|
||||
offsetAttribute.setOffset(finalOffset, finalOffset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
used = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
value = null;
|
||||
}
|
||||
}
|
||||
|
||||
/** Specifies whether and how a field should be stored. */
|
||||
public static enum Store {
|
||||
|
|
|
@ -175,17 +175,6 @@ public abstract class AtomicReader extends IndexReader {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/** Returns the number of unique terms (across all fields)
|
||||
* in this reader.
|
||||
*/
|
||||
public final long getUniqueTermCount() throws IOException {
|
||||
final Fields fields = fields();
|
||||
if (fields == null) {
|
||||
return 0;
|
||||
}
|
||||
return fields.getUniqueTermCount();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@link DocValues} for this field.
|
||||
|
|
|
@ -1112,21 +1112,6 @@ public class CheckIndex {
|
|||
throw new RuntimeException("fieldCount mismatch " + fieldCount + " vs recomputed field count " + computedFieldCount);
|
||||
}
|
||||
}
|
||||
|
||||
// for most implementations, this is boring (just the sum across all fields)
|
||||
// but codecs that don't work per-field like preflex actually implement this,
|
||||
// but don't implement it on Terms, so the check isn't redundant.
|
||||
long uniqueTermCountAllFields = fields.getUniqueTermCount();
|
||||
|
||||
// this means something is seriously screwed, e.g. we are somehow getting enclosed in PFCW!!!!!!
|
||||
|
||||
if (uniqueTermCountAllFields == -1) {
|
||||
throw new RuntimeException("invalid termCount: -1");
|
||||
}
|
||||
|
||||
if (status.termCount != uniqueTermCountAllFields) {
|
||||
throw new RuntimeException("termCount mismatch " + uniqueTermCountAllFields + " vs " + (status.termCount));
|
||||
}
|
||||
|
||||
if (doPrint) {
|
||||
msg("OK [" + status.termCount + " terms; " + status.totFreq + " terms/docs pairs; " + status.totPos + " tokens]");
|
||||
|
|
|
@ -47,7 +47,7 @@ class CoalescedDeletes {
|
|||
|
||||
public Iterable<Term> termsIterable() {
|
||||
return new Iterable<Term>() {
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({"unchecked","rawtypes"})
|
||||
@Override
|
||||
public Iterator<Term> iterator() {
|
||||
Iterator<Term> subs[] = new Iterator[iterables.size()];
|
||||
|
|
|
@ -34,6 +34,8 @@ import org.apache.lucene.index.FieldInfo.IndexOptions;
|
|||
public class FieldInfos implements Iterable<FieldInfo> {
|
||||
private final boolean hasFreq;
|
||||
private final boolean hasProx;
|
||||
private final boolean hasPayloads;
|
||||
private final boolean hasOffsets;
|
||||
private final boolean hasVectors;
|
||||
private final boolean hasNorms;
|
||||
private final boolean hasDocValues;
|
||||
|
@ -45,6 +47,8 @@ public class FieldInfos implements Iterable<FieldInfo> {
|
|||
public FieldInfos(FieldInfo[] infos) {
|
||||
boolean hasVectors = false;
|
||||
boolean hasProx = false;
|
||||
boolean hasPayloads = false;
|
||||
boolean hasOffsets = false;
|
||||
boolean hasFreq = false;
|
||||
boolean hasNorms = false;
|
||||
boolean hasDocValues = false;
|
||||
|
@ -58,12 +62,16 @@ public class FieldInfos implements Iterable<FieldInfo> {
|
|||
hasVectors |= info.hasVectors();
|
||||
hasProx |= info.isIndexed() && info.getIndexOptions().compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0;
|
||||
hasFreq |= info.isIndexed() && info.getIndexOptions() != IndexOptions.DOCS_ONLY;
|
||||
hasOffsets |= info.isIndexed() && info.getIndexOptions().compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
|
||||
hasNorms |= info.hasNorms();
|
||||
hasDocValues |= info.hasDocValues();
|
||||
hasPayloads |= info.hasPayloads();
|
||||
}
|
||||
|
||||
this.hasVectors = hasVectors;
|
||||
this.hasProx = hasProx;
|
||||
this.hasPayloads = hasPayloads;
|
||||
this.hasOffsets = hasOffsets;
|
||||
this.hasFreq = hasFreq;
|
||||
this.hasNorms = hasNorms;
|
||||
this.hasDocValues = hasDocValues;
|
||||
|
@ -79,6 +87,16 @@ public class FieldInfos implements Iterable<FieldInfo> {
|
|||
public boolean hasProx() {
|
||||
return hasProx;
|
||||
}
|
||||
|
||||
/** Returns true if any fields have payloads */
|
||||
public boolean hasPayloads() {
|
||||
return hasPayloads;
|
||||
}
|
||||
|
||||
/** Returns true if any fields have offsets */
|
||||
public boolean hasOffsets() {
|
||||
return hasOffsets;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if at least one field has any vectors
|
||||
|
|
|
@ -36,28 +36,7 @@ public abstract class Fields implements Iterable<String> {
|
|||
/** Returns the number of fields or -1 if the number of
|
||||
* distinct field names is unknown. If >= 0,
|
||||
* {@link #iterator} will return as many field names. */
|
||||
public abstract int size() throws IOException;
|
||||
|
||||
/** Returns the number of terms for all fields, or -1 if this
|
||||
* measure isn't stored by the codec. Note that, just like
|
||||
* other term measures, this measure does not take deleted
|
||||
* documents into account. */
|
||||
// TODO: deprecate?
|
||||
public long getUniqueTermCount() throws IOException {
|
||||
long numTerms = 0;
|
||||
for (String field : this) {
|
||||
Terms terms = terms(field);
|
||||
if (terms != null) {
|
||||
final long termCount = terms.size();
|
||||
if (termCount == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
numTerms += termCount;
|
||||
}
|
||||
}
|
||||
return numTerms;
|
||||
}
|
||||
public abstract int size();
|
||||
|
||||
public final static Fields[] EMPTY_ARRAY = new Fields[0];
|
||||
}
|
||||
|
|
|
@ -57,14 +57,9 @@ public class FilterAtomicReader extends AtomicReader {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int size() throws IOException {
|
||||
public int size() {
|
||||
return in.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getUniqueTermCount() throws IOException {
|
||||
return in.getUniqueTermCount();
|
||||
}
|
||||
}
|
||||
|
||||
/** Base class for filtering {@link Terms}
|
||||
|
|
|
@ -64,6 +64,13 @@ public abstract class LogMergePolicy extends MergePolicy {
|
|||
* @see #setNoCFSRatio */
|
||||
public static final double DEFAULT_NO_CFS_RATIO = 0.1;
|
||||
|
||||
/** Default maxCFSSegmentSize value allows compound file
|
||||
* for a segment of any size. The actual file format is
|
||||
* still subject to noCFSRatio.
|
||||
* @see #setMaxCFSSegmentSizeMB(double)
|
||||
*/
|
||||
public static final long DEFAULT_MAX_CFS_SEGMENT_SIZE = Long.MAX_VALUE;
|
||||
|
||||
protected int mergeFactor = DEFAULT_MERGE_FACTOR;
|
||||
|
||||
protected long minMergeSize;
|
||||
|
@ -74,6 +81,7 @@ public abstract class LogMergePolicy extends MergePolicy {
|
|||
protected int maxMergeDocs = DEFAULT_MAX_MERGE_DOCS;
|
||||
|
||||
protected double noCFSRatio = DEFAULT_NO_CFS_RATIO;
|
||||
protected long maxCFSSegmentSize = DEFAULT_MAX_CFS_SEGMENT_SIZE;
|
||||
|
||||
protected boolean calibrateSizeByDeletes = true;
|
||||
|
||||
|
@ -136,21 +144,21 @@ public abstract class LogMergePolicy extends MergePolicy {
|
|||
// Javadoc inherited
|
||||
@Override
|
||||
public boolean useCompoundFile(SegmentInfos infos, SegmentInfoPerCommit mergedInfo) throws IOException {
|
||||
final boolean doCFS;
|
||||
|
||||
if (!useCompoundFile) {
|
||||
doCFS = false;
|
||||
} else if (noCFSRatio == 1.0) {
|
||||
doCFS = true;
|
||||
} else {
|
||||
long totalSize = 0;
|
||||
for (SegmentInfoPerCommit info : infos) {
|
||||
totalSize += size(info);
|
||||
}
|
||||
|
||||
doCFS = size(mergedInfo) <= noCFSRatio * totalSize;
|
||||
if (!getUseCompoundFile()) {
|
||||
return false;
|
||||
}
|
||||
return doCFS;
|
||||
long mergedInfoSize = size(mergedInfo);
|
||||
if (mergedInfoSize > maxCFSSegmentSize) {
|
||||
return false;
|
||||
}
|
||||
if (getNoCFSRatio() >= 1.0) {
|
||||
return true;
|
||||
}
|
||||
long totalSize = 0;
|
||||
for (SegmentInfoPerCommit info : infos) {
|
||||
totalSize += size(info);
|
||||
}
|
||||
return mergedInfoSize <= getNoCFSRatio() * totalSize;
|
||||
}
|
||||
|
||||
/** Sets whether compound file format should be used for
|
||||
|
@ -674,9 +682,28 @@ public abstract class LogMergePolicy extends MergePolicy {
|
|||
sb.append("calibrateSizeByDeletes=").append(calibrateSizeByDeletes).append(", ");
|
||||
sb.append("maxMergeDocs=").append(maxMergeDocs).append(", ");
|
||||
sb.append("useCompoundFile=").append(useCompoundFile).append(", ");
|
||||
sb.append("maxCFSSegmentSizeMB=").append(getMaxCFSSegmentSizeMB()).append(", ");
|
||||
sb.append("noCFSRatio=").append(noCFSRatio);
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
/** Returns the largest size allowed for a compound file segment */
|
||||
public final double getMaxCFSSegmentSizeMB() {
|
||||
return maxCFSSegmentSize/1024/1024.;
|
||||
}
|
||||
|
||||
/** If a merged segment will be more than this value,
|
||||
* leave the segment as
|
||||
* non-compound file even if compound file is enabled.
|
||||
* Set this to Double.POSITIVE_INFINITY (default) and noCFSRatio to 1.0
|
||||
* to always use CFS regardless of merge size. */
|
||||
public final void setMaxCFSSegmentSizeMB(double v) {
|
||||
if (v < 0.0) {
|
||||
throw new IllegalArgumentException("maxCFSSegmentSizeMB must be >=0 (got " + v + ")");
|
||||
}
|
||||
v *= 1024 * 1024;
|
||||
this.maxCFSSegmentSize = (v > Long.MAX_VALUE) ? Long.MAX_VALUE : (long) v;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -27,7 +27,6 @@ import java.util.SortedMap;
|
|||
import java.util.TreeMap;
|
||||
|
||||
import org.apache.lucene.util.Bits;
|
||||
import org.apache.lucene.util.UnmodifiableIterator;
|
||||
|
||||
|
||||
/** An {@link AtomicReader} which reads multiple, parallel indexes. Each index
|
||||
|
@ -163,7 +162,7 @@ public final class ParallelAtomicReader extends AtomicReader {
|
|||
|
||||
@Override
|
||||
public Iterator<String> iterator() {
|
||||
return new UnmodifiableIterator<String>(fields.keySet().iterator());
|
||||
return Collections.unmodifiableSet(fields.keySet()).iterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -84,6 +84,7 @@ public class TieredMergePolicy extends MergePolicy {
|
|||
private double forceMergeDeletesPctAllowed = 10.0;
|
||||
private boolean useCompoundFile = true;
|
||||
private double noCFSRatio = 0.1;
|
||||
private long maxCFSSegmentSize = Long.MAX_VALUE;
|
||||
private double reclaimDeletesWeight = 2.0;
|
||||
|
||||
/** Maximum number of segments to be merged at a time
|
||||
|
@ -127,7 +128,11 @@ public class TieredMergePolicy extends MergePolicy {
|
|||
* sizes of to-be-merged segments (compensating for
|
||||
* percent deleted docs). Default is 5 GB. */
|
||||
public TieredMergePolicy setMaxMergedSegmentMB(double v) {
|
||||
maxMergedSegmentBytes = (long) (v*1024*1024);
|
||||
if (v < 0.0) {
|
||||
throw new IllegalArgumentException("maxMergedSegmentMB must be >=0 (got " + v + ")");
|
||||
}
|
||||
v *= 1024 * 1024;
|
||||
maxMergedSegmentBytes = (v > Long.MAX_VALUE) ? Long.MAX_VALUE : (long) v;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -162,7 +167,8 @@ public class TieredMergePolicy extends MergePolicy {
|
|||
if (v <= 0.0) {
|
||||
throw new IllegalArgumentException("floorSegmentMB must be >= 0.0 (got " + v + ")");
|
||||
}
|
||||
floorSegmentBytes = (long) (v*1024*1024);
|
||||
v *= 1024 * 1024;
|
||||
floorSegmentBytes = (v > Long.MAX_VALUE) ? Long.MAX_VALUE : (long) v;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -602,21 +608,21 @@ public class TieredMergePolicy extends MergePolicy {
|
|||
|
||||
@Override
|
||||
public boolean useCompoundFile(SegmentInfos infos, SegmentInfoPerCommit mergedInfo) throws IOException {
|
||||
final boolean doCFS;
|
||||
|
||||
if (!useCompoundFile) {
|
||||
doCFS = false;
|
||||
} else if (noCFSRatio == 1.0) {
|
||||
doCFS = true;
|
||||
} else {
|
||||
long totalSize = 0;
|
||||
for (SegmentInfoPerCommit info : infos) {
|
||||
totalSize += size(info);
|
||||
}
|
||||
|
||||
doCFS = size(mergedInfo) <= noCFSRatio * totalSize;
|
||||
if (!getUseCompoundFile()) {
|
||||
return false;
|
||||
}
|
||||
return doCFS;
|
||||
long mergedInfoSize = size(mergedInfo);
|
||||
if (mergedInfoSize > maxCFSSegmentSize) {
|
||||
return false;
|
||||
}
|
||||
if (getNoCFSRatio() >= 1.0) {
|
||||
return true;
|
||||
}
|
||||
long totalSize = 0;
|
||||
for (SegmentInfoPerCommit info : infos) {
|
||||
totalSize += size(info);
|
||||
}
|
||||
return mergedInfoSize <= getNoCFSRatio() * totalSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -629,7 +635,7 @@ public class TieredMergePolicy extends MergePolicy {
|
|||
boolean hasDeletions = w.numDeletedDocs(info) > 0;
|
||||
return !hasDeletions &&
|
||||
info.info.dir == w.getDirectory() &&
|
||||
(info.info.getUseCompoundFile() == useCompoundFile || noCFSRatio < 1.0);
|
||||
(info.info.getUseCompoundFile() == useCompoundFile || noCFSRatio < 1.0 || maxCFSSegmentSize < Long.MAX_VALUE);
|
||||
}
|
||||
|
||||
// Segment size in bytes, pro-rated by % deleted
|
||||
|
@ -664,7 +670,27 @@ public class TieredMergePolicy extends MergePolicy {
|
|||
sb.append("forceMergeDeletesPctAllowed=").append(forceMergeDeletesPctAllowed).append(", ");
|
||||
sb.append("segmentsPerTier=").append(segsPerTier).append(", ");
|
||||
sb.append("useCompoundFile=").append(useCompoundFile).append(", ");
|
||||
sb.append("maxCFSSegmentSizeMB=").append(getMaxCFSSegmentSizeMB()).append(", ");
|
||||
sb.append("noCFSRatio=").append(noCFSRatio);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/** Returns the largest size allowed for a compound file segment */
|
||||
public final double getMaxCFSSegmentSizeMB() {
|
||||
return maxCFSSegmentSize/1024/1024.;
|
||||
}
|
||||
|
||||
/** If a merged segment will be more than this value,
|
||||
* leave the segment as
|
||||
* non-compound file even if compound file is enabled.
|
||||
* Set this to Double.POSITIVE_INFINITY (default) and noCFSRatio to 1.0
|
||||
* to always use CFS regardless of merge size. */
|
||||
public final TieredMergePolicy setMaxCFSSegmentSizeMB(double v) {
|
||||
if (v < 0.0) {
|
||||
throw new IllegalArgumentException("maxCFSSegmentSizeMB must be >=0 (got " + v + ")");
|
||||
}
|
||||
v *= 1024 * 1024;
|
||||
this.maxCFSSegmentSize = (v > Long.MAX_VALUE) ? Long.MAX_VALUE : (long) v;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,241 @@
|
|||
</head>
|
||||
<body>
|
||||
Code to maintain and access indices.
|
||||
<!-- TODO: add a BASIC overview here, including code examples of using postings apis -->
|
||||
<!-- TODO: add IndexWriter, IndexWriterConfig, DocValues, etc etc -->
|
||||
<h2>Table Of Contents</h2>
|
||||
<p>
|
||||
<ol>
|
||||
<li><a href="#postings">Postings APIs</a>
|
||||
<ul>
|
||||
<li><a href="#fields">Fields</a></li>
|
||||
<li><a href="#terms">Terms</a></li>
|
||||
<li><a href="#documents">Documents</a></li>
|
||||
<li><a href="#positions">Positions</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#stats">Index Statistics</a>
|
||||
<ul>
|
||||
<li><a href="#termstats">Term-level</a></li>
|
||||
<li><a href="#fieldstats">Field-level</a></li>
|
||||
<li><a href="#segmentstats">Segment-level</a></li>
|
||||
<li><a href="#documentstats">Document-level</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ol>
|
||||
</p>
|
||||
<a name="postings"></a>
|
||||
<h2>Postings APIs</h2>
|
||||
<a name="fields"></a>
|
||||
<h4>
|
||||
Fields
|
||||
</h4>
|
||||
<p>
|
||||
{@link org.apache.lucene.index.Fields} is the initial entry point into the
|
||||
postings APIs, this can be obtained in several ways:
|
||||
<pre class="prettyprint">
|
||||
// access indexed fields for an index segment
|
||||
Fields fields = reader.fields();
|
||||
// access term vector fields for a specified document
|
||||
Fields fields = reader.getTermVectors(docid);
|
||||
</pre>
|
||||
Fields implements Java's Iterable interface, so its easy to enumerate the
|
||||
list of fields:
|
||||
<pre class="prettyprint">
|
||||
// enumerate list of fields
|
||||
for (String field : fields) {
|
||||
// access the terms for this field
|
||||
Terms terms = fields.terms(field);
|
||||
}
|
||||
</pre>
|
||||
</p>
|
||||
<a name="terms"></a>
|
||||
<h4>
|
||||
Terms
|
||||
</h4>
|
||||
<p>
|
||||
{@link org.apache.lucene.index.Terms} represents the collection of terms
|
||||
within a field, exposes some metadata and <a href="#fieldstats">statistics</a>,
|
||||
and an API for enumeration.
|
||||
<pre class="prettyprint">
|
||||
// metadata about the field
|
||||
System.out.println("positions? " + terms.hasPositions());
|
||||
System.out.println("offsets? " + terms.hasOffsets());
|
||||
System.out.println("payloads? " + terms.hasPayloads());
|
||||
// iterate through terms
|
||||
TermsEnum termsEnum = terms.iterator(null);
|
||||
BytesRef term = null;
|
||||
while ((term = termsEnum.next()) != null) {
|
||||
doSomethingWith(termsEnum.term());
|
||||
}
|
||||
</pre>
|
||||
{@link org.apache.lucene.index.TermsEnum} provides an iterator over the list
|
||||
of terms within a field, some <a href="#termstats">statistics</a> about the term,
|
||||
and methods to access the term's <a href="#documents">documents</a> and
|
||||
<a href="#positions">positions</a>.
|
||||
<pre class="prettyprint">
|
||||
// seek to a specific term
|
||||
boolean found = termsEnum.seekExact(new BytesRef("foobar"), true);
|
||||
if (found) {
|
||||
// get the document frequency
|
||||
System.out.println(termsEnum.docFreq());
|
||||
// enumerate through documents
|
||||
DocsEnum docs = termsEnum.docs(null, null);
|
||||
// enumerate through documents and positions
|
||||
DocsAndPositionsEnum docsAndPositions = termsEnum.docsAndPositions(null, null);
|
||||
}
|
||||
</pre>
|
||||
</p>
|
||||
<a name="documents"></a>
|
||||
<h4>
|
||||
Documents
|
||||
</h4>
|
||||
<p>
|
||||
{@link org.apache.lucene.index.DocsEnum} is an extension of
|
||||
{@link org.apache.lucene.search.DocIdSetIterator}that iterates over the list of
|
||||
documents for a term, along with the term frequency within that document.
|
||||
<pre class="prettyprint">
|
||||
int docid;
|
||||
while ((docid = docsEnum.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
|
||||
System.out.println(docid);
|
||||
System.out.println(docsEnum.freq());
|
||||
}
|
||||
</pre>
|
||||
</p>
|
||||
<a name="positions"></a>
|
||||
<h4>
|
||||
Positions
|
||||
</h4>
|
||||
<p>
|
||||
{@link org.apache.lucene.index.DocsAndPositionsEnum} is an extension of
|
||||
{@link org.apache.lucene.index.DocsEnum} that additionally allows iteration
|
||||
of the positions a term occurred within the document, and any additional
|
||||
per-position information (offsets and payload)
|
||||
<pre class="prettyprint">
|
||||
int docid;
|
||||
while ((docid = docsAndPositionsEnum.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
|
||||
System.out.println(docid);
|
||||
int freq = docsAndPositionsEnum.freq();
|
||||
for (int i = 0; i < freq; i++) {
|
||||
System.out.println(docsAndPositionsEnum.nextPosition());
|
||||
System.out.println(docsAndPositionsEnum.startOffset());
|
||||
System.out.println(docsAndPositionsEnum.endOffset());
|
||||
System.out.println(docsAndPositionsEnum.getPayload());
|
||||
}
|
||||
}
|
||||
</pre>
|
||||
</p>
|
||||
<a name="stats"></a>
|
||||
<h2>Index Statistics</h2>
|
||||
<a name="termstats"></a>
|
||||
<h4>
|
||||
Term statistics
|
||||
</h4>
|
||||
<p>
|
||||
<ul>
|
||||
<li>{@link org.apache.lucene.index.TermsEnum#docFreq}: Returns the number of
|
||||
documents that contain at least one occurrence of the term. This statistic
|
||||
is always available for an indexed term. Note that it will also count
|
||||
deleted documents, when segments are merged the statistic is updated as
|
||||
those deleted documents are merged away.
|
||||
<li>{@link org.apache.lucene.index.TermsEnum#totalTermFreq}: Returns the number
|
||||
of occurrences of this term across all documents. Note that this statistic
|
||||
is unavailable (returns <code>-1</code>) if term frequencies were omitted
|
||||
from the index
|
||||
({@link org.apache.lucene.index.FieldInfo.IndexOptions#DOCS_ONLY DOCS_ONLY})
|
||||
for the field. Like docFreq(), it will also count occurrences that appear in
|
||||
deleted documents.
|
||||
</ul>
|
||||
</p>
|
||||
<a name="fieldstats"></a>
|
||||
<h4>
|
||||
Field statistics
|
||||
</h4>
|
||||
<p>
|
||||
<ul>
|
||||
<li>{@link org.apache.lucene.index.Terms#size}: Returns the number of
|
||||
unique terms in the field. This statistic may be unavailable
|
||||
(returns <code>-1</code>) for some Terms implementations such as
|
||||
{@link org.apache.lucene.index.MultiTerms}, where it cannot be efficiently
|
||||
computed. Note that this count also includes terms that appear only
|
||||
in deleted documents: when segments are merged such terms are also merged
|
||||
away and the statistic is then updated.
|
||||
<li>{@link org.apache.lucene.index.Terms#getDocCount}: Returns the number of
|
||||
documents that contain at least one occurrence of any term for this field.
|
||||
This can be thought of as a Field-level docFreq(). Like docFreq() it will
|
||||
also count deleted documents.
|
||||
<li>{@link org.apache.lucene.index.Terms#getSumDocFreq}: Returns the number of
|
||||
postings (term-document mappings in the inverted index) for the field. This
|
||||
can be thought of as the sum of {@link org.apache.lucene.index.TermsEnum#docFreq}
|
||||
across all terms in the field, and like docFreq() it will also count postings
|
||||
that appear in deleted documents.
|
||||
<li>{@link org.apache.lucene.index.Terms#getSumTotalTermFreq}: Returns the number
|
||||
of tokens for the field. This can be thought of as the sum of
|
||||
{@link org.apache.lucene.index.TermsEnum#totalTermFreq} across all terms in the
|
||||
field, and like totalTermFreq() it will also count occurrences that appear in
|
||||
deleted documents, and will be unavailable (returns <code>-1</code>) if term
|
||||
frequencies were omitted from the index
|
||||
({@link org.apache.lucene.index.FieldInfo.IndexOptions#DOCS_ONLY DOCS_ONLY})
|
||||
for the field.
|
||||
</ul>
|
||||
</p>
|
||||
<a name="segmentstats"></a>
|
||||
<h4>
|
||||
Segment statistics
|
||||
</h4>
|
||||
<p>
|
||||
<ul>
|
||||
<li>{@link org.apache.lucene.index.IndexReader#maxDoc}: Returns the number of
|
||||
documents (including deleted documents) in the index.
|
||||
<li>{@link org.apache.lucene.index.IndexReader#numDocs}: Returns the number
|
||||
of live documents (excluding deleted documents) in the index.
|
||||
<li>{@link org.apache.lucene.index.IndexReader#numDeletedDocs}: Returns the
|
||||
number of deleted documents in the index.
|
||||
<li>{@link org.apache.lucene.index.Fields#size}: Returns the number of indexed
|
||||
fields.
|
||||
</ul>
|
||||
</p>
|
||||
<a name="documentstats"></a>
|
||||
<h4>
|
||||
Document statistics
|
||||
</h4>
|
||||
<p>
|
||||
Document statistics are available during the indexing process for an indexed field: typically
|
||||
a {@link org.apache.lucene.search.similarities.Similarity} implementation will store some
|
||||
of these values (possibly in a lossy way), into the normalization value for the document in
|
||||
its {@link org.apache.lucene.search.similarities.Similarity#computeNorm} method.
|
||||
</p>
|
||||
<p>
|
||||
<ul>
|
||||
<li>{@link org.apache.lucene.index.FieldInvertState#getLength}: Returns the number of
|
||||
tokens for this field in the document. Note that this is just the number
|
||||
of times that {@link org.apache.lucene.analysis.TokenStream#incrementToken} returned
|
||||
true, and is unrelated to the values in
|
||||
{@link org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute}.
|
||||
<li>{@link org.apache.lucene.index.FieldInvertState#getNumOverlap}: Returns the number
|
||||
of tokens for this field in the document that had a position increment of zero. This
|
||||
can be used to compute a document length that discounts artificial tokens
|
||||
such as synonyms.
|
||||
<li>{@link org.apache.lucene.index.FieldInvertState#getPosition}: Returns the accumulated
|
||||
position value for this field in the document: computed from the values of
|
||||
{@link org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute} and including
|
||||
{@link org.apache.lucene.analysis.Analyzer#getPositionIncrementGap}s across multivalued
|
||||
fields.
|
||||
<li>{@link org.apache.lucene.index.FieldInvertState#getOffset}: Returns the total
|
||||
character offset value for this field in the document: computed from the values of
|
||||
{@link org.apache.lucene.analysis.tokenattributes.OffsetAttribute} returned by
|
||||
{@link org.apache.lucene.analysis.TokenStream#end}, and including
|
||||
{@link org.apache.lucene.analysis.Analyzer#getOffsetGap}s across multivalued
|
||||
fields.
|
||||
<li>{@link org.apache.lucene.index.FieldInvertState#getUniqueTermCount}: Returns the number
|
||||
of unique terms encountered for this field in the document.
|
||||
<li>{@link org.apache.lucene.index.FieldInvertState#getMaxTermFrequency}: Returns the maximum
|
||||
frequency across all unique terms encountered for this field in the document.
|
||||
</ul>
|
||||
</p>
|
||||
<p>
|
||||
Additional user-supplied statistics can be added to the document as DocValues fields and
|
||||
accessed via {@link org.apache.lucene.index.AtomicReader#docValues}.
|
||||
</p>
|
||||
<p>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -23,7 +23,6 @@ import java.util.Collection;
|
|||
import java.util.List;
|
||||
|
||||
import org.apache.lucene.index.AtomicReaderContext;
|
||||
import org.apache.lucene.search.BooleanClause.Occur;
|
||||
import org.apache.lucene.search.BooleanQuery.BooleanWeight;
|
||||
|
||||
/* Description from Doug Cutting (excerpted from
|
||||
|
@ -115,7 +114,7 @@ final class BooleanScorer extends Scorer {
|
|||
// Therefore the only methods that are implemented are score() and doc().
|
||||
private static final class BucketScorer extends Scorer {
|
||||
|
||||
float score;
|
||||
double score;
|
||||
int doc = NO_MORE_DOCS;
|
||||
int freq;
|
||||
|
||||
|
@ -134,13 +133,13 @@ final class BooleanScorer extends Scorer {
|
|||
public int nextDoc() { return NO_MORE_DOCS; }
|
||||
|
||||
@Override
|
||||
public float score() { return score; }
|
||||
public float score() { return (float)score; }
|
||||
|
||||
}
|
||||
|
||||
static final class Bucket {
|
||||
int doc = -1; // tells if bucket is valid
|
||||
float score; // incremental score
|
||||
double score; // incremental score
|
||||
// TODO: break out bool anyProhibited, int
|
||||
// numRequiredMatched; then we can remove 32 limit on
|
||||
// required clauses
|
||||
|
|
|
@ -129,6 +129,7 @@ class ConjunctionScorer extends Scorer {
|
|||
|
||||
@Override
|
||||
public float score() throws IOException {
|
||||
// TODO: sum into a double and cast to float if we ever send required clauses to BS1
|
||||
float sum = 0.0f;
|
||||
for (int i = 0; i < scorers.length; i++) {
|
||||
sum += scorers[i].score();
|
||||
|
|
|
@ -90,6 +90,7 @@ class ConjunctionTermScorer extends Scorer {
|
|||
|
||||
@Override
|
||||
public float score() throws IOException {
|
||||
// TODO: sum into a double and cast to float if we ever send required clauses to BS1
|
||||
float sum = 0.0f;
|
||||
for (DocsAndFreqs docs : docsAndFreqs) {
|
||||
sum += docs.scorer.score();
|
||||
|
|
|
@ -60,13 +60,17 @@ public abstract class DocIdSetIterator {
|
|||
*/
|
||||
public abstract int nextDoc() throws IOException;
|
||||
|
||||
/**
|
||||
* Advances to the first beyond (see NOTE below) the current whose document
|
||||
* number is greater than or equal to <i>target</i>. Returns the current
|
||||
* document number or {@link #NO_MORE_DOCS} if there are no more docs in the
|
||||
* set.
|
||||
/**
|
||||
* Advances to the first beyond the current whose document number is greater
|
||||
* than or equal to <i>target</i>, and returns the document number itself.
|
||||
* Exhausts the iterator and returns {@link #NO_MORE_DOCS} if <i>target</i>
|
||||
* is greater than the highest document number in the set.
|
||||
* <p>
|
||||
* Behaves as if written:
|
||||
* The behavior of this method is <b>undefined</b> when called with
|
||||
* <code> target ≤ current</code>, or after the iterator has exhausted.
|
||||
* Both cases may result in unpredicted behavior.
|
||||
* <p>
|
||||
* When <code> target > current</code> it behaves as if written:
|
||||
*
|
||||
* <pre>
|
||||
* int advance(int target) {
|
||||
|
@ -79,18 +83,12 @@ public abstract class DocIdSetIterator {
|
|||
*
|
||||
* Some implementations are considerably more efficient than that.
|
||||
* <p>
|
||||
* <b>NOTE:</b> when <code> target ≤ current</code> implementations may opt
|
||||
* not to advance beyond their current {@link #docID()}.
|
||||
* <p>
|
||||
* <b>NOTE:</b> this method may be called with {@link #NO_MORE_DOCS} for
|
||||
* efficiency by some Scorers. If your implementation cannot efficiently
|
||||
* determine that it should exhaust, it is recommended that you check for that
|
||||
* value in each call to this method.
|
||||
* <p>
|
||||
* <b>NOTE:</b> after the iterator has exhausted you should not call this
|
||||
* method, as it may result in unpredicted behavior.
|
||||
* <p>
|
||||
*
|
||||
*
|
||||
* @since 2.9
|
||||
*/
|
||||
public abstract int advance(int target) throws IOException;
|
||||
|
|
|
@ -1110,14 +1110,8 @@ class FieldCacheImpl implements FieldCache {
|
|||
// Try for coarse estimate for number of bits; this
|
||||
// should be an underestimate most of the time, which
|
||||
// is fine -- GrowableWriter will reallocate as needed
|
||||
long numUniqueTerms = 0;
|
||||
try {
|
||||
numUniqueTerms = terms.size();
|
||||
} catch (UnsupportedOperationException uoe) {
|
||||
numUniqueTerms = -1;
|
||||
}
|
||||
if (numUniqueTerms != -1) {
|
||||
|
||||
long numUniqueTerms = terms.size();
|
||||
if (numUniqueTerms != -1L) {
|
||||
if (numUniqueTerms > termCountHardLimit) {
|
||||
// app is misusing the API (there is more than
|
||||
// one term per doc); in this case we make best
|
||||
|
@ -1248,13 +1242,8 @@ class FieldCacheImpl implements FieldCache {
|
|||
// Try for coarse estimate for number of bits; this
|
||||
// should be an underestimate most of the time, which
|
||||
// is fine -- GrowableWriter will reallocate as needed
|
||||
long numUniqueTerms = 0;
|
||||
try {
|
||||
numUniqueTerms = terms.size();
|
||||
} catch (UnsupportedOperationException uoe) {
|
||||
numUniqueTerms = -1;
|
||||
}
|
||||
if (numUniqueTerms != -1) {
|
||||
long numUniqueTerms = terms.size();
|
||||
if (numUniqueTerms != -1L) {
|
||||
if (numUniqueTerms > termCountHardLimit) {
|
||||
numUniqueTerms = termCountHardLimit;
|
||||
}
|
||||
|
|
|
@ -83,9 +83,7 @@ public class FilteredQuery extends Query {
|
|||
|
||||
@Override
|
||||
public boolean scoresDocsOutOfOrder() {
|
||||
// TODO: Support out-of-order scoring!
|
||||
// For now we return false here, as we always get the scorer in order
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -148,9 +146,7 @@ public class FilteredQuery extends Query {
|
|||
|
||||
if (useRandomAccess) {
|
||||
// if we are using random access, we return the inner scorer, just with other acceptDocs
|
||||
// TODO, replace this by when BooleanWeight is fixed to be consistent with its scorer implementations:
|
||||
// return weight.scorer(context, scoreDocsInOrder, topScorer, filterAcceptDocs);
|
||||
return weight.scorer(context, true, topScorer, filterAcceptDocs);
|
||||
return weight.scorer(context, scoreDocsInOrder, topScorer, filterAcceptDocs);
|
||||
} else {
|
||||
assert firstFilterDoc > -1;
|
||||
// we are gonna advance() this scorer, so we set inorder=true/toplevel=false
|
||||
|
|
|
@ -28,17 +28,21 @@ import org.apache.lucene.index.Term;
|
|||
<p>Instantiable subclasses are:
|
||||
<ul>
|
||||
<li> {@link TermQuery}
|
||||
<li> {@link MultiTermQuery}
|
||||
<li> {@link BooleanQuery}
|
||||
<li> {@link WildcardQuery}
|
||||
<li> {@link PhraseQuery}
|
||||
<li> {@link PrefixQuery}
|
||||
<li> {@link MultiPhraseQuery}
|
||||
<li> {@link FuzzyQuery}
|
||||
<li> {@link RegexpQuery}
|
||||
<li> {@link TermRangeQuery}
|
||||
<li> {@link NumericRangeQuery}
|
||||
<li> {@link org.apache.lucene.search.spans.SpanQuery}
|
||||
<li> {@link ConstantScoreQuery}
|
||||
<li> {@link DisjunctionMaxQuery}
|
||||
<li> {@link MatchAllDocsQuery}
|
||||
</ul>
|
||||
<p>See also the family of {@link org.apache.lucene.search.spans Span Queries}
|
||||
and additional queries available in the <a href="{@docRoot}/../queries/overview-summary.html">Queries module</a>
|
||||
*/
|
||||
public abstract class Query implements Cloneable {
|
||||
private float boost = 1.0f; // query boost factor
|
||||
|
|
|
@ -97,7 +97,9 @@ public class RegexpQuery extends AutomatonQuery {
|
|||
buffer.append(term.field());
|
||||
buffer.append(":");
|
||||
}
|
||||
buffer.append('/');
|
||||
buffer.append(term.text());
|
||||
buffer.append('/');
|
||||
buffer.append(ToStringUtils.boost(getBoost()));
|
||||
return buffer.toString();
|
||||
}
|
||||
|
|
|
@ -69,6 +69,7 @@ class ReqOptSumScorer extends Scorer {
|
|||
*/
|
||||
@Override
|
||||
public float score() throws IOException {
|
||||
// TODO: sum into a double and cast to float if we ever send required clauses to BS1
|
||||
int curDoc = reqScorer.docID();
|
||||
float reqScore = reqScorer.score();
|
||||
if (optScorer == null) {
|
||||
|
|
|
@ -28,6 +28,13 @@ import org.apache.lucene.util.IOUtils;
|
|||
/**
|
||||
* Abstract base class for performing read operations of Lucene's low-level
|
||||
* data types.
|
||||
*
|
||||
* <p>{@code DataInput} may only be used from one thread, because it is not
|
||||
* thread safe (it keeps internal state like file position). To allow
|
||||
* multithreaded use, every {@code DataInput} instance must be cloned before
|
||||
* used in another thread. Subclasses must therefore implement {@link #clone()},
|
||||
* returning a new {@code DataInput} which operates on the same underlying
|
||||
* resource, but positioned independently.
|
||||
*/
|
||||
public abstract class DataInput implements Cloneable {
|
||||
/** Reads and returns a single byte.
|
||||
|
@ -195,12 +202,11 @@ public abstract class DataInput implements Cloneable {
|
|||
*/
|
||||
@Override
|
||||
public DataInput clone() {
|
||||
DataInput clone = null;
|
||||
try {
|
||||
clone = (DataInput)super.clone();
|
||||
} catch (CloneNotSupportedException e) {}
|
||||
|
||||
return clone;
|
||||
return (DataInput) super.clone();
|
||||
} catch (CloneNotSupportedException e) {
|
||||
throw new Error("This cannot happen: Failing to clone DataInput");
|
||||
}
|
||||
}
|
||||
|
||||
/** Reads a Map<String,String> previously written
|
||||
|
|
|
@ -27,6 +27,9 @@ import org.apache.lucene.util.UnicodeUtil;
|
|||
/**
|
||||
* Abstract base class for performing write operations of Lucene's low-level
|
||||
* data types.
|
||||
|
||||
* <p>{@code DataOutput} may only be used from one thread, because it is not
|
||||
* thread safe (it keeps internal state like file position).
|
||||
*/
|
||||
public abstract class DataOutput {
|
||||
|
||||
|
|
|
@ -231,7 +231,7 @@ public abstract class Directory implements Closeable {
|
|||
}
|
||||
@Override
|
||||
public IndexInput openFullSlice() {
|
||||
return (IndexInput) base.clone();
|
||||
return base.clone();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -278,7 +278,7 @@ public abstract class Directory implements Closeable {
|
|||
|
||||
SlicedIndexInput(final String sliceDescription, final IndexInput base, final long fileOffset, final long length, int readBufferSize) {
|
||||
super("SlicedIndexInput(" + sliceDescription + " in " + base + " slice=" + fileOffset + ":" + (fileOffset+length) + ")", readBufferSize);
|
||||
this.base = (IndexInput) base.clone();
|
||||
this.base = base.clone();
|
||||
this.fileOffset = fileOffset;
|
||||
this.length = length;
|
||||
}
|
||||
|
@ -286,7 +286,7 @@ public abstract class Directory implements Closeable {
|
|||
@Override
|
||||
public SlicedIndexInput clone() {
|
||||
SlicedIndexInput clone = (SlicedIndexInput)super.clone();
|
||||
clone.base = (IndexInput)base.clone();
|
||||
clone.base = base.clone();
|
||||
clone.fileOffset = fileOffset;
|
||||
clone.length = length;
|
||||
return clone;
|
||||
|
|
|
@ -22,6 +22,17 @@ import java.io.IOException;
|
|||
|
||||
/** Abstract base class for input from a file in a {@link Directory}. A
|
||||
* random-access input stream. Used for all Lucene index input operations.
|
||||
*
|
||||
* <p>{@code IndexInput} may only be used from one thread, because it is not
|
||||
* thread safe (it keeps internal state like file position). To allow
|
||||
* multithreaded use, every {@code IndexInput} instance must be cloned before
|
||||
* used in another thread. Subclasses must therefore implement {@link #clone()},
|
||||
* returning a new {@code IndexInput} which operates on the same underlying
|
||||
* resource, but positioned independently. Lucene never closes cloned
|
||||
* {@code IndexInput}s, it will only do this on the original one.
|
||||
* The original instance must take care that cloned instances throw
|
||||
* {@link AlreadyClosedException} when the original one is closed.
|
||||
|
||||
* @see Directory
|
||||
*/
|
||||
public abstract class IndexInput extends DataInput implements Cloneable,Closeable {
|
||||
|
@ -83,4 +94,15 @@ public abstract class IndexInput extends DataInput implements Cloneable,Closeabl
|
|||
public String toString() {
|
||||
return resourceDescription;
|
||||
}
|
||||
|
||||
/** {@inheritDoc}
|
||||
* <p><b>Warning:</b> Lucene never closes cloned
|
||||
* {@code IndexInput}s, it will only do this on the original one.
|
||||
* The original instance must take care that cloned instances throw
|
||||
* {@link AlreadyClosedException} when the original one is closed.
|
||||
*/
|
||||
@Override
|
||||
public IndexInput clone() {
|
||||
return (IndexInput) super.clone();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,10 @@ import java.io.IOException;
|
|||
|
||||
/** Abstract base class for output to a file in a Directory. A random-access
|
||||
* output stream. Used for all Lucene index output operations.
|
||||
|
||||
* <p>{@code IndexOutput} may only be used from one thread, because it is not
|
||||
* thread safe (it keeps internal state like file position).
|
||||
|
||||
* @see Directory
|
||||
* @see IndexInput
|
||||
*/
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
package org.apache.lucene.util;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* Wraps an iterator to ensure its unmodifiable
|
||||
*/
|
||||
public class UnmodifiableIterator<T> implements Iterator<T> {
|
||||
private final Iterator<T> in;
|
||||
|
||||
public UnmodifiableIterator(Iterator<T> in) {
|
||||
this.in = in;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return in.hasNext();
|
||||
}
|
||||
|
||||
@Override
|
||||
public T next() {
|
||||
return in.next();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
|
@ -107,6 +107,8 @@ public final class WeakIdentityMap<K,V> {
|
|||
public Iterator<K> keyIterator() {
|
||||
reap();
|
||||
final Iterator<IdentityWeakReference> iterator = backingStore.keySet().iterator();
|
||||
// IMPORTANT: Don't use oal.util.FilterIterator here:
|
||||
// We need *strong* reference to current key after setNext()!!!
|
||||
return new Iterator<K>() {
|
||||
// holds strong reference to next element in backing iterator:
|
||||
private Object next = null;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,360 @@
|
|||
// This file has been automatically generated, DO NOT EDIT
|
||||
|
||||
package org.apache.lucene.util.packed;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Efficient sequential read/write of packed integers.
|
||||
*/
|
||||
final class BulkOperationPacked1 extends BulkOperation {
|
||||
@Override
|
||||
public int blockCount() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int valueCount() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(long[] blocks, int blocksOffset, int[] values, int valuesOffset, int iterations) {
|
||||
assert blocksOffset + iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
final long block0 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (block0 >>> 63);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 62) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 61) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 60) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 59) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 58) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 57) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 56) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 55) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 54) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 53) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 52) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 51) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 50) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 49) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 48) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 47) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 46) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 45) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 44) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 43) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 42) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 41) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 40) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 39) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 38) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 37) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 36) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 35) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 34) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 33) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 32) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 31) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 30) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 29) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 28) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 27) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 26) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 25) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 24) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 23) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 22) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 21) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 20) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 19) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 18) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 17) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 16) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 15) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 14) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 13) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 12) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 11) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 10) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 9) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 8) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 7) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 6) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 5) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 4) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 3) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 2) & 1L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 1) & 1L);
|
||||
values[valuesOffset++] = (int) (block0 & 1L);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(byte[] blocks, int blocksOffset, int[] values, int valuesOffset, int iterations) {
|
||||
assert blocksOffset + 8 * iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
final int byte0 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = byte0 >>> 7;
|
||||
values[valuesOffset++] = (byte0 >>> 6) & 1;
|
||||
values[valuesOffset++] = (byte0 >>> 5) & 1;
|
||||
values[valuesOffset++] = (byte0 >>> 4) & 1;
|
||||
values[valuesOffset++] = (byte0 >>> 3) & 1;
|
||||
values[valuesOffset++] = (byte0 >>> 2) & 1;
|
||||
values[valuesOffset++] = (byte0 >>> 1) & 1;
|
||||
values[valuesOffset++] = byte0 & 1;
|
||||
final int byte1 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = byte1 >>> 7;
|
||||
values[valuesOffset++] = (byte1 >>> 6) & 1;
|
||||
values[valuesOffset++] = (byte1 >>> 5) & 1;
|
||||
values[valuesOffset++] = (byte1 >>> 4) & 1;
|
||||
values[valuesOffset++] = (byte1 >>> 3) & 1;
|
||||
values[valuesOffset++] = (byte1 >>> 2) & 1;
|
||||
values[valuesOffset++] = (byte1 >>> 1) & 1;
|
||||
values[valuesOffset++] = byte1 & 1;
|
||||
final int byte2 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = byte2 >>> 7;
|
||||
values[valuesOffset++] = (byte2 >>> 6) & 1;
|
||||
values[valuesOffset++] = (byte2 >>> 5) & 1;
|
||||
values[valuesOffset++] = (byte2 >>> 4) & 1;
|
||||
values[valuesOffset++] = (byte2 >>> 3) & 1;
|
||||
values[valuesOffset++] = (byte2 >>> 2) & 1;
|
||||
values[valuesOffset++] = (byte2 >>> 1) & 1;
|
||||
values[valuesOffset++] = byte2 & 1;
|
||||
final int byte3 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = byte3 >>> 7;
|
||||
values[valuesOffset++] = (byte3 >>> 6) & 1;
|
||||
values[valuesOffset++] = (byte3 >>> 5) & 1;
|
||||
values[valuesOffset++] = (byte3 >>> 4) & 1;
|
||||
values[valuesOffset++] = (byte3 >>> 3) & 1;
|
||||
values[valuesOffset++] = (byte3 >>> 2) & 1;
|
||||
values[valuesOffset++] = (byte3 >>> 1) & 1;
|
||||
values[valuesOffset++] = byte3 & 1;
|
||||
final int byte4 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = byte4 >>> 7;
|
||||
values[valuesOffset++] = (byte4 >>> 6) & 1;
|
||||
values[valuesOffset++] = (byte4 >>> 5) & 1;
|
||||
values[valuesOffset++] = (byte4 >>> 4) & 1;
|
||||
values[valuesOffset++] = (byte4 >>> 3) & 1;
|
||||
values[valuesOffset++] = (byte4 >>> 2) & 1;
|
||||
values[valuesOffset++] = (byte4 >>> 1) & 1;
|
||||
values[valuesOffset++] = byte4 & 1;
|
||||
final int byte5 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = byte5 >>> 7;
|
||||
values[valuesOffset++] = (byte5 >>> 6) & 1;
|
||||
values[valuesOffset++] = (byte5 >>> 5) & 1;
|
||||
values[valuesOffset++] = (byte5 >>> 4) & 1;
|
||||
values[valuesOffset++] = (byte5 >>> 3) & 1;
|
||||
values[valuesOffset++] = (byte5 >>> 2) & 1;
|
||||
values[valuesOffset++] = (byte5 >>> 1) & 1;
|
||||
values[valuesOffset++] = byte5 & 1;
|
||||
final int byte6 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = byte6 >>> 7;
|
||||
values[valuesOffset++] = (byte6 >>> 6) & 1;
|
||||
values[valuesOffset++] = (byte6 >>> 5) & 1;
|
||||
values[valuesOffset++] = (byte6 >>> 4) & 1;
|
||||
values[valuesOffset++] = (byte6 >>> 3) & 1;
|
||||
values[valuesOffset++] = (byte6 >>> 2) & 1;
|
||||
values[valuesOffset++] = (byte6 >>> 1) & 1;
|
||||
values[valuesOffset++] = byte6 & 1;
|
||||
final int byte7 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = byte7 >>> 7;
|
||||
values[valuesOffset++] = (byte7 >>> 6) & 1;
|
||||
values[valuesOffset++] = (byte7 >>> 5) & 1;
|
||||
values[valuesOffset++] = (byte7 >>> 4) & 1;
|
||||
values[valuesOffset++] = (byte7 >>> 3) & 1;
|
||||
values[valuesOffset++] = (byte7 >>> 2) & 1;
|
||||
values[valuesOffset++] = (byte7 >>> 1) & 1;
|
||||
values[valuesOffset++] = byte7 & 1;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(long[] blocks, int blocksOffset, long[] values, int valuesOffset, int iterations) {
|
||||
assert blocksOffset + iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
final long block0 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = block0 >>> 63;
|
||||
values[valuesOffset++] = (block0 >>> 62) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 61) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 60) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 59) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 58) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 57) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 56) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 55) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 54) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 53) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 52) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 51) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 50) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 49) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 48) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 47) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 46) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 45) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 44) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 43) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 42) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 41) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 40) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 39) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 38) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 37) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 36) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 35) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 34) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 33) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 32) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 31) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 30) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 29) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 28) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 27) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 26) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 25) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 24) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 23) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 22) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 21) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 20) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 19) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 18) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 17) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 16) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 15) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 14) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 13) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 12) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 11) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 10) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 9) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 8) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 7) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 6) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 5) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 4) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 3) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 2) & 1L;
|
||||
values[valuesOffset++] = (block0 >>> 1) & 1L;
|
||||
values[valuesOffset++] = block0 & 1L;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(byte[] blocks, int blocksOffset, long[] values, int valuesOffset, int iterations) {
|
||||
assert blocksOffset + 8 * iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
final long byte0 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = byte0 >>> 7;
|
||||
values[valuesOffset++] = (byte0 >>> 6) & 1;
|
||||
values[valuesOffset++] = (byte0 >>> 5) & 1;
|
||||
values[valuesOffset++] = (byte0 >>> 4) & 1;
|
||||
values[valuesOffset++] = (byte0 >>> 3) & 1;
|
||||
values[valuesOffset++] = (byte0 >>> 2) & 1;
|
||||
values[valuesOffset++] = (byte0 >>> 1) & 1;
|
||||
values[valuesOffset++] = byte0 & 1;
|
||||
final long byte1 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = byte1 >>> 7;
|
||||
values[valuesOffset++] = (byte1 >>> 6) & 1;
|
||||
values[valuesOffset++] = (byte1 >>> 5) & 1;
|
||||
values[valuesOffset++] = (byte1 >>> 4) & 1;
|
||||
values[valuesOffset++] = (byte1 >>> 3) & 1;
|
||||
values[valuesOffset++] = (byte1 >>> 2) & 1;
|
||||
values[valuesOffset++] = (byte1 >>> 1) & 1;
|
||||
values[valuesOffset++] = byte1 & 1;
|
||||
final long byte2 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = byte2 >>> 7;
|
||||
values[valuesOffset++] = (byte2 >>> 6) & 1;
|
||||
values[valuesOffset++] = (byte2 >>> 5) & 1;
|
||||
values[valuesOffset++] = (byte2 >>> 4) & 1;
|
||||
values[valuesOffset++] = (byte2 >>> 3) & 1;
|
||||
values[valuesOffset++] = (byte2 >>> 2) & 1;
|
||||
values[valuesOffset++] = (byte2 >>> 1) & 1;
|
||||
values[valuesOffset++] = byte2 & 1;
|
||||
final long byte3 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = byte3 >>> 7;
|
||||
values[valuesOffset++] = (byte3 >>> 6) & 1;
|
||||
values[valuesOffset++] = (byte3 >>> 5) & 1;
|
||||
values[valuesOffset++] = (byte3 >>> 4) & 1;
|
||||
values[valuesOffset++] = (byte3 >>> 3) & 1;
|
||||
values[valuesOffset++] = (byte3 >>> 2) & 1;
|
||||
values[valuesOffset++] = (byte3 >>> 1) & 1;
|
||||
values[valuesOffset++] = byte3 & 1;
|
||||
final long byte4 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = byte4 >>> 7;
|
||||
values[valuesOffset++] = (byte4 >>> 6) & 1;
|
||||
values[valuesOffset++] = (byte4 >>> 5) & 1;
|
||||
values[valuesOffset++] = (byte4 >>> 4) & 1;
|
||||
values[valuesOffset++] = (byte4 >>> 3) & 1;
|
||||
values[valuesOffset++] = (byte4 >>> 2) & 1;
|
||||
values[valuesOffset++] = (byte4 >>> 1) & 1;
|
||||
values[valuesOffset++] = byte4 & 1;
|
||||
final long byte5 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = byte5 >>> 7;
|
||||
values[valuesOffset++] = (byte5 >>> 6) & 1;
|
||||
values[valuesOffset++] = (byte5 >>> 5) & 1;
|
||||
values[valuesOffset++] = (byte5 >>> 4) & 1;
|
||||
values[valuesOffset++] = (byte5 >>> 3) & 1;
|
||||
values[valuesOffset++] = (byte5 >>> 2) & 1;
|
||||
values[valuesOffset++] = (byte5 >>> 1) & 1;
|
||||
values[valuesOffset++] = byte5 & 1;
|
||||
final long byte6 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = byte6 >>> 7;
|
||||
values[valuesOffset++] = (byte6 >>> 6) & 1;
|
||||
values[valuesOffset++] = (byte6 >>> 5) & 1;
|
||||
values[valuesOffset++] = (byte6 >>> 4) & 1;
|
||||
values[valuesOffset++] = (byte6 >>> 3) & 1;
|
||||
values[valuesOffset++] = (byte6 >>> 2) & 1;
|
||||
values[valuesOffset++] = (byte6 >>> 1) & 1;
|
||||
values[valuesOffset++] = byte6 & 1;
|
||||
final long byte7 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = byte7 >>> 7;
|
||||
values[valuesOffset++] = (byte7 >>> 6) & 1;
|
||||
values[valuesOffset++] = (byte7 >>> 5) & 1;
|
||||
values[valuesOffset++] = (byte7 >>> 4) & 1;
|
||||
values[valuesOffset++] = (byte7 >>> 3) & 1;
|
||||
values[valuesOffset++] = (byte7 >>> 2) & 1;
|
||||
values[valuesOffset++] = (byte7 >>> 1) & 1;
|
||||
values[valuesOffset++] = byte7 & 1;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(int[] values, int valuesOffset, long[] blocks, int blocksOffset, int iterations) {
|
||||
assert blocksOffset + iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 63) | ((values[valuesOffset++] & 0xffffffffL) << 62) | ((values[valuesOffset++] & 0xffffffffL) << 61) | ((values[valuesOffset++] & 0xffffffffL) << 60) | ((values[valuesOffset++] & 0xffffffffL) << 59) | ((values[valuesOffset++] & 0xffffffffL) << 58) | ((values[valuesOffset++] & 0xffffffffL) << 57) | ((values[valuesOffset++] & 0xffffffffL) << 56) | ((values[valuesOffset++] & 0xffffffffL) << 55) | ((values[valuesOffset++] & 0xffffffffL) << 54) | ((values[valuesOffset++] & 0xffffffffL) << 53) | ((values[valuesOffset++] & 0xffffffffL) << 52) | ((values[valuesOffset++] & 0xffffffffL) << 51) | ((values[valuesOffset++] & 0xffffffffL) << 50) | ((values[valuesOffset++] & 0xffffffffL) << 49) | ((values[valuesOffset++] & 0xffffffffL) << 48) | ((values[valuesOffset++] & 0xffffffffL) << 47) | ((values[valuesOffset++] & 0xffffffffL) << 46) | ((values[valuesOffset++] & 0xffffffffL) << 45) | ((values[valuesOffset++] & 0xffffffffL) << 44) | ((values[valuesOffset++] & 0xffffffffL) << 43) | ((values[valuesOffset++] & 0xffffffffL) << 42) | ((values[valuesOffset++] & 0xffffffffL) << 41) | ((values[valuesOffset++] & 0xffffffffL) << 40) | ((values[valuesOffset++] & 0xffffffffL) << 39) | ((values[valuesOffset++] & 0xffffffffL) << 38) | ((values[valuesOffset++] & 0xffffffffL) << 37) | ((values[valuesOffset++] & 0xffffffffL) << 36) | ((values[valuesOffset++] & 0xffffffffL) << 35) | ((values[valuesOffset++] & 0xffffffffL) << 34) | ((values[valuesOffset++] & 0xffffffffL) << 33) | ((values[valuesOffset++] & 0xffffffffL) << 32) | ((values[valuesOffset++] & 0xffffffffL) << 31) | ((values[valuesOffset++] & 0xffffffffL) << 30) | ((values[valuesOffset++] & 0xffffffffL) << 29) | ((values[valuesOffset++] & 0xffffffffL) << 28) | ((values[valuesOffset++] & 0xffffffffL) << 27) | ((values[valuesOffset++] & 0xffffffffL) << 26) | ((values[valuesOffset++] & 0xffffffffL) << 25) | ((values[valuesOffset++] & 0xffffffffL) << 24) | ((values[valuesOffset++] & 0xffffffffL) << 23) | ((values[valuesOffset++] & 0xffffffffL) << 22) | ((values[valuesOffset++] & 0xffffffffL) << 21) | ((values[valuesOffset++] & 0xffffffffL) << 20) | ((values[valuesOffset++] & 0xffffffffL) << 19) | ((values[valuesOffset++] & 0xffffffffL) << 18) | ((values[valuesOffset++] & 0xffffffffL) << 17) | ((values[valuesOffset++] & 0xffffffffL) << 16) | ((values[valuesOffset++] & 0xffffffffL) << 15) | ((values[valuesOffset++] & 0xffffffffL) << 14) | ((values[valuesOffset++] & 0xffffffffL) << 13) | ((values[valuesOffset++] & 0xffffffffL) << 12) | ((values[valuesOffset++] & 0xffffffffL) << 11) | ((values[valuesOffset++] & 0xffffffffL) << 10) | ((values[valuesOffset++] & 0xffffffffL) << 9) | ((values[valuesOffset++] & 0xffffffffL) << 8) | ((values[valuesOffset++] & 0xffffffffL) << 7) | ((values[valuesOffset++] & 0xffffffffL) << 6) | ((values[valuesOffset++] & 0xffffffffL) << 5) | ((values[valuesOffset++] & 0xffffffffL) << 4) | ((values[valuesOffset++] & 0xffffffffL) << 3) | ((values[valuesOffset++] & 0xffffffffL) << 2) | ((values[valuesOffset++] & 0xffffffffL) << 1) | (values[valuesOffset++] & 0xffffffffL);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(long[] values, int valuesOffset, long[] blocks, int blocksOffset, int iterations) {
|
||||
assert blocksOffset + iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 63) | (values[valuesOffset++] << 62) | (values[valuesOffset++] << 61) | (values[valuesOffset++] << 60) | (values[valuesOffset++] << 59) | (values[valuesOffset++] << 58) | (values[valuesOffset++] << 57) | (values[valuesOffset++] << 56) | (values[valuesOffset++] << 55) | (values[valuesOffset++] << 54) | (values[valuesOffset++] << 53) | (values[valuesOffset++] << 52) | (values[valuesOffset++] << 51) | (values[valuesOffset++] << 50) | (values[valuesOffset++] << 49) | (values[valuesOffset++] << 48) | (values[valuesOffset++] << 47) | (values[valuesOffset++] << 46) | (values[valuesOffset++] << 45) | (values[valuesOffset++] << 44) | (values[valuesOffset++] << 43) | (values[valuesOffset++] << 42) | (values[valuesOffset++] << 41) | (values[valuesOffset++] << 40) | (values[valuesOffset++] << 39) | (values[valuesOffset++] << 38) | (values[valuesOffset++] << 37) | (values[valuesOffset++] << 36) | (values[valuesOffset++] << 35) | (values[valuesOffset++] << 34) | (values[valuesOffset++] << 33) | (values[valuesOffset++] << 32) | (values[valuesOffset++] << 31) | (values[valuesOffset++] << 30) | (values[valuesOffset++] << 29) | (values[valuesOffset++] << 28) | (values[valuesOffset++] << 27) | (values[valuesOffset++] << 26) | (values[valuesOffset++] << 25) | (values[valuesOffset++] << 24) | (values[valuesOffset++] << 23) | (values[valuesOffset++] << 22) | (values[valuesOffset++] << 21) | (values[valuesOffset++] << 20) | (values[valuesOffset++] << 19) | (values[valuesOffset++] << 18) | (values[valuesOffset++] << 17) | (values[valuesOffset++] << 16) | (values[valuesOffset++] << 15) | (values[valuesOffset++] << 14) | (values[valuesOffset++] << 13) | (values[valuesOffset++] << 12) | (values[valuesOffset++] << 11) | (values[valuesOffset++] << 10) | (values[valuesOffset++] << 9) | (values[valuesOffset++] << 8) | (values[valuesOffset++] << 7) | (values[valuesOffset++] << 6) | (values[valuesOffset++] << 5) | (values[valuesOffset++] << 4) | (values[valuesOffset++] << 3) | (values[valuesOffset++] << 2) | (values[valuesOffset++] << 1) | values[valuesOffset++];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,312 @@
|
|||
// This file has been automatically generated, DO NOT EDIT
|
||||
|
||||
package org.apache.lucene.util.packed;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Efficient sequential read/write of packed integers.
|
||||
*/
|
||||
final class BulkOperationPacked10 extends BulkOperation {
|
||||
@Override
|
||||
public int blockCount() {
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int valueCount() {
|
||||
return 32;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(long[] blocks, int blocksOffset, int[] values, int valuesOffset, int iterations) {
|
||||
assert blocksOffset + iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
final long block0 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (block0 >>> 54);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 44) & 1023L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 34) & 1023L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 24) & 1023L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 14) & 1023L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 4) & 1023L);
|
||||
final long block1 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block0 & 15L) << 6) | (block1 >>> 58));
|
||||
values[valuesOffset++] = (int) ((block1 >>> 48) & 1023L);
|
||||
values[valuesOffset++] = (int) ((block1 >>> 38) & 1023L);
|
||||
values[valuesOffset++] = (int) ((block1 >>> 28) & 1023L);
|
||||
values[valuesOffset++] = (int) ((block1 >>> 18) & 1023L);
|
||||
values[valuesOffset++] = (int) ((block1 >>> 8) & 1023L);
|
||||
final long block2 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block1 & 255L) << 2) | (block2 >>> 62));
|
||||
values[valuesOffset++] = (int) ((block2 >>> 52) & 1023L);
|
||||
values[valuesOffset++] = (int) ((block2 >>> 42) & 1023L);
|
||||
values[valuesOffset++] = (int) ((block2 >>> 32) & 1023L);
|
||||
values[valuesOffset++] = (int) ((block2 >>> 22) & 1023L);
|
||||
values[valuesOffset++] = (int) ((block2 >>> 12) & 1023L);
|
||||
values[valuesOffset++] = (int) ((block2 >>> 2) & 1023L);
|
||||
final long block3 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block2 & 3L) << 8) | (block3 >>> 56));
|
||||
values[valuesOffset++] = (int) ((block3 >>> 46) & 1023L);
|
||||
values[valuesOffset++] = (int) ((block3 >>> 36) & 1023L);
|
||||
values[valuesOffset++] = (int) ((block3 >>> 26) & 1023L);
|
||||
values[valuesOffset++] = (int) ((block3 >>> 16) & 1023L);
|
||||
values[valuesOffset++] = (int) ((block3 >>> 6) & 1023L);
|
||||
final long block4 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block3 & 63L) << 4) | (block4 >>> 60));
|
||||
values[valuesOffset++] = (int) ((block4 >>> 50) & 1023L);
|
||||
values[valuesOffset++] = (int) ((block4 >>> 40) & 1023L);
|
||||
values[valuesOffset++] = (int) ((block4 >>> 30) & 1023L);
|
||||
values[valuesOffset++] = (int) ((block4 >>> 20) & 1023L);
|
||||
values[valuesOffset++] = (int) ((block4 >>> 10) & 1023L);
|
||||
values[valuesOffset++] = (int) (block4 & 1023L);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(byte[] blocks, int blocksOffset, int[] values, int valuesOffset, int iterations) {
|
||||
assert blocksOffset + 8 * iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
final int byte0 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte1 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte0 << 2) | (byte1 >>> 6);
|
||||
final int byte2 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte1 & 63) << 4) | (byte2 >>> 4);
|
||||
final int byte3 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte2 & 15) << 6) | (byte3 >>> 2);
|
||||
final int byte4 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte3 & 3) << 8) | byte4;
|
||||
final int byte5 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte6 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte5 << 2) | (byte6 >>> 6);
|
||||
final int byte7 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte6 & 63) << 4) | (byte7 >>> 4);
|
||||
final int byte8 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte7 & 15) << 6) | (byte8 >>> 2);
|
||||
final int byte9 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte8 & 3) << 8) | byte9;
|
||||
final int byte10 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte11 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte10 << 2) | (byte11 >>> 6);
|
||||
final int byte12 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte11 & 63) << 4) | (byte12 >>> 4);
|
||||
final int byte13 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte12 & 15) << 6) | (byte13 >>> 2);
|
||||
final int byte14 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte13 & 3) << 8) | byte14;
|
||||
final int byte15 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte16 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte15 << 2) | (byte16 >>> 6);
|
||||
final int byte17 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte16 & 63) << 4) | (byte17 >>> 4);
|
||||
final int byte18 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte17 & 15) << 6) | (byte18 >>> 2);
|
||||
final int byte19 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte18 & 3) << 8) | byte19;
|
||||
final int byte20 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte21 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte20 << 2) | (byte21 >>> 6);
|
||||
final int byte22 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte21 & 63) << 4) | (byte22 >>> 4);
|
||||
final int byte23 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte22 & 15) << 6) | (byte23 >>> 2);
|
||||
final int byte24 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte23 & 3) << 8) | byte24;
|
||||
final int byte25 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte26 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte25 << 2) | (byte26 >>> 6);
|
||||
final int byte27 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte26 & 63) << 4) | (byte27 >>> 4);
|
||||
final int byte28 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte27 & 15) << 6) | (byte28 >>> 2);
|
||||
final int byte29 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte28 & 3) << 8) | byte29;
|
||||
final int byte30 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte31 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte30 << 2) | (byte31 >>> 6);
|
||||
final int byte32 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte31 & 63) << 4) | (byte32 >>> 4);
|
||||
final int byte33 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte32 & 15) << 6) | (byte33 >>> 2);
|
||||
final int byte34 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte33 & 3) << 8) | byte34;
|
||||
final int byte35 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte36 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte35 << 2) | (byte36 >>> 6);
|
||||
final int byte37 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte36 & 63) << 4) | (byte37 >>> 4);
|
||||
final int byte38 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte37 & 15) << 6) | (byte38 >>> 2);
|
||||
final int byte39 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte38 & 3) << 8) | byte39;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(long[] blocks, int blocksOffset, long[] values, int valuesOffset, int iterations) {
|
||||
assert blocksOffset + iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
final long block0 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = block0 >>> 54;
|
||||
values[valuesOffset++] = (block0 >>> 44) & 1023L;
|
||||
values[valuesOffset++] = (block0 >>> 34) & 1023L;
|
||||
values[valuesOffset++] = (block0 >>> 24) & 1023L;
|
||||
values[valuesOffset++] = (block0 >>> 14) & 1023L;
|
||||
values[valuesOffset++] = (block0 >>> 4) & 1023L;
|
||||
final long block1 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block0 & 15L) << 6) | (block1 >>> 58);
|
||||
values[valuesOffset++] = (block1 >>> 48) & 1023L;
|
||||
values[valuesOffset++] = (block1 >>> 38) & 1023L;
|
||||
values[valuesOffset++] = (block1 >>> 28) & 1023L;
|
||||
values[valuesOffset++] = (block1 >>> 18) & 1023L;
|
||||
values[valuesOffset++] = (block1 >>> 8) & 1023L;
|
||||
final long block2 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block1 & 255L) << 2) | (block2 >>> 62);
|
||||
values[valuesOffset++] = (block2 >>> 52) & 1023L;
|
||||
values[valuesOffset++] = (block2 >>> 42) & 1023L;
|
||||
values[valuesOffset++] = (block2 >>> 32) & 1023L;
|
||||
values[valuesOffset++] = (block2 >>> 22) & 1023L;
|
||||
values[valuesOffset++] = (block2 >>> 12) & 1023L;
|
||||
values[valuesOffset++] = (block2 >>> 2) & 1023L;
|
||||
final long block3 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block2 & 3L) << 8) | (block3 >>> 56);
|
||||
values[valuesOffset++] = (block3 >>> 46) & 1023L;
|
||||
values[valuesOffset++] = (block3 >>> 36) & 1023L;
|
||||
values[valuesOffset++] = (block3 >>> 26) & 1023L;
|
||||
values[valuesOffset++] = (block3 >>> 16) & 1023L;
|
||||
values[valuesOffset++] = (block3 >>> 6) & 1023L;
|
||||
final long block4 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block3 & 63L) << 4) | (block4 >>> 60);
|
||||
values[valuesOffset++] = (block4 >>> 50) & 1023L;
|
||||
values[valuesOffset++] = (block4 >>> 40) & 1023L;
|
||||
values[valuesOffset++] = (block4 >>> 30) & 1023L;
|
||||
values[valuesOffset++] = (block4 >>> 20) & 1023L;
|
||||
values[valuesOffset++] = (block4 >>> 10) & 1023L;
|
||||
values[valuesOffset++] = block4 & 1023L;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(byte[] blocks, int blocksOffset, long[] values, int valuesOffset, int iterations) {
|
||||
assert blocksOffset + 8 * iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
final long byte0 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte1 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte0 << 2) | (byte1 >>> 6);
|
||||
final long byte2 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte1 & 63) << 4) | (byte2 >>> 4);
|
||||
final long byte3 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte2 & 15) << 6) | (byte3 >>> 2);
|
||||
final long byte4 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte3 & 3) << 8) | byte4;
|
||||
final long byte5 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte6 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte5 << 2) | (byte6 >>> 6);
|
||||
final long byte7 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte6 & 63) << 4) | (byte7 >>> 4);
|
||||
final long byte8 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte7 & 15) << 6) | (byte8 >>> 2);
|
||||
final long byte9 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte8 & 3) << 8) | byte9;
|
||||
final long byte10 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte11 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte10 << 2) | (byte11 >>> 6);
|
||||
final long byte12 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte11 & 63) << 4) | (byte12 >>> 4);
|
||||
final long byte13 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte12 & 15) << 6) | (byte13 >>> 2);
|
||||
final long byte14 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte13 & 3) << 8) | byte14;
|
||||
final long byte15 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte16 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte15 << 2) | (byte16 >>> 6);
|
||||
final long byte17 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte16 & 63) << 4) | (byte17 >>> 4);
|
||||
final long byte18 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte17 & 15) << 6) | (byte18 >>> 2);
|
||||
final long byte19 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte18 & 3) << 8) | byte19;
|
||||
final long byte20 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte21 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte20 << 2) | (byte21 >>> 6);
|
||||
final long byte22 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte21 & 63) << 4) | (byte22 >>> 4);
|
||||
final long byte23 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte22 & 15) << 6) | (byte23 >>> 2);
|
||||
final long byte24 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte23 & 3) << 8) | byte24;
|
||||
final long byte25 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte26 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte25 << 2) | (byte26 >>> 6);
|
||||
final long byte27 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte26 & 63) << 4) | (byte27 >>> 4);
|
||||
final long byte28 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte27 & 15) << 6) | (byte28 >>> 2);
|
||||
final long byte29 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte28 & 3) << 8) | byte29;
|
||||
final long byte30 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte31 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte30 << 2) | (byte31 >>> 6);
|
||||
final long byte32 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte31 & 63) << 4) | (byte32 >>> 4);
|
||||
final long byte33 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte32 & 15) << 6) | (byte33 >>> 2);
|
||||
final long byte34 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte33 & 3) << 8) | byte34;
|
||||
final long byte35 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte36 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte35 << 2) | (byte36 >>> 6);
|
||||
final long byte37 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte36 & 63) << 4) | (byte37 >>> 4);
|
||||
final long byte38 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte37 & 15) << 6) | (byte38 >>> 2);
|
||||
final long byte39 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte38 & 3) << 8) | byte39;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(int[] values, int valuesOffset, long[] blocks, int blocksOffset, int iterations) {
|
||||
assert blocksOffset + iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 54) | ((values[valuesOffset++] & 0xffffffffL) << 44) | ((values[valuesOffset++] & 0xffffffffL) << 34) | ((values[valuesOffset++] & 0xffffffffL) << 24) | ((values[valuesOffset++] & 0xffffffffL) << 14) | ((values[valuesOffset++] & 0xffffffffL) << 4) | ((values[valuesOffset] & 0xffffffffL) >>> 6);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 58) | ((values[valuesOffset++] & 0xffffffffL) << 48) | ((values[valuesOffset++] & 0xffffffffL) << 38) | ((values[valuesOffset++] & 0xffffffffL) << 28) | ((values[valuesOffset++] & 0xffffffffL) << 18) | ((values[valuesOffset++] & 0xffffffffL) << 8) | ((values[valuesOffset] & 0xffffffffL) >>> 2);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 62) | ((values[valuesOffset++] & 0xffffffffL) << 52) | ((values[valuesOffset++] & 0xffffffffL) << 42) | ((values[valuesOffset++] & 0xffffffffL) << 32) | ((values[valuesOffset++] & 0xffffffffL) << 22) | ((values[valuesOffset++] & 0xffffffffL) << 12) | ((values[valuesOffset++] & 0xffffffffL) << 2) | ((values[valuesOffset] & 0xffffffffL) >>> 8);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 56) | ((values[valuesOffset++] & 0xffffffffL) << 46) | ((values[valuesOffset++] & 0xffffffffL) << 36) | ((values[valuesOffset++] & 0xffffffffL) << 26) | ((values[valuesOffset++] & 0xffffffffL) << 16) | ((values[valuesOffset++] & 0xffffffffL) << 6) | ((values[valuesOffset] & 0xffffffffL) >>> 4);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 60) | ((values[valuesOffset++] & 0xffffffffL) << 50) | ((values[valuesOffset++] & 0xffffffffL) << 40) | ((values[valuesOffset++] & 0xffffffffL) << 30) | ((values[valuesOffset++] & 0xffffffffL) << 20) | ((values[valuesOffset++] & 0xffffffffL) << 10) | (values[valuesOffset++] & 0xffffffffL);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(long[] values, int valuesOffset, long[] blocks, int blocksOffset, int iterations) {
|
||||
assert blocksOffset + iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 54) | (values[valuesOffset++] << 44) | (values[valuesOffset++] << 34) | (values[valuesOffset++] << 24) | (values[valuesOffset++] << 14) | (values[valuesOffset++] << 4) | (values[valuesOffset] >>> 6);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 58) | (values[valuesOffset++] << 48) | (values[valuesOffset++] << 38) | (values[valuesOffset++] << 28) | (values[valuesOffset++] << 18) | (values[valuesOffset++] << 8) | (values[valuesOffset] >>> 2);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 62) | (values[valuesOffset++] << 52) | (values[valuesOffset++] << 42) | (values[valuesOffset++] << 32) | (values[valuesOffset++] << 22) | (values[valuesOffset++] << 12) | (values[valuesOffset++] << 2) | (values[valuesOffset] >>> 8);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 56) | (values[valuesOffset++] << 46) | (values[valuesOffset++] << 36) | (values[valuesOffset++] << 26) | (values[valuesOffset++] << 16) | (values[valuesOffset++] << 6) | (values[valuesOffset] >>> 4);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 60) | (values[valuesOffset++] << 50) | (values[valuesOffset++] << 40) | (values[valuesOffset++] << 30) | (values[valuesOffset++] << 20) | (values[valuesOffset++] << 10) | values[valuesOffset++];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,560 @@
|
|||
// This file has been automatically generated, DO NOT EDIT
|
||||
|
||||
package org.apache.lucene.util.packed;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Efficient sequential read/write of packed integers.
|
||||
*/
|
||||
final class BulkOperationPacked11 extends BulkOperation {
|
||||
@Override
|
||||
public int blockCount() {
|
||||
return 11;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int valueCount() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(long[] blocks, int blocksOffset, int[] values, int valuesOffset, int iterations) {
|
||||
assert blocksOffset + iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
final long block0 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (block0 >>> 53);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 42) & 2047L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 31) & 2047L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 20) & 2047L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 9) & 2047L);
|
||||
final long block1 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block0 & 511L) << 2) | (block1 >>> 62));
|
||||
values[valuesOffset++] = (int) ((block1 >>> 51) & 2047L);
|
||||
values[valuesOffset++] = (int) ((block1 >>> 40) & 2047L);
|
||||
values[valuesOffset++] = (int) ((block1 >>> 29) & 2047L);
|
||||
values[valuesOffset++] = (int) ((block1 >>> 18) & 2047L);
|
||||
values[valuesOffset++] = (int) ((block1 >>> 7) & 2047L);
|
||||
final long block2 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block1 & 127L) << 4) | (block2 >>> 60));
|
||||
values[valuesOffset++] = (int) ((block2 >>> 49) & 2047L);
|
||||
values[valuesOffset++] = (int) ((block2 >>> 38) & 2047L);
|
||||
values[valuesOffset++] = (int) ((block2 >>> 27) & 2047L);
|
||||
values[valuesOffset++] = (int) ((block2 >>> 16) & 2047L);
|
||||
values[valuesOffset++] = (int) ((block2 >>> 5) & 2047L);
|
||||
final long block3 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block2 & 31L) << 6) | (block3 >>> 58));
|
||||
values[valuesOffset++] = (int) ((block3 >>> 47) & 2047L);
|
||||
values[valuesOffset++] = (int) ((block3 >>> 36) & 2047L);
|
||||
values[valuesOffset++] = (int) ((block3 >>> 25) & 2047L);
|
||||
values[valuesOffset++] = (int) ((block3 >>> 14) & 2047L);
|
||||
values[valuesOffset++] = (int) ((block3 >>> 3) & 2047L);
|
||||
final long block4 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block3 & 7L) << 8) | (block4 >>> 56));
|
||||
values[valuesOffset++] = (int) ((block4 >>> 45) & 2047L);
|
||||
values[valuesOffset++] = (int) ((block4 >>> 34) & 2047L);
|
||||
values[valuesOffset++] = (int) ((block4 >>> 23) & 2047L);
|
||||
values[valuesOffset++] = (int) ((block4 >>> 12) & 2047L);
|
||||
values[valuesOffset++] = (int) ((block4 >>> 1) & 2047L);
|
||||
final long block5 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block4 & 1L) << 10) | (block5 >>> 54));
|
||||
values[valuesOffset++] = (int) ((block5 >>> 43) & 2047L);
|
||||
values[valuesOffset++] = (int) ((block5 >>> 32) & 2047L);
|
||||
values[valuesOffset++] = (int) ((block5 >>> 21) & 2047L);
|
||||
values[valuesOffset++] = (int) ((block5 >>> 10) & 2047L);
|
||||
final long block6 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block5 & 1023L) << 1) | (block6 >>> 63));
|
||||
values[valuesOffset++] = (int) ((block6 >>> 52) & 2047L);
|
||||
values[valuesOffset++] = (int) ((block6 >>> 41) & 2047L);
|
||||
values[valuesOffset++] = (int) ((block6 >>> 30) & 2047L);
|
||||
values[valuesOffset++] = (int) ((block6 >>> 19) & 2047L);
|
||||
values[valuesOffset++] = (int) ((block6 >>> 8) & 2047L);
|
||||
final long block7 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block6 & 255L) << 3) | (block7 >>> 61));
|
||||
values[valuesOffset++] = (int) ((block7 >>> 50) & 2047L);
|
||||
values[valuesOffset++] = (int) ((block7 >>> 39) & 2047L);
|
||||
values[valuesOffset++] = (int) ((block7 >>> 28) & 2047L);
|
||||
values[valuesOffset++] = (int) ((block7 >>> 17) & 2047L);
|
||||
values[valuesOffset++] = (int) ((block7 >>> 6) & 2047L);
|
||||
final long block8 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block7 & 63L) << 5) | (block8 >>> 59));
|
||||
values[valuesOffset++] = (int) ((block8 >>> 48) & 2047L);
|
||||
values[valuesOffset++] = (int) ((block8 >>> 37) & 2047L);
|
||||
values[valuesOffset++] = (int) ((block8 >>> 26) & 2047L);
|
||||
values[valuesOffset++] = (int) ((block8 >>> 15) & 2047L);
|
||||
values[valuesOffset++] = (int) ((block8 >>> 4) & 2047L);
|
||||
final long block9 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block8 & 15L) << 7) | (block9 >>> 57));
|
||||
values[valuesOffset++] = (int) ((block9 >>> 46) & 2047L);
|
||||
values[valuesOffset++] = (int) ((block9 >>> 35) & 2047L);
|
||||
values[valuesOffset++] = (int) ((block9 >>> 24) & 2047L);
|
||||
values[valuesOffset++] = (int) ((block9 >>> 13) & 2047L);
|
||||
values[valuesOffset++] = (int) ((block9 >>> 2) & 2047L);
|
||||
final long block10 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block9 & 3L) << 9) | (block10 >>> 55));
|
||||
values[valuesOffset++] = (int) ((block10 >>> 44) & 2047L);
|
||||
values[valuesOffset++] = (int) ((block10 >>> 33) & 2047L);
|
||||
values[valuesOffset++] = (int) ((block10 >>> 22) & 2047L);
|
||||
values[valuesOffset++] = (int) ((block10 >>> 11) & 2047L);
|
||||
values[valuesOffset++] = (int) (block10 & 2047L);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(byte[] blocks, int blocksOffset, int[] values, int valuesOffset, int iterations) {
|
||||
assert blocksOffset + 8 * iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
final int byte0 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte1 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte0 << 3) | (byte1 >>> 5);
|
||||
final int byte2 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte1 & 31) << 6) | (byte2 >>> 2);
|
||||
final int byte3 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte4 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte2 & 3) << 9) | (byte3 << 1) | (byte4 >>> 7);
|
||||
final int byte5 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte4 & 127) << 4) | (byte5 >>> 4);
|
||||
final int byte6 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte5 & 15) << 7) | (byte6 >>> 1);
|
||||
final int byte7 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte8 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte6 & 1) << 10) | (byte7 << 2) | (byte8 >>> 6);
|
||||
final int byte9 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte8 & 63) << 5) | (byte9 >>> 3);
|
||||
final int byte10 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte9 & 7) << 8) | byte10;
|
||||
final int byte11 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte12 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte11 << 3) | (byte12 >>> 5);
|
||||
final int byte13 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte12 & 31) << 6) | (byte13 >>> 2);
|
||||
final int byte14 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte15 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte13 & 3) << 9) | (byte14 << 1) | (byte15 >>> 7);
|
||||
final int byte16 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte15 & 127) << 4) | (byte16 >>> 4);
|
||||
final int byte17 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte16 & 15) << 7) | (byte17 >>> 1);
|
||||
final int byte18 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte19 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte17 & 1) << 10) | (byte18 << 2) | (byte19 >>> 6);
|
||||
final int byte20 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte19 & 63) << 5) | (byte20 >>> 3);
|
||||
final int byte21 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte20 & 7) << 8) | byte21;
|
||||
final int byte22 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte23 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte22 << 3) | (byte23 >>> 5);
|
||||
final int byte24 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte23 & 31) << 6) | (byte24 >>> 2);
|
||||
final int byte25 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte26 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte24 & 3) << 9) | (byte25 << 1) | (byte26 >>> 7);
|
||||
final int byte27 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte26 & 127) << 4) | (byte27 >>> 4);
|
||||
final int byte28 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte27 & 15) << 7) | (byte28 >>> 1);
|
||||
final int byte29 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte30 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte28 & 1) << 10) | (byte29 << 2) | (byte30 >>> 6);
|
||||
final int byte31 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte30 & 63) << 5) | (byte31 >>> 3);
|
||||
final int byte32 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte31 & 7) << 8) | byte32;
|
||||
final int byte33 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte34 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte33 << 3) | (byte34 >>> 5);
|
||||
final int byte35 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte34 & 31) << 6) | (byte35 >>> 2);
|
||||
final int byte36 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte37 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte35 & 3) << 9) | (byte36 << 1) | (byte37 >>> 7);
|
||||
final int byte38 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte37 & 127) << 4) | (byte38 >>> 4);
|
||||
final int byte39 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte38 & 15) << 7) | (byte39 >>> 1);
|
||||
final int byte40 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte41 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte39 & 1) << 10) | (byte40 << 2) | (byte41 >>> 6);
|
||||
final int byte42 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte41 & 63) << 5) | (byte42 >>> 3);
|
||||
final int byte43 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte42 & 7) << 8) | byte43;
|
||||
final int byte44 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte45 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte44 << 3) | (byte45 >>> 5);
|
||||
final int byte46 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte45 & 31) << 6) | (byte46 >>> 2);
|
||||
final int byte47 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte48 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte46 & 3) << 9) | (byte47 << 1) | (byte48 >>> 7);
|
||||
final int byte49 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte48 & 127) << 4) | (byte49 >>> 4);
|
||||
final int byte50 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte49 & 15) << 7) | (byte50 >>> 1);
|
||||
final int byte51 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte52 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte50 & 1) << 10) | (byte51 << 2) | (byte52 >>> 6);
|
||||
final int byte53 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte52 & 63) << 5) | (byte53 >>> 3);
|
||||
final int byte54 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte53 & 7) << 8) | byte54;
|
||||
final int byte55 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte56 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte55 << 3) | (byte56 >>> 5);
|
||||
final int byte57 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte56 & 31) << 6) | (byte57 >>> 2);
|
||||
final int byte58 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte59 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte57 & 3) << 9) | (byte58 << 1) | (byte59 >>> 7);
|
||||
final int byte60 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte59 & 127) << 4) | (byte60 >>> 4);
|
||||
final int byte61 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte60 & 15) << 7) | (byte61 >>> 1);
|
||||
final int byte62 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte63 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte61 & 1) << 10) | (byte62 << 2) | (byte63 >>> 6);
|
||||
final int byte64 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte63 & 63) << 5) | (byte64 >>> 3);
|
||||
final int byte65 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte64 & 7) << 8) | byte65;
|
||||
final int byte66 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte67 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte66 << 3) | (byte67 >>> 5);
|
||||
final int byte68 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte67 & 31) << 6) | (byte68 >>> 2);
|
||||
final int byte69 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte70 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte68 & 3) << 9) | (byte69 << 1) | (byte70 >>> 7);
|
||||
final int byte71 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte70 & 127) << 4) | (byte71 >>> 4);
|
||||
final int byte72 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte71 & 15) << 7) | (byte72 >>> 1);
|
||||
final int byte73 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte74 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte72 & 1) << 10) | (byte73 << 2) | (byte74 >>> 6);
|
||||
final int byte75 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte74 & 63) << 5) | (byte75 >>> 3);
|
||||
final int byte76 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte75 & 7) << 8) | byte76;
|
||||
final int byte77 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte78 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte77 << 3) | (byte78 >>> 5);
|
||||
final int byte79 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte78 & 31) << 6) | (byte79 >>> 2);
|
||||
final int byte80 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte81 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte79 & 3) << 9) | (byte80 << 1) | (byte81 >>> 7);
|
||||
final int byte82 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte81 & 127) << 4) | (byte82 >>> 4);
|
||||
final int byte83 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte82 & 15) << 7) | (byte83 >>> 1);
|
||||
final int byte84 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte85 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte83 & 1) << 10) | (byte84 << 2) | (byte85 >>> 6);
|
||||
final int byte86 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte85 & 63) << 5) | (byte86 >>> 3);
|
||||
final int byte87 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte86 & 7) << 8) | byte87;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(long[] blocks, int blocksOffset, long[] values, int valuesOffset, int iterations) {
|
||||
assert blocksOffset + iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
final long block0 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = block0 >>> 53;
|
||||
values[valuesOffset++] = (block0 >>> 42) & 2047L;
|
||||
values[valuesOffset++] = (block0 >>> 31) & 2047L;
|
||||
values[valuesOffset++] = (block0 >>> 20) & 2047L;
|
||||
values[valuesOffset++] = (block0 >>> 9) & 2047L;
|
||||
final long block1 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block0 & 511L) << 2) | (block1 >>> 62);
|
||||
values[valuesOffset++] = (block1 >>> 51) & 2047L;
|
||||
values[valuesOffset++] = (block1 >>> 40) & 2047L;
|
||||
values[valuesOffset++] = (block1 >>> 29) & 2047L;
|
||||
values[valuesOffset++] = (block1 >>> 18) & 2047L;
|
||||
values[valuesOffset++] = (block1 >>> 7) & 2047L;
|
||||
final long block2 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block1 & 127L) << 4) | (block2 >>> 60);
|
||||
values[valuesOffset++] = (block2 >>> 49) & 2047L;
|
||||
values[valuesOffset++] = (block2 >>> 38) & 2047L;
|
||||
values[valuesOffset++] = (block2 >>> 27) & 2047L;
|
||||
values[valuesOffset++] = (block2 >>> 16) & 2047L;
|
||||
values[valuesOffset++] = (block2 >>> 5) & 2047L;
|
||||
final long block3 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block2 & 31L) << 6) | (block3 >>> 58);
|
||||
values[valuesOffset++] = (block3 >>> 47) & 2047L;
|
||||
values[valuesOffset++] = (block3 >>> 36) & 2047L;
|
||||
values[valuesOffset++] = (block3 >>> 25) & 2047L;
|
||||
values[valuesOffset++] = (block3 >>> 14) & 2047L;
|
||||
values[valuesOffset++] = (block3 >>> 3) & 2047L;
|
||||
final long block4 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block3 & 7L) << 8) | (block4 >>> 56);
|
||||
values[valuesOffset++] = (block4 >>> 45) & 2047L;
|
||||
values[valuesOffset++] = (block4 >>> 34) & 2047L;
|
||||
values[valuesOffset++] = (block4 >>> 23) & 2047L;
|
||||
values[valuesOffset++] = (block4 >>> 12) & 2047L;
|
||||
values[valuesOffset++] = (block4 >>> 1) & 2047L;
|
||||
final long block5 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block4 & 1L) << 10) | (block5 >>> 54);
|
||||
values[valuesOffset++] = (block5 >>> 43) & 2047L;
|
||||
values[valuesOffset++] = (block5 >>> 32) & 2047L;
|
||||
values[valuesOffset++] = (block5 >>> 21) & 2047L;
|
||||
values[valuesOffset++] = (block5 >>> 10) & 2047L;
|
||||
final long block6 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block5 & 1023L) << 1) | (block6 >>> 63);
|
||||
values[valuesOffset++] = (block6 >>> 52) & 2047L;
|
||||
values[valuesOffset++] = (block6 >>> 41) & 2047L;
|
||||
values[valuesOffset++] = (block6 >>> 30) & 2047L;
|
||||
values[valuesOffset++] = (block6 >>> 19) & 2047L;
|
||||
values[valuesOffset++] = (block6 >>> 8) & 2047L;
|
||||
final long block7 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block6 & 255L) << 3) | (block7 >>> 61);
|
||||
values[valuesOffset++] = (block7 >>> 50) & 2047L;
|
||||
values[valuesOffset++] = (block7 >>> 39) & 2047L;
|
||||
values[valuesOffset++] = (block7 >>> 28) & 2047L;
|
||||
values[valuesOffset++] = (block7 >>> 17) & 2047L;
|
||||
values[valuesOffset++] = (block7 >>> 6) & 2047L;
|
||||
final long block8 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block7 & 63L) << 5) | (block8 >>> 59);
|
||||
values[valuesOffset++] = (block8 >>> 48) & 2047L;
|
||||
values[valuesOffset++] = (block8 >>> 37) & 2047L;
|
||||
values[valuesOffset++] = (block8 >>> 26) & 2047L;
|
||||
values[valuesOffset++] = (block8 >>> 15) & 2047L;
|
||||
values[valuesOffset++] = (block8 >>> 4) & 2047L;
|
||||
final long block9 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block8 & 15L) << 7) | (block9 >>> 57);
|
||||
values[valuesOffset++] = (block9 >>> 46) & 2047L;
|
||||
values[valuesOffset++] = (block9 >>> 35) & 2047L;
|
||||
values[valuesOffset++] = (block9 >>> 24) & 2047L;
|
||||
values[valuesOffset++] = (block9 >>> 13) & 2047L;
|
||||
values[valuesOffset++] = (block9 >>> 2) & 2047L;
|
||||
final long block10 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block9 & 3L) << 9) | (block10 >>> 55);
|
||||
values[valuesOffset++] = (block10 >>> 44) & 2047L;
|
||||
values[valuesOffset++] = (block10 >>> 33) & 2047L;
|
||||
values[valuesOffset++] = (block10 >>> 22) & 2047L;
|
||||
values[valuesOffset++] = (block10 >>> 11) & 2047L;
|
||||
values[valuesOffset++] = block10 & 2047L;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(byte[] blocks, int blocksOffset, long[] values, int valuesOffset, int iterations) {
|
||||
assert blocksOffset + 8 * iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
final long byte0 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte1 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte0 << 3) | (byte1 >>> 5);
|
||||
final long byte2 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte1 & 31) << 6) | (byte2 >>> 2);
|
||||
final long byte3 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte4 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte2 & 3) << 9) | (byte3 << 1) | (byte4 >>> 7);
|
||||
final long byte5 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte4 & 127) << 4) | (byte5 >>> 4);
|
||||
final long byte6 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte5 & 15) << 7) | (byte6 >>> 1);
|
||||
final long byte7 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte8 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte6 & 1) << 10) | (byte7 << 2) | (byte8 >>> 6);
|
||||
final long byte9 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte8 & 63) << 5) | (byte9 >>> 3);
|
||||
final long byte10 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte9 & 7) << 8) | byte10;
|
||||
final long byte11 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte12 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte11 << 3) | (byte12 >>> 5);
|
||||
final long byte13 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte12 & 31) << 6) | (byte13 >>> 2);
|
||||
final long byte14 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte15 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte13 & 3) << 9) | (byte14 << 1) | (byte15 >>> 7);
|
||||
final long byte16 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte15 & 127) << 4) | (byte16 >>> 4);
|
||||
final long byte17 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte16 & 15) << 7) | (byte17 >>> 1);
|
||||
final long byte18 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte19 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte17 & 1) << 10) | (byte18 << 2) | (byte19 >>> 6);
|
||||
final long byte20 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte19 & 63) << 5) | (byte20 >>> 3);
|
||||
final long byte21 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte20 & 7) << 8) | byte21;
|
||||
final long byte22 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte23 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte22 << 3) | (byte23 >>> 5);
|
||||
final long byte24 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte23 & 31) << 6) | (byte24 >>> 2);
|
||||
final long byte25 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte26 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte24 & 3) << 9) | (byte25 << 1) | (byte26 >>> 7);
|
||||
final long byte27 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte26 & 127) << 4) | (byte27 >>> 4);
|
||||
final long byte28 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte27 & 15) << 7) | (byte28 >>> 1);
|
||||
final long byte29 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte30 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte28 & 1) << 10) | (byte29 << 2) | (byte30 >>> 6);
|
||||
final long byte31 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte30 & 63) << 5) | (byte31 >>> 3);
|
||||
final long byte32 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte31 & 7) << 8) | byte32;
|
||||
final long byte33 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte34 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte33 << 3) | (byte34 >>> 5);
|
||||
final long byte35 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte34 & 31) << 6) | (byte35 >>> 2);
|
||||
final long byte36 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte37 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte35 & 3) << 9) | (byte36 << 1) | (byte37 >>> 7);
|
||||
final long byte38 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte37 & 127) << 4) | (byte38 >>> 4);
|
||||
final long byte39 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte38 & 15) << 7) | (byte39 >>> 1);
|
||||
final long byte40 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte41 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte39 & 1) << 10) | (byte40 << 2) | (byte41 >>> 6);
|
||||
final long byte42 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte41 & 63) << 5) | (byte42 >>> 3);
|
||||
final long byte43 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte42 & 7) << 8) | byte43;
|
||||
final long byte44 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte45 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte44 << 3) | (byte45 >>> 5);
|
||||
final long byte46 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte45 & 31) << 6) | (byte46 >>> 2);
|
||||
final long byte47 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte48 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte46 & 3) << 9) | (byte47 << 1) | (byte48 >>> 7);
|
||||
final long byte49 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte48 & 127) << 4) | (byte49 >>> 4);
|
||||
final long byte50 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte49 & 15) << 7) | (byte50 >>> 1);
|
||||
final long byte51 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte52 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte50 & 1) << 10) | (byte51 << 2) | (byte52 >>> 6);
|
||||
final long byte53 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte52 & 63) << 5) | (byte53 >>> 3);
|
||||
final long byte54 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte53 & 7) << 8) | byte54;
|
||||
final long byte55 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte56 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte55 << 3) | (byte56 >>> 5);
|
||||
final long byte57 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte56 & 31) << 6) | (byte57 >>> 2);
|
||||
final long byte58 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte59 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte57 & 3) << 9) | (byte58 << 1) | (byte59 >>> 7);
|
||||
final long byte60 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte59 & 127) << 4) | (byte60 >>> 4);
|
||||
final long byte61 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte60 & 15) << 7) | (byte61 >>> 1);
|
||||
final long byte62 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte63 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte61 & 1) << 10) | (byte62 << 2) | (byte63 >>> 6);
|
||||
final long byte64 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte63 & 63) << 5) | (byte64 >>> 3);
|
||||
final long byte65 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte64 & 7) << 8) | byte65;
|
||||
final long byte66 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte67 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte66 << 3) | (byte67 >>> 5);
|
||||
final long byte68 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte67 & 31) << 6) | (byte68 >>> 2);
|
||||
final long byte69 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte70 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte68 & 3) << 9) | (byte69 << 1) | (byte70 >>> 7);
|
||||
final long byte71 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte70 & 127) << 4) | (byte71 >>> 4);
|
||||
final long byte72 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte71 & 15) << 7) | (byte72 >>> 1);
|
||||
final long byte73 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte74 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte72 & 1) << 10) | (byte73 << 2) | (byte74 >>> 6);
|
||||
final long byte75 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte74 & 63) << 5) | (byte75 >>> 3);
|
||||
final long byte76 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte75 & 7) << 8) | byte76;
|
||||
final long byte77 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte78 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte77 << 3) | (byte78 >>> 5);
|
||||
final long byte79 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte78 & 31) << 6) | (byte79 >>> 2);
|
||||
final long byte80 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte81 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte79 & 3) << 9) | (byte80 << 1) | (byte81 >>> 7);
|
||||
final long byte82 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte81 & 127) << 4) | (byte82 >>> 4);
|
||||
final long byte83 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte82 & 15) << 7) | (byte83 >>> 1);
|
||||
final long byte84 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte85 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte83 & 1) << 10) | (byte84 << 2) | (byte85 >>> 6);
|
||||
final long byte86 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte85 & 63) << 5) | (byte86 >>> 3);
|
||||
final long byte87 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte86 & 7) << 8) | byte87;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(int[] values, int valuesOffset, long[] blocks, int blocksOffset, int iterations) {
|
||||
assert blocksOffset + iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 53) | ((values[valuesOffset++] & 0xffffffffL) << 42) | ((values[valuesOffset++] & 0xffffffffL) << 31) | ((values[valuesOffset++] & 0xffffffffL) << 20) | ((values[valuesOffset++] & 0xffffffffL) << 9) | ((values[valuesOffset] & 0xffffffffL) >>> 2);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 62) | ((values[valuesOffset++] & 0xffffffffL) << 51) | ((values[valuesOffset++] & 0xffffffffL) << 40) | ((values[valuesOffset++] & 0xffffffffL) << 29) | ((values[valuesOffset++] & 0xffffffffL) << 18) | ((values[valuesOffset++] & 0xffffffffL) << 7) | ((values[valuesOffset] & 0xffffffffL) >>> 4);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 60) | ((values[valuesOffset++] & 0xffffffffL) << 49) | ((values[valuesOffset++] & 0xffffffffL) << 38) | ((values[valuesOffset++] & 0xffffffffL) << 27) | ((values[valuesOffset++] & 0xffffffffL) << 16) | ((values[valuesOffset++] & 0xffffffffL) << 5) | ((values[valuesOffset] & 0xffffffffL) >>> 6);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 58) | ((values[valuesOffset++] & 0xffffffffL) << 47) | ((values[valuesOffset++] & 0xffffffffL) << 36) | ((values[valuesOffset++] & 0xffffffffL) << 25) | ((values[valuesOffset++] & 0xffffffffL) << 14) | ((values[valuesOffset++] & 0xffffffffL) << 3) | ((values[valuesOffset] & 0xffffffffL) >>> 8);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 56) | ((values[valuesOffset++] & 0xffffffffL) << 45) | ((values[valuesOffset++] & 0xffffffffL) << 34) | ((values[valuesOffset++] & 0xffffffffL) << 23) | ((values[valuesOffset++] & 0xffffffffL) << 12) | ((values[valuesOffset++] & 0xffffffffL) << 1) | ((values[valuesOffset] & 0xffffffffL) >>> 10);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 54) | ((values[valuesOffset++] & 0xffffffffL) << 43) | ((values[valuesOffset++] & 0xffffffffL) << 32) | ((values[valuesOffset++] & 0xffffffffL) << 21) | ((values[valuesOffset++] & 0xffffffffL) << 10) | ((values[valuesOffset] & 0xffffffffL) >>> 1);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 63) | ((values[valuesOffset++] & 0xffffffffL) << 52) | ((values[valuesOffset++] & 0xffffffffL) << 41) | ((values[valuesOffset++] & 0xffffffffL) << 30) | ((values[valuesOffset++] & 0xffffffffL) << 19) | ((values[valuesOffset++] & 0xffffffffL) << 8) | ((values[valuesOffset] & 0xffffffffL) >>> 3);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 61) | ((values[valuesOffset++] & 0xffffffffL) << 50) | ((values[valuesOffset++] & 0xffffffffL) << 39) | ((values[valuesOffset++] & 0xffffffffL) << 28) | ((values[valuesOffset++] & 0xffffffffL) << 17) | ((values[valuesOffset++] & 0xffffffffL) << 6) | ((values[valuesOffset] & 0xffffffffL) >>> 5);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 59) | ((values[valuesOffset++] & 0xffffffffL) << 48) | ((values[valuesOffset++] & 0xffffffffL) << 37) | ((values[valuesOffset++] & 0xffffffffL) << 26) | ((values[valuesOffset++] & 0xffffffffL) << 15) | ((values[valuesOffset++] & 0xffffffffL) << 4) | ((values[valuesOffset] & 0xffffffffL) >>> 7);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 57) | ((values[valuesOffset++] & 0xffffffffL) << 46) | ((values[valuesOffset++] & 0xffffffffL) << 35) | ((values[valuesOffset++] & 0xffffffffL) << 24) | ((values[valuesOffset++] & 0xffffffffL) << 13) | ((values[valuesOffset++] & 0xffffffffL) << 2) | ((values[valuesOffset] & 0xffffffffL) >>> 9);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 55) | ((values[valuesOffset++] & 0xffffffffL) << 44) | ((values[valuesOffset++] & 0xffffffffL) << 33) | ((values[valuesOffset++] & 0xffffffffL) << 22) | ((values[valuesOffset++] & 0xffffffffL) << 11) | (values[valuesOffset++] & 0xffffffffL);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(long[] values, int valuesOffset, long[] blocks, int blocksOffset, int iterations) {
|
||||
assert blocksOffset + iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 53) | (values[valuesOffset++] << 42) | (values[valuesOffset++] << 31) | (values[valuesOffset++] << 20) | (values[valuesOffset++] << 9) | (values[valuesOffset] >>> 2);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 62) | (values[valuesOffset++] << 51) | (values[valuesOffset++] << 40) | (values[valuesOffset++] << 29) | (values[valuesOffset++] << 18) | (values[valuesOffset++] << 7) | (values[valuesOffset] >>> 4);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 60) | (values[valuesOffset++] << 49) | (values[valuesOffset++] << 38) | (values[valuesOffset++] << 27) | (values[valuesOffset++] << 16) | (values[valuesOffset++] << 5) | (values[valuesOffset] >>> 6);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 58) | (values[valuesOffset++] << 47) | (values[valuesOffset++] << 36) | (values[valuesOffset++] << 25) | (values[valuesOffset++] << 14) | (values[valuesOffset++] << 3) | (values[valuesOffset] >>> 8);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 56) | (values[valuesOffset++] << 45) | (values[valuesOffset++] << 34) | (values[valuesOffset++] << 23) | (values[valuesOffset++] << 12) | (values[valuesOffset++] << 1) | (values[valuesOffset] >>> 10);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 54) | (values[valuesOffset++] << 43) | (values[valuesOffset++] << 32) | (values[valuesOffset++] << 21) | (values[valuesOffset++] << 10) | (values[valuesOffset] >>> 1);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 63) | (values[valuesOffset++] << 52) | (values[valuesOffset++] << 41) | (values[valuesOffset++] << 30) | (values[valuesOffset++] << 19) | (values[valuesOffset++] << 8) | (values[valuesOffset] >>> 3);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 61) | (values[valuesOffset++] << 50) | (values[valuesOffset++] << 39) | (values[valuesOffset++] << 28) | (values[valuesOffset++] << 17) | (values[valuesOffset++] << 6) | (values[valuesOffset] >>> 5);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 59) | (values[valuesOffset++] << 48) | (values[valuesOffset++] << 37) | (values[valuesOffset++] << 26) | (values[valuesOffset++] << 15) | (values[valuesOffset++] << 4) | (values[valuesOffset] >>> 7);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 57) | (values[valuesOffset++] << 46) | (values[valuesOffset++] << 35) | (values[valuesOffset++] << 24) | (values[valuesOffset++] << 13) | (values[valuesOffset++] << 2) | (values[valuesOffset] >>> 9);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 55) | (values[valuesOffset++] << 44) | (values[valuesOffset++] << 33) | (values[valuesOffset++] << 22) | (values[valuesOffset++] << 11) | values[valuesOffset++];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,208 @@
|
|||
// This file has been automatically generated, DO NOT EDIT
|
||||
|
||||
package org.apache.lucene.util.packed;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Efficient sequential read/write of packed integers.
|
||||
*/
|
||||
final class BulkOperationPacked12 extends BulkOperation {
|
||||
@Override
|
||||
public int blockCount() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int valueCount() {
|
||||
return 16;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(long[] blocks, int blocksOffset, int[] values, int valuesOffset, int iterations) {
|
||||
assert blocksOffset + iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
final long block0 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (block0 >>> 52);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 40) & 4095L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 28) & 4095L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 16) & 4095L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 4) & 4095L);
|
||||
final long block1 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block0 & 15L) << 8) | (block1 >>> 56));
|
||||
values[valuesOffset++] = (int) ((block1 >>> 44) & 4095L);
|
||||
values[valuesOffset++] = (int) ((block1 >>> 32) & 4095L);
|
||||
values[valuesOffset++] = (int) ((block1 >>> 20) & 4095L);
|
||||
values[valuesOffset++] = (int) ((block1 >>> 8) & 4095L);
|
||||
final long block2 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block1 & 255L) << 4) | (block2 >>> 60));
|
||||
values[valuesOffset++] = (int) ((block2 >>> 48) & 4095L);
|
||||
values[valuesOffset++] = (int) ((block2 >>> 36) & 4095L);
|
||||
values[valuesOffset++] = (int) ((block2 >>> 24) & 4095L);
|
||||
values[valuesOffset++] = (int) ((block2 >>> 12) & 4095L);
|
||||
values[valuesOffset++] = (int) (block2 & 4095L);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(byte[] blocks, int blocksOffset, int[] values, int valuesOffset, int iterations) {
|
||||
assert blocksOffset + 8 * iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
final int byte0 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte1 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte0 << 4) | (byte1 >>> 4);
|
||||
final int byte2 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte1 & 15) << 8) | byte2;
|
||||
final int byte3 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte4 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte3 << 4) | (byte4 >>> 4);
|
||||
final int byte5 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte4 & 15) << 8) | byte5;
|
||||
final int byte6 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte7 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte6 << 4) | (byte7 >>> 4);
|
||||
final int byte8 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte7 & 15) << 8) | byte8;
|
||||
final int byte9 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte10 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte9 << 4) | (byte10 >>> 4);
|
||||
final int byte11 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte10 & 15) << 8) | byte11;
|
||||
final int byte12 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte13 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte12 << 4) | (byte13 >>> 4);
|
||||
final int byte14 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte13 & 15) << 8) | byte14;
|
||||
final int byte15 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte16 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte15 << 4) | (byte16 >>> 4);
|
||||
final int byte17 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte16 & 15) << 8) | byte17;
|
||||
final int byte18 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte19 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte18 << 4) | (byte19 >>> 4);
|
||||
final int byte20 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte19 & 15) << 8) | byte20;
|
||||
final int byte21 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte22 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte21 << 4) | (byte22 >>> 4);
|
||||
final int byte23 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte22 & 15) << 8) | byte23;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(long[] blocks, int blocksOffset, long[] values, int valuesOffset, int iterations) {
|
||||
assert blocksOffset + iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
final long block0 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = block0 >>> 52;
|
||||
values[valuesOffset++] = (block0 >>> 40) & 4095L;
|
||||
values[valuesOffset++] = (block0 >>> 28) & 4095L;
|
||||
values[valuesOffset++] = (block0 >>> 16) & 4095L;
|
||||
values[valuesOffset++] = (block0 >>> 4) & 4095L;
|
||||
final long block1 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block0 & 15L) << 8) | (block1 >>> 56);
|
||||
values[valuesOffset++] = (block1 >>> 44) & 4095L;
|
||||
values[valuesOffset++] = (block1 >>> 32) & 4095L;
|
||||
values[valuesOffset++] = (block1 >>> 20) & 4095L;
|
||||
values[valuesOffset++] = (block1 >>> 8) & 4095L;
|
||||
final long block2 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block1 & 255L) << 4) | (block2 >>> 60);
|
||||
values[valuesOffset++] = (block2 >>> 48) & 4095L;
|
||||
values[valuesOffset++] = (block2 >>> 36) & 4095L;
|
||||
values[valuesOffset++] = (block2 >>> 24) & 4095L;
|
||||
values[valuesOffset++] = (block2 >>> 12) & 4095L;
|
||||
values[valuesOffset++] = block2 & 4095L;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(byte[] blocks, int blocksOffset, long[] values, int valuesOffset, int iterations) {
|
||||
assert blocksOffset + 8 * iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
final long byte0 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte1 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte0 << 4) | (byte1 >>> 4);
|
||||
final long byte2 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte1 & 15) << 8) | byte2;
|
||||
final long byte3 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte4 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte3 << 4) | (byte4 >>> 4);
|
||||
final long byte5 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte4 & 15) << 8) | byte5;
|
||||
final long byte6 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte7 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte6 << 4) | (byte7 >>> 4);
|
||||
final long byte8 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte7 & 15) << 8) | byte8;
|
||||
final long byte9 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte10 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte9 << 4) | (byte10 >>> 4);
|
||||
final long byte11 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte10 & 15) << 8) | byte11;
|
||||
final long byte12 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte13 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte12 << 4) | (byte13 >>> 4);
|
||||
final long byte14 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte13 & 15) << 8) | byte14;
|
||||
final long byte15 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte16 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte15 << 4) | (byte16 >>> 4);
|
||||
final long byte17 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte16 & 15) << 8) | byte17;
|
||||
final long byte18 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte19 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte18 << 4) | (byte19 >>> 4);
|
||||
final long byte20 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte19 & 15) << 8) | byte20;
|
||||
final long byte21 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte22 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte21 << 4) | (byte22 >>> 4);
|
||||
final long byte23 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte22 & 15) << 8) | byte23;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(int[] values, int valuesOffset, long[] blocks, int blocksOffset, int iterations) {
|
||||
assert blocksOffset + iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 52) | ((values[valuesOffset++] & 0xffffffffL) << 40) | ((values[valuesOffset++] & 0xffffffffL) << 28) | ((values[valuesOffset++] & 0xffffffffL) << 16) | ((values[valuesOffset++] & 0xffffffffL) << 4) | ((values[valuesOffset] & 0xffffffffL) >>> 8);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 56) | ((values[valuesOffset++] & 0xffffffffL) << 44) | ((values[valuesOffset++] & 0xffffffffL) << 32) | ((values[valuesOffset++] & 0xffffffffL) << 20) | ((values[valuesOffset++] & 0xffffffffL) << 8) | ((values[valuesOffset] & 0xffffffffL) >>> 4);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 60) | ((values[valuesOffset++] & 0xffffffffL) << 48) | ((values[valuesOffset++] & 0xffffffffL) << 36) | ((values[valuesOffset++] & 0xffffffffL) << 24) | ((values[valuesOffset++] & 0xffffffffL) << 12) | (values[valuesOffset++] & 0xffffffffL);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(long[] values, int valuesOffset, long[] blocks, int blocksOffset, int iterations) {
|
||||
assert blocksOffset + iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 52) | (values[valuesOffset++] << 40) | (values[valuesOffset++] << 28) | (values[valuesOffset++] << 16) | (values[valuesOffset++] << 4) | (values[valuesOffset] >>> 8);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 56) | (values[valuesOffset++] << 44) | (values[valuesOffset++] << 32) | (values[valuesOffset++] << 20) | (values[valuesOffset++] << 8) | (values[valuesOffset] >>> 4);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 60) | (values[valuesOffset++] << 48) | (values[valuesOffset++] << 36) | (values[valuesOffset++] << 24) | (values[valuesOffset++] << 12) | values[valuesOffset++];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,600 @@
|
|||
// This file has been automatically generated, DO NOT EDIT
|
||||
|
||||
package org.apache.lucene.util.packed;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Efficient sequential read/write of packed integers.
|
||||
*/
|
||||
final class BulkOperationPacked13 extends BulkOperation {
|
||||
@Override
|
||||
public int blockCount() {
|
||||
return 13;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int valueCount() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(long[] blocks, int blocksOffset, int[] values, int valuesOffset, int iterations) {
|
||||
assert blocksOffset + iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
final long block0 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (block0 >>> 51);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 38) & 8191L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 25) & 8191L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 12) & 8191L);
|
||||
final long block1 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block0 & 4095L) << 1) | (block1 >>> 63));
|
||||
values[valuesOffset++] = (int) ((block1 >>> 50) & 8191L);
|
||||
values[valuesOffset++] = (int) ((block1 >>> 37) & 8191L);
|
||||
values[valuesOffset++] = (int) ((block1 >>> 24) & 8191L);
|
||||
values[valuesOffset++] = (int) ((block1 >>> 11) & 8191L);
|
||||
final long block2 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block1 & 2047L) << 2) | (block2 >>> 62));
|
||||
values[valuesOffset++] = (int) ((block2 >>> 49) & 8191L);
|
||||
values[valuesOffset++] = (int) ((block2 >>> 36) & 8191L);
|
||||
values[valuesOffset++] = (int) ((block2 >>> 23) & 8191L);
|
||||
values[valuesOffset++] = (int) ((block2 >>> 10) & 8191L);
|
||||
final long block3 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block2 & 1023L) << 3) | (block3 >>> 61));
|
||||
values[valuesOffset++] = (int) ((block3 >>> 48) & 8191L);
|
||||
values[valuesOffset++] = (int) ((block3 >>> 35) & 8191L);
|
||||
values[valuesOffset++] = (int) ((block3 >>> 22) & 8191L);
|
||||
values[valuesOffset++] = (int) ((block3 >>> 9) & 8191L);
|
||||
final long block4 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block3 & 511L) << 4) | (block4 >>> 60));
|
||||
values[valuesOffset++] = (int) ((block4 >>> 47) & 8191L);
|
||||
values[valuesOffset++] = (int) ((block4 >>> 34) & 8191L);
|
||||
values[valuesOffset++] = (int) ((block4 >>> 21) & 8191L);
|
||||
values[valuesOffset++] = (int) ((block4 >>> 8) & 8191L);
|
||||
final long block5 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block4 & 255L) << 5) | (block5 >>> 59));
|
||||
values[valuesOffset++] = (int) ((block5 >>> 46) & 8191L);
|
||||
values[valuesOffset++] = (int) ((block5 >>> 33) & 8191L);
|
||||
values[valuesOffset++] = (int) ((block5 >>> 20) & 8191L);
|
||||
values[valuesOffset++] = (int) ((block5 >>> 7) & 8191L);
|
||||
final long block6 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block5 & 127L) << 6) | (block6 >>> 58));
|
||||
values[valuesOffset++] = (int) ((block6 >>> 45) & 8191L);
|
||||
values[valuesOffset++] = (int) ((block6 >>> 32) & 8191L);
|
||||
values[valuesOffset++] = (int) ((block6 >>> 19) & 8191L);
|
||||
values[valuesOffset++] = (int) ((block6 >>> 6) & 8191L);
|
||||
final long block7 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block6 & 63L) << 7) | (block7 >>> 57));
|
||||
values[valuesOffset++] = (int) ((block7 >>> 44) & 8191L);
|
||||
values[valuesOffset++] = (int) ((block7 >>> 31) & 8191L);
|
||||
values[valuesOffset++] = (int) ((block7 >>> 18) & 8191L);
|
||||
values[valuesOffset++] = (int) ((block7 >>> 5) & 8191L);
|
||||
final long block8 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block7 & 31L) << 8) | (block8 >>> 56));
|
||||
values[valuesOffset++] = (int) ((block8 >>> 43) & 8191L);
|
||||
values[valuesOffset++] = (int) ((block8 >>> 30) & 8191L);
|
||||
values[valuesOffset++] = (int) ((block8 >>> 17) & 8191L);
|
||||
values[valuesOffset++] = (int) ((block8 >>> 4) & 8191L);
|
||||
final long block9 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block8 & 15L) << 9) | (block9 >>> 55));
|
||||
values[valuesOffset++] = (int) ((block9 >>> 42) & 8191L);
|
||||
values[valuesOffset++] = (int) ((block9 >>> 29) & 8191L);
|
||||
values[valuesOffset++] = (int) ((block9 >>> 16) & 8191L);
|
||||
values[valuesOffset++] = (int) ((block9 >>> 3) & 8191L);
|
||||
final long block10 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block9 & 7L) << 10) | (block10 >>> 54));
|
||||
values[valuesOffset++] = (int) ((block10 >>> 41) & 8191L);
|
||||
values[valuesOffset++] = (int) ((block10 >>> 28) & 8191L);
|
||||
values[valuesOffset++] = (int) ((block10 >>> 15) & 8191L);
|
||||
values[valuesOffset++] = (int) ((block10 >>> 2) & 8191L);
|
||||
final long block11 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block10 & 3L) << 11) | (block11 >>> 53));
|
||||
values[valuesOffset++] = (int) ((block11 >>> 40) & 8191L);
|
||||
values[valuesOffset++] = (int) ((block11 >>> 27) & 8191L);
|
||||
values[valuesOffset++] = (int) ((block11 >>> 14) & 8191L);
|
||||
values[valuesOffset++] = (int) ((block11 >>> 1) & 8191L);
|
||||
final long block12 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block11 & 1L) << 12) | (block12 >>> 52));
|
||||
values[valuesOffset++] = (int) ((block12 >>> 39) & 8191L);
|
||||
values[valuesOffset++] = (int) ((block12 >>> 26) & 8191L);
|
||||
values[valuesOffset++] = (int) ((block12 >>> 13) & 8191L);
|
||||
values[valuesOffset++] = (int) (block12 & 8191L);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(byte[] blocks, int blocksOffset, int[] values, int valuesOffset, int iterations) {
|
||||
assert blocksOffset + 8 * iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
final int byte0 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte1 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte0 << 5) | (byte1 >>> 3);
|
||||
final int byte2 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte3 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte1 & 7) << 10) | (byte2 << 2) | (byte3 >>> 6);
|
||||
final int byte4 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte3 & 63) << 7) | (byte4 >>> 1);
|
||||
final int byte5 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte6 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte4 & 1) << 12) | (byte5 << 4) | (byte6 >>> 4);
|
||||
final int byte7 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte8 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte6 & 15) << 9) | (byte7 << 1) | (byte8 >>> 7);
|
||||
final int byte9 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte8 & 127) << 6) | (byte9 >>> 2);
|
||||
final int byte10 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte11 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte9 & 3) << 11) | (byte10 << 3) | (byte11 >>> 5);
|
||||
final int byte12 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte11 & 31) << 8) | byte12;
|
||||
final int byte13 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte14 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte13 << 5) | (byte14 >>> 3);
|
||||
final int byte15 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte16 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte14 & 7) << 10) | (byte15 << 2) | (byte16 >>> 6);
|
||||
final int byte17 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte16 & 63) << 7) | (byte17 >>> 1);
|
||||
final int byte18 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte19 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte17 & 1) << 12) | (byte18 << 4) | (byte19 >>> 4);
|
||||
final int byte20 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte21 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte19 & 15) << 9) | (byte20 << 1) | (byte21 >>> 7);
|
||||
final int byte22 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte21 & 127) << 6) | (byte22 >>> 2);
|
||||
final int byte23 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte24 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte22 & 3) << 11) | (byte23 << 3) | (byte24 >>> 5);
|
||||
final int byte25 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte24 & 31) << 8) | byte25;
|
||||
final int byte26 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte27 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte26 << 5) | (byte27 >>> 3);
|
||||
final int byte28 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte29 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte27 & 7) << 10) | (byte28 << 2) | (byte29 >>> 6);
|
||||
final int byte30 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte29 & 63) << 7) | (byte30 >>> 1);
|
||||
final int byte31 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte32 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte30 & 1) << 12) | (byte31 << 4) | (byte32 >>> 4);
|
||||
final int byte33 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte34 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte32 & 15) << 9) | (byte33 << 1) | (byte34 >>> 7);
|
||||
final int byte35 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte34 & 127) << 6) | (byte35 >>> 2);
|
||||
final int byte36 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte37 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte35 & 3) << 11) | (byte36 << 3) | (byte37 >>> 5);
|
||||
final int byte38 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte37 & 31) << 8) | byte38;
|
||||
final int byte39 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte40 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte39 << 5) | (byte40 >>> 3);
|
||||
final int byte41 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte42 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte40 & 7) << 10) | (byte41 << 2) | (byte42 >>> 6);
|
||||
final int byte43 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte42 & 63) << 7) | (byte43 >>> 1);
|
||||
final int byte44 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte45 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte43 & 1) << 12) | (byte44 << 4) | (byte45 >>> 4);
|
||||
final int byte46 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte47 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte45 & 15) << 9) | (byte46 << 1) | (byte47 >>> 7);
|
||||
final int byte48 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte47 & 127) << 6) | (byte48 >>> 2);
|
||||
final int byte49 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte50 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte48 & 3) << 11) | (byte49 << 3) | (byte50 >>> 5);
|
||||
final int byte51 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte50 & 31) << 8) | byte51;
|
||||
final int byte52 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte53 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte52 << 5) | (byte53 >>> 3);
|
||||
final int byte54 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte55 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte53 & 7) << 10) | (byte54 << 2) | (byte55 >>> 6);
|
||||
final int byte56 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte55 & 63) << 7) | (byte56 >>> 1);
|
||||
final int byte57 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte58 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte56 & 1) << 12) | (byte57 << 4) | (byte58 >>> 4);
|
||||
final int byte59 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte60 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte58 & 15) << 9) | (byte59 << 1) | (byte60 >>> 7);
|
||||
final int byte61 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte60 & 127) << 6) | (byte61 >>> 2);
|
||||
final int byte62 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte63 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte61 & 3) << 11) | (byte62 << 3) | (byte63 >>> 5);
|
||||
final int byte64 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte63 & 31) << 8) | byte64;
|
||||
final int byte65 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte66 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte65 << 5) | (byte66 >>> 3);
|
||||
final int byte67 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte68 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte66 & 7) << 10) | (byte67 << 2) | (byte68 >>> 6);
|
||||
final int byte69 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte68 & 63) << 7) | (byte69 >>> 1);
|
||||
final int byte70 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte71 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte69 & 1) << 12) | (byte70 << 4) | (byte71 >>> 4);
|
||||
final int byte72 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte73 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte71 & 15) << 9) | (byte72 << 1) | (byte73 >>> 7);
|
||||
final int byte74 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte73 & 127) << 6) | (byte74 >>> 2);
|
||||
final int byte75 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte76 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte74 & 3) << 11) | (byte75 << 3) | (byte76 >>> 5);
|
||||
final int byte77 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte76 & 31) << 8) | byte77;
|
||||
final int byte78 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte79 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte78 << 5) | (byte79 >>> 3);
|
||||
final int byte80 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte81 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte79 & 7) << 10) | (byte80 << 2) | (byte81 >>> 6);
|
||||
final int byte82 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte81 & 63) << 7) | (byte82 >>> 1);
|
||||
final int byte83 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte84 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte82 & 1) << 12) | (byte83 << 4) | (byte84 >>> 4);
|
||||
final int byte85 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte86 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte84 & 15) << 9) | (byte85 << 1) | (byte86 >>> 7);
|
||||
final int byte87 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte86 & 127) << 6) | (byte87 >>> 2);
|
||||
final int byte88 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte89 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte87 & 3) << 11) | (byte88 << 3) | (byte89 >>> 5);
|
||||
final int byte90 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte89 & 31) << 8) | byte90;
|
||||
final int byte91 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte92 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte91 << 5) | (byte92 >>> 3);
|
||||
final int byte93 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte94 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte92 & 7) << 10) | (byte93 << 2) | (byte94 >>> 6);
|
||||
final int byte95 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte94 & 63) << 7) | (byte95 >>> 1);
|
||||
final int byte96 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte97 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte95 & 1) << 12) | (byte96 << 4) | (byte97 >>> 4);
|
||||
final int byte98 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte99 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte97 & 15) << 9) | (byte98 << 1) | (byte99 >>> 7);
|
||||
final int byte100 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte99 & 127) << 6) | (byte100 >>> 2);
|
||||
final int byte101 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte102 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte100 & 3) << 11) | (byte101 << 3) | (byte102 >>> 5);
|
||||
final int byte103 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte102 & 31) << 8) | byte103;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(long[] blocks, int blocksOffset, long[] values, int valuesOffset, int iterations) {
|
||||
assert blocksOffset + iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
final long block0 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = block0 >>> 51;
|
||||
values[valuesOffset++] = (block0 >>> 38) & 8191L;
|
||||
values[valuesOffset++] = (block0 >>> 25) & 8191L;
|
||||
values[valuesOffset++] = (block0 >>> 12) & 8191L;
|
||||
final long block1 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block0 & 4095L) << 1) | (block1 >>> 63);
|
||||
values[valuesOffset++] = (block1 >>> 50) & 8191L;
|
||||
values[valuesOffset++] = (block1 >>> 37) & 8191L;
|
||||
values[valuesOffset++] = (block1 >>> 24) & 8191L;
|
||||
values[valuesOffset++] = (block1 >>> 11) & 8191L;
|
||||
final long block2 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block1 & 2047L) << 2) | (block2 >>> 62);
|
||||
values[valuesOffset++] = (block2 >>> 49) & 8191L;
|
||||
values[valuesOffset++] = (block2 >>> 36) & 8191L;
|
||||
values[valuesOffset++] = (block2 >>> 23) & 8191L;
|
||||
values[valuesOffset++] = (block2 >>> 10) & 8191L;
|
||||
final long block3 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block2 & 1023L) << 3) | (block3 >>> 61);
|
||||
values[valuesOffset++] = (block3 >>> 48) & 8191L;
|
||||
values[valuesOffset++] = (block3 >>> 35) & 8191L;
|
||||
values[valuesOffset++] = (block3 >>> 22) & 8191L;
|
||||
values[valuesOffset++] = (block3 >>> 9) & 8191L;
|
||||
final long block4 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block3 & 511L) << 4) | (block4 >>> 60);
|
||||
values[valuesOffset++] = (block4 >>> 47) & 8191L;
|
||||
values[valuesOffset++] = (block4 >>> 34) & 8191L;
|
||||
values[valuesOffset++] = (block4 >>> 21) & 8191L;
|
||||
values[valuesOffset++] = (block4 >>> 8) & 8191L;
|
||||
final long block5 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block4 & 255L) << 5) | (block5 >>> 59);
|
||||
values[valuesOffset++] = (block5 >>> 46) & 8191L;
|
||||
values[valuesOffset++] = (block5 >>> 33) & 8191L;
|
||||
values[valuesOffset++] = (block5 >>> 20) & 8191L;
|
||||
values[valuesOffset++] = (block5 >>> 7) & 8191L;
|
||||
final long block6 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block5 & 127L) << 6) | (block6 >>> 58);
|
||||
values[valuesOffset++] = (block6 >>> 45) & 8191L;
|
||||
values[valuesOffset++] = (block6 >>> 32) & 8191L;
|
||||
values[valuesOffset++] = (block6 >>> 19) & 8191L;
|
||||
values[valuesOffset++] = (block6 >>> 6) & 8191L;
|
||||
final long block7 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block6 & 63L) << 7) | (block7 >>> 57);
|
||||
values[valuesOffset++] = (block7 >>> 44) & 8191L;
|
||||
values[valuesOffset++] = (block7 >>> 31) & 8191L;
|
||||
values[valuesOffset++] = (block7 >>> 18) & 8191L;
|
||||
values[valuesOffset++] = (block7 >>> 5) & 8191L;
|
||||
final long block8 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block7 & 31L) << 8) | (block8 >>> 56);
|
||||
values[valuesOffset++] = (block8 >>> 43) & 8191L;
|
||||
values[valuesOffset++] = (block8 >>> 30) & 8191L;
|
||||
values[valuesOffset++] = (block8 >>> 17) & 8191L;
|
||||
values[valuesOffset++] = (block8 >>> 4) & 8191L;
|
||||
final long block9 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block8 & 15L) << 9) | (block9 >>> 55);
|
||||
values[valuesOffset++] = (block9 >>> 42) & 8191L;
|
||||
values[valuesOffset++] = (block9 >>> 29) & 8191L;
|
||||
values[valuesOffset++] = (block9 >>> 16) & 8191L;
|
||||
values[valuesOffset++] = (block9 >>> 3) & 8191L;
|
||||
final long block10 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block9 & 7L) << 10) | (block10 >>> 54);
|
||||
values[valuesOffset++] = (block10 >>> 41) & 8191L;
|
||||
values[valuesOffset++] = (block10 >>> 28) & 8191L;
|
||||
values[valuesOffset++] = (block10 >>> 15) & 8191L;
|
||||
values[valuesOffset++] = (block10 >>> 2) & 8191L;
|
||||
final long block11 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block10 & 3L) << 11) | (block11 >>> 53);
|
||||
values[valuesOffset++] = (block11 >>> 40) & 8191L;
|
||||
values[valuesOffset++] = (block11 >>> 27) & 8191L;
|
||||
values[valuesOffset++] = (block11 >>> 14) & 8191L;
|
||||
values[valuesOffset++] = (block11 >>> 1) & 8191L;
|
||||
final long block12 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block11 & 1L) << 12) | (block12 >>> 52);
|
||||
values[valuesOffset++] = (block12 >>> 39) & 8191L;
|
||||
values[valuesOffset++] = (block12 >>> 26) & 8191L;
|
||||
values[valuesOffset++] = (block12 >>> 13) & 8191L;
|
||||
values[valuesOffset++] = block12 & 8191L;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(byte[] blocks, int blocksOffset, long[] values, int valuesOffset, int iterations) {
|
||||
assert blocksOffset + 8 * iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
final long byte0 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte1 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte0 << 5) | (byte1 >>> 3);
|
||||
final long byte2 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte3 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte1 & 7) << 10) | (byte2 << 2) | (byte3 >>> 6);
|
||||
final long byte4 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte3 & 63) << 7) | (byte4 >>> 1);
|
||||
final long byte5 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte6 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte4 & 1) << 12) | (byte5 << 4) | (byte6 >>> 4);
|
||||
final long byte7 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte8 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte6 & 15) << 9) | (byte7 << 1) | (byte8 >>> 7);
|
||||
final long byte9 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte8 & 127) << 6) | (byte9 >>> 2);
|
||||
final long byte10 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte11 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte9 & 3) << 11) | (byte10 << 3) | (byte11 >>> 5);
|
||||
final long byte12 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte11 & 31) << 8) | byte12;
|
||||
final long byte13 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte14 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte13 << 5) | (byte14 >>> 3);
|
||||
final long byte15 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte16 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte14 & 7) << 10) | (byte15 << 2) | (byte16 >>> 6);
|
||||
final long byte17 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte16 & 63) << 7) | (byte17 >>> 1);
|
||||
final long byte18 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte19 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte17 & 1) << 12) | (byte18 << 4) | (byte19 >>> 4);
|
||||
final long byte20 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte21 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte19 & 15) << 9) | (byte20 << 1) | (byte21 >>> 7);
|
||||
final long byte22 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte21 & 127) << 6) | (byte22 >>> 2);
|
||||
final long byte23 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte24 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte22 & 3) << 11) | (byte23 << 3) | (byte24 >>> 5);
|
||||
final long byte25 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte24 & 31) << 8) | byte25;
|
||||
final long byte26 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte27 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte26 << 5) | (byte27 >>> 3);
|
||||
final long byte28 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte29 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte27 & 7) << 10) | (byte28 << 2) | (byte29 >>> 6);
|
||||
final long byte30 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte29 & 63) << 7) | (byte30 >>> 1);
|
||||
final long byte31 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte32 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte30 & 1) << 12) | (byte31 << 4) | (byte32 >>> 4);
|
||||
final long byte33 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte34 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte32 & 15) << 9) | (byte33 << 1) | (byte34 >>> 7);
|
||||
final long byte35 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte34 & 127) << 6) | (byte35 >>> 2);
|
||||
final long byte36 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte37 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte35 & 3) << 11) | (byte36 << 3) | (byte37 >>> 5);
|
||||
final long byte38 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte37 & 31) << 8) | byte38;
|
||||
final long byte39 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte40 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte39 << 5) | (byte40 >>> 3);
|
||||
final long byte41 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte42 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte40 & 7) << 10) | (byte41 << 2) | (byte42 >>> 6);
|
||||
final long byte43 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte42 & 63) << 7) | (byte43 >>> 1);
|
||||
final long byte44 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte45 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte43 & 1) << 12) | (byte44 << 4) | (byte45 >>> 4);
|
||||
final long byte46 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte47 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte45 & 15) << 9) | (byte46 << 1) | (byte47 >>> 7);
|
||||
final long byte48 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte47 & 127) << 6) | (byte48 >>> 2);
|
||||
final long byte49 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte50 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte48 & 3) << 11) | (byte49 << 3) | (byte50 >>> 5);
|
||||
final long byte51 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte50 & 31) << 8) | byte51;
|
||||
final long byte52 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte53 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte52 << 5) | (byte53 >>> 3);
|
||||
final long byte54 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte55 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte53 & 7) << 10) | (byte54 << 2) | (byte55 >>> 6);
|
||||
final long byte56 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte55 & 63) << 7) | (byte56 >>> 1);
|
||||
final long byte57 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte58 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte56 & 1) << 12) | (byte57 << 4) | (byte58 >>> 4);
|
||||
final long byte59 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte60 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte58 & 15) << 9) | (byte59 << 1) | (byte60 >>> 7);
|
||||
final long byte61 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte60 & 127) << 6) | (byte61 >>> 2);
|
||||
final long byte62 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte63 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte61 & 3) << 11) | (byte62 << 3) | (byte63 >>> 5);
|
||||
final long byte64 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte63 & 31) << 8) | byte64;
|
||||
final long byte65 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte66 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte65 << 5) | (byte66 >>> 3);
|
||||
final long byte67 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte68 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte66 & 7) << 10) | (byte67 << 2) | (byte68 >>> 6);
|
||||
final long byte69 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte68 & 63) << 7) | (byte69 >>> 1);
|
||||
final long byte70 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte71 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte69 & 1) << 12) | (byte70 << 4) | (byte71 >>> 4);
|
||||
final long byte72 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte73 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte71 & 15) << 9) | (byte72 << 1) | (byte73 >>> 7);
|
||||
final long byte74 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte73 & 127) << 6) | (byte74 >>> 2);
|
||||
final long byte75 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte76 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte74 & 3) << 11) | (byte75 << 3) | (byte76 >>> 5);
|
||||
final long byte77 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte76 & 31) << 8) | byte77;
|
||||
final long byte78 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte79 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte78 << 5) | (byte79 >>> 3);
|
||||
final long byte80 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte81 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte79 & 7) << 10) | (byte80 << 2) | (byte81 >>> 6);
|
||||
final long byte82 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte81 & 63) << 7) | (byte82 >>> 1);
|
||||
final long byte83 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte84 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte82 & 1) << 12) | (byte83 << 4) | (byte84 >>> 4);
|
||||
final long byte85 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte86 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte84 & 15) << 9) | (byte85 << 1) | (byte86 >>> 7);
|
||||
final long byte87 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte86 & 127) << 6) | (byte87 >>> 2);
|
||||
final long byte88 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte89 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte87 & 3) << 11) | (byte88 << 3) | (byte89 >>> 5);
|
||||
final long byte90 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte89 & 31) << 8) | byte90;
|
||||
final long byte91 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte92 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte91 << 5) | (byte92 >>> 3);
|
||||
final long byte93 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte94 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte92 & 7) << 10) | (byte93 << 2) | (byte94 >>> 6);
|
||||
final long byte95 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte94 & 63) << 7) | (byte95 >>> 1);
|
||||
final long byte96 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte97 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte95 & 1) << 12) | (byte96 << 4) | (byte97 >>> 4);
|
||||
final long byte98 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte99 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte97 & 15) << 9) | (byte98 << 1) | (byte99 >>> 7);
|
||||
final long byte100 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte99 & 127) << 6) | (byte100 >>> 2);
|
||||
final long byte101 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte102 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte100 & 3) << 11) | (byte101 << 3) | (byte102 >>> 5);
|
||||
final long byte103 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte102 & 31) << 8) | byte103;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(int[] values, int valuesOffset, long[] blocks, int blocksOffset, int iterations) {
|
||||
assert blocksOffset + iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 51) | ((values[valuesOffset++] & 0xffffffffL) << 38) | ((values[valuesOffset++] & 0xffffffffL) << 25) | ((values[valuesOffset++] & 0xffffffffL) << 12) | ((values[valuesOffset] & 0xffffffffL) >>> 1);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 63) | ((values[valuesOffset++] & 0xffffffffL) << 50) | ((values[valuesOffset++] & 0xffffffffL) << 37) | ((values[valuesOffset++] & 0xffffffffL) << 24) | ((values[valuesOffset++] & 0xffffffffL) << 11) | ((values[valuesOffset] & 0xffffffffL) >>> 2);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 62) | ((values[valuesOffset++] & 0xffffffffL) << 49) | ((values[valuesOffset++] & 0xffffffffL) << 36) | ((values[valuesOffset++] & 0xffffffffL) << 23) | ((values[valuesOffset++] & 0xffffffffL) << 10) | ((values[valuesOffset] & 0xffffffffL) >>> 3);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 61) | ((values[valuesOffset++] & 0xffffffffL) << 48) | ((values[valuesOffset++] & 0xffffffffL) << 35) | ((values[valuesOffset++] & 0xffffffffL) << 22) | ((values[valuesOffset++] & 0xffffffffL) << 9) | ((values[valuesOffset] & 0xffffffffL) >>> 4);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 60) | ((values[valuesOffset++] & 0xffffffffL) << 47) | ((values[valuesOffset++] & 0xffffffffL) << 34) | ((values[valuesOffset++] & 0xffffffffL) << 21) | ((values[valuesOffset++] & 0xffffffffL) << 8) | ((values[valuesOffset] & 0xffffffffL) >>> 5);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 59) | ((values[valuesOffset++] & 0xffffffffL) << 46) | ((values[valuesOffset++] & 0xffffffffL) << 33) | ((values[valuesOffset++] & 0xffffffffL) << 20) | ((values[valuesOffset++] & 0xffffffffL) << 7) | ((values[valuesOffset] & 0xffffffffL) >>> 6);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 58) | ((values[valuesOffset++] & 0xffffffffL) << 45) | ((values[valuesOffset++] & 0xffffffffL) << 32) | ((values[valuesOffset++] & 0xffffffffL) << 19) | ((values[valuesOffset++] & 0xffffffffL) << 6) | ((values[valuesOffset] & 0xffffffffL) >>> 7);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 57) | ((values[valuesOffset++] & 0xffffffffL) << 44) | ((values[valuesOffset++] & 0xffffffffL) << 31) | ((values[valuesOffset++] & 0xffffffffL) << 18) | ((values[valuesOffset++] & 0xffffffffL) << 5) | ((values[valuesOffset] & 0xffffffffL) >>> 8);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 56) | ((values[valuesOffset++] & 0xffffffffL) << 43) | ((values[valuesOffset++] & 0xffffffffL) << 30) | ((values[valuesOffset++] & 0xffffffffL) << 17) | ((values[valuesOffset++] & 0xffffffffL) << 4) | ((values[valuesOffset] & 0xffffffffL) >>> 9);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 55) | ((values[valuesOffset++] & 0xffffffffL) << 42) | ((values[valuesOffset++] & 0xffffffffL) << 29) | ((values[valuesOffset++] & 0xffffffffL) << 16) | ((values[valuesOffset++] & 0xffffffffL) << 3) | ((values[valuesOffset] & 0xffffffffL) >>> 10);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 54) | ((values[valuesOffset++] & 0xffffffffL) << 41) | ((values[valuesOffset++] & 0xffffffffL) << 28) | ((values[valuesOffset++] & 0xffffffffL) << 15) | ((values[valuesOffset++] & 0xffffffffL) << 2) | ((values[valuesOffset] & 0xffffffffL) >>> 11);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 53) | ((values[valuesOffset++] & 0xffffffffL) << 40) | ((values[valuesOffset++] & 0xffffffffL) << 27) | ((values[valuesOffset++] & 0xffffffffL) << 14) | ((values[valuesOffset++] & 0xffffffffL) << 1) | ((values[valuesOffset] & 0xffffffffL) >>> 12);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 52) | ((values[valuesOffset++] & 0xffffffffL) << 39) | ((values[valuesOffset++] & 0xffffffffL) << 26) | ((values[valuesOffset++] & 0xffffffffL) << 13) | (values[valuesOffset++] & 0xffffffffL);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(long[] values, int valuesOffset, long[] blocks, int blocksOffset, int iterations) {
|
||||
assert blocksOffset + iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 51) | (values[valuesOffset++] << 38) | (values[valuesOffset++] << 25) | (values[valuesOffset++] << 12) | (values[valuesOffset] >>> 1);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 63) | (values[valuesOffset++] << 50) | (values[valuesOffset++] << 37) | (values[valuesOffset++] << 24) | (values[valuesOffset++] << 11) | (values[valuesOffset] >>> 2);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 62) | (values[valuesOffset++] << 49) | (values[valuesOffset++] << 36) | (values[valuesOffset++] << 23) | (values[valuesOffset++] << 10) | (values[valuesOffset] >>> 3);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 61) | (values[valuesOffset++] << 48) | (values[valuesOffset++] << 35) | (values[valuesOffset++] << 22) | (values[valuesOffset++] << 9) | (values[valuesOffset] >>> 4);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 60) | (values[valuesOffset++] << 47) | (values[valuesOffset++] << 34) | (values[valuesOffset++] << 21) | (values[valuesOffset++] << 8) | (values[valuesOffset] >>> 5);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 59) | (values[valuesOffset++] << 46) | (values[valuesOffset++] << 33) | (values[valuesOffset++] << 20) | (values[valuesOffset++] << 7) | (values[valuesOffset] >>> 6);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 58) | (values[valuesOffset++] << 45) | (values[valuesOffset++] << 32) | (values[valuesOffset++] << 19) | (values[valuesOffset++] << 6) | (values[valuesOffset] >>> 7);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 57) | (values[valuesOffset++] << 44) | (values[valuesOffset++] << 31) | (values[valuesOffset++] << 18) | (values[valuesOffset++] << 5) | (values[valuesOffset] >>> 8);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 56) | (values[valuesOffset++] << 43) | (values[valuesOffset++] << 30) | (values[valuesOffset++] << 17) | (values[valuesOffset++] << 4) | (values[valuesOffset] >>> 9);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 55) | (values[valuesOffset++] << 42) | (values[valuesOffset++] << 29) | (values[valuesOffset++] << 16) | (values[valuesOffset++] << 3) | (values[valuesOffset] >>> 10);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 54) | (values[valuesOffset++] << 41) | (values[valuesOffset++] << 28) | (values[valuesOffset++] << 15) | (values[valuesOffset++] << 2) | (values[valuesOffset] >>> 11);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 53) | (values[valuesOffset++] << 40) | (values[valuesOffset++] << 27) | (values[valuesOffset++] << 14) | (values[valuesOffset++] << 1) | (values[valuesOffset] >>> 12);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 52) | (values[valuesOffset++] << 39) | (values[valuesOffset++] << 26) | (values[valuesOffset++] << 13) | values[valuesOffset++];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,352 @@
|
|||
// This file has been automatically generated, DO NOT EDIT
|
||||
|
||||
package org.apache.lucene.util.packed;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Efficient sequential read/write of packed integers.
|
||||
*/
|
||||
final class BulkOperationPacked14 extends BulkOperation {
|
||||
@Override
|
||||
public int blockCount() {
|
||||
return 7;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int valueCount() {
|
||||
return 32;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(long[] blocks, int blocksOffset, int[] values, int valuesOffset, int iterations) {
|
||||
assert blocksOffset + iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
final long block0 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (block0 >>> 50);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 36) & 16383L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 22) & 16383L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 8) & 16383L);
|
||||
final long block1 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block0 & 255L) << 6) | (block1 >>> 58));
|
||||
values[valuesOffset++] = (int) ((block1 >>> 44) & 16383L);
|
||||
values[valuesOffset++] = (int) ((block1 >>> 30) & 16383L);
|
||||
values[valuesOffset++] = (int) ((block1 >>> 16) & 16383L);
|
||||
values[valuesOffset++] = (int) ((block1 >>> 2) & 16383L);
|
||||
final long block2 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block1 & 3L) << 12) | (block2 >>> 52));
|
||||
values[valuesOffset++] = (int) ((block2 >>> 38) & 16383L);
|
||||
values[valuesOffset++] = (int) ((block2 >>> 24) & 16383L);
|
||||
values[valuesOffset++] = (int) ((block2 >>> 10) & 16383L);
|
||||
final long block3 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block2 & 1023L) << 4) | (block3 >>> 60));
|
||||
values[valuesOffset++] = (int) ((block3 >>> 46) & 16383L);
|
||||
values[valuesOffset++] = (int) ((block3 >>> 32) & 16383L);
|
||||
values[valuesOffset++] = (int) ((block3 >>> 18) & 16383L);
|
||||
values[valuesOffset++] = (int) ((block3 >>> 4) & 16383L);
|
||||
final long block4 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block3 & 15L) << 10) | (block4 >>> 54));
|
||||
values[valuesOffset++] = (int) ((block4 >>> 40) & 16383L);
|
||||
values[valuesOffset++] = (int) ((block4 >>> 26) & 16383L);
|
||||
values[valuesOffset++] = (int) ((block4 >>> 12) & 16383L);
|
||||
final long block5 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block4 & 4095L) << 2) | (block5 >>> 62));
|
||||
values[valuesOffset++] = (int) ((block5 >>> 48) & 16383L);
|
||||
values[valuesOffset++] = (int) ((block5 >>> 34) & 16383L);
|
||||
values[valuesOffset++] = (int) ((block5 >>> 20) & 16383L);
|
||||
values[valuesOffset++] = (int) ((block5 >>> 6) & 16383L);
|
||||
final long block6 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block5 & 63L) << 8) | (block6 >>> 56));
|
||||
values[valuesOffset++] = (int) ((block6 >>> 42) & 16383L);
|
||||
values[valuesOffset++] = (int) ((block6 >>> 28) & 16383L);
|
||||
values[valuesOffset++] = (int) ((block6 >>> 14) & 16383L);
|
||||
values[valuesOffset++] = (int) (block6 & 16383L);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(byte[] blocks, int blocksOffset, int[] values, int valuesOffset, int iterations) {
|
||||
assert blocksOffset + 8 * iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
final int byte0 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte1 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte0 << 6) | (byte1 >>> 2);
|
||||
final int byte2 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte3 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte1 & 3) << 12) | (byte2 << 4) | (byte3 >>> 4);
|
||||
final int byte4 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte5 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte3 & 15) << 10) | (byte4 << 2) | (byte5 >>> 6);
|
||||
final int byte6 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte5 & 63) << 8) | byte6;
|
||||
final int byte7 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte8 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte7 << 6) | (byte8 >>> 2);
|
||||
final int byte9 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte10 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte8 & 3) << 12) | (byte9 << 4) | (byte10 >>> 4);
|
||||
final int byte11 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte12 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte10 & 15) << 10) | (byte11 << 2) | (byte12 >>> 6);
|
||||
final int byte13 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte12 & 63) << 8) | byte13;
|
||||
final int byte14 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte15 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte14 << 6) | (byte15 >>> 2);
|
||||
final int byte16 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte17 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte15 & 3) << 12) | (byte16 << 4) | (byte17 >>> 4);
|
||||
final int byte18 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte19 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte17 & 15) << 10) | (byte18 << 2) | (byte19 >>> 6);
|
||||
final int byte20 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte19 & 63) << 8) | byte20;
|
||||
final int byte21 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte22 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte21 << 6) | (byte22 >>> 2);
|
||||
final int byte23 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte24 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte22 & 3) << 12) | (byte23 << 4) | (byte24 >>> 4);
|
||||
final int byte25 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte26 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte24 & 15) << 10) | (byte25 << 2) | (byte26 >>> 6);
|
||||
final int byte27 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte26 & 63) << 8) | byte27;
|
||||
final int byte28 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte29 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte28 << 6) | (byte29 >>> 2);
|
||||
final int byte30 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte31 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte29 & 3) << 12) | (byte30 << 4) | (byte31 >>> 4);
|
||||
final int byte32 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte33 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte31 & 15) << 10) | (byte32 << 2) | (byte33 >>> 6);
|
||||
final int byte34 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte33 & 63) << 8) | byte34;
|
||||
final int byte35 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte36 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte35 << 6) | (byte36 >>> 2);
|
||||
final int byte37 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte38 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte36 & 3) << 12) | (byte37 << 4) | (byte38 >>> 4);
|
||||
final int byte39 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte40 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte38 & 15) << 10) | (byte39 << 2) | (byte40 >>> 6);
|
||||
final int byte41 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte40 & 63) << 8) | byte41;
|
||||
final int byte42 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte43 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte42 << 6) | (byte43 >>> 2);
|
||||
final int byte44 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte45 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte43 & 3) << 12) | (byte44 << 4) | (byte45 >>> 4);
|
||||
final int byte46 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte47 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte45 & 15) << 10) | (byte46 << 2) | (byte47 >>> 6);
|
||||
final int byte48 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte47 & 63) << 8) | byte48;
|
||||
final int byte49 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte50 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte49 << 6) | (byte50 >>> 2);
|
||||
final int byte51 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte52 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte50 & 3) << 12) | (byte51 << 4) | (byte52 >>> 4);
|
||||
final int byte53 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte54 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte52 & 15) << 10) | (byte53 << 2) | (byte54 >>> 6);
|
||||
final int byte55 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte54 & 63) << 8) | byte55;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(long[] blocks, int blocksOffset, long[] values, int valuesOffset, int iterations) {
|
||||
assert blocksOffset + iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
final long block0 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = block0 >>> 50;
|
||||
values[valuesOffset++] = (block0 >>> 36) & 16383L;
|
||||
values[valuesOffset++] = (block0 >>> 22) & 16383L;
|
||||
values[valuesOffset++] = (block0 >>> 8) & 16383L;
|
||||
final long block1 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block0 & 255L) << 6) | (block1 >>> 58);
|
||||
values[valuesOffset++] = (block1 >>> 44) & 16383L;
|
||||
values[valuesOffset++] = (block1 >>> 30) & 16383L;
|
||||
values[valuesOffset++] = (block1 >>> 16) & 16383L;
|
||||
values[valuesOffset++] = (block1 >>> 2) & 16383L;
|
||||
final long block2 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block1 & 3L) << 12) | (block2 >>> 52);
|
||||
values[valuesOffset++] = (block2 >>> 38) & 16383L;
|
||||
values[valuesOffset++] = (block2 >>> 24) & 16383L;
|
||||
values[valuesOffset++] = (block2 >>> 10) & 16383L;
|
||||
final long block3 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block2 & 1023L) << 4) | (block3 >>> 60);
|
||||
values[valuesOffset++] = (block3 >>> 46) & 16383L;
|
||||
values[valuesOffset++] = (block3 >>> 32) & 16383L;
|
||||
values[valuesOffset++] = (block3 >>> 18) & 16383L;
|
||||
values[valuesOffset++] = (block3 >>> 4) & 16383L;
|
||||
final long block4 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block3 & 15L) << 10) | (block4 >>> 54);
|
||||
values[valuesOffset++] = (block4 >>> 40) & 16383L;
|
||||
values[valuesOffset++] = (block4 >>> 26) & 16383L;
|
||||
values[valuesOffset++] = (block4 >>> 12) & 16383L;
|
||||
final long block5 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block4 & 4095L) << 2) | (block5 >>> 62);
|
||||
values[valuesOffset++] = (block5 >>> 48) & 16383L;
|
||||
values[valuesOffset++] = (block5 >>> 34) & 16383L;
|
||||
values[valuesOffset++] = (block5 >>> 20) & 16383L;
|
||||
values[valuesOffset++] = (block5 >>> 6) & 16383L;
|
||||
final long block6 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block5 & 63L) << 8) | (block6 >>> 56);
|
||||
values[valuesOffset++] = (block6 >>> 42) & 16383L;
|
||||
values[valuesOffset++] = (block6 >>> 28) & 16383L;
|
||||
values[valuesOffset++] = (block6 >>> 14) & 16383L;
|
||||
values[valuesOffset++] = block6 & 16383L;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(byte[] blocks, int blocksOffset, long[] values, int valuesOffset, int iterations) {
|
||||
assert blocksOffset + 8 * iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
final long byte0 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte1 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte0 << 6) | (byte1 >>> 2);
|
||||
final long byte2 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte3 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte1 & 3) << 12) | (byte2 << 4) | (byte3 >>> 4);
|
||||
final long byte4 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte5 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte3 & 15) << 10) | (byte4 << 2) | (byte5 >>> 6);
|
||||
final long byte6 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte5 & 63) << 8) | byte6;
|
||||
final long byte7 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte8 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte7 << 6) | (byte8 >>> 2);
|
||||
final long byte9 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte10 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte8 & 3) << 12) | (byte9 << 4) | (byte10 >>> 4);
|
||||
final long byte11 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte12 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte10 & 15) << 10) | (byte11 << 2) | (byte12 >>> 6);
|
||||
final long byte13 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte12 & 63) << 8) | byte13;
|
||||
final long byte14 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte15 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte14 << 6) | (byte15 >>> 2);
|
||||
final long byte16 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte17 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte15 & 3) << 12) | (byte16 << 4) | (byte17 >>> 4);
|
||||
final long byte18 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte19 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte17 & 15) << 10) | (byte18 << 2) | (byte19 >>> 6);
|
||||
final long byte20 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte19 & 63) << 8) | byte20;
|
||||
final long byte21 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte22 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte21 << 6) | (byte22 >>> 2);
|
||||
final long byte23 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte24 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte22 & 3) << 12) | (byte23 << 4) | (byte24 >>> 4);
|
||||
final long byte25 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte26 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte24 & 15) << 10) | (byte25 << 2) | (byte26 >>> 6);
|
||||
final long byte27 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte26 & 63) << 8) | byte27;
|
||||
final long byte28 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte29 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte28 << 6) | (byte29 >>> 2);
|
||||
final long byte30 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte31 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte29 & 3) << 12) | (byte30 << 4) | (byte31 >>> 4);
|
||||
final long byte32 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte33 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte31 & 15) << 10) | (byte32 << 2) | (byte33 >>> 6);
|
||||
final long byte34 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte33 & 63) << 8) | byte34;
|
||||
final long byte35 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte36 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte35 << 6) | (byte36 >>> 2);
|
||||
final long byte37 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte38 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte36 & 3) << 12) | (byte37 << 4) | (byte38 >>> 4);
|
||||
final long byte39 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte40 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte38 & 15) << 10) | (byte39 << 2) | (byte40 >>> 6);
|
||||
final long byte41 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte40 & 63) << 8) | byte41;
|
||||
final long byte42 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte43 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte42 << 6) | (byte43 >>> 2);
|
||||
final long byte44 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte45 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte43 & 3) << 12) | (byte44 << 4) | (byte45 >>> 4);
|
||||
final long byte46 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte47 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte45 & 15) << 10) | (byte46 << 2) | (byte47 >>> 6);
|
||||
final long byte48 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte47 & 63) << 8) | byte48;
|
||||
final long byte49 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte50 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte49 << 6) | (byte50 >>> 2);
|
||||
final long byte51 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte52 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte50 & 3) << 12) | (byte51 << 4) | (byte52 >>> 4);
|
||||
final long byte53 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte54 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte52 & 15) << 10) | (byte53 << 2) | (byte54 >>> 6);
|
||||
final long byte55 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte54 & 63) << 8) | byte55;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(int[] values, int valuesOffset, long[] blocks, int blocksOffset, int iterations) {
|
||||
assert blocksOffset + iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 50) | ((values[valuesOffset++] & 0xffffffffL) << 36) | ((values[valuesOffset++] & 0xffffffffL) << 22) | ((values[valuesOffset++] & 0xffffffffL) << 8) | ((values[valuesOffset] & 0xffffffffL) >>> 6);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 58) | ((values[valuesOffset++] & 0xffffffffL) << 44) | ((values[valuesOffset++] & 0xffffffffL) << 30) | ((values[valuesOffset++] & 0xffffffffL) << 16) | ((values[valuesOffset++] & 0xffffffffL) << 2) | ((values[valuesOffset] & 0xffffffffL) >>> 12);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 52) | ((values[valuesOffset++] & 0xffffffffL) << 38) | ((values[valuesOffset++] & 0xffffffffL) << 24) | ((values[valuesOffset++] & 0xffffffffL) << 10) | ((values[valuesOffset] & 0xffffffffL) >>> 4);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 60) | ((values[valuesOffset++] & 0xffffffffL) << 46) | ((values[valuesOffset++] & 0xffffffffL) << 32) | ((values[valuesOffset++] & 0xffffffffL) << 18) | ((values[valuesOffset++] & 0xffffffffL) << 4) | ((values[valuesOffset] & 0xffffffffL) >>> 10);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 54) | ((values[valuesOffset++] & 0xffffffffL) << 40) | ((values[valuesOffset++] & 0xffffffffL) << 26) | ((values[valuesOffset++] & 0xffffffffL) << 12) | ((values[valuesOffset] & 0xffffffffL) >>> 2);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 62) | ((values[valuesOffset++] & 0xffffffffL) << 48) | ((values[valuesOffset++] & 0xffffffffL) << 34) | ((values[valuesOffset++] & 0xffffffffL) << 20) | ((values[valuesOffset++] & 0xffffffffL) << 6) | ((values[valuesOffset] & 0xffffffffL) >>> 8);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 56) | ((values[valuesOffset++] & 0xffffffffL) << 42) | ((values[valuesOffset++] & 0xffffffffL) << 28) | ((values[valuesOffset++] & 0xffffffffL) << 14) | (values[valuesOffset++] & 0xffffffffL);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(long[] values, int valuesOffset, long[] blocks, int blocksOffset, int iterations) {
|
||||
assert blocksOffset + iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 50) | (values[valuesOffset++] << 36) | (values[valuesOffset++] << 22) | (values[valuesOffset++] << 8) | (values[valuesOffset] >>> 6);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 58) | (values[valuesOffset++] << 44) | (values[valuesOffset++] << 30) | (values[valuesOffset++] << 16) | (values[valuesOffset++] << 2) | (values[valuesOffset] >>> 12);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 52) | (values[valuesOffset++] << 38) | (values[valuesOffset++] << 24) | (values[valuesOffset++] << 10) | (values[valuesOffset] >>> 4);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 60) | (values[valuesOffset++] << 46) | (values[valuesOffset++] << 32) | (values[valuesOffset++] << 18) | (values[valuesOffset++] << 4) | (values[valuesOffset] >>> 10);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 54) | (values[valuesOffset++] << 40) | (values[valuesOffset++] << 26) | (values[valuesOffset++] << 12) | (values[valuesOffset] >>> 2);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 62) | (values[valuesOffset++] << 48) | (values[valuesOffset++] << 34) | (values[valuesOffset++] << 20) | (values[valuesOffset++] << 6) | (values[valuesOffset] >>> 8);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 56) | (values[valuesOffset++] << 42) | (values[valuesOffset++] << 28) | (values[valuesOffset++] << 14) | values[valuesOffset++];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,640 @@
|
|||
// This file has been automatically generated, DO NOT EDIT
|
||||
|
||||
package org.apache.lucene.util.packed;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Efficient sequential read/write of packed integers.
|
||||
*/
|
||||
final class BulkOperationPacked15 extends BulkOperation {
|
||||
@Override
|
||||
public int blockCount() {
|
||||
return 15;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int valueCount() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(long[] blocks, int blocksOffset, int[] values, int valuesOffset, int iterations) {
|
||||
assert blocksOffset + iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
final long block0 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (block0 >>> 49);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 34) & 32767L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 19) & 32767L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 4) & 32767L);
|
||||
final long block1 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block0 & 15L) << 11) | (block1 >>> 53));
|
||||
values[valuesOffset++] = (int) ((block1 >>> 38) & 32767L);
|
||||
values[valuesOffset++] = (int) ((block1 >>> 23) & 32767L);
|
||||
values[valuesOffset++] = (int) ((block1 >>> 8) & 32767L);
|
||||
final long block2 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block1 & 255L) << 7) | (block2 >>> 57));
|
||||
values[valuesOffset++] = (int) ((block2 >>> 42) & 32767L);
|
||||
values[valuesOffset++] = (int) ((block2 >>> 27) & 32767L);
|
||||
values[valuesOffset++] = (int) ((block2 >>> 12) & 32767L);
|
||||
final long block3 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block2 & 4095L) << 3) | (block3 >>> 61));
|
||||
values[valuesOffset++] = (int) ((block3 >>> 46) & 32767L);
|
||||
values[valuesOffset++] = (int) ((block3 >>> 31) & 32767L);
|
||||
values[valuesOffset++] = (int) ((block3 >>> 16) & 32767L);
|
||||
values[valuesOffset++] = (int) ((block3 >>> 1) & 32767L);
|
||||
final long block4 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block3 & 1L) << 14) | (block4 >>> 50));
|
||||
values[valuesOffset++] = (int) ((block4 >>> 35) & 32767L);
|
||||
values[valuesOffset++] = (int) ((block4 >>> 20) & 32767L);
|
||||
values[valuesOffset++] = (int) ((block4 >>> 5) & 32767L);
|
||||
final long block5 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block4 & 31L) << 10) | (block5 >>> 54));
|
||||
values[valuesOffset++] = (int) ((block5 >>> 39) & 32767L);
|
||||
values[valuesOffset++] = (int) ((block5 >>> 24) & 32767L);
|
||||
values[valuesOffset++] = (int) ((block5 >>> 9) & 32767L);
|
||||
final long block6 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block5 & 511L) << 6) | (block6 >>> 58));
|
||||
values[valuesOffset++] = (int) ((block6 >>> 43) & 32767L);
|
||||
values[valuesOffset++] = (int) ((block6 >>> 28) & 32767L);
|
||||
values[valuesOffset++] = (int) ((block6 >>> 13) & 32767L);
|
||||
final long block7 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block6 & 8191L) << 2) | (block7 >>> 62));
|
||||
values[valuesOffset++] = (int) ((block7 >>> 47) & 32767L);
|
||||
values[valuesOffset++] = (int) ((block7 >>> 32) & 32767L);
|
||||
values[valuesOffset++] = (int) ((block7 >>> 17) & 32767L);
|
||||
values[valuesOffset++] = (int) ((block7 >>> 2) & 32767L);
|
||||
final long block8 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block7 & 3L) << 13) | (block8 >>> 51));
|
||||
values[valuesOffset++] = (int) ((block8 >>> 36) & 32767L);
|
||||
values[valuesOffset++] = (int) ((block8 >>> 21) & 32767L);
|
||||
values[valuesOffset++] = (int) ((block8 >>> 6) & 32767L);
|
||||
final long block9 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block8 & 63L) << 9) | (block9 >>> 55));
|
||||
values[valuesOffset++] = (int) ((block9 >>> 40) & 32767L);
|
||||
values[valuesOffset++] = (int) ((block9 >>> 25) & 32767L);
|
||||
values[valuesOffset++] = (int) ((block9 >>> 10) & 32767L);
|
||||
final long block10 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block9 & 1023L) << 5) | (block10 >>> 59));
|
||||
values[valuesOffset++] = (int) ((block10 >>> 44) & 32767L);
|
||||
values[valuesOffset++] = (int) ((block10 >>> 29) & 32767L);
|
||||
values[valuesOffset++] = (int) ((block10 >>> 14) & 32767L);
|
||||
final long block11 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block10 & 16383L) << 1) | (block11 >>> 63));
|
||||
values[valuesOffset++] = (int) ((block11 >>> 48) & 32767L);
|
||||
values[valuesOffset++] = (int) ((block11 >>> 33) & 32767L);
|
||||
values[valuesOffset++] = (int) ((block11 >>> 18) & 32767L);
|
||||
values[valuesOffset++] = (int) ((block11 >>> 3) & 32767L);
|
||||
final long block12 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block11 & 7L) << 12) | (block12 >>> 52));
|
||||
values[valuesOffset++] = (int) ((block12 >>> 37) & 32767L);
|
||||
values[valuesOffset++] = (int) ((block12 >>> 22) & 32767L);
|
||||
values[valuesOffset++] = (int) ((block12 >>> 7) & 32767L);
|
||||
final long block13 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block12 & 127L) << 8) | (block13 >>> 56));
|
||||
values[valuesOffset++] = (int) ((block13 >>> 41) & 32767L);
|
||||
values[valuesOffset++] = (int) ((block13 >>> 26) & 32767L);
|
||||
values[valuesOffset++] = (int) ((block13 >>> 11) & 32767L);
|
||||
final long block14 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block13 & 2047L) << 4) | (block14 >>> 60));
|
||||
values[valuesOffset++] = (int) ((block14 >>> 45) & 32767L);
|
||||
values[valuesOffset++] = (int) ((block14 >>> 30) & 32767L);
|
||||
values[valuesOffset++] = (int) ((block14 >>> 15) & 32767L);
|
||||
values[valuesOffset++] = (int) (block14 & 32767L);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(byte[] blocks, int blocksOffset, int[] values, int valuesOffset, int iterations) {
|
||||
assert blocksOffset + 8 * iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
final int byte0 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte1 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte0 << 7) | (byte1 >>> 1);
|
||||
final int byte2 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte3 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte1 & 1) << 14) | (byte2 << 6) | (byte3 >>> 2);
|
||||
final int byte4 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte5 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte3 & 3) << 13) | (byte4 << 5) | (byte5 >>> 3);
|
||||
final int byte6 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte7 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte5 & 7) << 12) | (byte6 << 4) | (byte7 >>> 4);
|
||||
final int byte8 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte9 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte7 & 15) << 11) | (byte8 << 3) | (byte9 >>> 5);
|
||||
final int byte10 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte11 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte9 & 31) << 10) | (byte10 << 2) | (byte11 >>> 6);
|
||||
final int byte12 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte13 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte11 & 63) << 9) | (byte12 << 1) | (byte13 >>> 7);
|
||||
final int byte14 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte13 & 127) << 8) | byte14;
|
||||
final int byte15 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte16 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte15 << 7) | (byte16 >>> 1);
|
||||
final int byte17 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte18 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte16 & 1) << 14) | (byte17 << 6) | (byte18 >>> 2);
|
||||
final int byte19 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte20 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte18 & 3) << 13) | (byte19 << 5) | (byte20 >>> 3);
|
||||
final int byte21 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte22 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte20 & 7) << 12) | (byte21 << 4) | (byte22 >>> 4);
|
||||
final int byte23 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte24 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte22 & 15) << 11) | (byte23 << 3) | (byte24 >>> 5);
|
||||
final int byte25 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte26 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte24 & 31) << 10) | (byte25 << 2) | (byte26 >>> 6);
|
||||
final int byte27 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte28 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte26 & 63) << 9) | (byte27 << 1) | (byte28 >>> 7);
|
||||
final int byte29 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte28 & 127) << 8) | byte29;
|
||||
final int byte30 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte31 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte30 << 7) | (byte31 >>> 1);
|
||||
final int byte32 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte33 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte31 & 1) << 14) | (byte32 << 6) | (byte33 >>> 2);
|
||||
final int byte34 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte35 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte33 & 3) << 13) | (byte34 << 5) | (byte35 >>> 3);
|
||||
final int byte36 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte37 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte35 & 7) << 12) | (byte36 << 4) | (byte37 >>> 4);
|
||||
final int byte38 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte39 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte37 & 15) << 11) | (byte38 << 3) | (byte39 >>> 5);
|
||||
final int byte40 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte41 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte39 & 31) << 10) | (byte40 << 2) | (byte41 >>> 6);
|
||||
final int byte42 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte43 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte41 & 63) << 9) | (byte42 << 1) | (byte43 >>> 7);
|
||||
final int byte44 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte43 & 127) << 8) | byte44;
|
||||
final int byte45 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte46 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte45 << 7) | (byte46 >>> 1);
|
||||
final int byte47 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte48 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte46 & 1) << 14) | (byte47 << 6) | (byte48 >>> 2);
|
||||
final int byte49 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte50 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte48 & 3) << 13) | (byte49 << 5) | (byte50 >>> 3);
|
||||
final int byte51 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte52 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte50 & 7) << 12) | (byte51 << 4) | (byte52 >>> 4);
|
||||
final int byte53 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte54 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte52 & 15) << 11) | (byte53 << 3) | (byte54 >>> 5);
|
||||
final int byte55 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte56 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte54 & 31) << 10) | (byte55 << 2) | (byte56 >>> 6);
|
||||
final int byte57 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte58 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte56 & 63) << 9) | (byte57 << 1) | (byte58 >>> 7);
|
||||
final int byte59 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte58 & 127) << 8) | byte59;
|
||||
final int byte60 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte61 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte60 << 7) | (byte61 >>> 1);
|
||||
final int byte62 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte63 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte61 & 1) << 14) | (byte62 << 6) | (byte63 >>> 2);
|
||||
final int byte64 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte65 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte63 & 3) << 13) | (byte64 << 5) | (byte65 >>> 3);
|
||||
final int byte66 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte67 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte65 & 7) << 12) | (byte66 << 4) | (byte67 >>> 4);
|
||||
final int byte68 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte69 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte67 & 15) << 11) | (byte68 << 3) | (byte69 >>> 5);
|
||||
final int byte70 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte71 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte69 & 31) << 10) | (byte70 << 2) | (byte71 >>> 6);
|
||||
final int byte72 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte73 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte71 & 63) << 9) | (byte72 << 1) | (byte73 >>> 7);
|
||||
final int byte74 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte73 & 127) << 8) | byte74;
|
||||
final int byte75 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte76 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte75 << 7) | (byte76 >>> 1);
|
||||
final int byte77 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte78 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte76 & 1) << 14) | (byte77 << 6) | (byte78 >>> 2);
|
||||
final int byte79 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte80 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte78 & 3) << 13) | (byte79 << 5) | (byte80 >>> 3);
|
||||
final int byte81 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte82 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte80 & 7) << 12) | (byte81 << 4) | (byte82 >>> 4);
|
||||
final int byte83 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte84 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte82 & 15) << 11) | (byte83 << 3) | (byte84 >>> 5);
|
||||
final int byte85 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte86 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte84 & 31) << 10) | (byte85 << 2) | (byte86 >>> 6);
|
||||
final int byte87 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte88 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte86 & 63) << 9) | (byte87 << 1) | (byte88 >>> 7);
|
||||
final int byte89 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte88 & 127) << 8) | byte89;
|
||||
final int byte90 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte91 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte90 << 7) | (byte91 >>> 1);
|
||||
final int byte92 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte93 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte91 & 1) << 14) | (byte92 << 6) | (byte93 >>> 2);
|
||||
final int byte94 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte95 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte93 & 3) << 13) | (byte94 << 5) | (byte95 >>> 3);
|
||||
final int byte96 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte97 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte95 & 7) << 12) | (byte96 << 4) | (byte97 >>> 4);
|
||||
final int byte98 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte99 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte97 & 15) << 11) | (byte98 << 3) | (byte99 >>> 5);
|
||||
final int byte100 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte101 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte99 & 31) << 10) | (byte100 << 2) | (byte101 >>> 6);
|
||||
final int byte102 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte103 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte101 & 63) << 9) | (byte102 << 1) | (byte103 >>> 7);
|
||||
final int byte104 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte103 & 127) << 8) | byte104;
|
||||
final int byte105 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte106 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte105 << 7) | (byte106 >>> 1);
|
||||
final int byte107 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte108 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte106 & 1) << 14) | (byte107 << 6) | (byte108 >>> 2);
|
||||
final int byte109 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte110 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte108 & 3) << 13) | (byte109 << 5) | (byte110 >>> 3);
|
||||
final int byte111 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte112 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte110 & 7) << 12) | (byte111 << 4) | (byte112 >>> 4);
|
||||
final int byte113 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte114 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte112 & 15) << 11) | (byte113 << 3) | (byte114 >>> 5);
|
||||
final int byte115 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte116 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte114 & 31) << 10) | (byte115 << 2) | (byte116 >>> 6);
|
||||
final int byte117 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte118 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte116 & 63) << 9) | (byte117 << 1) | (byte118 >>> 7);
|
||||
final int byte119 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte118 & 127) << 8) | byte119;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(long[] blocks, int blocksOffset, long[] values, int valuesOffset, int iterations) {
|
||||
assert blocksOffset + iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
final long block0 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = block0 >>> 49;
|
||||
values[valuesOffset++] = (block0 >>> 34) & 32767L;
|
||||
values[valuesOffset++] = (block0 >>> 19) & 32767L;
|
||||
values[valuesOffset++] = (block0 >>> 4) & 32767L;
|
||||
final long block1 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block0 & 15L) << 11) | (block1 >>> 53);
|
||||
values[valuesOffset++] = (block1 >>> 38) & 32767L;
|
||||
values[valuesOffset++] = (block1 >>> 23) & 32767L;
|
||||
values[valuesOffset++] = (block1 >>> 8) & 32767L;
|
||||
final long block2 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block1 & 255L) << 7) | (block2 >>> 57);
|
||||
values[valuesOffset++] = (block2 >>> 42) & 32767L;
|
||||
values[valuesOffset++] = (block2 >>> 27) & 32767L;
|
||||
values[valuesOffset++] = (block2 >>> 12) & 32767L;
|
||||
final long block3 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block2 & 4095L) << 3) | (block3 >>> 61);
|
||||
values[valuesOffset++] = (block3 >>> 46) & 32767L;
|
||||
values[valuesOffset++] = (block3 >>> 31) & 32767L;
|
||||
values[valuesOffset++] = (block3 >>> 16) & 32767L;
|
||||
values[valuesOffset++] = (block3 >>> 1) & 32767L;
|
||||
final long block4 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block3 & 1L) << 14) | (block4 >>> 50);
|
||||
values[valuesOffset++] = (block4 >>> 35) & 32767L;
|
||||
values[valuesOffset++] = (block4 >>> 20) & 32767L;
|
||||
values[valuesOffset++] = (block4 >>> 5) & 32767L;
|
||||
final long block5 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block4 & 31L) << 10) | (block5 >>> 54);
|
||||
values[valuesOffset++] = (block5 >>> 39) & 32767L;
|
||||
values[valuesOffset++] = (block5 >>> 24) & 32767L;
|
||||
values[valuesOffset++] = (block5 >>> 9) & 32767L;
|
||||
final long block6 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block5 & 511L) << 6) | (block6 >>> 58);
|
||||
values[valuesOffset++] = (block6 >>> 43) & 32767L;
|
||||
values[valuesOffset++] = (block6 >>> 28) & 32767L;
|
||||
values[valuesOffset++] = (block6 >>> 13) & 32767L;
|
||||
final long block7 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block6 & 8191L) << 2) | (block7 >>> 62);
|
||||
values[valuesOffset++] = (block7 >>> 47) & 32767L;
|
||||
values[valuesOffset++] = (block7 >>> 32) & 32767L;
|
||||
values[valuesOffset++] = (block7 >>> 17) & 32767L;
|
||||
values[valuesOffset++] = (block7 >>> 2) & 32767L;
|
||||
final long block8 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block7 & 3L) << 13) | (block8 >>> 51);
|
||||
values[valuesOffset++] = (block8 >>> 36) & 32767L;
|
||||
values[valuesOffset++] = (block8 >>> 21) & 32767L;
|
||||
values[valuesOffset++] = (block8 >>> 6) & 32767L;
|
||||
final long block9 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block8 & 63L) << 9) | (block9 >>> 55);
|
||||
values[valuesOffset++] = (block9 >>> 40) & 32767L;
|
||||
values[valuesOffset++] = (block9 >>> 25) & 32767L;
|
||||
values[valuesOffset++] = (block9 >>> 10) & 32767L;
|
||||
final long block10 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block9 & 1023L) << 5) | (block10 >>> 59);
|
||||
values[valuesOffset++] = (block10 >>> 44) & 32767L;
|
||||
values[valuesOffset++] = (block10 >>> 29) & 32767L;
|
||||
values[valuesOffset++] = (block10 >>> 14) & 32767L;
|
||||
final long block11 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block10 & 16383L) << 1) | (block11 >>> 63);
|
||||
values[valuesOffset++] = (block11 >>> 48) & 32767L;
|
||||
values[valuesOffset++] = (block11 >>> 33) & 32767L;
|
||||
values[valuesOffset++] = (block11 >>> 18) & 32767L;
|
||||
values[valuesOffset++] = (block11 >>> 3) & 32767L;
|
||||
final long block12 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block11 & 7L) << 12) | (block12 >>> 52);
|
||||
values[valuesOffset++] = (block12 >>> 37) & 32767L;
|
||||
values[valuesOffset++] = (block12 >>> 22) & 32767L;
|
||||
values[valuesOffset++] = (block12 >>> 7) & 32767L;
|
||||
final long block13 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block12 & 127L) << 8) | (block13 >>> 56);
|
||||
values[valuesOffset++] = (block13 >>> 41) & 32767L;
|
||||
values[valuesOffset++] = (block13 >>> 26) & 32767L;
|
||||
values[valuesOffset++] = (block13 >>> 11) & 32767L;
|
||||
final long block14 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block13 & 2047L) << 4) | (block14 >>> 60);
|
||||
values[valuesOffset++] = (block14 >>> 45) & 32767L;
|
||||
values[valuesOffset++] = (block14 >>> 30) & 32767L;
|
||||
values[valuesOffset++] = (block14 >>> 15) & 32767L;
|
||||
values[valuesOffset++] = block14 & 32767L;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(byte[] blocks, int blocksOffset, long[] values, int valuesOffset, int iterations) {
|
||||
assert blocksOffset + 8 * iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
final long byte0 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte1 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte0 << 7) | (byte1 >>> 1);
|
||||
final long byte2 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte3 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte1 & 1) << 14) | (byte2 << 6) | (byte3 >>> 2);
|
||||
final long byte4 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte5 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte3 & 3) << 13) | (byte4 << 5) | (byte5 >>> 3);
|
||||
final long byte6 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte7 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte5 & 7) << 12) | (byte6 << 4) | (byte7 >>> 4);
|
||||
final long byte8 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte9 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte7 & 15) << 11) | (byte8 << 3) | (byte9 >>> 5);
|
||||
final long byte10 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte11 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte9 & 31) << 10) | (byte10 << 2) | (byte11 >>> 6);
|
||||
final long byte12 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte13 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte11 & 63) << 9) | (byte12 << 1) | (byte13 >>> 7);
|
||||
final long byte14 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte13 & 127) << 8) | byte14;
|
||||
final long byte15 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte16 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte15 << 7) | (byte16 >>> 1);
|
||||
final long byte17 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte18 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte16 & 1) << 14) | (byte17 << 6) | (byte18 >>> 2);
|
||||
final long byte19 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte20 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte18 & 3) << 13) | (byte19 << 5) | (byte20 >>> 3);
|
||||
final long byte21 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte22 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte20 & 7) << 12) | (byte21 << 4) | (byte22 >>> 4);
|
||||
final long byte23 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte24 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte22 & 15) << 11) | (byte23 << 3) | (byte24 >>> 5);
|
||||
final long byte25 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte26 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte24 & 31) << 10) | (byte25 << 2) | (byte26 >>> 6);
|
||||
final long byte27 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte28 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte26 & 63) << 9) | (byte27 << 1) | (byte28 >>> 7);
|
||||
final long byte29 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte28 & 127) << 8) | byte29;
|
||||
final long byte30 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte31 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte30 << 7) | (byte31 >>> 1);
|
||||
final long byte32 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte33 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte31 & 1) << 14) | (byte32 << 6) | (byte33 >>> 2);
|
||||
final long byte34 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte35 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte33 & 3) << 13) | (byte34 << 5) | (byte35 >>> 3);
|
||||
final long byte36 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte37 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte35 & 7) << 12) | (byte36 << 4) | (byte37 >>> 4);
|
||||
final long byte38 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte39 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte37 & 15) << 11) | (byte38 << 3) | (byte39 >>> 5);
|
||||
final long byte40 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte41 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte39 & 31) << 10) | (byte40 << 2) | (byte41 >>> 6);
|
||||
final long byte42 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte43 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte41 & 63) << 9) | (byte42 << 1) | (byte43 >>> 7);
|
||||
final long byte44 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte43 & 127) << 8) | byte44;
|
||||
final long byte45 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte46 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte45 << 7) | (byte46 >>> 1);
|
||||
final long byte47 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte48 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte46 & 1) << 14) | (byte47 << 6) | (byte48 >>> 2);
|
||||
final long byte49 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte50 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte48 & 3) << 13) | (byte49 << 5) | (byte50 >>> 3);
|
||||
final long byte51 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte52 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte50 & 7) << 12) | (byte51 << 4) | (byte52 >>> 4);
|
||||
final long byte53 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte54 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte52 & 15) << 11) | (byte53 << 3) | (byte54 >>> 5);
|
||||
final long byte55 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte56 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte54 & 31) << 10) | (byte55 << 2) | (byte56 >>> 6);
|
||||
final long byte57 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte58 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte56 & 63) << 9) | (byte57 << 1) | (byte58 >>> 7);
|
||||
final long byte59 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte58 & 127) << 8) | byte59;
|
||||
final long byte60 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte61 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte60 << 7) | (byte61 >>> 1);
|
||||
final long byte62 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte63 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte61 & 1) << 14) | (byte62 << 6) | (byte63 >>> 2);
|
||||
final long byte64 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte65 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte63 & 3) << 13) | (byte64 << 5) | (byte65 >>> 3);
|
||||
final long byte66 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte67 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte65 & 7) << 12) | (byte66 << 4) | (byte67 >>> 4);
|
||||
final long byte68 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte69 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte67 & 15) << 11) | (byte68 << 3) | (byte69 >>> 5);
|
||||
final long byte70 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte71 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte69 & 31) << 10) | (byte70 << 2) | (byte71 >>> 6);
|
||||
final long byte72 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte73 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte71 & 63) << 9) | (byte72 << 1) | (byte73 >>> 7);
|
||||
final long byte74 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte73 & 127) << 8) | byte74;
|
||||
final long byte75 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte76 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte75 << 7) | (byte76 >>> 1);
|
||||
final long byte77 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte78 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte76 & 1) << 14) | (byte77 << 6) | (byte78 >>> 2);
|
||||
final long byte79 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte80 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte78 & 3) << 13) | (byte79 << 5) | (byte80 >>> 3);
|
||||
final long byte81 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte82 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte80 & 7) << 12) | (byte81 << 4) | (byte82 >>> 4);
|
||||
final long byte83 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte84 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte82 & 15) << 11) | (byte83 << 3) | (byte84 >>> 5);
|
||||
final long byte85 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte86 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte84 & 31) << 10) | (byte85 << 2) | (byte86 >>> 6);
|
||||
final long byte87 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte88 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte86 & 63) << 9) | (byte87 << 1) | (byte88 >>> 7);
|
||||
final long byte89 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte88 & 127) << 8) | byte89;
|
||||
final long byte90 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte91 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte90 << 7) | (byte91 >>> 1);
|
||||
final long byte92 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte93 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte91 & 1) << 14) | (byte92 << 6) | (byte93 >>> 2);
|
||||
final long byte94 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte95 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte93 & 3) << 13) | (byte94 << 5) | (byte95 >>> 3);
|
||||
final long byte96 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte97 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte95 & 7) << 12) | (byte96 << 4) | (byte97 >>> 4);
|
||||
final long byte98 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte99 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte97 & 15) << 11) | (byte98 << 3) | (byte99 >>> 5);
|
||||
final long byte100 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte101 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte99 & 31) << 10) | (byte100 << 2) | (byte101 >>> 6);
|
||||
final long byte102 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte103 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte101 & 63) << 9) | (byte102 << 1) | (byte103 >>> 7);
|
||||
final long byte104 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte103 & 127) << 8) | byte104;
|
||||
final long byte105 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte106 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte105 << 7) | (byte106 >>> 1);
|
||||
final long byte107 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte108 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte106 & 1) << 14) | (byte107 << 6) | (byte108 >>> 2);
|
||||
final long byte109 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte110 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte108 & 3) << 13) | (byte109 << 5) | (byte110 >>> 3);
|
||||
final long byte111 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte112 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte110 & 7) << 12) | (byte111 << 4) | (byte112 >>> 4);
|
||||
final long byte113 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte114 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte112 & 15) << 11) | (byte113 << 3) | (byte114 >>> 5);
|
||||
final long byte115 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte116 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte114 & 31) << 10) | (byte115 << 2) | (byte116 >>> 6);
|
||||
final long byte117 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte118 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte116 & 63) << 9) | (byte117 << 1) | (byte118 >>> 7);
|
||||
final long byte119 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte118 & 127) << 8) | byte119;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(int[] values, int valuesOffset, long[] blocks, int blocksOffset, int iterations) {
|
||||
assert blocksOffset + iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 49) | ((values[valuesOffset++] & 0xffffffffL) << 34) | ((values[valuesOffset++] & 0xffffffffL) << 19) | ((values[valuesOffset++] & 0xffffffffL) << 4) | ((values[valuesOffset] & 0xffffffffL) >>> 11);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 53) | ((values[valuesOffset++] & 0xffffffffL) << 38) | ((values[valuesOffset++] & 0xffffffffL) << 23) | ((values[valuesOffset++] & 0xffffffffL) << 8) | ((values[valuesOffset] & 0xffffffffL) >>> 7);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 57) | ((values[valuesOffset++] & 0xffffffffL) << 42) | ((values[valuesOffset++] & 0xffffffffL) << 27) | ((values[valuesOffset++] & 0xffffffffL) << 12) | ((values[valuesOffset] & 0xffffffffL) >>> 3);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 61) | ((values[valuesOffset++] & 0xffffffffL) << 46) | ((values[valuesOffset++] & 0xffffffffL) << 31) | ((values[valuesOffset++] & 0xffffffffL) << 16) | ((values[valuesOffset++] & 0xffffffffL) << 1) | ((values[valuesOffset] & 0xffffffffL) >>> 14);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 50) | ((values[valuesOffset++] & 0xffffffffL) << 35) | ((values[valuesOffset++] & 0xffffffffL) << 20) | ((values[valuesOffset++] & 0xffffffffL) << 5) | ((values[valuesOffset] & 0xffffffffL) >>> 10);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 54) | ((values[valuesOffset++] & 0xffffffffL) << 39) | ((values[valuesOffset++] & 0xffffffffL) << 24) | ((values[valuesOffset++] & 0xffffffffL) << 9) | ((values[valuesOffset] & 0xffffffffL) >>> 6);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 58) | ((values[valuesOffset++] & 0xffffffffL) << 43) | ((values[valuesOffset++] & 0xffffffffL) << 28) | ((values[valuesOffset++] & 0xffffffffL) << 13) | ((values[valuesOffset] & 0xffffffffL) >>> 2);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 62) | ((values[valuesOffset++] & 0xffffffffL) << 47) | ((values[valuesOffset++] & 0xffffffffL) << 32) | ((values[valuesOffset++] & 0xffffffffL) << 17) | ((values[valuesOffset++] & 0xffffffffL) << 2) | ((values[valuesOffset] & 0xffffffffL) >>> 13);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 51) | ((values[valuesOffset++] & 0xffffffffL) << 36) | ((values[valuesOffset++] & 0xffffffffL) << 21) | ((values[valuesOffset++] & 0xffffffffL) << 6) | ((values[valuesOffset] & 0xffffffffL) >>> 9);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 55) | ((values[valuesOffset++] & 0xffffffffL) << 40) | ((values[valuesOffset++] & 0xffffffffL) << 25) | ((values[valuesOffset++] & 0xffffffffL) << 10) | ((values[valuesOffset] & 0xffffffffL) >>> 5);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 59) | ((values[valuesOffset++] & 0xffffffffL) << 44) | ((values[valuesOffset++] & 0xffffffffL) << 29) | ((values[valuesOffset++] & 0xffffffffL) << 14) | ((values[valuesOffset] & 0xffffffffL) >>> 1);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 63) | ((values[valuesOffset++] & 0xffffffffL) << 48) | ((values[valuesOffset++] & 0xffffffffL) << 33) | ((values[valuesOffset++] & 0xffffffffL) << 18) | ((values[valuesOffset++] & 0xffffffffL) << 3) | ((values[valuesOffset] & 0xffffffffL) >>> 12);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 52) | ((values[valuesOffset++] & 0xffffffffL) << 37) | ((values[valuesOffset++] & 0xffffffffL) << 22) | ((values[valuesOffset++] & 0xffffffffL) << 7) | ((values[valuesOffset] & 0xffffffffL) >>> 8);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 56) | ((values[valuesOffset++] & 0xffffffffL) << 41) | ((values[valuesOffset++] & 0xffffffffL) << 26) | ((values[valuesOffset++] & 0xffffffffL) << 11) | ((values[valuesOffset] & 0xffffffffL) >>> 4);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 60) | ((values[valuesOffset++] & 0xffffffffL) << 45) | ((values[valuesOffset++] & 0xffffffffL) << 30) | ((values[valuesOffset++] & 0xffffffffL) << 15) | (values[valuesOffset++] & 0xffffffffL);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(long[] values, int valuesOffset, long[] blocks, int blocksOffset, int iterations) {
|
||||
assert blocksOffset + iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 49) | (values[valuesOffset++] << 34) | (values[valuesOffset++] << 19) | (values[valuesOffset++] << 4) | (values[valuesOffset] >>> 11);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 53) | (values[valuesOffset++] << 38) | (values[valuesOffset++] << 23) | (values[valuesOffset++] << 8) | (values[valuesOffset] >>> 7);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 57) | (values[valuesOffset++] << 42) | (values[valuesOffset++] << 27) | (values[valuesOffset++] << 12) | (values[valuesOffset] >>> 3);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 61) | (values[valuesOffset++] << 46) | (values[valuesOffset++] << 31) | (values[valuesOffset++] << 16) | (values[valuesOffset++] << 1) | (values[valuesOffset] >>> 14);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 50) | (values[valuesOffset++] << 35) | (values[valuesOffset++] << 20) | (values[valuesOffset++] << 5) | (values[valuesOffset] >>> 10);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 54) | (values[valuesOffset++] << 39) | (values[valuesOffset++] << 24) | (values[valuesOffset++] << 9) | (values[valuesOffset] >>> 6);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 58) | (values[valuesOffset++] << 43) | (values[valuesOffset++] << 28) | (values[valuesOffset++] << 13) | (values[valuesOffset] >>> 2);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 62) | (values[valuesOffset++] << 47) | (values[valuesOffset++] << 32) | (values[valuesOffset++] << 17) | (values[valuesOffset++] << 2) | (values[valuesOffset] >>> 13);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 51) | (values[valuesOffset++] << 36) | (values[valuesOffset++] << 21) | (values[valuesOffset++] << 6) | (values[valuesOffset] >>> 9);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 55) | (values[valuesOffset++] << 40) | (values[valuesOffset++] << 25) | (values[valuesOffset++] << 10) | (values[valuesOffset] >>> 5);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 59) | (values[valuesOffset++] << 44) | (values[valuesOffset++] << 29) | (values[valuesOffset++] << 14) | (values[valuesOffset] >>> 1);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 63) | (values[valuesOffset++] << 48) | (values[valuesOffset++] << 33) | (values[valuesOffset++] << 18) | (values[valuesOffset++] << 3) | (values[valuesOffset] >>> 12);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 52) | (values[valuesOffset++] << 37) | (values[valuesOffset++] << 22) | (values[valuesOffset++] << 7) | (values[valuesOffset] >>> 8);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 56) | (values[valuesOffset++] << 41) | (values[valuesOffset++] << 26) | (values[valuesOffset++] << 11) | (values[valuesOffset] >>> 4);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 60) | (values[valuesOffset++] << 45) | (values[valuesOffset++] << 30) | (values[valuesOffset++] << 15) | values[valuesOffset++];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,120 @@
|
|||
// This file has been automatically generated, DO NOT EDIT
|
||||
|
||||
package org.apache.lucene.util.packed;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Efficient sequential read/write of packed integers.
|
||||
*/
|
||||
final class BulkOperationPacked16 extends BulkOperation {
|
||||
@Override
|
||||
public int blockCount() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int valueCount() {
|
||||
return 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(long[] blocks, int blocksOffset, int[] values, int valuesOffset, int iterations) {
|
||||
assert blocksOffset + iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
final long block0 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (block0 >>> 48);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 32) & 65535L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 16) & 65535L);
|
||||
values[valuesOffset++] = (int) (block0 & 65535L);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(byte[] blocks, int blocksOffset, int[] values, int valuesOffset, int iterations) {
|
||||
assert blocksOffset + 8 * iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
final int byte0 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte1 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte0 << 8) | byte1;
|
||||
final int byte2 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte3 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte2 << 8) | byte3;
|
||||
final int byte4 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte5 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte4 << 8) | byte5;
|
||||
final int byte6 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte7 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte6 << 8) | byte7;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(long[] blocks, int blocksOffset, long[] values, int valuesOffset, int iterations) {
|
||||
assert blocksOffset + iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
final long block0 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = block0 >>> 48;
|
||||
values[valuesOffset++] = (block0 >>> 32) & 65535L;
|
||||
values[valuesOffset++] = (block0 >>> 16) & 65535L;
|
||||
values[valuesOffset++] = block0 & 65535L;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(byte[] blocks, int blocksOffset, long[] values, int valuesOffset, int iterations) {
|
||||
assert blocksOffset + 8 * iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
final long byte0 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte1 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte0 << 8) | byte1;
|
||||
final long byte2 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte3 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte2 << 8) | byte3;
|
||||
final long byte4 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte5 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte4 << 8) | byte5;
|
||||
final long byte6 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte7 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte6 << 8) | byte7;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(int[] values, int valuesOffset, long[] blocks, int blocksOffset, int iterations) {
|
||||
assert blocksOffset + iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 48) | ((values[valuesOffset++] & 0xffffffffL) << 32) | ((values[valuesOffset++] & 0xffffffffL) << 16) | (values[valuesOffset++] & 0xffffffffL);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(long[] values, int valuesOffset, long[] blocks, int blocksOffset, int iterations) {
|
||||
assert blocksOffset + iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 48) | (values[valuesOffset++] << 32) | (values[valuesOffset++] << 16) | values[valuesOffset++];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,680 @@
|
|||
// This file has been automatically generated, DO NOT EDIT
|
||||
|
||||
package org.apache.lucene.util.packed;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Efficient sequential read/write of packed integers.
|
||||
*/
|
||||
final class BulkOperationPacked17 extends BulkOperation {
|
||||
@Override
|
||||
public int blockCount() {
|
||||
return 17;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int valueCount() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(long[] blocks, int blocksOffset, int[] values, int valuesOffset, int iterations) {
|
||||
assert blocksOffset + iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
final long block0 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (block0 >>> 47);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 30) & 131071L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 13) & 131071L);
|
||||
final long block1 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block0 & 8191L) << 4) | (block1 >>> 60));
|
||||
values[valuesOffset++] = (int) ((block1 >>> 43) & 131071L);
|
||||
values[valuesOffset++] = (int) ((block1 >>> 26) & 131071L);
|
||||
values[valuesOffset++] = (int) ((block1 >>> 9) & 131071L);
|
||||
final long block2 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block1 & 511L) << 8) | (block2 >>> 56));
|
||||
values[valuesOffset++] = (int) ((block2 >>> 39) & 131071L);
|
||||
values[valuesOffset++] = (int) ((block2 >>> 22) & 131071L);
|
||||
values[valuesOffset++] = (int) ((block2 >>> 5) & 131071L);
|
||||
final long block3 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block2 & 31L) << 12) | (block3 >>> 52));
|
||||
values[valuesOffset++] = (int) ((block3 >>> 35) & 131071L);
|
||||
values[valuesOffset++] = (int) ((block3 >>> 18) & 131071L);
|
||||
values[valuesOffset++] = (int) ((block3 >>> 1) & 131071L);
|
||||
final long block4 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block3 & 1L) << 16) | (block4 >>> 48));
|
||||
values[valuesOffset++] = (int) ((block4 >>> 31) & 131071L);
|
||||
values[valuesOffset++] = (int) ((block4 >>> 14) & 131071L);
|
||||
final long block5 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block4 & 16383L) << 3) | (block5 >>> 61));
|
||||
values[valuesOffset++] = (int) ((block5 >>> 44) & 131071L);
|
||||
values[valuesOffset++] = (int) ((block5 >>> 27) & 131071L);
|
||||
values[valuesOffset++] = (int) ((block5 >>> 10) & 131071L);
|
||||
final long block6 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block5 & 1023L) << 7) | (block6 >>> 57));
|
||||
values[valuesOffset++] = (int) ((block6 >>> 40) & 131071L);
|
||||
values[valuesOffset++] = (int) ((block6 >>> 23) & 131071L);
|
||||
values[valuesOffset++] = (int) ((block6 >>> 6) & 131071L);
|
||||
final long block7 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block6 & 63L) << 11) | (block7 >>> 53));
|
||||
values[valuesOffset++] = (int) ((block7 >>> 36) & 131071L);
|
||||
values[valuesOffset++] = (int) ((block7 >>> 19) & 131071L);
|
||||
values[valuesOffset++] = (int) ((block7 >>> 2) & 131071L);
|
||||
final long block8 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block7 & 3L) << 15) | (block8 >>> 49));
|
||||
values[valuesOffset++] = (int) ((block8 >>> 32) & 131071L);
|
||||
values[valuesOffset++] = (int) ((block8 >>> 15) & 131071L);
|
||||
final long block9 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block8 & 32767L) << 2) | (block9 >>> 62));
|
||||
values[valuesOffset++] = (int) ((block9 >>> 45) & 131071L);
|
||||
values[valuesOffset++] = (int) ((block9 >>> 28) & 131071L);
|
||||
values[valuesOffset++] = (int) ((block9 >>> 11) & 131071L);
|
||||
final long block10 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block9 & 2047L) << 6) | (block10 >>> 58));
|
||||
values[valuesOffset++] = (int) ((block10 >>> 41) & 131071L);
|
||||
values[valuesOffset++] = (int) ((block10 >>> 24) & 131071L);
|
||||
values[valuesOffset++] = (int) ((block10 >>> 7) & 131071L);
|
||||
final long block11 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block10 & 127L) << 10) | (block11 >>> 54));
|
||||
values[valuesOffset++] = (int) ((block11 >>> 37) & 131071L);
|
||||
values[valuesOffset++] = (int) ((block11 >>> 20) & 131071L);
|
||||
values[valuesOffset++] = (int) ((block11 >>> 3) & 131071L);
|
||||
final long block12 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block11 & 7L) << 14) | (block12 >>> 50));
|
||||
values[valuesOffset++] = (int) ((block12 >>> 33) & 131071L);
|
||||
values[valuesOffset++] = (int) ((block12 >>> 16) & 131071L);
|
||||
final long block13 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block12 & 65535L) << 1) | (block13 >>> 63));
|
||||
values[valuesOffset++] = (int) ((block13 >>> 46) & 131071L);
|
||||
values[valuesOffset++] = (int) ((block13 >>> 29) & 131071L);
|
||||
values[valuesOffset++] = (int) ((block13 >>> 12) & 131071L);
|
||||
final long block14 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block13 & 4095L) << 5) | (block14 >>> 59));
|
||||
values[valuesOffset++] = (int) ((block14 >>> 42) & 131071L);
|
||||
values[valuesOffset++] = (int) ((block14 >>> 25) & 131071L);
|
||||
values[valuesOffset++] = (int) ((block14 >>> 8) & 131071L);
|
||||
final long block15 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block14 & 255L) << 9) | (block15 >>> 55));
|
||||
values[valuesOffset++] = (int) ((block15 >>> 38) & 131071L);
|
||||
values[valuesOffset++] = (int) ((block15 >>> 21) & 131071L);
|
||||
values[valuesOffset++] = (int) ((block15 >>> 4) & 131071L);
|
||||
final long block16 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block15 & 15L) << 13) | (block16 >>> 51));
|
||||
values[valuesOffset++] = (int) ((block16 >>> 34) & 131071L);
|
||||
values[valuesOffset++] = (int) ((block16 >>> 17) & 131071L);
|
||||
values[valuesOffset++] = (int) (block16 & 131071L);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(byte[] blocks, int blocksOffset, int[] values, int valuesOffset, int iterations) {
|
||||
assert blocksOffset + 8 * iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
final int byte0 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte1 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte2 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte0 << 9) | (byte1 << 1) | (byte2 >>> 7);
|
||||
final int byte3 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte4 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte2 & 127) << 10) | (byte3 << 2) | (byte4 >>> 6);
|
||||
final int byte5 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte6 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte4 & 63) << 11) | (byte5 << 3) | (byte6 >>> 5);
|
||||
final int byte7 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte8 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte6 & 31) << 12) | (byte7 << 4) | (byte8 >>> 4);
|
||||
final int byte9 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte10 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte8 & 15) << 13) | (byte9 << 5) | (byte10 >>> 3);
|
||||
final int byte11 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte12 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte10 & 7) << 14) | (byte11 << 6) | (byte12 >>> 2);
|
||||
final int byte13 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte14 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte12 & 3) << 15) | (byte13 << 7) | (byte14 >>> 1);
|
||||
final int byte15 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte16 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte14 & 1) << 16) | (byte15 << 8) | byte16;
|
||||
final int byte17 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte18 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte19 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte17 << 9) | (byte18 << 1) | (byte19 >>> 7);
|
||||
final int byte20 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte21 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte19 & 127) << 10) | (byte20 << 2) | (byte21 >>> 6);
|
||||
final int byte22 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte23 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte21 & 63) << 11) | (byte22 << 3) | (byte23 >>> 5);
|
||||
final int byte24 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte25 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte23 & 31) << 12) | (byte24 << 4) | (byte25 >>> 4);
|
||||
final int byte26 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte27 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte25 & 15) << 13) | (byte26 << 5) | (byte27 >>> 3);
|
||||
final int byte28 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte29 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte27 & 7) << 14) | (byte28 << 6) | (byte29 >>> 2);
|
||||
final int byte30 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte31 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte29 & 3) << 15) | (byte30 << 7) | (byte31 >>> 1);
|
||||
final int byte32 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte33 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte31 & 1) << 16) | (byte32 << 8) | byte33;
|
||||
final int byte34 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte35 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte36 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte34 << 9) | (byte35 << 1) | (byte36 >>> 7);
|
||||
final int byte37 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte38 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte36 & 127) << 10) | (byte37 << 2) | (byte38 >>> 6);
|
||||
final int byte39 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte40 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte38 & 63) << 11) | (byte39 << 3) | (byte40 >>> 5);
|
||||
final int byte41 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte42 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte40 & 31) << 12) | (byte41 << 4) | (byte42 >>> 4);
|
||||
final int byte43 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte44 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte42 & 15) << 13) | (byte43 << 5) | (byte44 >>> 3);
|
||||
final int byte45 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte46 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte44 & 7) << 14) | (byte45 << 6) | (byte46 >>> 2);
|
||||
final int byte47 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte48 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte46 & 3) << 15) | (byte47 << 7) | (byte48 >>> 1);
|
||||
final int byte49 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte50 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte48 & 1) << 16) | (byte49 << 8) | byte50;
|
||||
final int byte51 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte52 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte53 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte51 << 9) | (byte52 << 1) | (byte53 >>> 7);
|
||||
final int byte54 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte55 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte53 & 127) << 10) | (byte54 << 2) | (byte55 >>> 6);
|
||||
final int byte56 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte57 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte55 & 63) << 11) | (byte56 << 3) | (byte57 >>> 5);
|
||||
final int byte58 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte59 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte57 & 31) << 12) | (byte58 << 4) | (byte59 >>> 4);
|
||||
final int byte60 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte61 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte59 & 15) << 13) | (byte60 << 5) | (byte61 >>> 3);
|
||||
final int byte62 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte63 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte61 & 7) << 14) | (byte62 << 6) | (byte63 >>> 2);
|
||||
final int byte64 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte65 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte63 & 3) << 15) | (byte64 << 7) | (byte65 >>> 1);
|
||||
final int byte66 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte67 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte65 & 1) << 16) | (byte66 << 8) | byte67;
|
||||
final int byte68 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte69 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte70 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte68 << 9) | (byte69 << 1) | (byte70 >>> 7);
|
||||
final int byte71 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte72 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte70 & 127) << 10) | (byte71 << 2) | (byte72 >>> 6);
|
||||
final int byte73 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte74 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte72 & 63) << 11) | (byte73 << 3) | (byte74 >>> 5);
|
||||
final int byte75 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte76 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte74 & 31) << 12) | (byte75 << 4) | (byte76 >>> 4);
|
||||
final int byte77 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte78 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte76 & 15) << 13) | (byte77 << 5) | (byte78 >>> 3);
|
||||
final int byte79 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte80 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte78 & 7) << 14) | (byte79 << 6) | (byte80 >>> 2);
|
||||
final int byte81 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte82 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte80 & 3) << 15) | (byte81 << 7) | (byte82 >>> 1);
|
||||
final int byte83 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte84 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte82 & 1) << 16) | (byte83 << 8) | byte84;
|
||||
final int byte85 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte86 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte87 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte85 << 9) | (byte86 << 1) | (byte87 >>> 7);
|
||||
final int byte88 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte89 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte87 & 127) << 10) | (byte88 << 2) | (byte89 >>> 6);
|
||||
final int byte90 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte91 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte89 & 63) << 11) | (byte90 << 3) | (byte91 >>> 5);
|
||||
final int byte92 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte93 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte91 & 31) << 12) | (byte92 << 4) | (byte93 >>> 4);
|
||||
final int byte94 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte95 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte93 & 15) << 13) | (byte94 << 5) | (byte95 >>> 3);
|
||||
final int byte96 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte97 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte95 & 7) << 14) | (byte96 << 6) | (byte97 >>> 2);
|
||||
final int byte98 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte99 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte97 & 3) << 15) | (byte98 << 7) | (byte99 >>> 1);
|
||||
final int byte100 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte101 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte99 & 1) << 16) | (byte100 << 8) | byte101;
|
||||
final int byte102 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte103 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte104 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte102 << 9) | (byte103 << 1) | (byte104 >>> 7);
|
||||
final int byte105 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte106 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte104 & 127) << 10) | (byte105 << 2) | (byte106 >>> 6);
|
||||
final int byte107 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte108 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte106 & 63) << 11) | (byte107 << 3) | (byte108 >>> 5);
|
||||
final int byte109 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte110 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte108 & 31) << 12) | (byte109 << 4) | (byte110 >>> 4);
|
||||
final int byte111 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte112 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte110 & 15) << 13) | (byte111 << 5) | (byte112 >>> 3);
|
||||
final int byte113 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte114 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte112 & 7) << 14) | (byte113 << 6) | (byte114 >>> 2);
|
||||
final int byte115 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte116 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte114 & 3) << 15) | (byte115 << 7) | (byte116 >>> 1);
|
||||
final int byte117 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte118 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte116 & 1) << 16) | (byte117 << 8) | byte118;
|
||||
final int byte119 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte120 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte121 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte119 << 9) | (byte120 << 1) | (byte121 >>> 7);
|
||||
final int byte122 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte123 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte121 & 127) << 10) | (byte122 << 2) | (byte123 >>> 6);
|
||||
final int byte124 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte125 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte123 & 63) << 11) | (byte124 << 3) | (byte125 >>> 5);
|
||||
final int byte126 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte127 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte125 & 31) << 12) | (byte126 << 4) | (byte127 >>> 4);
|
||||
final int byte128 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte129 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte127 & 15) << 13) | (byte128 << 5) | (byte129 >>> 3);
|
||||
final int byte130 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte131 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte129 & 7) << 14) | (byte130 << 6) | (byte131 >>> 2);
|
||||
final int byte132 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte133 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte131 & 3) << 15) | (byte132 << 7) | (byte133 >>> 1);
|
||||
final int byte134 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte135 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte133 & 1) << 16) | (byte134 << 8) | byte135;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(long[] blocks, int blocksOffset, long[] values, int valuesOffset, int iterations) {
|
||||
assert blocksOffset + iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
final long block0 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = block0 >>> 47;
|
||||
values[valuesOffset++] = (block0 >>> 30) & 131071L;
|
||||
values[valuesOffset++] = (block0 >>> 13) & 131071L;
|
||||
final long block1 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block0 & 8191L) << 4) | (block1 >>> 60);
|
||||
values[valuesOffset++] = (block1 >>> 43) & 131071L;
|
||||
values[valuesOffset++] = (block1 >>> 26) & 131071L;
|
||||
values[valuesOffset++] = (block1 >>> 9) & 131071L;
|
||||
final long block2 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block1 & 511L) << 8) | (block2 >>> 56);
|
||||
values[valuesOffset++] = (block2 >>> 39) & 131071L;
|
||||
values[valuesOffset++] = (block2 >>> 22) & 131071L;
|
||||
values[valuesOffset++] = (block2 >>> 5) & 131071L;
|
||||
final long block3 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block2 & 31L) << 12) | (block3 >>> 52);
|
||||
values[valuesOffset++] = (block3 >>> 35) & 131071L;
|
||||
values[valuesOffset++] = (block3 >>> 18) & 131071L;
|
||||
values[valuesOffset++] = (block3 >>> 1) & 131071L;
|
||||
final long block4 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block3 & 1L) << 16) | (block4 >>> 48);
|
||||
values[valuesOffset++] = (block4 >>> 31) & 131071L;
|
||||
values[valuesOffset++] = (block4 >>> 14) & 131071L;
|
||||
final long block5 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block4 & 16383L) << 3) | (block5 >>> 61);
|
||||
values[valuesOffset++] = (block5 >>> 44) & 131071L;
|
||||
values[valuesOffset++] = (block5 >>> 27) & 131071L;
|
||||
values[valuesOffset++] = (block5 >>> 10) & 131071L;
|
||||
final long block6 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block5 & 1023L) << 7) | (block6 >>> 57);
|
||||
values[valuesOffset++] = (block6 >>> 40) & 131071L;
|
||||
values[valuesOffset++] = (block6 >>> 23) & 131071L;
|
||||
values[valuesOffset++] = (block6 >>> 6) & 131071L;
|
||||
final long block7 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block6 & 63L) << 11) | (block7 >>> 53);
|
||||
values[valuesOffset++] = (block7 >>> 36) & 131071L;
|
||||
values[valuesOffset++] = (block7 >>> 19) & 131071L;
|
||||
values[valuesOffset++] = (block7 >>> 2) & 131071L;
|
||||
final long block8 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block7 & 3L) << 15) | (block8 >>> 49);
|
||||
values[valuesOffset++] = (block8 >>> 32) & 131071L;
|
||||
values[valuesOffset++] = (block8 >>> 15) & 131071L;
|
||||
final long block9 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block8 & 32767L) << 2) | (block9 >>> 62);
|
||||
values[valuesOffset++] = (block9 >>> 45) & 131071L;
|
||||
values[valuesOffset++] = (block9 >>> 28) & 131071L;
|
||||
values[valuesOffset++] = (block9 >>> 11) & 131071L;
|
||||
final long block10 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block9 & 2047L) << 6) | (block10 >>> 58);
|
||||
values[valuesOffset++] = (block10 >>> 41) & 131071L;
|
||||
values[valuesOffset++] = (block10 >>> 24) & 131071L;
|
||||
values[valuesOffset++] = (block10 >>> 7) & 131071L;
|
||||
final long block11 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block10 & 127L) << 10) | (block11 >>> 54);
|
||||
values[valuesOffset++] = (block11 >>> 37) & 131071L;
|
||||
values[valuesOffset++] = (block11 >>> 20) & 131071L;
|
||||
values[valuesOffset++] = (block11 >>> 3) & 131071L;
|
||||
final long block12 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block11 & 7L) << 14) | (block12 >>> 50);
|
||||
values[valuesOffset++] = (block12 >>> 33) & 131071L;
|
||||
values[valuesOffset++] = (block12 >>> 16) & 131071L;
|
||||
final long block13 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block12 & 65535L) << 1) | (block13 >>> 63);
|
||||
values[valuesOffset++] = (block13 >>> 46) & 131071L;
|
||||
values[valuesOffset++] = (block13 >>> 29) & 131071L;
|
||||
values[valuesOffset++] = (block13 >>> 12) & 131071L;
|
||||
final long block14 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block13 & 4095L) << 5) | (block14 >>> 59);
|
||||
values[valuesOffset++] = (block14 >>> 42) & 131071L;
|
||||
values[valuesOffset++] = (block14 >>> 25) & 131071L;
|
||||
values[valuesOffset++] = (block14 >>> 8) & 131071L;
|
||||
final long block15 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block14 & 255L) << 9) | (block15 >>> 55);
|
||||
values[valuesOffset++] = (block15 >>> 38) & 131071L;
|
||||
values[valuesOffset++] = (block15 >>> 21) & 131071L;
|
||||
values[valuesOffset++] = (block15 >>> 4) & 131071L;
|
||||
final long block16 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block15 & 15L) << 13) | (block16 >>> 51);
|
||||
values[valuesOffset++] = (block16 >>> 34) & 131071L;
|
||||
values[valuesOffset++] = (block16 >>> 17) & 131071L;
|
||||
values[valuesOffset++] = block16 & 131071L;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(byte[] blocks, int blocksOffset, long[] values, int valuesOffset, int iterations) {
|
||||
assert blocksOffset + 8 * iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
final long byte0 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte1 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte2 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte0 << 9) | (byte1 << 1) | (byte2 >>> 7);
|
||||
final long byte3 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte4 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte2 & 127) << 10) | (byte3 << 2) | (byte4 >>> 6);
|
||||
final long byte5 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte6 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte4 & 63) << 11) | (byte5 << 3) | (byte6 >>> 5);
|
||||
final long byte7 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte8 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte6 & 31) << 12) | (byte7 << 4) | (byte8 >>> 4);
|
||||
final long byte9 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte10 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte8 & 15) << 13) | (byte9 << 5) | (byte10 >>> 3);
|
||||
final long byte11 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte12 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte10 & 7) << 14) | (byte11 << 6) | (byte12 >>> 2);
|
||||
final long byte13 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte14 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte12 & 3) << 15) | (byte13 << 7) | (byte14 >>> 1);
|
||||
final long byte15 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte16 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte14 & 1) << 16) | (byte15 << 8) | byte16;
|
||||
final long byte17 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte18 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte19 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte17 << 9) | (byte18 << 1) | (byte19 >>> 7);
|
||||
final long byte20 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte21 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte19 & 127) << 10) | (byte20 << 2) | (byte21 >>> 6);
|
||||
final long byte22 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte23 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte21 & 63) << 11) | (byte22 << 3) | (byte23 >>> 5);
|
||||
final long byte24 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte25 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte23 & 31) << 12) | (byte24 << 4) | (byte25 >>> 4);
|
||||
final long byte26 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte27 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte25 & 15) << 13) | (byte26 << 5) | (byte27 >>> 3);
|
||||
final long byte28 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte29 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte27 & 7) << 14) | (byte28 << 6) | (byte29 >>> 2);
|
||||
final long byte30 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte31 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte29 & 3) << 15) | (byte30 << 7) | (byte31 >>> 1);
|
||||
final long byte32 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte33 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte31 & 1) << 16) | (byte32 << 8) | byte33;
|
||||
final long byte34 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte35 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte36 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte34 << 9) | (byte35 << 1) | (byte36 >>> 7);
|
||||
final long byte37 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte38 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte36 & 127) << 10) | (byte37 << 2) | (byte38 >>> 6);
|
||||
final long byte39 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte40 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte38 & 63) << 11) | (byte39 << 3) | (byte40 >>> 5);
|
||||
final long byte41 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte42 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte40 & 31) << 12) | (byte41 << 4) | (byte42 >>> 4);
|
||||
final long byte43 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte44 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte42 & 15) << 13) | (byte43 << 5) | (byte44 >>> 3);
|
||||
final long byte45 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte46 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte44 & 7) << 14) | (byte45 << 6) | (byte46 >>> 2);
|
||||
final long byte47 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte48 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte46 & 3) << 15) | (byte47 << 7) | (byte48 >>> 1);
|
||||
final long byte49 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte50 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte48 & 1) << 16) | (byte49 << 8) | byte50;
|
||||
final long byte51 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte52 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte53 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte51 << 9) | (byte52 << 1) | (byte53 >>> 7);
|
||||
final long byte54 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte55 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte53 & 127) << 10) | (byte54 << 2) | (byte55 >>> 6);
|
||||
final long byte56 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte57 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte55 & 63) << 11) | (byte56 << 3) | (byte57 >>> 5);
|
||||
final long byte58 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte59 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte57 & 31) << 12) | (byte58 << 4) | (byte59 >>> 4);
|
||||
final long byte60 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte61 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte59 & 15) << 13) | (byte60 << 5) | (byte61 >>> 3);
|
||||
final long byte62 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte63 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte61 & 7) << 14) | (byte62 << 6) | (byte63 >>> 2);
|
||||
final long byte64 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte65 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte63 & 3) << 15) | (byte64 << 7) | (byte65 >>> 1);
|
||||
final long byte66 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte67 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte65 & 1) << 16) | (byte66 << 8) | byte67;
|
||||
final long byte68 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte69 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte70 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte68 << 9) | (byte69 << 1) | (byte70 >>> 7);
|
||||
final long byte71 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte72 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte70 & 127) << 10) | (byte71 << 2) | (byte72 >>> 6);
|
||||
final long byte73 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte74 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte72 & 63) << 11) | (byte73 << 3) | (byte74 >>> 5);
|
||||
final long byte75 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte76 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte74 & 31) << 12) | (byte75 << 4) | (byte76 >>> 4);
|
||||
final long byte77 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte78 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte76 & 15) << 13) | (byte77 << 5) | (byte78 >>> 3);
|
||||
final long byte79 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte80 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte78 & 7) << 14) | (byte79 << 6) | (byte80 >>> 2);
|
||||
final long byte81 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte82 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte80 & 3) << 15) | (byte81 << 7) | (byte82 >>> 1);
|
||||
final long byte83 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte84 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte82 & 1) << 16) | (byte83 << 8) | byte84;
|
||||
final long byte85 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte86 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte87 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte85 << 9) | (byte86 << 1) | (byte87 >>> 7);
|
||||
final long byte88 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte89 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte87 & 127) << 10) | (byte88 << 2) | (byte89 >>> 6);
|
||||
final long byte90 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte91 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte89 & 63) << 11) | (byte90 << 3) | (byte91 >>> 5);
|
||||
final long byte92 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte93 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte91 & 31) << 12) | (byte92 << 4) | (byte93 >>> 4);
|
||||
final long byte94 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte95 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte93 & 15) << 13) | (byte94 << 5) | (byte95 >>> 3);
|
||||
final long byte96 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte97 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte95 & 7) << 14) | (byte96 << 6) | (byte97 >>> 2);
|
||||
final long byte98 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte99 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte97 & 3) << 15) | (byte98 << 7) | (byte99 >>> 1);
|
||||
final long byte100 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte101 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte99 & 1) << 16) | (byte100 << 8) | byte101;
|
||||
final long byte102 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte103 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte104 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte102 << 9) | (byte103 << 1) | (byte104 >>> 7);
|
||||
final long byte105 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte106 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte104 & 127) << 10) | (byte105 << 2) | (byte106 >>> 6);
|
||||
final long byte107 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte108 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte106 & 63) << 11) | (byte107 << 3) | (byte108 >>> 5);
|
||||
final long byte109 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte110 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte108 & 31) << 12) | (byte109 << 4) | (byte110 >>> 4);
|
||||
final long byte111 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte112 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte110 & 15) << 13) | (byte111 << 5) | (byte112 >>> 3);
|
||||
final long byte113 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte114 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte112 & 7) << 14) | (byte113 << 6) | (byte114 >>> 2);
|
||||
final long byte115 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte116 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte114 & 3) << 15) | (byte115 << 7) | (byte116 >>> 1);
|
||||
final long byte117 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte118 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte116 & 1) << 16) | (byte117 << 8) | byte118;
|
||||
final long byte119 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte120 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte121 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte119 << 9) | (byte120 << 1) | (byte121 >>> 7);
|
||||
final long byte122 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte123 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte121 & 127) << 10) | (byte122 << 2) | (byte123 >>> 6);
|
||||
final long byte124 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte125 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte123 & 63) << 11) | (byte124 << 3) | (byte125 >>> 5);
|
||||
final long byte126 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte127 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte125 & 31) << 12) | (byte126 << 4) | (byte127 >>> 4);
|
||||
final long byte128 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte129 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte127 & 15) << 13) | (byte128 << 5) | (byte129 >>> 3);
|
||||
final long byte130 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte131 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte129 & 7) << 14) | (byte130 << 6) | (byte131 >>> 2);
|
||||
final long byte132 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte133 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte131 & 3) << 15) | (byte132 << 7) | (byte133 >>> 1);
|
||||
final long byte134 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte135 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte133 & 1) << 16) | (byte134 << 8) | byte135;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(int[] values, int valuesOffset, long[] blocks, int blocksOffset, int iterations) {
|
||||
assert blocksOffset + iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 47) | ((values[valuesOffset++] & 0xffffffffL) << 30) | ((values[valuesOffset++] & 0xffffffffL) << 13) | ((values[valuesOffset] & 0xffffffffL) >>> 4);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 60) | ((values[valuesOffset++] & 0xffffffffL) << 43) | ((values[valuesOffset++] & 0xffffffffL) << 26) | ((values[valuesOffset++] & 0xffffffffL) << 9) | ((values[valuesOffset] & 0xffffffffL) >>> 8);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 56) | ((values[valuesOffset++] & 0xffffffffL) << 39) | ((values[valuesOffset++] & 0xffffffffL) << 22) | ((values[valuesOffset++] & 0xffffffffL) << 5) | ((values[valuesOffset] & 0xffffffffL) >>> 12);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 52) | ((values[valuesOffset++] & 0xffffffffL) << 35) | ((values[valuesOffset++] & 0xffffffffL) << 18) | ((values[valuesOffset++] & 0xffffffffL) << 1) | ((values[valuesOffset] & 0xffffffffL) >>> 16);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 48) | ((values[valuesOffset++] & 0xffffffffL) << 31) | ((values[valuesOffset++] & 0xffffffffL) << 14) | ((values[valuesOffset] & 0xffffffffL) >>> 3);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 61) | ((values[valuesOffset++] & 0xffffffffL) << 44) | ((values[valuesOffset++] & 0xffffffffL) << 27) | ((values[valuesOffset++] & 0xffffffffL) << 10) | ((values[valuesOffset] & 0xffffffffL) >>> 7);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 57) | ((values[valuesOffset++] & 0xffffffffL) << 40) | ((values[valuesOffset++] & 0xffffffffL) << 23) | ((values[valuesOffset++] & 0xffffffffL) << 6) | ((values[valuesOffset] & 0xffffffffL) >>> 11);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 53) | ((values[valuesOffset++] & 0xffffffffL) << 36) | ((values[valuesOffset++] & 0xffffffffL) << 19) | ((values[valuesOffset++] & 0xffffffffL) << 2) | ((values[valuesOffset] & 0xffffffffL) >>> 15);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 49) | ((values[valuesOffset++] & 0xffffffffL) << 32) | ((values[valuesOffset++] & 0xffffffffL) << 15) | ((values[valuesOffset] & 0xffffffffL) >>> 2);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 62) | ((values[valuesOffset++] & 0xffffffffL) << 45) | ((values[valuesOffset++] & 0xffffffffL) << 28) | ((values[valuesOffset++] & 0xffffffffL) << 11) | ((values[valuesOffset] & 0xffffffffL) >>> 6);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 58) | ((values[valuesOffset++] & 0xffffffffL) << 41) | ((values[valuesOffset++] & 0xffffffffL) << 24) | ((values[valuesOffset++] & 0xffffffffL) << 7) | ((values[valuesOffset] & 0xffffffffL) >>> 10);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 54) | ((values[valuesOffset++] & 0xffffffffL) << 37) | ((values[valuesOffset++] & 0xffffffffL) << 20) | ((values[valuesOffset++] & 0xffffffffL) << 3) | ((values[valuesOffset] & 0xffffffffL) >>> 14);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 50) | ((values[valuesOffset++] & 0xffffffffL) << 33) | ((values[valuesOffset++] & 0xffffffffL) << 16) | ((values[valuesOffset] & 0xffffffffL) >>> 1);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 63) | ((values[valuesOffset++] & 0xffffffffL) << 46) | ((values[valuesOffset++] & 0xffffffffL) << 29) | ((values[valuesOffset++] & 0xffffffffL) << 12) | ((values[valuesOffset] & 0xffffffffL) >>> 5);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 59) | ((values[valuesOffset++] & 0xffffffffL) << 42) | ((values[valuesOffset++] & 0xffffffffL) << 25) | ((values[valuesOffset++] & 0xffffffffL) << 8) | ((values[valuesOffset] & 0xffffffffL) >>> 9);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 55) | ((values[valuesOffset++] & 0xffffffffL) << 38) | ((values[valuesOffset++] & 0xffffffffL) << 21) | ((values[valuesOffset++] & 0xffffffffL) << 4) | ((values[valuesOffset] & 0xffffffffL) >>> 13);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 51) | ((values[valuesOffset++] & 0xffffffffL) << 34) | ((values[valuesOffset++] & 0xffffffffL) << 17) | (values[valuesOffset++] & 0xffffffffL);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(long[] values, int valuesOffset, long[] blocks, int blocksOffset, int iterations) {
|
||||
assert blocksOffset + iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 47) | (values[valuesOffset++] << 30) | (values[valuesOffset++] << 13) | (values[valuesOffset] >>> 4);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 60) | (values[valuesOffset++] << 43) | (values[valuesOffset++] << 26) | (values[valuesOffset++] << 9) | (values[valuesOffset] >>> 8);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 56) | (values[valuesOffset++] << 39) | (values[valuesOffset++] << 22) | (values[valuesOffset++] << 5) | (values[valuesOffset] >>> 12);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 52) | (values[valuesOffset++] << 35) | (values[valuesOffset++] << 18) | (values[valuesOffset++] << 1) | (values[valuesOffset] >>> 16);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 48) | (values[valuesOffset++] << 31) | (values[valuesOffset++] << 14) | (values[valuesOffset] >>> 3);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 61) | (values[valuesOffset++] << 44) | (values[valuesOffset++] << 27) | (values[valuesOffset++] << 10) | (values[valuesOffset] >>> 7);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 57) | (values[valuesOffset++] << 40) | (values[valuesOffset++] << 23) | (values[valuesOffset++] << 6) | (values[valuesOffset] >>> 11);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 53) | (values[valuesOffset++] << 36) | (values[valuesOffset++] << 19) | (values[valuesOffset++] << 2) | (values[valuesOffset] >>> 15);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 49) | (values[valuesOffset++] << 32) | (values[valuesOffset++] << 15) | (values[valuesOffset] >>> 2);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 62) | (values[valuesOffset++] << 45) | (values[valuesOffset++] << 28) | (values[valuesOffset++] << 11) | (values[valuesOffset] >>> 6);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 58) | (values[valuesOffset++] << 41) | (values[valuesOffset++] << 24) | (values[valuesOffset++] << 7) | (values[valuesOffset] >>> 10);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 54) | (values[valuesOffset++] << 37) | (values[valuesOffset++] << 20) | (values[valuesOffset++] << 3) | (values[valuesOffset] >>> 14);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 50) | (values[valuesOffset++] << 33) | (values[valuesOffset++] << 16) | (values[valuesOffset] >>> 1);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 63) | (values[valuesOffset++] << 46) | (values[valuesOffset++] << 29) | (values[valuesOffset++] << 12) | (values[valuesOffset] >>> 5);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 59) | (values[valuesOffset++] << 42) | (values[valuesOffset++] << 25) | (values[valuesOffset++] << 8) | (values[valuesOffset] >>> 9);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 55) | (values[valuesOffset++] << 38) | (values[valuesOffset++] << 21) | (values[valuesOffset++] << 4) | (values[valuesOffset] >>> 13);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 51) | (values[valuesOffset++] << 34) | (values[valuesOffset++] << 17) | values[valuesOffset++];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,392 @@
|
|||
// This file has been automatically generated, DO NOT EDIT
|
||||
|
||||
package org.apache.lucene.util.packed;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Efficient sequential read/write of packed integers.
|
||||
*/
|
||||
final class BulkOperationPacked18 extends BulkOperation {
|
||||
@Override
|
||||
public int blockCount() {
|
||||
return 9;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int valueCount() {
|
||||
return 32;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(long[] blocks, int blocksOffset, int[] values, int valuesOffset, int iterations) {
|
||||
assert blocksOffset + iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
final long block0 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (block0 >>> 46);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 28) & 262143L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 10) & 262143L);
|
||||
final long block1 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block0 & 1023L) << 8) | (block1 >>> 56));
|
||||
values[valuesOffset++] = (int) ((block1 >>> 38) & 262143L);
|
||||
values[valuesOffset++] = (int) ((block1 >>> 20) & 262143L);
|
||||
values[valuesOffset++] = (int) ((block1 >>> 2) & 262143L);
|
||||
final long block2 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block1 & 3L) << 16) | (block2 >>> 48));
|
||||
values[valuesOffset++] = (int) ((block2 >>> 30) & 262143L);
|
||||
values[valuesOffset++] = (int) ((block2 >>> 12) & 262143L);
|
||||
final long block3 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block2 & 4095L) << 6) | (block3 >>> 58));
|
||||
values[valuesOffset++] = (int) ((block3 >>> 40) & 262143L);
|
||||
values[valuesOffset++] = (int) ((block3 >>> 22) & 262143L);
|
||||
values[valuesOffset++] = (int) ((block3 >>> 4) & 262143L);
|
||||
final long block4 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block3 & 15L) << 14) | (block4 >>> 50));
|
||||
values[valuesOffset++] = (int) ((block4 >>> 32) & 262143L);
|
||||
values[valuesOffset++] = (int) ((block4 >>> 14) & 262143L);
|
||||
final long block5 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block4 & 16383L) << 4) | (block5 >>> 60));
|
||||
values[valuesOffset++] = (int) ((block5 >>> 42) & 262143L);
|
||||
values[valuesOffset++] = (int) ((block5 >>> 24) & 262143L);
|
||||
values[valuesOffset++] = (int) ((block5 >>> 6) & 262143L);
|
||||
final long block6 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block5 & 63L) << 12) | (block6 >>> 52));
|
||||
values[valuesOffset++] = (int) ((block6 >>> 34) & 262143L);
|
||||
values[valuesOffset++] = (int) ((block6 >>> 16) & 262143L);
|
||||
final long block7 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block6 & 65535L) << 2) | (block7 >>> 62));
|
||||
values[valuesOffset++] = (int) ((block7 >>> 44) & 262143L);
|
||||
values[valuesOffset++] = (int) ((block7 >>> 26) & 262143L);
|
||||
values[valuesOffset++] = (int) ((block7 >>> 8) & 262143L);
|
||||
final long block8 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block7 & 255L) << 10) | (block8 >>> 54));
|
||||
values[valuesOffset++] = (int) ((block8 >>> 36) & 262143L);
|
||||
values[valuesOffset++] = (int) ((block8 >>> 18) & 262143L);
|
||||
values[valuesOffset++] = (int) (block8 & 262143L);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(byte[] blocks, int blocksOffset, int[] values, int valuesOffset, int iterations) {
|
||||
assert blocksOffset + 8 * iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
final int byte0 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte1 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte2 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte0 << 10) | (byte1 << 2) | (byte2 >>> 6);
|
||||
final int byte3 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte4 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte2 & 63) << 12) | (byte3 << 4) | (byte4 >>> 4);
|
||||
final int byte5 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte6 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte4 & 15) << 14) | (byte5 << 6) | (byte6 >>> 2);
|
||||
final int byte7 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte8 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte6 & 3) << 16) | (byte7 << 8) | byte8;
|
||||
final int byte9 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte10 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte11 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte9 << 10) | (byte10 << 2) | (byte11 >>> 6);
|
||||
final int byte12 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte13 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte11 & 63) << 12) | (byte12 << 4) | (byte13 >>> 4);
|
||||
final int byte14 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte15 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte13 & 15) << 14) | (byte14 << 6) | (byte15 >>> 2);
|
||||
final int byte16 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte17 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte15 & 3) << 16) | (byte16 << 8) | byte17;
|
||||
final int byte18 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte19 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte20 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte18 << 10) | (byte19 << 2) | (byte20 >>> 6);
|
||||
final int byte21 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte22 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte20 & 63) << 12) | (byte21 << 4) | (byte22 >>> 4);
|
||||
final int byte23 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte24 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte22 & 15) << 14) | (byte23 << 6) | (byte24 >>> 2);
|
||||
final int byte25 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte26 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte24 & 3) << 16) | (byte25 << 8) | byte26;
|
||||
final int byte27 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte28 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte29 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte27 << 10) | (byte28 << 2) | (byte29 >>> 6);
|
||||
final int byte30 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte31 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte29 & 63) << 12) | (byte30 << 4) | (byte31 >>> 4);
|
||||
final int byte32 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte33 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte31 & 15) << 14) | (byte32 << 6) | (byte33 >>> 2);
|
||||
final int byte34 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte35 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte33 & 3) << 16) | (byte34 << 8) | byte35;
|
||||
final int byte36 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte37 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte38 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte36 << 10) | (byte37 << 2) | (byte38 >>> 6);
|
||||
final int byte39 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte40 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte38 & 63) << 12) | (byte39 << 4) | (byte40 >>> 4);
|
||||
final int byte41 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte42 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte40 & 15) << 14) | (byte41 << 6) | (byte42 >>> 2);
|
||||
final int byte43 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte44 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte42 & 3) << 16) | (byte43 << 8) | byte44;
|
||||
final int byte45 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte46 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte47 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte45 << 10) | (byte46 << 2) | (byte47 >>> 6);
|
||||
final int byte48 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte49 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte47 & 63) << 12) | (byte48 << 4) | (byte49 >>> 4);
|
||||
final int byte50 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte51 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte49 & 15) << 14) | (byte50 << 6) | (byte51 >>> 2);
|
||||
final int byte52 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte53 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte51 & 3) << 16) | (byte52 << 8) | byte53;
|
||||
final int byte54 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte55 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte56 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte54 << 10) | (byte55 << 2) | (byte56 >>> 6);
|
||||
final int byte57 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte58 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte56 & 63) << 12) | (byte57 << 4) | (byte58 >>> 4);
|
||||
final int byte59 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte60 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte58 & 15) << 14) | (byte59 << 6) | (byte60 >>> 2);
|
||||
final int byte61 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte62 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte60 & 3) << 16) | (byte61 << 8) | byte62;
|
||||
final int byte63 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte64 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte65 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte63 << 10) | (byte64 << 2) | (byte65 >>> 6);
|
||||
final int byte66 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte67 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte65 & 63) << 12) | (byte66 << 4) | (byte67 >>> 4);
|
||||
final int byte68 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte69 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte67 & 15) << 14) | (byte68 << 6) | (byte69 >>> 2);
|
||||
final int byte70 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte71 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte69 & 3) << 16) | (byte70 << 8) | byte71;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(long[] blocks, int blocksOffset, long[] values, int valuesOffset, int iterations) {
|
||||
assert blocksOffset + iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
final long block0 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = block0 >>> 46;
|
||||
values[valuesOffset++] = (block0 >>> 28) & 262143L;
|
||||
values[valuesOffset++] = (block0 >>> 10) & 262143L;
|
||||
final long block1 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block0 & 1023L) << 8) | (block1 >>> 56);
|
||||
values[valuesOffset++] = (block1 >>> 38) & 262143L;
|
||||
values[valuesOffset++] = (block1 >>> 20) & 262143L;
|
||||
values[valuesOffset++] = (block1 >>> 2) & 262143L;
|
||||
final long block2 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block1 & 3L) << 16) | (block2 >>> 48);
|
||||
values[valuesOffset++] = (block2 >>> 30) & 262143L;
|
||||
values[valuesOffset++] = (block2 >>> 12) & 262143L;
|
||||
final long block3 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block2 & 4095L) << 6) | (block3 >>> 58);
|
||||
values[valuesOffset++] = (block3 >>> 40) & 262143L;
|
||||
values[valuesOffset++] = (block3 >>> 22) & 262143L;
|
||||
values[valuesOffset++] = (block3 >>> 4) & 262143L;
|
||||
final long block4 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block3 & 15L) << 14) | (block4 >>> 50);
|
||||
values[valuesOffset++] = (block4 >>> 32) & 262143L;
|
||||
values[valuesOffset++] = (block4 >>> 14) & 262143L;
|
||||
final long block5 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block4 & 16383L) << 4) | (block5 >>> 60);
|
||||
values[valuesOffset++] = (block5 >>> 42) & 262143L;
|
||||
values[valuesOffset++] = (block5 >>> 24) & 262143L;
|
||||
values[valuesOffset++] = (block5 >>> 6) & 262143L;
|
||||
final long block6 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block5 & 63L) << 12) | (block6 >>> 52);
|
||||
values[valuesOffset++] = (block6 >>> 34) & 262143L;
|
||||
values[valuesOffset++] = (block6 >>> 16) & 262143L;
|
||||
final long block7 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block6 & 65535L) << 2) | (block7 >>> 62);
|
||||
values[valuesOffset++] = (block7 >>> 44) & 262143L;
|
||||
values[valuesOffset++] = (block7 >>> 26) & 262143L;
|
||||
values[valuesOffset++] = (block7 >>> 8) & 262143L;
|
||||
final long block8 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block7 & 255L) << 10) | (block8 >>> 54);
|
||||
values[valuesOffset++] = (block8 >>> 36) & 262143L;
|
||||
values[valuesOffset++] = (block8 >>> 18) & 262143L;
|
||||
values[valuesOffset++] = block8 & 262143L;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(byte[] blocks, int blocksOffset, long[] values, int valuesOffset, int iterations) {
|
||||
assert blocksOffset + 8 * iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
final long byte0 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte1 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte2 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte0 << 10) | (byte1 << 2) | (byte2 >>> 6);
|
||||
final long byte3 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte4 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte2 & 63) << 12) | (byte3 << 4) | (byte4 >>> 4);
|
||||
final long byte5 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte6 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte4 & 15) << 14) | (byte5 << 6) | (byte6 >>> 2);
|
||||
final long byte7 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte8 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte6 & 3) << 16) | (byte7 << 8) | byte8;
|
||||
final long byte9 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte10 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte11 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte9 << 10) | (byte10 << 2) | (byte11 >>> 6);
|
||||
final long byte12 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte13 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte11 & 63) << 12) | (byte12 << 4) | (byte13 >>> 4);
|
||||
final long byte14 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte15 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte13 & 15) << 14) | (byte14 << 6) | (byte15 >>> 2);
|
||||
final long byte16 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte17 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte15 & 3) << 16) | (byte16 << 8) | byte17;
|
||||
final long byte18 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte19 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte20 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte18 << 10) | (byte19 << 2) | (byte20 >>> 6);
|
||||
final long byte21 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte22 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte20 & 63) << 12) | (byte21 << 4) | (byte22 >>> 4);
|
||||
final long byte23 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte24 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte22 & 15) << 14) | (byte23 << 6) | (byte24 >>> 2);
|
||||
final long byte25 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte26 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte24 & 3) << 16) | (byte25 << 8) | byte26;
|
||||
final long byte27 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte28 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte29 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte27 << 10) | (byte28 << 2) | (byte29 >>> 6);
|
||||
final long byte30 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte31 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte29 & 63) << 12) | (byte30 << 4) | (byte31 >>> 4);
|
||||
final long byte32 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte33 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte31 & 15) << 14) | (byte32 << 6) | (byte33 >>> 2);
|
||||
final long byte34 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte35 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte33 & 3) << 16) | (byte34 << 8) | byte35;
|
||||
final long byte36 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte37 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte38 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte36 << 10) | (byte37 << 2) | (byte38 >>> 6);
|
||||
final long byte39 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte40 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte38 & 63) << 12) | (byte39 << 4) | (byte40 >>> 4);
|
||||
final long byte41 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte42 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte40 & 15) << 14) | (byte41 << 6) | (byte42 >>> 2);
|
||||
final long byte43 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte44 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte42 & 3) << 16) | (byte43 << 8) | byte44;
|
||||
final long byte45 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte46 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte47 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte45 << 10) | (byte46 << 2) | (byte47 >>> 6);
|
||||
final long byte48 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte49 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte47 & 63) << 12) | (byte48 << 4) | (byte49 >>> 4);
|
||||
final long byte50 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte51 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte49 & 15) << 14) | (byte50 << 6) | (byte51 >>> 2);
|
||||
final long byte52 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte53 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte51 & 3) << 16) | (byte52 << 8) | byte53;
|
||||
final long byte54 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte55 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte56 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte54 << 10) | (byte55 << 2) | (byte56 >>> 6);
|
||||
final long byte57 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte58 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte56 & 63) << 12) | (byte57 << 4) | (byte58 >>> 4);
|
||||
final long byte59 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte60 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte58 & 15) << 14) | (byte59 << 6) | (byte60 >>> 2);
|
||||
final long byte61 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte62 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte60 & 3) << 16) | (byte61 << 8) | byte62;
|
||||
final long byte63 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte64 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte65 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte63 << 10) | (byte64 << 2) | (byte65 >>> 6);
|
||||
final long byte66 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte67 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte65 & 63) << 12) | (byte66 << 4) | (byte67 >>> 4);
|
||||
final long byte68 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte69 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte67 & 15) << 14) | (byte68 << 6) | (byte69 >>> 2);
|
||||
final long byte70 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte71 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte69 & 3) << 16) | (byte70 << 8) | byte71;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(int[] values, int valuesOffset, long[] blocks, int blocksOffset, int iterations) {
|
||||
assert blocksOffset + iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 46) | ((values[valuesOffset++] & 0xffffffffL) << 28) | ((values[valuesOffset++] & 0xffffffffL) << 10) | ((values[valuesOffset] & 0xffffffffL) >>> 8);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 56) | ((values[valuesOffset++] & 0xffffffffL) << 38) | ((values[valuesOffset++] & 0xffffffffL) << 20) | ((values[valuesOffset++] & 0xffffffffL) << 2) | ((values[valuesOffset] & 0xffffffffL) >>> 16);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 48) | ((values[valuesOffset++] & 0xffffffffL) << 30) | ((values[valuesOffset++] & 0xffffffffL) << 12) | ((values[valuesOffset] & 0xffffffffL) >>> 6);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 58) | ((values[valuesOffset++] & 0xffffffffL) << 40) | ((values[valuesOffset++] & 0xffffffffL) << 22) | ((values[valuesOffset++] & 0xffffffffL) << 4) | ((values[valuesOffset] & 0xffffffffL) >>> 14);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 50) | ((values[valuesOffset++] & 0xffffffffL) << 32) | ((values[valuesOffset++] & 0xffffffffL) << 14) | ((values[valuesOffset] & 0xffffffffL) >>> 4);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 60) | ((values[valuesOffset++] & 0xffffffffL) << 42) | ((values[valuesOffset++] & 0xffffffffL) << 24) | ((values[valuesOffset++] & 0xffffffffL) << 6) | ((values[valuesOffset] & 0xffffffffL) >>> 12);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 52) | ((values[valuesOffset++] & 0xffffffffL) << 34) | ((values[valuesOffset++] & 0xffffffffL) << 16) | ((values[valuesOffset] & 0xffffffffL) >>> 2);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 62) | ((values[valuesOffset++] & 0xffffffffL) << 44) | ((values[valuesOffset++] & 0xffffffffL) << 26) | ((values[valuesOffset++] & 0xffffffffL) << 8) | ((values[valuesOffset] & 0xffffffffL) >>> 10);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 54) | ((values[valuesOffset++] & 0xffffffffL) << 36) | ((values[valuesOffset++] & 0xffffffffL) << 18) | (values[valuesOffset++] & 0xffffffffL);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(long[] values, int valuesOffset, long[] blocks, int blocksOffset, int iterations) {
|
||||
assert blocksOffset + iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 46) | (values[valuesOffset++] << 28) | (values[valuesOffset++] << 10) | (values[valuesOffset] >>> 8);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 56) | (values[valuesOffset++] << 38) | (values[valuesOffset++] << 20) | (values[valuesOffset++] << 2) | (values[valuesOffset] >>> 16);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 48) | (values[valuesOffset++] << 30) | (values[valuesOffset++] << 12) | (values[valuesOffset] >>> 6);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 58) | (values[valuesOffset++] << 40) | (values[valuesOffset++] << 22) | (values[valuesOffset++] << 4) | (values[valuesOffset] >>> 14);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 50) | (values[valuesOffset++] << 32) | (values[valuesOffset++] << 14) | (values[valuesOffset] >>> 4);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 60) | (values[valuesOffset++] << 42) | (values[valuesOffset++] << 24) | (values[valuesOffset++] << 6) | (values[valuesOffset] >>> 12);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 52) | (values[valuesOffset++] << 34) | (values[valuesOffset++] << 16) | (values[valuesOffset] >>> 2);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 62) | (values[valuesOffset++] << 44) | (values[valuesOffset++] << 26) | (values[valuesOffset++] << 8) | (values[valuesOffset] >>> 10);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 54) | (values[valuesOffset++] << 36) | (values[valuesOffset++] << 18) | values[valuesOffset++];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,720 @@
|
|||
// This file has been automatically generated, DO NOT EDIT
|
||||
|
||||
package org.apache.lucene.util.packed;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Efficient sequential read/write of packed integers.
|
||||
*/
|
||||
final class BulkOperationPacked19 extends BulkOperation {
|
||||
@Override
|
||||
public int blockCount() {
|
||||
return 19;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int valueCount() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(long[] blocks, int blocksOffset, int[] values, int valuesOffset, int iterations) {
|
||||
assert blocksOffset + iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
final long block0 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (block0 >>> 45);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 26) & 524287L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 7) & 524287L);
|
||||
final long block1 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block0 & 127L) << 12) | (block1 >>> 52));
|
||||
values[valuesOffset++] = (int) ((block1 >>> 33) & 524287L);
|
||||
values[valuesOffset++] = (int) ((block1 >>> 14) & 524287L);
|
||||
final long block2 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block1 & 16383L) << 5) | (block2 >>> 59));
|
||||
values[valuesOffset++] = (int) ((block2 >>> 40) & 524287L);
|
||||
values[valuesOffset++] = (int) ((block2 >>> 21) & 524287L);
|
||||
values[valuesOffset++] = (int) ((block2 >>> 2) & 524287L);
|
||||
final long block3 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block2 & 3L) << 17) | (block3 >>> 47));
|
||||
values[valuesOffset++] = (int) ((block3 >>> 28) & 524287L);
|
||||
values[valuesOffset++] = (int) ((block3 >>> 9) & 524287L);
|
||||
final long block4 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block3 & 511L) << 10) | (block4 >>> 54));
|
||||
values[valuesOffset++] = (int) ((block4 >>> 35) & 524287L);
|
||||
values[valuesOffset++] = (int) ((block4 >>> 16) & 524287L);
|
||||
final long block5 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block4 & 65535L) << 3) | (block5 >>> 61));
|
||||
values[valuesOffset++] = (int) ((block5 >>> 42) & 524287L);
|
||||
values[valuesOffset++] = (int) ((block5 >>> 23) & 524287L);
|
||||
values[valuesOffset++] = (int) ((block5 >>> 4) & 524287L);
|
||||
final long block6 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block5 & 15L) << 15) | (block6 >>> 49));
|
||||
values[valuesOffset++] = (int) ((block6 >>> 30) & 524287L);
|
||||
values[valuesOffset++] = (int) ((block6 >>> 11) & 524287L);
|
||||
final long block7 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block6 & 2047L) << 8) | (block7 >>> 56));
|
||||
values[valuesOffset++] = (int) ((block7 >>> 37) & 524287L);
|
||||
values[valuesOffset++] = (int) ((block7 >>> 18) & 524287L);
|
||||
final long block8 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block7 & 262143L) << 1) | (block8 >>> 63));
|
||||
values[valuesOffset++] = (int) ((block8 >>> 44) & 524287L);
|
||||
values[valuesOffset++] = (int) ((block8 >>> 25) & 524287L);
|
||||
values[valuesOffset++] = (int) ((block8 >>> 6) & 524287L);
|
||||
final long block9 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block8 & 63L) << 13) | (block9 >>> 51));
|
||||
values[valuesOffset++] = (int) ((block9 >>> 32) & 524287L);
|
||||
values[valuesOffset++] = (int) ((block9 >>> 13) & 524287L);
|
||||
final long block10 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block9 & 8191L) << 6) | (block10 >>> 58));
|
||||
values[valuesOffset++] = (int) ((block10 >>> 39) & 524287L);
|
||||
values[valuesOffset++] = (int) ((block10 >>> 20) & 524287L);
|
||||
values[valuesOffset++] = (int) ((block10 >>> 1) & 524287L);
|
||||
final long block11 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block10 & 1L) << 18) | (block11 >>> 46));
|
||||
values[valuesOffset++] = (int) ((block11 >>> 27) & 524287L);
|
||||
values[valuesOffset++] = (int) ((block11 >>> 8) & 524287L);
|
||||
final long block12 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block11 & 255L) << 11) | (block12 >>> 53));
|
||||
values[valuesOffset++] = (int) ((block12 >>> 34) & 524287L);
|
||||
values[valuesOffset++] = (int) ((block12 >>> 15) & 524287L);
|
||||
final long block13 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block12 & 32767L) << 4) | (block13 >>> 60));
|
||||
values[valuesOffset++] = (int) ((block13 >>> 41) & 524287L);
|
||||
values[valuesOffset++] = (int) ((block13 >>> 22) & 524287L);
|
||||
values[valuesOffset++] = (int) ((block13 >>> 3) & 524287L);
|
||||
final long block14 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block13 & 7L) << 16) | (block14 >>> 48));
|
||||
values[valuesOffset++] = (int) ((block14 >>> 29) & 524287L);
|
||||
values[valuesOffset++] = (int) ((block14 >>> 10) & 524287L);
|
||||
final long block15 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block14 & 1023L) << 9) | (block15 >>> 55));
|
||||
values[valuesOffset++] = (int) ((block15 >>> 36) & 524287L);
|
||||
values[valuesOffset++] = (int) ((block15 >>> 17) & 524287L);
|
||||
final long block16 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block15 & 131071L) << 2) | (block16 >>> 62));
|
||||
values[valuesOffset++] = (int) ((block16 >>> 43) & 524287L);
|
||||
values[valuesOffset++] = (int) ((block16 >>> 24) & 524287L);
|
||||
values[valuesOffset++] = (int) ((block16 >>> 5) & 524287L);
|
||||
final long block17 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block16 & 31L) << 14) | (block17 >>> 50));
|
||||
values[valuesOffset++] = (int) ((block17 >>> 31) & 524287L);
|
||||
values[valuesOffset++] = (int) ((block17 >>> 12) & 524287L);
|
||||
final long block18 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (((block17 & 4095L) << 7) | (block18 >>> 57));
|
||||
values[valuesOffset++] = (int) ((block18 >>> 38) & 524287L);
|
||||
values[valuesOffset++] = (int) ((block18 >>> 19) & 524287L);
|
||||
values[valuesOffset++] = (int) (block18 & 524287L);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(byte[] blocks, int blocksOffset, int[] values, int valuesOffset, int iterations) {
|
||||
assert blocksOffset + 8 * iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
final int byte0 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte1 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte2 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte0 << 11) | (byte1 << 3) | (byte2 >>> 5);
|
||||
final int byte3 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte4 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte2 & 31) << 14) | (byte3 << 6) | (byte4 >>> 2);
|
||||
final int byte5 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte6 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte7 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte4 & 3) << 17) | (byte5 << 9) | (byte6 << 1) | (byte7 >>> 7);
|
||||
final int byte8 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte9 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte7 & 127) << 12) | (byte8 << 4) | (byte9 >>> 4);
|
||||
final int byte10 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte11 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte9 & 15) << 15) | (byte10 << 7) | (byte11 >>> 1);
|
||||
final int byte12 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte13 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte14 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte11 & 1) << 18) | (byte12 << 10) | (byte13 << 2) | (byte14 >>> 6);
|
||||
final int byte15 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte16 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte14 & 63) << 13) | (byte15 << 5) | (byte16 >>> 3);
|
||||
final int byte17 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte18 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte16 & 7) << 16) | (byte17 << 8) | byte18;
|
||||
final int byte19 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte20 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte21 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte19 << 11) | (byte20 << 3) | (byte21 >>> 5);
|
||||
final int byte22 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte23 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte21 & 31) << 14) | (byte22 << 6) | (byte23 >>> 2);
|
||||
final int byte24 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte25 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte26 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte23 & 3) << 17) | (byte24 << 9) | (byte25 << 1) | (byte26 >>> 7);
|
||||
final int byte27 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte28 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte26 & 127) << 12) | (byte27 << 4) | (byte28 >>> 4);
|
||||
final int byte29 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte30 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte28 & 15) << 15) | (byte29 << 7) | (byte30 >>> 1);
|
||||
final int byte31 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte32 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte33 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte30 & 1) << 18) | (byte31 << 10) | (byte32 << 2) | (byte33 >>> 6);
|
||||
final int byte34 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte35 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte33 & 63) << 13) | (byte34 << 5) | (byte35 >>> 3);
|
||||
final int byte36 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte37 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte35 & 7) << 16) | (byte36 << 8) | byte37;
|
||||
final int byte38 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte39 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte40 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte38 << 11) | (byte39 << 3) | (byte40 >>> 5);
|
||||
final int byte41 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte42 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte40 & 31) << 14) | (byte41 << 6) | (byte42 >>> 2);
|
||||
final int byte43 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte44 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte45 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte42 & 3) << 17) | (byte43 << 9) | (byte44 << 1) | (byte45 >>> 7);
|
||||
final int byte46 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte47 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte45 & 127) << 12) | (byte46 << 4) | (byte47 >>> 4);
|
||||
final int byte48 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte49 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte47 & 15) << 15) | (byte48 << 7) | (byte49 >>> 1);
|
||||
final int byte50 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte51 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte52 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte49 & 1) << 18) | (byte50 << 10) | (byte51 << 2) | (byte52 >>> 6);
|
||||
final int byte53 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte54 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte52 & 63) << 13) | (byte53 << 5) | (byte54 >>> 3);
|
||||
final int byte55 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte56 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte54 & 7) << 16) | (byte55 << 8) | byte56;
|
||||
final int byte57 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte58 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte59 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte57 << 11) | (byte58 << 3) | (byte59 >>> 5);
|
||||
final int byte60 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte61 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte59 & 31) << 14) | (byte60 << 6) | (byte61 >>> 2);
|
||||
final int byte62 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte63 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte64 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte61 & 3) << 17) | (byte62 << 9) | (byte63 << 1) | (byte64 >>> 7);
|
||||
final int byte65 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte66 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte64 & 127) << 12) | (byte65 << 4) | (byte66 >>> 4);
|
||||
final int byte67 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte68 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte66 & 15) << 15) | (byte67 << 7) | (byte68 >>> 1);
|
||||
final int byte69 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte70 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte71 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte68 & 1) << 18) | (byte69 << 10) | (byte70 << 2) | (byte71 >>> 6);
|
||||
final int byte72 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte73 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte71 & 63) << 13) | (byte72 << 5) | (byte73 >>> 3);
|
||||
final int byte74 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte75 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte73 & 7) << 16) | (byte74 << 8) | byte75;
|
||||
final int byte76 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte77 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte78 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte76 << 11) | (byte77 << 3) | (byte78 >>> 5);
|
||||
final int byte79 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte80 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte78 & 31) << 14) | (byte79 << 6) | (byte80 >>> 2);
|
||||
final int byte81 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte82 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte83 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte80 & 3) << 17) | (byte81 << 9) | (byte82 << 1) | (byte83 >>> 7);
|
||||
final int byte84 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte85 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte83 & 127) << 12) | (byte84 << 4) | (byte85 >>> 4);
|
||||
final int byte86 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte87 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte85 & 15) << 15) | (byte86 << 7) | (byte87 >>> 1);
|
||||
final int byte88 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte89 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte90 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte87 & 1) << 18) | (byte88 << 10) | (byte89 << 2) | (byte90 >>> 6);
|
||||
final int byte91 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte92 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte90 & 63) << 13) | (byte91 << 5) | (byte92 >>> 3);
|
||||
final int byte93 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte94 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte92 & 7) << 16) | (byte93 << 8) | byte94;
|
||||
final int byte95 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte96 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte97 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte95 << 11) | (byte96 << 3) | (byte97 >>> 5);
|
||||
final int byte98 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte99 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte97 & 31) << 14) | (byte98 << 6) | (byte99 >>> 2);
|
||||
final int byte100 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte101 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte102 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte99 & 3) << 17) | (byte100 << 9) | (byte101 << 1) | (byte102 >>> 7);
|
||||
final int byte103 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte104 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte102 & 127) << 12) | (byte103 << 4) | (byte104 >>> 4);
|
||||
final int byte105 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte106 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte104 & 15) << 15) | (byte105 << 7) | (byte106 >>> 1);
|
||||
final int byte107 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte108 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte109 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte106 & 1) << 18) | (byte107 << 10) | (byte108 << 2) | (byte109 >>> 6);
|
||||
final int byte110 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte111 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte109 & 63) << 13) | (byte110 << 5) | (byte111 >>> 3);
|
||||
final int byte112 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte113 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte111 & 7) << 16) | (byte112 << 8) | byte113;
|
||||
final int byte114 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte115 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte116 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte114 << 11) | (byte115 << 3) | (byte116 >>> 5);
|
||||
final int byte117 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte118 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte116 & 31) << 14) | (byte117 << 6) | (byte118 >>> 2);
|
||||
final int byte119 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte120 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte121 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte118 & 3) << 17) | (byte119 << 9) | (byte120 << 1) | (byte121 >>> 7);
|
||||
final int byte122 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte123 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte121 & 127) << 12) | (byte122 << 4) | (byte123 >>> 4);
|
||||
final int byte124 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte125 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte123 & 15) << 15) | (byte124 << 7) | (byte125 >>> 1);
|
||||
final int byte126 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte127 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte128 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte125 & 1) << 18) | (byte126 << 10) | (byte127 << 2) | (byte128 >>> 6);
|
||||
final int byte129 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte130 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte128 & 63) << 13) | (byte129 << 5) | (byte130 >>> 3);
|
||||
final int byte131 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte132 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte130 & 7) << 16) | (byte131 << 8) | byte132;
|
||||
final int byte133 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte134 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte135 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte133 << 11) | (byte134 << 3) | (byte135 >>> 5);
|
||||
final int byte136 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte137 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte135 & 31) << 14) | (byte136 << 6) | (byte137 >>> 2);
|
||||
final int byte138 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte139 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte140 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte137 & 3) << 17) | (byte138 << 9) | (byte139 << 1) | (byte140 >>> 7);
|
||||
final int byte141 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte142 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte140 & 127) << 12) | (byte141 << 4) | (byte142 >>> 4);
|
||||
final int byte143 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte144 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte142 & 15) << 15) | (byte143 << 7) | (byte144 >>> 1);
|
||||
final int byte145 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte146 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte147 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte144 & 1) << 18) | (byte145 << 10) | (byte146 << 2) | (byte147 >>> 6);
|
||||
final int byte148 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte149 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte147 & 63) << 13) | (byte148 << 5) | (byte149 >>> 3);
|
||||
final int byte150 = blocks[blocksOffset++] & 0xFF;
|
||||
final int byte151 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte149 & 7) << 16) | (byte150 << 8) | byte151;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(long[] blocks, int blocksOffset, long[] values, int valuesOffset, int iterations) {
|
||||
assert blocksOffset + iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
final long block0 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = block0 >>> 45;
|
||||
values[valuesOffset++] = (block0 >>> 26) & 524287L;
|
||||
values[valuesOffset++] = (block0 >>> 7) & 524287L;
|
||||
final long block1 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block0 & 127L) << 12) | (block1 >>> 52);
|
||||
values[valuesOffset++] = (block1 >>> 33) & 524287L;
|
||||
values[valuesOffset++] = (block1 >>> 14) & 524287L;
|
||||
final long block2 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block1 & 16383L) << 5) | (block2 >>> 59);
|
||||
values[valuesOffset++] = (block2 >>> 40) & 524287L;
|
||||
values[valuesOffset++] = (block2 >>> 21) & 524287L;
|
||||
values[valuesOffset++] = (block2 >>> 2) & 524287L;
|
||||
final long block3 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block2 & 3L) << 17) | (block3 >>> 47);
|
||||
values[valuesOffset++] = (block3 >>> 28) & 524287L;
|
||||
values[valuesOffset++] = (block3 >>> 9) & 524287L;
|
||||
final long block4 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block3 & 511L) << 10) | (block4 >>> 54);
|
||||
values[valuesOffset++] = (block4 >>> 35) & 524287L;
|
||||
values[valuesOffset++] = (block4 >>> 16) & 524287L;
|
||||
final long block5 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block4 & 65535L) << 3) | (block5 >>> 61);
|
||||
values[valuesOffset++] = (block5 >>> 42) & 524287L;
|
||||
values[valuesOffset++] = (block5 >>> 23) & 524287L;
|
||||
values[valuesOffset++] = (block5 >>> 4) & 524287L;
|
||||
final long block6 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block5 & 15L) << 15) | (block6 >>> 49);
|
||||
values[valuesOffset++] = (block6 >>> 30) & 524287L;
|
||||
values[valuesOffset++] = (block6 >>> 11) & 524287L;
|
||||
final long block7 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block6 & 2047L) << 8) | (block7 >>> 56);
|
||||
values[valuesOffset++] = (block7 >>> 37) & 524287L;
|
||||
values[valuesOffset++] = (block7 >>> 18) & 524287L;
|
||||
final long block8 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block7 & 262143L) << 1) | (block8 >>> 63);
|
||||
values[valuesOffset++] = (block8 >>> 44) & 524287L;
|
||||
values[valuesOffset++] = (block8 >>> 25) & 524287L;
|
||||
values[valuesOffset++] = (block8 >>> 6) & 524287L;
|
||||
final long block9 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block8 & 63L) << 13) | (block9 >>> 51);
|
||||
values[valuesOffset++] = (block9 >>> 32) & 524287L;
|
||||
values[valuesOffset++] = (block9 >>> 13) & 524287L;
|
||||
final long block10 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block9 & 8191L) << 6) | (block10 >>> 58);
|
||||
values[valuesOffset++] = (block10 >>> 39) & 524287L;
|
||||
values[valuesOffset++] = (block10 >>> 20) & 524287L;
|
||||
values[valuesOffset++] = (block10 >>> 1) & 524287L;
|
||||
final long block11 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block10 & 1L) << 18) | (block11 >>> 46);
|
||||
values[valuesOffset++] = (block11 >>> 27) & 524287L;
|
||||
values[valuesOffset++] = (block11 >>> 8) & 524287L;
|
||||
final long block12 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block11 & 255L) << 11) | (block12 >>> 53);
|
||||
values[valuesOffset++] = (block12 >>> 34) & 524287L;
|
||||
values[valuesOffset++] = (block12 >>> 15) & 524287L;
|
||||
final long block13 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block12 & 32767L) << 4) | (block13 >>> 60);
|
||||
values[valuesOffset++] = (block13 >>> 41) & 524287L;
|
||||
values[valuesOffset++] = (block13 >>> 22) & 524287L;
|
||||
values[valuesOffset++] = (block13 >>> 3) & 524287L;
|
||||
final long block14 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block13 & 7L) << 16) | (block14 >>> 48);
|
||||
values[valuesOffset++] = (block14 >>> 29) & 524287L;
|
||||
values[valuesOffset++] = (block14 >>> 10) & 524287L;
|
||||
final long block15 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block14 & 1023L) << 9) | (block15 >>> 55);
|
||||
values[valuesOffset++] = (block15 >>> 36) & 524287L;
|
||||
values[valuesOffset++] = (block15 >>> 17) & 524287L;
|
||||
final long block16 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block15 & 131071L) << 2) | (block16 >>> 62);
|
||||
values[valuesOffset++] = (block16 >>> 43) & 524287L;
|
||||
values[valuesOffset++] = (block16 >>> 24) & 524287L;
|
||||
values[valuesOffset++] = (block16 >>> 5) & 524287L;
|
||||
final long block17 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block16 & 31L) << 14) | (block17 >>> 50);
|
||||
values[valuesOffset++] = (block17 >>> 31) & 524287L;
|
||||
values[valuesOffset++] = (block17 >>> 12) & 524287L;
|
||||
final long block18 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = ((block17 & 4095L) << 7) | (block18 >>> 57);
|
||||
values[valuesOffset++] = (block18 >>> 38) & 524287L;
|
||||
values[valuesOffset++] = (block18 >>> 19) & 524287L;
|
||||
values[valuesOffset++] = block18 & 524287L;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(byte[] blocks, int blocksOffset, long[] values, int valuesOffset, int iterations) {
|
||||
assert blocksOffset + 8 * iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
final long byte0 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte1 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte2 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte0 << 11) | (byte1 << 3) | (byte2 >>> 5);
|
||||
final long byte3 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte4 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte2 & 31) << 14) | (byte3 << 6) | (byte4 >>> 2);
|
||||
final long byte5 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte6 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte7 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte4 & 3) << 17) | (byte5 << 9) | (byte6 << 1) | (byte7 >>> 7);
|
||||
final long byte8 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte9 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte7 & 127) << 12) | (byte8 << 4) | (byte9 >>> 4);
|
||||
final long byte10 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte11 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte9 & 15) << 15) | (byte10 << 7) | (byte11 >>> 1);
|
||||
final long byte12 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte13 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte14 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte11 & 1) << 18) | (byte12 << 10) | (byte13 << 2) | (byte14 >>> 6);
|
||||
final long byte15 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte16 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte14 & 63) << 13) | (byte15 << 5) | (byte16 >>> 3);
|
||||
final long byte17 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte18 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte16 & 7) << 16) | (byte17 << 8) | byte18;
|
||||
final long byte19 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte20 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte21 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte19 << 11) | (byte20 << 3) | (byte21 >>> 5);
|
||||
final long byte22 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte23 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte21 & 31) << 14) | (byte22 << 6) | (byte23 >>> 2);
|
||||
final long byte24 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte25 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte26 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte23 & 3) << 17) | (byte24 << 9) | (byte25 << 1) | (byte26 >>> 7);
|
||||
final long byte27 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte28 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte26 & 127) << 12) | (byte27 << 4) | (byte28 >>> 4);
|
||||
final long byte29 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte30 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte28 & 15) << 15) | (byte29 << 7) | (byte30 >>> 1);
|
||||
final long byte31 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte32 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte33 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte30 & 1) << 18) | (byte31 << 10) | (byte32 << 2) | (byte33 >>> 6);
|
||||
final long byte34 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte35 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte33 & 63) << 13) | (byte34 << 5) | (byte35 >>> 3);
|
||||
final long byte36 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte37 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte35 & 7) << 16) | (byte36 << 8) | byte37;
|
||||
final long byte38 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte39 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte40 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte38 << 11) | (byte39 << 3) | (byte40 >>> 5);
|
||||
final long byte41 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte42 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte40 & 31) << 14) | (byte41 << 6) | (byte42 >>> 2);
|
||||
final long byte43 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte44 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte45 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte42 & 3) << 17) | (byte43 << 9) | (byte44 << 1) | (byte45 >>> 7);
|
||||
final long byte46 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte47 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte45 & 127) << 12) | (byte46 << 4) | (byte47 >>> 4);
|
||||
final long byte48 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte49 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte47 & 15) << 15) | (byte48 << 7) | (byte49 >>> 1);
|
||||
final long byte50 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte51 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte52 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte49 & 1) << 18) | (byte50 << 10) | (byte51 << 2) | (byte52 >>> 6);
|
||||
final long byte53 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte54 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte52 & 63) << 13) | (byte53 << 5) | (byte54 >>> 3);
|
||||
final long byte55 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte56 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte54 & 7) << 16) | (byte55 << 8) | byte56;
|
||||
final long byte57 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte58 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte59 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte57 << 11) | (byte58 << 3) | (byte59 >>> 5);
|
||||
final long byte60 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte61 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte59 & 31) << 14) | (byte60 << 6) | (byte61 >>> 2);
|
||||
final long byte62 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte63 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte64 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte61 & 3) << 17) | (byte62 << 9) | (byte63 << 1) | (byte64 >>> 7);
|
||||
final long byte65 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte66 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte64 & 127) << 12) | (byte65 << 4) | (byte66 >>> 4);
|
||||
final long byte67 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte68 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte66 & 15) << 15) | (byte67 << 7) | (byte68 >>> 1);
|
||||
final long byte69 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte70 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte71 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte68 & 1) << 18) | (byte69 << 10) | (byte70 << 2) | (byte71 >>> 6);
|
||||
final long byte72 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte73 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte71 & 63) << 13) | (byte72 << 5) | (byte73 >>> 3);
|
||||
final long byte74 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte75 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte73 & 7) << 16) | (byte74 << 8) | byte75;
|
||||
final long byte76 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte77 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte78 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte76 << 11) | (byte77 << 3) | (byte78 >>> 5);
|
||||
final long byte79 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte80 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte78 & 31) << 14) | (byte79 << 6) | (byte80 >>> 2);
|
||||
final long byte81 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte82 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte83 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte80 & 3) << 17) | (byte81 << 9) | (byte82 << 1) | (byte83 >>> 7);
|
||||
final long byte84 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte85 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte83 & 127) << 12) | (byte84 << 4) | (byte85 >>> 4);
|
||||
final long byte86 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte87 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte85 & 15) << 15) | (byte86 << 7) | (byte87 >>> 1);
|
||||
final long byte88 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte89 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte90 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte87 & 1) << 18) | (byte88 << 10) | (byte89 << 2) | (byte90 >>> 6);
|
||||
final long byte91 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte92 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte90 & 63) << 13) | (byte91 << 5) | (byte92 >>> 3);
|
||||
final long byte93 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte94 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte92 & 7) << 16) | (byte93 << 8) | byte94;
|
||||
final long byte95 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte96 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte97 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte95 << 11) | (byte96 << 3) | (byte97 >>> 5);
|
||||
final long byte98 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte99 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte97 & 31) << 14) | (byte98 << 6) | (byte99 >>> 2);
|
||||
final long byte100 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte101 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte102 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte99 & 3) << 17) | (byte100 << 9) | (byte101 << 1) | (byte102 >>> 7);
|
||||
final long byte103 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte104 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte102 & 127) << 12) | (byte103 << 4) | (byte104 >>> 4);
|
||||
final long byte105 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte106 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte104 & 15) << 15) | (byte105 << 7) | (byte106 >>> 1);
|
||||
final long byte107 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte108 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte109 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte106 & 1) << 18) | (byte107 << 10) | (byte108 << 2) | (byte109 >>> 6);
|
||||
final long byte110 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte111 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte109 & 63) << 13) | (byte110 << 5) | (byte111 >>> 3);
|
||||
final long byte112 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte113 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte111 & 7) << 16) | (byte112 << 8) | byte113;
|
||||
final long byte114 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte115 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte116 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte114 << 11) | (byte115 << 3) | (byte116 >>> 5);
|
||||
final long byte117 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte118 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte116 & 31) << 14) | (byte117 << 6) | (byte118 >>> 2);
|
||||
final long byte119 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte120 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte121 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte118 & 3) << 17) | (byte119 << 9) | (byte120 << 1) | (byte121 >>> 7);
|
||||
final long byte122 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte123 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte121 & 127) << 12) | (byte122 << 4) | (byte123 >>> 4);
|
||||
final long byte124 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte125 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte123 & 15) << 15) | (byte124 << 7) | (byte125 >>> 1);
|
||||
final long byte126 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte127 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte128 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte125 & 1) << 18) | (byte126 << 10) | (byte127 << 2) | (byte128 >>> 6);
|
||||
final long byte129 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte130 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte128 & 63) << 13) | (byte129 << 5) | (byte130 >>> 3);
|
||||
final long byte131 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte132 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte130 & 7) << 16) | (byte131 << 8) | byte132;
|
||||
final long byte133 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte134 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte135 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = (byte133 << 11) | (byte134 << 3) | (byte135 >>> 5);
|
||||
final long byte136 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte137 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte135 & 31) << 14) | (byte136 << 6) | (byte137 >>> 2);
|
||||
final long byte138 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte139 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte140 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte137 & 3) << 17) | (byte138 << 9) | (byte139 << 1) | (byte140 >>> 7);
|
||||
final long byte141 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte142 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte140 & 127) << 12) | (byte141 << 4) | (byte142 >>> 4);
|
||||
final long byte143 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte144 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte142 & 15) << 15) | (byte143 << 7) | (byte144 >>> 1);
|
||||
final long byte145 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte146 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte147 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte144 & 1) << 18) | (byte145 << 10) | (byte146 << 2) | (byte147 >>> 6);
|
||||
final long byte148 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte149 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte147 & 63) << 13) | (byte148 << 5) | (byte149 >>> 3);
|
||||
final long byte150 = blocks[blocksOffset++] & 0xFF;
|
||||
final long byte151 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = ((byte149 & 7) << 16) | (byte150 << 8) | byte151;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(int[] values, int valuesOffset, long[] blocks, int blocksOffset, int iterations) {
|
||||
assert blocksOffset + iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 45) | ((values[valuesOffset++] & 0xffffffffL) << 26) | ((values[valuesOffset++] & 0xffffffffL) << 7) | ((values[valuesOffset] & 0xffffffffL) >>> 12);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 52) | ((values[valuesOffset++] & 0xffffffffL) << 33) | ((values[valuesOffset++] & 0xffffffffL) << 14) | ((values[valuesOffset] & 0xffffffffL) >>> 5);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 59) | ((values[valuesOffset++] & 0xffffffffL) << 40) | ((values[valuesOffset++] & 0xffffffffL) << 21) | ((values[valuesOffset++] & 0xffffffffL) << 2) | ((values[valuesOffset] & 0xffffffffL) >>> 17);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 47) | ((values[valuesOffset++] & 0xffffffffL) << 28) | ((values[valuesOffset++] & 0xffffffffL) << 9) | ((values[valuesOffset] & 0xffffffffL) >>> 10);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 54) | ((values[valuesOffset++] & 0xffffffffL) << 35) | ((values[valuesOffset++] & 0xffffffffL) << 16) | ((values[valuesOffset] & 0xffffffffL) >>> 3);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 61) | ((values[valuesOffset++] & 0xffffffffL) << 42) | ((values[valuesOffset++] & 0xffffffffL) << 23) | ((values[valuesOffset++] & 0xffffffffL) << 4) | ((values[valuesOffset] & 0xffffffffL) >>> 15);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 49) | ((values[valuesOffset++] & 0xffffffffL) << 30) | ((values[valuesOffset++] & 0xffffffffL) << 11) | ((values[valuesOffset] & 0xffffffffL) >>> 8);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 56) | ((values[valuesOffset++] & 0xffffffffL) << 37) | ((values[valuesOffset++] & 0xffffffffL) << 18) | ((values[valuesOffset] & 0xffffffffL) >>> 1);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 63) | ((values[valuesOffset++] & 0xffffffffL) << 44) | ((values[valuesOffset++] & 0xffffffffL) << 25) | ((values[valuesOffset++] & 0xffffffffL) << 6) | ((values[valuesOffset] & 0xffffffffL) >>> 13);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 51) | ((values[valuesOffset++] & 0xffffffffL) << 32) | ((values[valuesOffset++] & 0xffffffffL) << 13) | ((values[valuesOffset] & 0xffffffffL) >>> 6);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 58) | ((values[valuesOffset++] & 0xffffffffL) << 39) | ((values[valuesOffset++] & 0xffffffffL) << 20) | ((values[valuesOffset++] & 0xffffffffL) << 1) | ((values[valuesOffset] & 0xffffffffL) >>> 18);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 46) | ((values[valuesOffset++] & 0xffffffffL) << 27) | ((values[valuesOffset++] & 0xffffffffL) << 8) | ((values[valuesOffset] & 0xffffffffL) >>> 11);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 53) | ((values[valuesOffset++] & 0xffffffffL) << 34) | ((values[valuesOffset++] & 0xffffffffL) << 15) | ((values[valuesOffset] & 0xffffffffL) >>> 4);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 60) | ((values[valuesOffset++] & 0xffffffffL) << 41) | ((values[valuesOffset++] & 0xffffffffL) << 22) | ((values[valuesOffset++] & 0xffffffffL) << 3) | ((values[valuesOffset] & 0xffffffffL) >>> 16);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 48) | ((values[valuesOffset++] & 0xffffffffL) << 29) | ((values[valuesOffset++] & 0xffffffffL) << 10) | ((values[valuesOffset] & 0xffffffffL) >>> 9);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 55) | ((values[valuesOffset++] & 0xffffffffL) << 36) | ((values[valuesOffset++] & 0xffffffffL) << 17) | ((values[valuesOffset] & 0xffffffffL) >>> 2);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 62) | ((values[valuesOffset++] & 0xffffffffL) << 43) | ((values[valuesOffset++] & 0xffffffffL) << 24) | ((values[valuesOffset++] & 0xffffffffL) << 5) | ((values[valuesOffset] & 0xffffffffL) >>> 14);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 50) | ((values[valuesOffset++] & 0xffffffffL) << 31) | ((values[valuesOffset++] & 0xffffffffL) << 12) | ((values[valuesOffset] & 0xffffffffL) >>> 7);
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 57) | ((values[valuesOffset++] & 0xffffffffL) << 38) | ((values[valuesOffset++] & 0xffffffffL) << 19) | (values[valuesOffset++] & 0xffffffffL);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(long[] values, int valuesOffset, long[] blocks, int blocksOffset, int iterations) {
|
||||
assert blocksOffset + iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 45) | (values[valuesOffset++] << 26) | (values[valuesOffset++] << 7) | (values[valuesOffset] >>> 12);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 52) | (values[valuesOffset++] << 33) | (values[valuesOffset++] << 14) | (values[valuesOffset] >>> 5);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 59) | (values[valuesOffset++] << 40) | (values[valuesOffset++] << 21) | (values[valuesOffset++] << 2) | (values[valuesOffset] >>> 17);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 47) | (values[valuesOffset++] << 28) | (values[valuesOffset++] << 9) | (values[valuesOffset] >>> 10);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 54) | (values[valuesOffset++] << 35) | (values[valuesOffset++] << 16) | (values[valuesOffset] >>> 3);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 61) | (values[valuesOffset++] << 42) | (values[valuesOffset++] << 23) | (values[valuesOffset++] << 4) | (values[valuesOffset] >>> 15);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 49) | (values[valuesOffset++] << 30) | (values[valuesOffset++] << 11) | (values[valuesOffset] >>> 8);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 56) | (values[valuesOffset++] << 37) | (values[valuesOffset++] << 18) | (values[valuesOffset] >>> 1);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 63) | (values[valuesOffset++] << 44) | (values[valuesOffset++] << 25) | (values[valuesOffset++] << 6) | (values[valuesOffset] >>> 13);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 51) | (values[valuesOffset++] << 32) | (values[valuesOffset++] << 13) | (values[valuesOffset] >>> 6);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 58) | (values[valuesOffset++] << 39) | (values[valuesOffset++] << 20) | (values[valuesOffset++] << 1) | (values[valuesOffset] >>> 18);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 46) | (values[valuesOffset++] << 27) | (values[valuesOffset++] << 8) | (values[valuesOffset] >>> 11);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 53) | (values[valuesOffset++] << 34) | (values[valuesOffset++] << 15) | (values[valuesOffset] >>> 4);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 60) | (values[valuesOffset++] << 41) | (values[valuesOffset++] << 22) | (values[valuesOffset++] << 3) | (values[valuesOffset] >>> 16);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 48) | (values[valuesOffset++] << 29) | (values[valuesOffset++] << 10) | (values[valuesOffset] >>> 9);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 55) | (values[valuesOffset++] << 36) | (values[valuesOffset++] << 17) | (values[valuesOffset] >>> 2);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 62) | (values[valuesOffset++] << 43) | (values[valuesOffset++] << 24) | (values[valuesOffset++] << 5) | (values[valuesOffset] >>> 14);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 50) | (values[valuesOffset++] << 31) | (values[valuesOffset++] << 12) | (values[valuesOffset] >>> 7);
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 57) | (values[valuesOffset++] << 38) | (values[valuesOffset++] << 19) | values[valuesOffset++];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,232 @@
|
|||
// This file has been automatically generated, DO NOT EDIT
|
||||
|
||||
package org.apache.lucene.util.packed;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Efficient sequential read/write of packed integers.
|
||||
*/
|
||||
final class BulkOperationPacked2 extends BulkOperation {
|
||||
@Override
|
||||
public int blockCount() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int valueCount() {
|
||||
return 32;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(long[] blocks, int blocksOffset, int[] values, int valuesOffset, int iterations) {
|
||||
assert blocksOffset + iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
final long block0 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = (int) (block0 >>> 62);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 60) & 3L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 58) & 3L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 56) & 3L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 54) & 3L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 52) & 3L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 50) & 3L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 48) & 3L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 46) & 3L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 44) & 3L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 42) & 3L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 40) & 3L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 38) & 3L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 36) & 3L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 34) & 3L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 32) & 3L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 30) & 3L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 28) & 3L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 26) & 3L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 24) & 3L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 22) & 3L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 20) & 3L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 18) & 3L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 16) & 3L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 14) & 3L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 12) & 3L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 10) & 3L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 8) & 3L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 6) & 3L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 4) & 3L);
|
||||
values[valuesOffset++] = (int) ((block0 >>> 2) & 3L);
|
||||
values[valuesOffset++] = (int) (block0 & 3L);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(byte[] blocks, int blocksOffset, int[] values, int valuesOffset, int iterations) {
|
||||
assert blocksOffset + 8 * iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
final int byte0 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = byte0 >>> 6;
|
||||
values[valuesOffset++] = (byte0 >>> 4) & 3;
|
||||
values[valuesOffset++] = (byte0 >>> 2) & 3;
|
||||
values[valuesOffset++] = byte0 & 3;
|
||||
final int byte1 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = byte1 >>> 6;
|
||||
values[valuesOffset++] = (byte1 >>> 4) & 3;
|
||||
values[valuesOffset++] = (byte1 >>> 2) & 3;
|
||||
values[valuesOffset++] = byte1 & 3;
|
||||
final int byte2 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = byte2 >>> 6;
|
||||
values[valuesOffset++] = (byte2 >>> 4) & 3;
|
||||
values[valuesOffset++] = (byte2 >>> 2) & 3;
|
||||
values[valuesOffset++] = byte2 & 3;
|
||||
final int byte3 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = byte3 >>> 6;
|
||||
values[valuesOffset++] = (byte3 >>> 4) & 3;
|
||||
values[valuesOffset++] = (byte3 >>> 2) & 3;
|
||||
values[valuesOffset++] = byte3 & 3;
|
||||
final int byte4 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = byte4 >>> 6;
|
||||
values[valuesOffset++] = (byte4 >>> 4) & 3;
|
||||
values[valuesOffset++] = (byte4 >>> 2) & 3;
|
||||
values[valuesOffset++] = byte4 & 3;
|
||||
final int byte5 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = byte5 >>> 6;
|
||||
values[valuesOffset++] = (byte5 >>> 4) & 3;
|
||||
values[valuesOffset++] = (byte5 >>> 2) & 3;
|
||||
values[valuesOffset++] = byte5 & 3;
|
||||
final int byte6 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = byte6 >>> 6;
|
||||
values[valuesOffset++] = (byte6 >>> 4) & 3;
|
||||
values[valuesOffset++] = (byte6 >>> 2) & 3;
|
||||
values[valuesOffset++] = byte6 & 3;
|
||||
final int byte7 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = byte7 >>> 6;
|
||||
values[valuesOffset++] = (byte7 >>> 4) & 3;
|
||||
values[valuesOffset++] = (byte7 >>> 2) & 3;
|
||||
values[valuesOffset++] = byte7 & 3;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(long[] blocks, int blocksOffset, long[] values, int valuesOffset, int iterations) {
|
||||
assert blocksOffset + iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
final long block0 = blocks[blocksOffset++];
|
||||
values[valuesOffset++] = block0 >>> 62;
|
||||
values[valuesOffset++] = (block0 >>> 60) & 3L;
|
||||
values[valuesOffset++] = (block0 >>> 58) & 3L;
|
||||
values[valuesOffset++] = (block0 >>> 56) & 3L;
|
||||
values[valuesOffset++] = (block0 >>> 54) & 3L;
|
||||
values[valuesOffset++] = (block0 >>> 52) & 3L;
|
||||
values[valuesOffset++] = (block0 >>> 50) & 3L;
|
||||
values[valuesOffset++] = (block0 >>> 48) & 3L;
|
||||
values[valuesOffset++] = (block0 >>> 46) & 3L;
|
||||
values[valuesOffset++] = (block0 >>> 44) & 3L;
|
||||
values[valuesOffset++] = (block0 >>> 42) & 3L;
|
||||
values[valuesOffset++] = (block0 >>> 40) & 3L;
|
||||
values[valuesOffset++] = (block0 >>> 38) & 3L;
|
||||
values[valuesOffset++] = (block0 >>> 36) & 3L;
|
||||
values[valuesOffset++] = (block0 >>> 34) & 3L;
|
||||
values[valuesOffset++] = (block0 >>> 32) & 3L;
|
||||
values[valuesOffset++] = (block0 >>> 30) & 3L;
|
||||
values[valuesOffset++] = (block0 >>> 28) & 3L;
|
||||
values[valuesOffset++] = (block0 >>> 26) & 3L;
|
||||
values[valuesOffset++] = (block0 >>> 24) & 3L;
|
||||
values[valuesOffset++] = (block0 >>> 22) & 3L;
|
||||
values[valuesOffset++] = (block0 >>> 20) & 3L;
|
||||
values[valuesOffset++] = (block0 >>> 18) & 3L;
|
||||
values[valuesOffset++] = (block0 >>> 16) & 3L;
|
||||
values[valuesOffset++] = (block0 >>> 14) & 3L;
|
||||
values[valuesOffset++] = (block0 >>> 12) & 3L;
|
||||
values[valuesOffset++] = (block0 >>> 10) & 3L;
|
||||
values[valuesOffset++] = (block0 >>> 8) & 3L;
|
||||
values[valuesOffset++] = (block0 >>> 6) & 3L;
|
||||
values[valuesOffset++] = (block0 >>> 4) & 3L;
|
||||
values[valuesOffset++] = (block0 >>> 2) & 3L;
|
||||
values[valuesOffset++] = block0 & 3L;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(byte[] blocks, int blocksOffset, long[] values, int valuesOffset, int iterations) {
|
||||
assert blocksOffset + 8 * iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
final long byte0 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = byte0 >>> 6;
|
||||
values[valuesOffset++] = (byte0 >>> 4) & 3;
|
||||
values[valuesOffset++] = (byte0 >>> 2) & 3;
|
||||
values[valuesOffset++] = byte0 & 3;
|
||||
final long byte1 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = byte1 >>> 6;
|
||||
values[valuesOffset++] = (byte1 >>> 4) & 3;
|
||||
values[valuesOffset++] = (byte1 >>> 2) & 3;
|
||||
values[valuesOffset++] = byte1 & 3;
|
||||
final long byte2 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = byte2 >>> 6;
|
||||
values[valuesOffset++] = (byte2 >>> 4) & 3;
|
||||
values[valuesOffset++] = (byte2 >>> 2) & 3;
|
||||
values[valuesOffset++] = byte2 & 3;
|
||||
final long byte3 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = byte3 >>> 6;
|
||||
values[valuesOffset++] = (byte3 >>> 4) & 3;
|
||||
values[valuesOffset++] = (byte3 >>> 2) & 3;
|
||||
values[valuesOffset++] = byte3 & 3;
|
||||
final long byte4 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = byte4 >>> 6;
|
||||
values[valuesOffset++] = (byte4 >>> 4) & 3;
|
||||
values[valuesOffset++] = (byte4 >>> 2) & 3;
|
||||
values[valuesOffset++] = byte4 & 3;
|
||||
final long byte5 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = byte5 >>> 6;
|
||||
values[valuesOffset++] = (byte5 >>> 4) & 3;
|
||||
values[valuesOffset++] = (byte5 >>> 2) & 3;
|
||||
values[valuesOffset++] = byte5 & 3;
|
||||
final long byte6 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = byte6 >>> 6;
|
||||
values[valuesOffset++] = (byte6 >>> 4) & 3;
|
||||
values[valuesOffset++] = (byte6 >>> 2) & 3;
|
||||
values[valuesOffset++] = byte6 & 3;
|
||||
final long byte7 = blocks[blocksOffset++] & 0xFF;
|
||||
values[valuesOffset++] = byte7 >>> 6;
|
||||
values[valuesOffset++] = (byte7 >>> 4) & 3;
|
||||
values[valuesOffset++] = (byte7 >>> 2) & 3;
|
||||
values[valuesOffset++] = byte7 & 3;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(int[] values, int valuesOffset, long[] blocks, int blocksOffset, int iterations) {
|
||||
assert blocksOffset + iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
blocks[blocksOffset++] = ((values[valuesOffset++] & 0xffffffffL) << 62) | ((values[valuesOffset++] & 0xffffffffL) << 60) | ((values[valuesOffset++] & 0xffffffffL) << 58) | ((values[valuesOffset++] & 0xffffffffL) << 56) | ((values[valuesOffset++] & 0xffffffffL) << 54) | ((values[valuesOffset++] & 0xffffffffL) << 52) | ((values[valuesOffset++] & 0xffffffffL) << 50) | ((values[valuesOffset++] & 0xffffffffL) << 48) | ((values[valuesOffset++] & 0xffffffffL) << 46) | ((values[valuesOffset++] & 0xffffffffL) << 44) | ((values[valuesOffset++] & 0xffffffffL) << 42) | ((values[valuesOffset++] & 0xffffffffL) << 40) | ((values[valuesOffset++] & 0xffffffffL) << 38) | ((values[valuesOffset++] & 0xffffffffL) << 36) | ((values[valuesOffset++] & 0xffffffffL) << 34) | ((values[valuesOffset++] & 0xffffffffL) << 32) | ((values[valuesOffset++] & 0xffffffffL) << 30) | ((values[valuesOffset++] & 0xffffffffL) << 28) | ((values[valuesOffset++] & 0xffffffffL) << 26) | ((values[valuesOffset++] & 0xffffffffL) << 24) | ((values[valuesOffset++] & 0xffffffffL) << 22) | ((values[valuesOffset++] & 0xffffffffL) << 20) | ((values[valuesOffset++] & 0xffffffffL) << 18) | ((values[valuesOffset++] & 0xffffffffL) << 16) | ((values[valuesOffset++] & 0xffffffffL) << 14) | ((values[valuesOffset++] & 0xffffffffL) << 12) | ((values[valuesOffset++] & 0xffffffffL) << 10) | ((values[valuesOffset++] & 0xffffffffL) << 8) | ((values[valuesOffset++] & 0xffffffffL) << 6) | ((values[valuesOffset++] & 0xffffffffL) << 4) | ((values[valuesOffset++] & 0xffffffffL) << 2) | (values[valuesOffset++] & 0xffffffffL);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(long[] values, int valuesOffset, long[] blocks, int blocksOffset, int iterations) {
|
||||
assert blocksOffset + iterations * blockCount() <= blocks.length;
|
||||
assert valuesOffset + iterations * valueCount() <= values.length;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
blocks[blocksOffset++] = (values[valuesOffset++] << 62) | (values[valuesOffset++] << 60) | (values[valuesOffset++] << 58) | (values[valuesOffset++] << 56) | (values[valuesOffset++] << 54) | (values[valuesOffset++] << 52) | (values[valuesOffset++] << 50) | (values[valuesOffset++] << 48) | (values[valuesOffset++] << 46) | (values[valuesOffset++] << 44) | (values[valuesOffset++] << 42) | (values[valuesOffset++] << 40) | (values[valuesOffset++] << 38) | (values[valuesOffset++] << 36) | (values[valuesOffset++] << 34) | (values[valuesOffset++] << 32) | (values[valuesOffset++] << 30) | (values[valuesOffset++] << 28) | (values[valuesOffset++] << 26) | (values[valuesOffset++] << 24) | (values[valuesOffset++] << 22) | (values[valuesOffset++] << 20) | (values[valuesOffset++] << 18) | (values[valuesOffset++] << 16) | (values[valuesOffset++] << 14) | (values[valuesOffset++] << 12) | (values[valuesOffset++] << 10) | (values[valuesOffset++] << 8) | (values[valuesOffset++] << 6) | (values[valuesOffset++] << 4) | (values[valuesOffset++] << 2) | values[valuesOffset++];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue