shr()

Performs a bitwise right shift operation.

Syntax

shr(value, shift)

Parameters

Parameter Type Description
value Number The integer value to shift.
shift Number The number of bits to shift right.

Return Value

Examples

shr(8, 3);   // returns 1  (1000 >> 3 = 0001)
shr(16, 2);  // returns 4  (10000 >> 2 = 0001)
shr(5, 1);   // returns 2  (0101 >> 1 = 0010)

See also

bit
not
and
or
xor
nand
nor
xnor
shl
shr