OpCodes.Conv_R_Un 字段


将位于计算堆栈顶部的无符号整数值转换为 float32Converts the unsigned integer value on top of the evaluation stack to float32.

public: static initonly System::Reflection::Emit::OpCode Conv_R_Un;
public static readonly System.Reflection.Emit.OpCode Conv_R_Un;
 staticval mutable Conv_R_Un : System.Reflection.Emit.OpCode
Public Shared ReadOnly Conv_R_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
7676 约定conv.r.un 将无符号整数转换为浮点,并将 F 推送到堆栈上。Convert unsigned integer to floating-point, pushing F on stack.

堆栈转换行为顺序如下: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.

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

@No__t 操作码将堆栈顶部的 value 转换为操作码中指定的类型,并将转换后的值保留在堆栈的顶部。The conv.r.un opcode converts the value on top of the stack to the type specified in the opcode, and leave that converted value on the top of the stack. 小于4个字节的整数值在加载到计算堆栈时将扩展到 int32 (除非使用 @no__t 或 conv.u,在这种情况下,结果也 native int)。Integer values of less than 4 bytes are extended to int32 when they are loaded onto the evaluation stack (unless conv.i or conv.u is used, in which case the result is also native int). 浮点值将转换为 @no__t 类型。Floating-point values are converted to the F type.

从浮点数到整数值的转换会将数字截断到零。Conversion from floating-point numbers to integer values truncates the number toward zero. float64 转换到 @no__t 时,精度可能会丢失。When converting from a float64 to a float32, precision can be lost. 如果 value 太大,无法容纳 float32 (F)、正无穷(如果 value 为正)或负无穷(如果 value 为负数)。If value is too large to fit in a float32 (F), positive infinity (if value is positive) or negative infinity (if value is negative) is returned. 如果在将一个整数类型转换为另一个整数类型时发生溢出,则会截断高序位。If overflow occurs converting one integer type to another, the high order bits are truncated. 如果结果小于 int32,则值将进行符号扩展以填充槽。If the result is smaller than an int32, the value is sign-extended to fill the slot.

如果在将浮点类型转换为整数时出现溢出,则不指定返回 resultIf overflow occurs converting a floating-point type to an integer the result returned is unspecified. @No__t 0 操作从堆栈中提取一个整数,将其解释为无符号的整数,并将其替换为浮点数以表示整数 @no__t:如果此宽度足以表示整数而不丢失精度,则为,否则为 float64The conv.r.un operation takes an integer off the stack, interprets it as unsigned, and replaces it with a floating-point number to represent the integer: either a float32, if this is wide enough to represent the integer without loss of precision, or else a float64.

使用此字段时,不会引发异常。No exceptions are ever thrown when using this field.

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

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