mirror of https://github.com/apache/lucene.git
Optimize convert byte2int. (#13889)
This commit is contained in:
parent
cf29597fec
commit
4d19a5408e
|
@ -775,10 +775,11 @@ public final class Util {
|
|||
|
||||
/** Just takes unsigned byte values from the BytesRef and converts into an IntsRef. */
|
||||
public static IntsRef toIntsRef(BytesRef input, IntsRefBuilder scratch) {
|
||||
scratch.clear();
|
||||
scratch.growNoCopy(input.length);
|
||||
for (int i = 0; i < input.length; i++) {
|
||||
scratch.append(input.bytes[i + input.offset] & 0xFF);
|
||||
scratch.setIntAt(i, input.bytes[i + input.offset] & 0xFF);
|
||||
}
|
||||
scratch.setLength(input.length);
|
||||
return scratch.get();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue