diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2023-06-27 14:21:26 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2023-06-29 13:40:00 +0000 |
| commit | 5e9d68695c05d4be03ac7b83dd0eabc42bb7fefd (patch) | |
| tree | 8c003da289af1e820a76872e873be9d9b49aec95 | |
| parent | scripts: generate-alt-random: set P2=1 when emitting sixels (diff) | |
sixel: add_ar_11(): manually unroll loop
This generates both smaller, and faster code
| -rw-r--r-- | sixel.c | 25 |
1 files changed, 18 insertions, 7 deletions
@@ -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 |
