OpCodes.Conv_Ovf_I 字段
定义
将位于计算堆栈顶部的有符号值转换为有符号的 native int,并在溢出时引发 OverflowException 。Converts the signed value on top of the evaluation stack to signed native int, throwing OverflowException on overflow.
public: static initonly System::Reflection::Emit::OpCode Conv_Ovf_I;
public static readonly System.Reflection.Emit.OpCode Conv_Ovf_I;
staticval mutable Conv_Ovf_I : System.Reflection.Emit.OpCode
Public Shared ReadOnly Conv_Ovf_I 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 |
|---|---|---|
| D4D4 | ovf。 iconv.ovf.i | 转换为 native int 堆栈上的 (native int ,) 并在溢出时引发异常。Convert to a native int (on the stack as native int) and throw an exception on overflow. |
堆栈转换行为顺序如下:The stack transitional behavior, in sequential order, is:
value被推送到堆栈上。valueis pushed onto the stack.value从堆栈中弹出,并尝试执行转换操作。valueis popped from the stack and the conversion operation is attempted. 如果发生溢出,则会引发异常。If overflow occurs, an exception is thrown.如果转换成功,则将结果值推送到堆栈上。If the conversion is successful, the resulting value is pushed onto the stack.
conv.ovf.i操作码将 value 堆栈顶部的转换为操作码中指定的类型,并将转换后的值置于堆栈的顶部。The conv.ovf.i 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 加载到计算堆栈上时将扩展到 (除非 conv.ovf.i conv.ovf.u 使用或,在这种情况下,还将 native int) 结果。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).
OverflowException 如果结果不能用结果类型表示,则会引发。OverflowException is thrown if the result can not be represented in the result type.
以下 Emit 方法重载可以使用 conv.ovf.i 操作码:The following Emit method overload can use the conv.ovf.i opcode: