toUInt

Common
JVM
JS
Native
1.3
@ExperimentalUnsignedTypes fun Byte.toUInt(): UInt

Converts this Byte value to UInt.

If this value is positive, the resulting UInt value represents the same numerical value as this Byte.

The least significant 8 bits of the resulting UInt value are the same as the bits of this Byte value, whereas the most significant 24 bits are filled with the sign bit of this value.

Common
JVM
JS
Native
1.3
@ExperimentalUnsignedTypes fun Short.toUInt(): UInt

Converts this Short value to UInt.

If this value is positive, the resulting UInt value represents the same numerical value as this Short.

The least significant 16 bits of the resulting UInt value are the same as the bits of this Short value, whereas the most significant 16 bits are filled with the sign bit of this value.

Common
JVM
JS
Native
1.3
@ExperimentalUnsignedTypes fun Int.toUInt(): UInt

Converts this Int value to UInt.

If this value is positive, the resulting UInt value represents the same numerical value as this Int.

The resulting UInt value has the same binary representation as this Int value.

Common
JVM
JS
Native
1.3
@ExperimentalUnsignedTypes fun Long.toUInt(): UInt

Converts this Long value to UInt.

If this value is positive and less than or equals to UInt.MAX_VALUE, the resulting UInt value represents the same numerical value as this Long.

The resulting UInt value is represented by the least significant 32 bits of this Long value.

Common
JVM
JS
Native
1.3
@ExperimentalUnsignedTypes fun Float.toUInt(): UInt

Converts this Float value to UInt.

The fractional part, if any, is rounded down. Returns zero if this Float value is negative or NaN, UInt.MAX_VALUE if it's bigger than UInt.MAX_VALUE.

Common
JVM
JS
Native
1.3
@ExperimentalUnsignedTypes fun Double.toUInt(): UInt

Converts this Double value to UInt.

The fractional part, if any, is rounded down. Returns zero if this Double value is negative or NaN, UInt.MAX_VALUE if it's bigger than UInt.MAX_VALUE.