-
20 cases? If the cases are consecutive integers, no. Compilers use it as an index in a table. If they're all over the place the compiler may use some quicky scan in an array. But we're talking about nano seconds either way. Or you could construct your own table and index into that somehow to get the hex codes required.
-
If the values are not consecutive (and far apart, as in cases where you switch on, say, 3, 5, 7, 8, 12, it may still use a table of 10 elements), it will use a "binary search", so 20 cases should be 5 or less comparisons.
--
Mats