OpCodes.Conv_Ovf_U2_Un 字段

定义

将位于计算堆栈顶部的无符号值转换为 unsigned int16 并将其扩展为 int32,并在溢出时引发 OverflowExceptionConverts the unsigned value on top of the evaluation stack to unsigned int16 and extends it to int32, throwing OverflowException on overflow.

public: static initonly System::Reflection::Emit::OpCode Conv_Ovf_U2_Un;
public static readonly System.Reflection.Emit.OpCode Conv_Ovf_U2_Un;
 staticval mutable Conv_Ovf_U2_Un : System.Reflection.Emit.OpCode
Public Shared ReadOnly Conv_Ovf_U2_Un 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
8787 conv.ovf.u2.unconv.ovf.u2.un 将无符号值转换为 @no__t 0 (在堆栈上为 int32)并在溢出时引发异常。Converts an unsigned value to an unsigned int16 (on the stack as int32) and throw an exception on overflow.

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

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

  2. 从堆栈中弹出 value,并尝试执行转换操作。value is popped from the stack and the conversion operation is attempted. 如果发生溢出,则会引发异常。If overflow occurs, an exception is thrown.

  3. 如果转换成功,则将结果值推送到堆栈上。If the conversion is successful, the resulting value is pushed onto the stack.

@No__t 操作码将堆栈顶部的 value 转换为操作码中指定的类型,并将转换后的值放在堆栈的顶部。The conv.ovf.u2.un opcode converts the value on top of the stack to the type specified in the opcode, and places that converted value on the top of the stack. 如果值太大或太小而无法由目标类型表示,则会引发异常。If the value is too large or too small to be represented by the target type, an exception is thrown.

从浮点数到整数值的转换会将数字截断到零。Conversions from floating-point numbers to integer values truncate the number toward zero. 请注意,在将小于4个字节的整数值加载到计算堆栈上时,将其扩展到 int32 (除非使用 @no__t 或 @no__t,在这种情况下,结果也 @no__t 为-3)。Note that integer values of less than 4 bytes are extended to int32 when they are loaded onto the evaluation stack (unless conv.ovf.i or conv.ovf.u are used, in which case the result is also native int).

如果结果类型中不能表示结果,则会引发 OverflowExceptionOverflowException is thrown if the result can not be represented in the result type.

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

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

适用于