ST20-C1 STMICROELECTRONICS [STMicroelectronics], ST20-C1 Datasheet - Page 181

no-image

ST20-C1

Manufacturer Part Number
ST20-C1
Description
Instruction Set Reference Manual
Manufacturer
STMICROELECTRONICS [STMicroelectronics]
Datasheet
Consider compiling the following switch expression:
where, for brevity, it is assumed that all the switch selectors are already in increasing
order.
Three entries or less
This switch is compiled as:
Four to twelve entries
This switch is compiled as:
Using a jump table
Assume that c
switch X
if (X = c
else if (X = c
...
else if (X = c
if (X <= c
{
}
else
if ( X < c
{
c
...
c
P
P
P
... etc.
1
n
1
2
n
switch X
P
P
if (X <= c
else
1
n
c
...
c
1
i-1
i
...etc.
... etc.
P
P
... c
1
1
i-1
)
n/2
i
)
)
m
2
n
n/4
form a third filled jump table. Then the switch is compiled as:
)
)
)
181/205

Related parts for ST20-C1