toUShort

Common
JVM
JS
Native
1.3
@ExperimentalUnsignedTypes fun Byte.toUShort(): UShort

Converts this Byte value to UShort.

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

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

Common
JVM
JS
Native
1.3
@ExperimentalUnsignedTypes fun Short.toUShort(): UShort

Converts this Short value to UShort.

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

The resulting UShort value has the same binary representation as this Short value.

Common
JVM
JS
Native
1.3
@ExperimentalUnsignedTypes fun Int.toUShort(): UShort

Converts this Int value to UShort.

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

The resulting UShort value is represented by the least significant 16 bits of this Int value.

Common
JVM
JS
Native
1.3
@ExperimentalUnsignedTypes fun Long.toUShort(): UShort

Converts this Long value to UShort.

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

The resulting UShort value is represented by the least significant 16 bits of this Long value.