OpCodes.Add 字段
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
将两个值相加,并将结果推送到计算堆栈。
public: static initonly System::Reflection::Emit::OpCode Add;
public static readonly System.Reflection.Emit.OpCode Add;
staticval mutable Add : System.Reflection.Emit.OpCode
Public Shared ReadOnly Add As OpCode
字段值
注解
下表列出了指令的十六进制和Microsoft中间语言(MSIL)程序集格式,以及简短的参考摘要:
| Format | 程序集格式 | Description |
|---|---|---|
| 58 | 添加 | 添加两个数值,返回新的数值。 |
堆栈过渡行为按顺序排列,为:
value1被推送到堆栈上。value2被推送到堆栈上。value2并从value1堆栈中弹出;value1被添加到value2。结果被推送到堆栈上。
整数操作未检测到溢出(有关正确溢出处理,请参阅 Add_Ovf)。
整数加法换行,而不是饱和。 例如,假设 8 位整数 value1 设置为 255 且 value2 设置为 1,则包装的结果为 0 而不是 256。
浮点溢出返回 +inf (PositiveInfinity) 或 -inf (NegativeInfinity)。
下表中列出了可接受的操作数类型及其相应的结果数据类型。 如果特定类型组合没有条目(例如,int32 和 float; int32 和 int64),则它是无效的Microsoft中间语言(MSIL)并生成错误。
| 操作数 | value1 类型 | value2 类型 | 结果类型 |
|---|---|---|---|
| 添加 | int32 |
int32 |
int32 |
| 添加 | int32 |
native int |
native int |
| 添加 | int32 |
& |
& |
| 添加 | int32 |
* |
* |
| 添加 | int64 |
int64 |
int64 |
| 添加 | native int |
int32 |
native int |
| 添加 | native int |
native int |
native int |
| 添加 | native int |
& |
& |
| 添加 | native int |
* |
* |
| 添加 | F |
F |
F |
| 添加 | & |
int32 |
& |
| 添加 | & |
native int |
& |
| 添加 | * |
int32 |
* |
| 添加 | * |
native int |
* |
以下 Emit 方法重载可以使用 add 操作码: