mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-12-19 15:09:18 +00:00
fix linear palette not growing correctly
This commit is contained in:
@@ -29,7 +29,7 @@ public class DataContainer<T> {
|
|||||||
private static final boolean TRIM = Boolean.getBoolean("iris.trim-palette");
|
private static final boolean TRIM = Boolean.getBoolean("iris.trim-palette");
|
||||||
protected static final int INITIAL_BITS = 3;
|
protected static final int INITIAL_BITS = 3;
|
||||||
protected static final int LINEAR_BITS_LIMIT = 4;
|
protected static final int LINEAR_BITS_LIMIT = 4;
|
||||||
protected static final int LINEAR_INITIAL_LENGTH = (int) Math.pow(2, LINEAR_BITS_LIMIT) + 1;
|
protected static final int LINEAR_INITIAL_LENGTH = (int) Math.pow(2, LINEAR_BITS_LIMIT) + 2;
|
||||||
protected static final int[] BIT = computeBitLimits();
|
protected static final int[] BIT = computeBitLimits();
|
||||||
private final Lock read, write;
|
private final Lock read, write;
|
||||||
|
|
||||||
|
|||||||
@@ -52,11 +52,11 @@ public class LinearPalette<T> implements Palette<T> {
|
|||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void grow(int newLength) {
|
private synchronized void grow(int lastIndex) {
|
||||||
if (palette.length() <= newLength)
|
if (palette.length() > lastIndex)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
AtomicReferenceArray<T> a = new AtomicReferenceArray<>(newLength + 1);
|
AtomicReferenceArray<T> a = new AtomicReferenceArray<>(lastIndex + 1);
|
||||||
for (int i = 0; i < palette.length(); i++) {
|
for (int i = 0; i < palette.length(); i++) {
|
||||||
a.set(i, palette.get(i));
|
a.set(i, palette.get(i));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user