Added terminator for MPQ#getIndex(long,int,short) for case where not found

This commit is contained in:
Collin Smith
2020-09-23 01:54:08 -07:00
parent 2c5d056457
commit e1252e172c

View File

@ -268,7 +268,7 @@ public final class MPQ {
searches++;
int bestId = -1;
final Entry[] table = this.table;
for (int i = offset & (table.length - 1);; i++, misses++) {
for (int i = offset & (table.length - 1), s = table.length; i < s; i++, misses++) {
final Entry entry = table[i];
if (entry.block == Entry.BLOCK_UNUSED) {
return bestId;
@ -282,6 +282,8 @@ public final class MPQ {
}
}
}
return bestId;
}
Entry getEntry(final long key, final int offset, final short locale) {