OpCodes.Shr 字段


将整数值右移(保留符号)指定的位数,并将结果推送到计算堆栈上。Shifts an integer value (in sign) to the right by a specified number of bits, pushing the result onto the evaluation stack.

public: static initonly System::Reflection::Emit::OpCode Shr;
public static readonly System.Reflection.Emit.OpCode Shr;
 staticval mutable Shr : System.Reflection.Emit.OpCode
Public Shared ReadOnly Shr As OpCode 



下表列出了指令的十六进制和 Microsoft 中间语言(MSIL)程序集格式以及简短的参考摘要:The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary:

格式Format 程序集格式Assembly Format 说明Description
6363 shrshr 向右移动一个整数(移位)。Shifts an integer to the right (shifting in sign).

堆栈转换行为顺序如下:The stack transitional behavior, in sequential order, is:

  1. 将值推送到堆栈上。A value is pushed onto the stack.

  2. 要移动的位数将被推送到堆栈上。The amount of bits to be shifted is pushed onto the stack.

  3. 要移动的位数以及从堆栈中弹出的值的数目;值向右移动指定的位数。The number of bits to be shifted and the value are popped from the stack; the value is shifted right by the specified number of bits.

  4. 将结果推送到堆栈上。The result is pushed onto the stack.

@No__t-0 指令将值(键入 int32int64native int)向右移动指定的位数。The shr.un instruction shifts the value (type int32, int64 or native int) right by the specified number of bits. 位数为 int32native int 类型的值。The number of bits is a value of type int32 or native int. 如果要移位的位数大于或等于所提供值的宽度(以位为单位),则返回值为未指定。The return value is unspecified if the number of bits to be shifted is greater than or equal to the width (in bits) of the supplied value.

Shr 会在每次移位时复制高序位,同时保留 @no__t 中原始值的符号。Shr replicates the high order bit on each shift, preserving the sign of the original value in the result.

以下 @no__t 0 方法重载可以使用 @no__t 操作码:The following Emit method overload can use the shr opcode:

  • ILGenerator.Emit(OpCode)ILGenerator.Emit(OpCode)