Optimize palette clear

This commit is contained in:
themode 2022-01-04 06:07:24 +01:00 committed by TheMode
parent 33e1b4b157
commit 0148ad9aaf

View File

@ -154,12 +154,17 @@ final class PaletteImpl implements Palette, Cloneable {
this.values = values = new long[(size + valuesPerLong - 1) / valuesPerLong];
}
if (placedAir) {
Arrays.fill(values, 0);
this.count = 0;
} else {
long block = 0;
for (int i = 0; i < valuesPerLong; i++) {
block |= (long) value << i * bitsPerEntry;
}
Arrays.fill(values, block);
this.count = placedAir ? 0 : maxSize();
this.count = maxSize();
}
}
@Override