Skip to content

Commit

Permalink
Merge pull request #5241 from bjhargrave/remove-store
Browse files Browse the repository at this point in the history
immutable: Remove a variable store in a loop
  • Loading branch information
bjhargrave committed May 6, 2022
2 parents 815cb77 + 81fb609 commit 484abbf
Showing 1 changed file with 3 additions and 3 deletions.
Expand Up @@ -42,14 +42,14 @@ private static short[] hash(Object[] entries) {
throw new IllegalArgumentException("map too large: " + length);
}
short[] hash_bucket = new short[length * 2];
for (int slot = 0, index = 0; slot < length;) {
Object key = entries[index++];
for (int slot = 0, index = 0; slot < length; index += 2) {
Object key = entries[index];
int hash = -1 - linear_probe(entries, hash_bucket, key);
if (hash < 0) {
throw new IllegalArgumentException("duplicate key: " + key);
}
hash_bucket[hash] = (short) ++slot;
requireNonNull(entries[index++]);
requireNonNull(entries[index + 1]);
}
return hash_bucket;
}
Expand Down

0 comments on commit 484abbf

Please sign in to comment.