hoist shift out of loop

This commit is contained in:
Autumn Lamonte 2022-01-29 10:45:28 -06:00
parent dbc993b48f
commit 3b73cc28cd
2 changed files with 4 additions and 2 deletions

View file

@ -1938,10 +1938,11 @@ public class HQSixelEncoder implements SixelEncoder {
j++) {
int base = width * (currentRow + j);
int value = 1 << j;
for (int imageX = 0; imageX < width; imageX++) {
// Is there was a way to do this without the if?
if (rgbArray[base + imageX] == i) {
row[imageX] += 1 << j;
row[imageX] += value;
}
}
}

View file

@ -901,10 +901,11 @@ public class LegacySixelEncoder implements SixelEncoder {
j++) {
int base = width * (currentRow + j);
int value = 1 << j;
for (int imageX = 0; imageX < width; imageX++) {
// Is there was a way to do this without the if?
if (rgbArray[base + imageX] == i) {
row[imageX] += 1 << j;
row[imageX] += value;
}
}
}