C/C++ Compiler Language Extensions
Fractional Arithmetic Operations
The following notes summarize information about fractional arithmetic
operators supported by the
• Standard arithmetic operations on two
tion, subtraction, and multiplication.
• Assignment operations include
• Shift operations include left and right shifts. A left shift is imple-
mented as a logical shift and a right shift is an arithmetic shift.
Shifting left by a negative amount is not recommended.
• Comparison operations are supported between two
• Mixed-mode arithmetic has a preference for
mation about the mixed-mode arithmetic, see
• Multiplication of a fractional and an integer produces an integer
result or a fractional result. The program context determines which
variant is generated following the conversion algorithm of C++.
When the compiler does not have enough context, it generates an
ambiguous operator message. For example,
error:more than one operator "*" matches these operands:
If this error occurs, cast the result of the multiply to the desired
type.
Mixed Mode Operations
Most operations supported for fractional values, are supported for mixed
fractional/float or fractional/double arithmetic expressions. At run time, a
floating-point value is converted to a fractional value, and the operation is
completed using fractional arithmetic.
1-92
compiler:
cc219x
VisualDSP++ 3.5 C/C++ Compiler and Library Manual
items include addi-
fract
,
, and
.
+=
-=
*=
fract
on page
for ADSP-219x DSPs
items.
fract
. For more infor-
1-92.
Need help?
Do you have a question about the VISUALDSP++ 3.5 and is the answer not in the manual?
Questions and answers