Hacker News new | ask | show | jobs
by flohofwoe 32 days ago
Hmm, IME at least in emulators the switch tables usually have enough 'structure' that GCC or Clang have no trouble turning them into jump tables.
1 comments

That usually works well enough for risc code.

As a massage, I wish there was a flag to set a minimum branch target size. If all the branch targets for a switch are the same size then you can often turn the jump table into a multiply-accumulate, or sometimes even a shift and add.