mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-04 04:06:06 -05:00
sixel: add_ar_11(): manually unroll loop
This generates both smaller, and faster code
This commit is contained in:
parent
fc46087ce9
commit
5e9d68695c
1 changed files with 18 additions and 7 deletions
25
sixel.c
25
sixel.c
|
|
@ -1360,15 +1360,26 @@ sixel_add_ar_11(struct terminal *term, int col, int width, uint32_t color,
|
|||
xassert(term->sixel.pos.row < term->sixel.image.height);
|
||||
xassert(term->sixel.pan == 1);
|
||||
|
||||
size_t ofs = term->sixel.row_byte_ofs + col;
|
||||
const size_t ofs = term->sixel.row_byte_ofs + col;
|
||||
uint32_t *data = &term->sixel.image.data[ofs];
|
||||
|
||||
for (int i = 0; i < 6; i++, sixel >>= 1, data += width) {
|
||||
if (sixel & 1)
|
||||
*data = color;
|
||||
}
|
||||
|
||||
xassert(sixel == 0);
|
||||
if (sixel & 0x01)
|
||||
*data = color;
|
||||
data += width;
|
||||
if (sixel & 0x02)
|
||||
*data = color;
|
||||
data += width;
|
||||
if (sixel & 0x04)
|
||||
*data = color;
|
||||
data += width;
|
||||
if (sixel & 0x08)
|
||||
*data = color;
|
||||
data += width;
|
||||
if (sixel & 0x10)
|
||||
*data = color;
|
||||
data += width;
|
||||
if (sixel & 0x20)
|
||||
*data = color;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue