toUShort

inline fun Byte.toUShort(): UShort(source)

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.

Since Kotlin

1.5

inline fun Short.toUShort(): UShort(source)

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.

Since Kotlin

1.5

inline fun Int.toUShort(): UShort(source)

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.

Since Kotlin

1.5

inline fun Long.toUShort(): UShort(source)

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.

Since Kotlin

1.5