Home / lang / shr 
Shr
Syntax
Value = Shr ( Number , Bit AS Integer )

Returns Number shifted to the right by Bit bits. The sign of Number is kept. (Except if Number is a Byte)

The type of Number may be Byte, Short, Integer, or Long

The valid range of Bit depends on the type of the Number argument:

Type Range of Bit
Byte 0...15
Short 0...15
Integer 0...31
Long 0...63

Examples

PRINT Shr(11, 3)
<hr>1

PRINT Shr(-11, 3)
<hr>-2

Asr with a negative Byte Number argument will not keep the sign because the datatype Byte is always unsigned.

PRINT Asr(CByte(-64), 2)
<hr>48

See also

Bits Manipulation Functions  Logical Operators