INTSM – Integer number bit shift and mask

Block SymbolLicensing group: STANDARD
PIC

Function Description
The INTSM block performs bit shift of input value i by shift bits right (if shift is positive) or left (if shift is negative). Free space resulting from shifting is filled with zeros.

Output value n is calculated as bitwise AND of shifted input i and bit mask mask.

Typical application of this block is extraction of one or more adjacent bits from a given position in integer register which was read from some external system.

Input

i

Integer value to shift and mask

long

Parameters

shift

Bit shift (negative=left, positive=right)   -31  31

long

mask

Bit mask (applied after bit shift)   XXX  XXX XXX

dword

Output

n

Resulting integer value

long