From ef8e8313ab2d190887489dba92f9aaad2c309db7 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 12 Nov 2023 15:13:54 +0530 Subject: [PATCH] For some reason, memcpy is faster than assignment --- kitty/screen.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kitty/screen.c b/kitty/screen.c index 72766d194..6750e3310 100644 --- a/kitty/screen.c +++ b/kitty/screen.c @@ -676,8 +676,8 @@ screen_draw_printable_ascii(Screen *self, const uint8_t *chars, size_t num) { GPUCell *gp = self->linebuf->line->gpu_cells; \ CPUCell *cp = self->linebuf->line->cpu_cells; \ for (; self->cursor->x < limit; self->cursor->x++, p++) { \ - gp[self->cursor->x] = g; \ - cp[self->cursor->x] = cc; \ + memcpy(gp + self->cursor->x, &g, sizeof(g)); \ + memcpy(cp + self->cursor->x, &cc, sizeof(cc)); \ cp[self->cursor->x].ch = *p; \ } \ if (selection_has_screen_line(&self->selections, self->cursor->y)) clear_selection(&self->selections); \