Skip to content
This repository has been archived by the owner on Nov 13, 2024. It is now read-only.

Commit

Permalink
Reduced size of indices table to short
Browse files Browse the repository at this point in the history
  • Loading branch information
nibix committed Jun 14, 2024
1 parent 74d8732 commit a9d32ef
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/main/java/com/selectivem/check/BackingCollections.java
Original file line number Diff line number Diff line change
Expand Up @@ -494,9 +494,9 @@ final static class HashArrayBackedSet<E> extends IndexedUnmodifiableSet<E> {

private final E[] table;
private final E[] flat;
private final int[] indices;
private final short[] indices;

HashArrayBackedSet(int tableSize, int size, E[] table, int[] indices, E[] flat) {
HashArrayBackedSet(int tableSize, int size, E[] table, short[] indices, E[] flat) {
super(size);
this.tableSize = tableSize;
this.size = size;
Expand Down Expand Up @@ -658,8 +658,8 @@ static <E> int checkTable(E[] table, Object e, int hashPosition) {
static class Builder<E> extends IndexedUnmodifiableSet.InternalBuilder<E> {
private E[] table;
private E[] flat;
private int[] indices;
private int size = 0;
private short[] indices;
private short size = 0;
private final int tableSize;

public Builder(int tableSize) {
Expand All @@ -675,7 +675,7 @@ public InternalBuilder<E> with(E e) {
int hashPosition = hashPosition(e);
table = createEArray(tableSize + COLLISION_HEAD_ROOM);
flat = createEArray(tableSize + COLLISION_HEAD_ROOM);
indices = new int[tableSize + COLLISION_HEAD_ROOM];
indices = new short[tableSize + COLLISION_HEAD_ROOM];
table[hashPosition] = e;
indices[hashPosition] = 0;
flat[0] = e;
Expand Down

0 comments on commit a9d32ef

Please sign in to comment.