OpCodes.Add_Ovf 字段

定义

将两个整数相加,执行溢出检查,并且将结果推送到计算堆栈上。Adds two integers, performs an overflow check, and pushes the result onto the evaluation stack.

public: static initonly System::Reflection::Emit::OpCode Add_Ovf;
public static readonly System.Reflection.Emit.OpCode Add_Ovf;
 staticval mutable Add_Ovf : System.Reflection.Emit.OpCode
Public Shared ReadOnly Add_Ovf 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
D6D6 add.ovfadd.ovf 使用溢出检查添加两个有符号整数值。Adds two signed integer values with an overflow check.

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

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

  2. value2 推送到堆栈上。value2 is pushed onto the stack.

  3. value2 和 @no__t 从堆栈中弹出;value1 添加到 @no__t,并检查溢出。value2 and value1 are popped from the stack; value1 is added to value2 with a check for overflow.

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

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

您可以对有符号整数执行此操作。You can perform this operation on signed integers. 对于浮点值,请使用 AddFor floating-point values, use Add.

下表列出了可接受的操作数类型及其对应的结果数据类型。The acceptable operand types and their corresponding result data type are listed in the table below. 如果没有特定类型组合的条目(例如 int32float; int32 和 @no__t 3),则它是无效的 Microsoft 中间语言(MSIL)指令并生成错误。If there is no entry for a particular type combination (for example, int32 and float; int32 and int64), it is an invalid Microsoft Intermediate Language (MSIL) instruction and generates an error.

操作数operand value1 类型value1 type value2 类型value2 type 结果类型result type
addadd int32 int32 int32
添加add int32 native int native int
添加add int32 & &
添加add int32 * *
添加add int64 int64 int64
添加add native int int32 native int
添加add native int native int native int
添加add native int & &
添加add native int * *
添加add F F F
添加add & int32 &
添加add & native int &
添加add * int32 *
addadd * native int *

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

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

适用于