OpCodes.Rem 字段


将两个值相除并将余数推送到计算堆栈上。Divides two values and pushes the remainder onto the evaluation stack.

public: static initonly System::Reflection::Emit::OpCode Rem;
public static readonly System.Reflection.Emit.OpCode Rem;
 staticval mutable Rem : System.Reflection.Emit.OpCode
Public Shared ReadOnly Rem 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
5D5D remrem 将 @no__t @no__t 除以0的剩余部分推送到堆栈上。Pushes the remainder of dividing value1 by value2 onto the stack.

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

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

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

  3. value2 和 @no__t 从堆栈中弹出,并计算 @no__t 2 div @no__t 计算。value2 and value1 are popped from the stack and the remainder of value1 div value2 computed.

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

result @ no__t-1 @ no__t value1 rem 满足以下条件:result = value1 rem value2 satisfies the following conditions:

result @ no__t-1 @ no__t-2 @ @no__t no__t (value1 div value2),并执行以下操作:result = value1 - value2 × (value1 div value2), and:

0 = | result | < | value2 |、sign (result) = sign (value1),其中 div 是截断到零的除法指令。0 = | result | < | value2 |, sign(result) = sign(value1), where div is the division instruction that truncates towards zero.

如果 @no__t 0 为零或 value1 为无穷,则结果为 NaN。If value2 is zero or value1 is infinity the result is NaN. 如果 @no__t 为无穷,则结果为 value1 (对 @no__t 求反)。If value2 is infinity, the result is value1 (negated for -infinity).

如果 value2 为零,则整数运算引发 DivideByZeroExceptionIntegral operations throw DivideByZeroException if value2 is zero.

请注意,在基于 Intel 的平台上,计算(minint rem-1)会引发 OverflowExceptionNote that on the Intel-based platforms an OverflowException is thrown when computing (minint rem -1).

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

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