Skip to content

Commit

Permalink
Grow internal arrays when growing the capacity in AbstractHash implem…
Browse files Browse the repository at this point in the history
…entations
  • Loading branch information
iverase committed Oct 16, 2024
1 parent 8ae5ca4 commit eaba952
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ private long set(BytesRef key, int code, long id) {
private void append(long id, BytesRef key, int code) {
assert size == id;
bytesRefs.append(key);
hashes = bigArrays.grow(hashes, id + 1);
hashes.set(id, code);
}

Expand Down Expand Up @@ -211,6 +210,7 @@ public long add(BytesRef key, int code) {
if (size >= maxSize) {
assert size == maxSize;
grow();
hashes = bigArrays.resize(hashes, maxSize);
}
assert size < maxSize;
return set(key, rehash(code), size);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ private long set(long key, long id) {
}

private void append(long id, long key) {
keys = bigArrays.grow(keys, id + 1);
keys.set(id, key);
}

Expand All @@ -102,6 +101,7 @@ public long add(long key) {
if (size >= maxSize) {
assert size == maxSize;
grow();
keys = bigArrays.resize(keys, maxSize);
}
assert size < maxSize;
return set(key, size);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ private long set(long key1, long key2, long id) {

private void append(long id, long key1, long key2) {
long keyOffset = 2 * id;
keys = bigArrays.grow(keys, keyOffset + 2);
keys.set(keyOffset, key1);
keys.set(keyOffset + 1, key2);
}
Expand Down Expand Up @@ -128,6 +127,7 @@ public long add(long key1, long key2) {
if (size >= maxSize) {
assert size == maxSize;
grow();
keys = bigArrays.resize(keys, maxSize * 2);
}
assert size < maxSize;
return set(key1, key2, size);
Expand Down

0 comments on commit eaba952

Please sign in to comment.