Remove unused +1 on doc buffer length. (#14043)

We no longer take advantatge of it.
This commit is contained in:
Adrien Grand 2024-12-06 10:43:11 +01:00
parent e11b3b72c7
commit d42ad2cc6c
1 changed files with 1 additions and 6 deletions

View File

@ -297,7 +297,7 @@ public final class Lucene101PostingsReader extends PostingsReaderBase {
private ForDeltaUtil forDeltaUtil; private ForDeltaUtil forDeltaUtil;
private PForUtil pforUtil; private PForUtil pforUtil;
private final int[] docBuffer = new int[BLOCK_SIZE + 1]; private final int[] docBuffer = new int[BLOCK_SIZE];
private int doc; // doc we last read private int doc; // doc we last read
@ -418,10 +418,6 @@ public final class Lucene101PostingsReader extends PostingsReaderBase {
this.needsImpacts = needsImpacts; this.needsImpacts = needsImpacts;
needsDocsAndFreqsOnly = needsPos == false && needsImpacts == false; needsDocsAndFreqsOnly = needsPos == false && needsImpacts == false;
// We set the last element of docBuffer to NO_MORE_DOCS, it helps save conditionals in
// advance()
docBuffer[BLOCK_SIZE] = NO_MORE_DOCS;
if (needsFreq == false) { if (needsFreq == false) {
Arrays.fill(freqBuffer, 1); Arrays.fill(freqBuffer, 1);
} }
@ -586,7 +582,6 @@ public final class Lucene101PostingsReader extends PostingsReaderBase {
prevDocID = docBuffer[BLOCK_SIZE - 1]; prevDocID = docBuffer[BLOCK_SIZE - 1];
docBufferUpto = 0; docBufferUpto = 0;
posDocBufferUpto = 0; posDocBufferUpto = 0;
assert docBuffer[docBufferSize] == NO_MORE_DOCS;
} }
private void refillRemainder() throws IOException { private void refillRemainder() throws IOException {