>> As remarked in another reply: Tell us what you want to achieve
and we can comment in more detail on the pros and contras.
I read somewhere that assembly of switch generates jump tables
and is faster as compared to if-then equivalent.
Any statement of the form "A is faster than or slower than or about the
same speed as B" is probably false if you don't specify the hardware,
compiler and version, and OS and version.
Maybe the compiler generates a jump table. I doubt it would in this case:
switch(fark) {
case 0x7fffffff: ...; break;
case 0: ...; break;
case 0x40003726: ...; break;
case 0x80000007: ...; break;
default: ...; break;
since the jump table would likely exceed available address space on
a machine with 32-bit integers and a 32-bit address space.
Compilers can use various strategies: sequential if-then-else,
jump table, or binary search (nested if-then-else), and they can
use different strategies for parts of the search space. For example,
if you have a switch with 20 different values in the range 'a' ..
'z', plus EOF, it could do the EOF with if-then-else, and use a
jump table for the rest of it where the values are densely packed
together. A jump table (with initial range checking) probably isn't
worth it if the switch has few cases, e.g. less than 3 - 10.
Gordon L. Burditt