uschindler commented on code in PR #12841:
URL: https://github.com/apache/lucene/pull/12841#discussion_r1420377148
##########
lucene/core/src/java21/org/apache/lucene/store/MemorySegmentIndexInput.java:
##########
@@ -324,24 +324,9 @@ private void readGroupVInt(long[] dst, int offset) throws
IOException {
try {
final int flag = curSegment.get(LAYOUT_BYTE, curPosition++) & 0xFF;
-
- final int n1Minus1 = flag >> 6;
- final int n2Minus1 = (flag >> 4) & 0x03;
- final int n3Minus1 = (flag >> 2) & 0x03;
- final int n4Minus1 = flag & 0x03;
-
- dst[offset] =
- curSegment.get(LAYOUT_LE_INT, curPosition) &
GroupVIntUtil.GROUP_VINT_MASKS[n1Minus1];
- curPosition += 1 + n1Minus1;
- dst[offset + 1] =
- curSegment.get(LAYOUT_LE_INT, curPosition) &
GroupVIntUtil.GROUP_VINT_MASKS[n2Minus1];
- curPosition += 1 + n2Minus1;
- dst[offset + 2] =
- curSegment.get(LAYOUT_LE_INT, curPosition) &
GroupVIntUtil.GROUP_VINT_MASKS[n3Minus1];
- curPosition += 1 + n3Minus1;
- dst[offset + 3] =
- curSegment.get(LAYOUT_LE_INT, curPosition) &
GroupVIntUtil.GROUP_VINT_MASKS[n4Minus1];
- curPosition += 1 + n4Minus1;
+ curPosition +=
+ GroupVIntUtil.readGroupVInt(
+ flag, p -> curSegment.get(LAYOUT_LE_INT, p), curPosition, dst,
offset);
Review Comment:
isn't the +1 missing here like above?
This is why I'd like to have a test that reads a vint group and other data
from the same input placed behind each other!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]