Skip to content

Commit f5c0413

Browse files
libretroadminLibretroAdmin
authored andcommitted
menu_cbs_sublabel: convert the uniform dispatch cases to a searched table
Eight hundred five groups of the thousand-case sublabel switch - 826 labels, each case a bind and a break - become one const table of label and callback rows, platform guards carried inside; the 232 cases with surrounding guard scope or extra logic stay in the residual switch, and groups whose guards span group boundaries were left literal rather than lose their scope. Lookup is a linear scan of the const table, keeping every row in read-only, link-resolved storage on non-PIE targets rather than paying a runtime sort with dirty pages. Verified by a transient in-binary referee holding the original switch: all 6,403 enums bind identical pointers through the new path, zero mismatches, run against this exact form. The file drops 1,565 lines - 6,073 to 4,508 - and the object 18.5 kilobytes, 12.4 of text and a net 6 of data, the switch's jump tables having cost more than the table that replaced them.
1 parent c46ce8c commit f5c0413

1 file changed

Lines changed: 927 additions & 2508 deletions

File tree

0 commit comments

Comments
 (0)