BITRSHIFT (Number, ShiftAmount) BITRSHIFT (Number; ShiftAmount)

Number

Number Number

The number to be shifted right.

ShiftAmount

Number Number

The number of bits to shift the number. A negative shift amount shifts the number left instead.

Returns

Number Number

The shifted number.

Shifts a number right by the specified number of bits. Shifting a number right by one bit divides it by two and discards the remainder, so shifting it right by three bits divides it by eight and discards the remainder.

The number and the result must be non-negative integers less than 2 raised to the power of 48. Other numbers result in an error.

Examples

DEC2BIN ( BITRSHIFT ( BIN2DEC ("00010011"), 2), 8)
DEC2BIN ( BITRSHIFT ( BIN2DEC ("00010011"); 2); 8)

Returns "00000100".

BITRSHIFT (19, 2)
BITRSHIFT (19; 2)

Returns 4. This example is equivalent to the preceding example, but does not convert the decimal numbers to binary to ease readability.

BITRSHIFT (19, - 2)
BITRSHIFT (19; - 2)

Returns 76, the same result as BITLSHIFT (19, 2) BITLSHIFT (19; 2).

fxEngine Shell Want this in your own terminal? A standalone version is coming. Get notified.
Loading fxEngine Shell