OpCodes.Conv_R4 字段
定义
将位于计算堆栈顶部的值转换为 float32。Converts the value on top of the evaluation stack to float32.
public: static initonly System::Reflection::Emit::OpCode Conv_R4;
public static readonly System.Reflection.Emit.OpCode Conv_R4;
staticval mutable Conv_R4 : System.Reflection.Emit.OpCode
Public Shared ReadOnly Conv_R4 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 |
|---|---|---|
| 606B | r4conv.r4 | 转换为 float32 ,推送 F 堆栈。Convert to float32, pushing F on stack. |
堆栈转换行为顺序如下: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 the conversion is successful, the resulting value is pushed onto the stack.
conv.r4操作码将 value 堆栈顶部的转换为操作码中指定的类型,并将转换后的值保留在堆栈的顶部。The conv.r4 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 计算堆栈上时将扩展到 (除非 conv.i 使用或 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). 将浮点值转换为 F 类型。Floating-point values are converted to the F type.
从浮点数到整数值的转换会将数字截断到零。Conversion from floating-point numbers to integer values truncates the number toward zero. 从转换到时 float64 float32 ,精度可能会丢失。When converting from an float64 to an 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.
如果发生溢出,将浮点类型转换为整数,则返回的值是未指定的。If overflow occurs converting a floating-point type to an integer the value returned is unspecified.
使用此字段时,不会引发异常。No exceptions are ever thrown when using this field.
以下 Emit 方法重载可以使用 conv.r4 操作码:The following Emit method overload can use the conv.r4 opcode: