jpountz commented on code in PR #13636: URL: https://github.com/apache/lucene/pull/13636#discussion_r1709749808
########## lucene/core/src/java/org/apache/lucene/codecs/lucene912/ForUtil.java: ########## @@ -630,55 +637,55 @@ private static void decode1(DataInput in, long[] tmp, long[] longs) throws IOExc shiftLongs(tmp, 2, longs, 14, 0, MASK8_1); } - private static void decode2(DataInput in, long[] tmp, long[] longs) throws IOException { - in.readLongs(tmp, 0, 4); - shiftLongs(tmp, 4, longs, 0, 6, MASK8_2); + private static void decode2(PostingDecodingUtil pdu, long[] tmp, long[] longs) + throws IOException { + pdu.splitLongs(4, longs, 6, MASK8_2, tmp, MASK8_6); shiftLongs(tmp, 4, longs, 4, 4, MASK8_2); shiftLongs(tmp, 4, longs, 8, 2, MASK8_2); shiftLongs(tmp, 4, longs, 12, 0, MASK8_2); } - private static void decode3(DataInput in, long[] tmp, long[] longs) throws IOException { - in.readLongs(tmp, 0, 6); - shiftLongs(tmp, 6, longs, 0, 5, MASK8_3); + private static void decode3(PostingDecodingUtil pdu, long[] tmp, long[] longs) + throws IOException { + pdu.splitLongs(6, longs, 5, MASK8_3, tmp, MASK8_5); shiftLongs(tmp, 6, longs, 6, 2, MASK8_3); + maskLongs(tmp, 6, MASK8_2); for (int iter = 0, tmpIdx = 0, longsIdx = 12; iter < 2; ++iter, tmpIdx += 3, longsIdx += 2) { - long l0 = (tmp[tmpIdx + 0] & MASK8_2) << 1; + long l0 = tmp[tmpIdx + 0] << 1; l0 |= (tmp[tmpIdx + 1] >>> 1) & MASK8_1; longs[longsIdx + 0] = l0; long l1 = (tmp[tmpIdx + 1] & MASK8_1) << 2; - l1 |= (tmp[tmpIdx + 2] & MASK8_2) << 0; + l1 |= tmp[tmpIdx + 2] << 0; longs[longsIdx + 1] = l1; } } - private static void decode4(DataInput in, long[] tmp, long[] longs) throws IOException { - in.readLongs(tmp, 0, 8); - shiftLongs(tmp, 8, longs, 0, 4, MASK8_4); + private static void decode4(PostingDecodingUtil pdu, long[] tmp, long[] longs) + throws IOException { + pdu.splitLongs(8, longs, 4, MASK8_4, tmp, MASK8_4); shiftLongs(tmp, 8, longs, 8, 0, MASK8_4); Review Comment: Note to self: if `splitLongs` took an offset for the second array, this could be just `pdu.splitLongs(8, longs, 4, MASK8_4, longs, 8, MASK8_4);`. -- 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: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org