From afd0bacb6a7130e6ab30d6d00c154577168e8fc2 Mon Sep 17 00:00:00 2001 From: Pranav P Date: Wed, 21 May 2025 13:02:11 +0530 Subject: [PATCH] Fix endianness bug reported in issue #8548 --- kitty/line.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/kitty/line.h b/kitty/line.h index fe8510544..55f9fdc13 100644 --- a/kitty/line.h +++ b/kitty/line.h @@ -48,8 +48,15 @@ static_assert(sizeof(GPUCell) == 20, "Fix the ordering of GPUCell"); typedef union CPUCell { struct { + #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ char_type ch_or_idx: sizeof(char_type) * 8 - 1; char_type ch_is_idx: 1; + #elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ + char_type ch_is_idx: 1; + char_type ch_or_idx: sizeof(char_type) * 8 - 1; + #else + #error "Unsupported endianness" + #endif char_type hyperlink_id: sizeof(hyperlink_id_type) * 8; char_type next_char_was_wrapped : 1; char_type is_multicell : 1;