diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2024-06-25 14:22:22 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2024-06-26 16:32:10 +0000 |
| commit | aed9c392ebdf1b030f819ad3e55d21d80dbee2cf (patch) | |
| tree | f11fb90c30c028c97ff29dc0626d7986296d48cb | |
| parent | vt: unittest: verify emoji_vs list is sorted (diff) | |
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.
| -rw-r--r-- | scripts/generate-emoji-variation-sequences.py | 6 |
1 files changed, 3 insertions, 3 deletions
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 <stdbool.h>\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') |
