sixel: add: calculate absolute row no inside the loop

This results in the same number of instructions inside the loop, with
a ‘lea’ instead of a ‘mov’, but simplifies the post-loop logic to
update the global state.
This commit is contained in:
Daniel Eklöf 2021-03-07 15:45:39 +01:00
parent 751ccf5316
commit 6e963dbf68
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -1007,10 +1007,11 @@ sixel_add(struct terminal *term, uint32_t color, uint8_t sixel)
uint32_t *data = &term->sixel.image.data[ofs];
int max_non_empty_row = 0;
int row = term->sixel.pos.row;
for (int i = 0; i < 6; i++, sixel >>= 1, data += width) {
if (sixel & 1) {
max_non_empty_row = i;
*data = color;
max_non_empty_row = row + i;
}
}
@ -1019,7 +1020,7 @@ sixel_add(struct terminal *term, uint32_t color, uint8_t sixel)
term->sixel.max_non_empty_row_no = max(
term->sixel.max_non_empty_row_no,
term->sixel.pos.row + max_non_empty_row);
max_non_empty_row);
}
static void