User Tools

Site Tools


bshift_return_shifted_bits_.htm
Navigation:  Language Reference > 13 - Built-in Functions >====== BSHIFT (return shifted bits) ====== Previous pageReturn to chapter overviewNext page

BSHIFT(value,count)

blk2blue.jpg

BSHIFT Performs the bit shift operation.
value A numeric constant, variable, or expression. The value is converted to a LONG data type prior to the operation, if necessary.
count A numeric constant, variable, or expression for the number of bit positions to be shifted. If count is positive, value is shifted left. If count is negative, value is shifted right.

The BSHIFT procedure shifts a bit value by a bit count. The bit value may be shifted left (toward the high order), or right (toward the low order). Zero bits are supplied to fill vacated bit positions when shifting.

Return Data Type: LONG

Example:

!BSHIFT(0110b,1)   returns 1100b

!BSHIFT(0110b,-1)  returns 0011b

Varswitch = BSHIFT(20,3)         !Multiply by eight

Varswitch = BSHIFT(Varswitch,-2) !Divide by four

See Also:

BAND

BOR

BXOR

bshift_return_shifted_bits_.htm.txt · Last modified: 2021/04/15 15:57 (external edit)