From 33ab1d9019b91e9ed4ddbb647cacca9ad3a5973c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 31 Oct 2024 12:12:54 +0530 Subject: [PATCH] Reduce size of LineAttrs from 4 bytes to 1 byte --- kitty/line.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kitty/line.h b/kitty/line.h index f9157fb27..9077012b6 100644 --- a/kitty/line.h +++ b/kitty/line.h @@ -20,9 +20,11 @@ typedef union CellAttrs { uint16_t dim : 1; uint16_t mark : 2; uint16_t next_char_was_wrapped : 1; + uint16_t : 3; }; uint16_t val; } CellAttrs; +static_assert(sizeof(CellAttrs) == sizeof(uint16_t), "Fix the ordering of CellAttrs"); #define WIDTH_MASK (3u) #define DECORATION_MASK (7u) @@ -56,10 +58,12 @@ typedef union LineAttrs { uint8_t is_continued : 1; uint8_t has_dirty_text : 1; uint8_t has_image_placeholders : 1; - PromptKind prompt_kind : 2; + uint8_t prompt_kind : 2; + uint8_t : 3; }; uint8_t val; } LineAttrs ; +static_assert(sizeof(LineAttrs) == sizeof(uint8_t), "Fix the ordering of LineAttrs"); typedef struct {