dungba88 commented on code in PR #12710: URL: https://github.com/apache/lucene/pull/12710#discussion_r1368339258
########## lucene/core/src/java/org/apache/lucene/util/fst/IntSequenceOutputs.java: ########## @@ -43,28 +44,29 @@ public IntsRef common(IntsRef output1, IntsRef output2) { assert output1 != null; assert output2 != null; - int pos1 = output1.offset; - int pos2 = output2.offset; - int stopAt1 = pos1 + Math.min(output1.length, output2.length); - while (pos1 < stopAt1) { - if (output1.ints[pos1] != output2.ints[pos2]) { - break; - } - pos1++; - pos2++; - } + int mismatchPos = + Arrays.mismatch( + output1.ints, + output1.offset, + output1.offset + output1.length, + output2.ints, + output2.offset, + output2.offset + output2.length); - if (pos1 == output1.offset) { + if (mismatchPos == 0) { // no common prefix return NO_OUTPUT; - } else if (pos1 == output1.offset + output1.length) { + } else if (mismatchPos == -1) { Review Comment: Why aren't we merging these 2 branches? ``` else if (mismatchPos == -1 || mismatchPos == output1.length) ``` -- 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