From aed9c392ebdf1b030f819ad3e55d21d80dbee2cf Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Tue, 25 Jun 2024 16:22:22 +0200 Subject: scripts: generate-emoji-variation-sequences: compact the C struct Lookups in this table is not performance critical at all. Thus, let's compact it to bring down the binary size of foot. This brings the size of each entry down from 9 bytes to 6, bringing the size of the whole thing down from 1647 bytes to 1098 bytes, saving us 549 bytes. --- scripts/generate-emoji-variation-sequences.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/generate-emoji-variation-sequences.py b/scripts/generate-emoji-variation-sequences.py index 7324ae3b..2c71594c 100644 --- a/scripts/generate-emoji-variation-sequences.py +++ b/scripts/generate-emoji-variation-sequences.py @@ -67,12 +67,12 @@ def main(): opts.output.write('#include \n') opts.output.write('\n') opts.output.write('struct emoji_vs {\n') - opts.output.write(' uint32_t start;\n') - opts.output.write(' uint32_t end;\n') + opts.output.write(' uint32_t start:21;\n') + opts.output.write(' uint32_t end:21;\n') opts.output.write(' bool vs15:1;\n') opts.output.write(' bool vs16:1;\n') opts.output.write('} __attribute__((packed));\n') - opts.output.write('_Static_assert(sizeof(struct emoji_vs) == 9, "unexpected struct size");\n') + opts.output.write('_Static_assert(sizeof(struct emoji_vs) == 6, "unexpected struct size");\n') opts.output.write('\n') opts.output.write('#if defined(FOOT_GRAPHEME_CLUSTERING)\n') opts.output.write('\n') -- cgit v1.3