Conv_U Field
Collapse the table of content
Expand the table of content

OpCodes.Conv_U Field


Converts the value on top of the evaluation stack to unsigned native int, and extends it to native int.

Namespace:   System.Reflection.Emit
Assembly:  mscorlib (in mscorlib.dll)

public static readonly OpCode Conv_U

The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary:


Assembly Format




Convert to unsigned native int, pushing native int on stack.

The stack transitional behavior, in sequential order, is:

  1. value is pushed onto the stack.

  2. 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.

The conv.u 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. 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). Floating-point values are converted to the F type.

Conversion from floating-point numbers to integer values truncates the number toward zero. When converting from an float64 to an float32, precision can be lost. 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. 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. See Conv_Ovf_I and Conv_Ovf_I_Un for equivalent instructions that will throw an exception when the result type can not properly represent the result value.

The following Emit method overload can use the conv.u opcode:

  • ILGenerator.Emit(OpCode)

Universal Windows Platform
Available since 4.5
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Available since 2.0
Windows Phone Silverlight
Available since 7.1
Windows Phone
Available since 8.1
Return to top
© 2015 Microsoft