Integer Expression Analysis
6-28
6.6 Integer Expression Analysis
This section describes some special considerations for you to remember when
evaluating integer expressions.
6.6.1 Arithmetic Overflow and Underflow
The TMS320C2x/C2xx/C5x produces a 32-bit result even when 16-bit values
are used as data operands; thus,
arithmetic overflow and underflow cannot be
handled in a predictable manner
. If code depends on a particular type of over-
flow/underflow handling, there is no assurance that this code will execute
correctly. Generally, it is a good practice to avoid such code because it is not
portable.
6.6.2 Integer Division and Modulus
The TMS320C2x/C2xx/C5x does not directly support integer division, so all
division and modulus operations are performed through calls to run-time-sup-
port routines. These functions push the right-hand portion (divisor) of the
operation onto the stack and then place the left-hand portion (dividend) into
the 16 LSBs of the accumulator. The function places the result in the accumu-
lator.
6.6.3 Long (32-Bit) Expression Analysis
Long expression analysis operations in C are performed with function calls
that
do not
follow the standard C calling conventions. These functions work
together with the compiler to maximize speed and minimize code space. The
operations are:
-
Left shift by a variable
-
Right shift by a variable
-
Division
-
Modulus
-
Multiplication
Summary of Contents for TMS320C2x
Page 8: ...viii...
Page 69: ...2 47 C Compiler Description...
Page 159: ...6 36...
Page 226: ...8 6...