BITS functions

Purpose

Return the least significant Byte, Word, Integer, Double-word, or Long-integer of an expression.  Allows easy conversion between signed and unsigned expressions.

Syntax

bytevar  = BITS?(expression)

wordvar  = BITS??(expression)

dwordvar = BITS???(expression)

intvar   = BITS%(expression)

longvar  = BITS&(expression)

Remarks

The various BITS functions return the least-significant bits of expression, as shown in the following table:

Function

Accepts

Returns

BITS?

Long-integer

Byte (least-significant 8 bits, unsigned)

BITS??

Long-integer

Word (least-significant 16 bits, unsigned)

BITS???

Quad-integer

Double-word (least-significant 32 bits, unsigned)

BITS%

Long-integer

Integer (least-significant 16 bits, signed)

BITS&

Quad-integer

Long-integer (least-significant 32 bits, signed)

See also

BIT CALC statementBIT functionBIT statement