Note to OP: investigate your compiler's assembly output of a switch statement with and without "holes" for cases; let us know if it effectively creates an if-else tree. This will help find a solution if we know more of the limitations.
Printable View
Note to OP: investigate your compiler's assembly output of a switch statement with and without "holes" for cases; let us know if it effectively creates an if-else tree. This will help find a solution if we know more of the limitations.
The switch statement does a compare and branch to each Case defined. It ignores holes and only generates branches to valid Cases.
It's a Jump Table not an If..else. It executes much faster than an if..else.