toUShort
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.
fun Short.toUShort(): UShort
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.
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.
© 2010–2021 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/to-u-short.html