public BytesRef common(BytesRef output1, BytesRef 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.bytes[pos1] != output2.bytes[pos2]) {break;}pos1++;pos2++;}if (pos1 == output1.offset) {return NO_OUTPUT;} else if (pos1 == output1.offset + output1.length) {return output1;} else if (pos2 == output2.offset + output2.length) {return output2;} else {return new BytesRef(output1.bytes, output1.offset, pos1-output1.offset);}}

public override BytesRef Common(BytesRef output1, BytesRef output2){Debug.Assert(output1 != null);Debug.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.Bytes[pos1] != output2.Bytes[pos2]){break;}pos1++;pos2++;}if (pos1 == output1.Offset){return NO_OUTPUT;}else if (pos1 == output1.Offset + output1.Length){return output1;}else if (pos2 == output2.Offset + output2.Length){return output2;}else{return new BytesRef(output1.Bytes, output1.Offset, pos1 - output1.Offset);}}
