Forum : 8051
Original Post
Post Information | Post |
---|---|
June 1, 2007 - 3:56pm
|
How can I force the RC51 compiler to produce jump tables for switch statements ? thanks M.Marolda |
A jump table will be generated when the "case" values are consecutive:
Typically:
switch ( c )
{
case 10:
fct10();
break;
case 11:
fct11();
break;
case 12:
fct12();
break;
case 13:
fct13();
break;
etc...
When the values are too different, table with couples "address+value" will be generated.
I still can't see how to obtain a real jump table,
I tried to compile your example and this is the result:
Source code
RC51 compiler result
It depends on the number of tested values. If you add more cases, you will get the following listing:
Perfect!!
Know I have a wonderfull and fast assembler code.
Thank you a lots
Massimo Marolda