Operation
addition
subtraction
multiplication
division
(operand 1 is the
dividend; operand 2
is the divisor)
© National Instruments Corporation
Table 2-7 shows permissible operand and result sizes for the arithmetic
macros.
Table 2-7. Arithmetic Macros—Operand and Result Sizes
Operand 1 Size
byte
short
long
byte
short
short
long
long
For example, the macro to add two 8-bit unsigned numbers with overflow
protection and produce an unsigned 8-bit result is:
ubADD_ub_ubp(n1,n2,rp1,rp2,rp3)
The macro to subtract a 16-bit unsigned number from a 16-bit signed
number with overflow protection and produce an unsigned 16-bit result is:
usSUB_ss_usp(n1,n2,rp1,rp2,rp3)
The macro to multiply two 16-bit signed numbers with overflow protection
and produce a 16-bit signed result is:
ssMUL_ss_ssp(n1,n2,rp1,rp2,rp3)
The macro to divide two 32-bit signed numbers with overflow protection
and produce a 32-bit signed result is:
slDIV_sl_slp(n1,n2,rp1,rp2,rp3)
Operand 2 Size
byte
short
long
byte
byte
short
short
long
2-39
Chapter 2
C Language Reference
Result Size
byte or short
short or long
long
byte
byte
short
short
long
AutoCode Reference
Need help?
Do you have a question about the AutoCode NI MATRIX and is the answer not in the manual?
Questions and answers