National Instruments AutoCode NI MATRIX User Manual

Page 56

Advertising
background image

Chapter 2

C Language Reference

© National Instruments Corporation

2-39

AutoCode Reference

Table 2-7 shows permissible operand and result sizes for the arithmetic
macros.

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)

Table 2-7. Arithmetic Macros—Operand and Result Sizes

Operation

Operand 1 Size

Operand 2 Size

Result Size

addition
subtraction
multiplication

byte

byte

byte or short

short

short

short or long

long

long

long

division
(operand 1 is the
dividend; operand 2
is the divisor)

byte

byte

byte

short

byte

byte

short

short

short

long

short

short

long

long

long

Advertising