Chapter 2 C Language Reference
AutoCode Reference 2-38 ni.com
Arithmetic MacrosThe arithmetic macros perform addition, subtraction, multiplication, and
division. The top level macros for arithmetic operations are present in the
sa_fxm.h and sa_fxmp.h files. These macros in turn call the ALIGN
macros that are defined either in sa_fx.h or sa_fxp.h, depending on
whether or not they are overflow protected. The macros for addition and
subtraction also make use of addition and subtraction functions defined in
sa_fxmp.c.
Figure 2-9 shows how the arithmetic macros are named. Notice that macro
names have no embedded spaces.
Figure 2-9. AutoCode/C Arithmetic Macros
sr wr op _ s1 w1 _ s2 w2 p (n1,n2,rp1, rp2, rp3)
n1 = First fixed-point operand
n2 = Second fixed-point operand
rp1 = Radix position for n1
rp2 = Radix position for n2
rp3 = Radix position for result
p = Overflow protection (optional)
s2= sign of n2 (u=unsigned, s=signed)
w1 = size of n1 (b=byte, s=short, l=long)
w2= size of n2 (b=byte, s=short, l=long)
s1 = sign of n1 (u=unsigned s=signed)
op = ADD, SUB, MUL, or DIV
wr = Result wordsize (b=byte, s=short, l=long)
sr = Result sign (u=unsigned, s=signed)
_ (underscore character; part of macro name)
_ (underscore character; part of macro name)