From: NeilBrown Date: Sat, 13 Nov 2021 08:32:42 +0000 (+1100) Subject: parsergen: rearrange 'struct state' to reduce wastage. X-Git-Url: https://ocean-lang.org/code/?p=ocean;a=commitdiff_plain;h=4e76641ba6fa31b2cafb16b2452f585ba70a6822 parsergen: rearrange 'struct state' to reduce wastage. Having a pointer between two shorts results in a lot of empty space in the struct. Remove this wastage. Signed-off-by: NeilBrown --- diff --git a/csrc/parsergen.mdc b/csrc/parsergen.mdc index 076f382..709a9ac 100644 --- a/csrc/parsergen.mdc +++ b/csrc/parsergen.mdc @@ -1969,9 +1969,9 @@ The go to table is stored in a simple array of `sym` and corresponding short result_size; }; struct state { + short reduce_prod; short go_to_cnt; const struct lookup * go_to; - short reduce_prod; }; ###### functions @@ -2039,10 +2039,10 @@ The go to table is stored in a simple array of `sym` and corresponding } } if (is->go_to.cnt) - fprintf(f, "\t[%d] = { %d, goto_%d, %d },\n", - i, is->go_to.cnt, i, prod); + fprintf(f, "\t[%d] = { %d, %d, goto_%d },\n", + i, prod, is->go_to.cnt, i); else - fprintf(f, "\t[%d] = { 0, NULL, %d },\n", i, prod); + fprintf(f, "\t[%d] = { %d, 0, NULL },\n", i, prod); } fprintf(f, "};\n\n"); }