]> ocean-lang.org Git - ocean/commitdiff
parsergen: rearrange 'struct state' to reduce wastage.
authorNeilBrown <neil@brown.name>
Sat, 13 Nov 2021 08:32:42 +0000 (19:32 +1100)
committerNeilBrown <neil@brown.name>
Sat, 13 Nov 2021 22:50:58 +0000 (09:50 +1100)
Having a pointer between two shorts results in a lot of empty space
in the struct.  Remove this wastage.

Signed-off-by: NeilBrown <neil@brown.name>
csrc/parsergen.mdc

index 076f3823941a20c4abb05237da892bc726d70266..709a9acb962e8be130030d7d7d183c2fb3222ed2 100644 (file)
@@ -1969,9 +1969,9 @@ The go to table is stored in a simple array of `sym` and corresponding
                short result_size;
        };
        struct state {
                short result_size;
        };
        struct state {
+               short reduce_prod;
                short go_to_cnt;
                const struct lookup * go_to;
                short go_to_cnt;
                const struct lookup * go_to;
-               short reduce_prod;
        };
 
 ###### functions
        };
 
 ###### functions
@@ -2039,10 +2039,10 @@ The go to table is stored in a simple array of `sym` and corresponding
                                }
                        }
                        if (is->go_to.cnt)
                                }
                        }
                        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
                        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");
        }
                }
                fprintf(f, "};\n\n");
        }