Table Lookup Compiled -O
vowel:
sll %o0,2,%g1
sethi %hi(vowels-260),%g2
add %g2,%lo(vowels-260),%g2
retl ! Result = %o0
ld [%g1+%g2],%o0 ! volatile
Bottom Line:
| switch | 46 |
| switch -O | 15 |
| Table Lookup | 10 |
| Table Lookup -O | 5 |
Table Lookup beats the switch statement in code size and performance; it is also better Software Engineering.