EasyManuals Logo
Home>Texas Instruments>Calculator>TI-89

Texas Instruments TI-89 Software Guide

Texas Instruments TI-89
334 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #104 background imageLoading...
Page #104 background image
92
Section 2: Compiler
TI
-
89 / TI
-
92 Plus Sierra C Assembler Reference Manual
Not for Distribution
Beta Version February 2, 2001
a function can be assigned to the same register if they all have nonoverlapping
lifetimes. Different lifetimes of the same variable can be allocated to different
registers or a combination of registers and stack locations.
2.15.2. Switch Statements
The compiler uses three different code generation algorithms to implement the C
language
switch
statement. The algorithm employed for a given
switch
statement depends on the number of
case
statements and the range of
case
statement values.
If there are four or fewer case labels, the compiler generates a sequence of
explicit tests against the case values. This is equivalent to the code generated by
a series of
if-else
statements.
If there are more than four case labels, the
switch
algorithm selected is
determined by both the number of
case
statements and their values. If the case
value density is sufficiently high, a jump table is generated; otherwise, the
compiler generates code that performs an in-line binary search to locate the
appropriate
case
statement.
A jump table is generated when at least one third of the possible integral values
over the case value range are represented by
case
statements (i.e., when the
difference between the highest and lowest case values divided by the total
number of
case
statements is less than three). For example, a jump table would
not be generated for the following
switch
statement:
int i;
f()
{
switch(i) {
case 4: ... ;
case 8: ... ;
case 12: ... ;
case 16: ... ;
case 20: ... ;
default: ... ;
}
}
In this example, the binary search algorithm is used because the case density is
not high enough to justify a jump table. The difference between the maximum
and minimum
case
values divided by the number of
case
statements is not less
than three (i.e., (20 - 4) / 5 > 3).

Table of Contents

Other manuals for Texas Instruments TI-89

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Texas Instruments TI-89 and is the answer not in the manual?

Texas Instruments TI-89 Specifications

General IconGeneral
Display size (HxV)100 x 160 mm
Memory type639K FLASH ROM, 188K bytes RAM
Compatible operating systemsOperating System 2.09
Battery typeAAA

Related product manuals