首页 > lang > shr 
 en fr de es it nl pl pt pt_BR mk sq ca hu cs tr ar fa id vi ko ja ru zh eo
前一个  下一个  编辑  重命名  撤销  搜索  管理  
文档  
警告! 该页面未翻译。  参见英文版 
Shr
Value = Shr ( Number , Bit )

Returns Number shifted to the right by Bit bits. The sign of Number is kept.

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 of Number Range of Bit
Byte 0...7
Short 0...15
Integer 0...31
Long 0...63

The datatype of the return value is the datatype of Number.

错误

消息说明
Type mismatch (6) The datatype of the Number argument is not valid.
Bad argument (20) The Bit argument is out of range.

Example

PRINT Bin(11, 32), 11
PRINT Bin(Shr(11, 2), 32), Shr(11, 2)

00000000000000000000000000001011        11
00000000000000000000000000000010        2

PRINT Bin(-11, 32), -11
PRINT Bin(Shr(-11, 2), 32), Shr(-11, 2)

11111111111111111111111111110101        -11
11111111111111111111111111111101        -3

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

PRINT Asr(CByte(-64), 2)

48

参见

Bits Manipulation Functions, Logical Operators