UShort
@ExperimentalUnsignedTypes inline class UShort : Comparable<UShort>
Functions
and
Performs a bitwise AND operation between the two values.
infix fun and(other: UShort): UShort
compareTo
Compares this value with the specified value for order. Returns zero if this value is equal to the specified other value, a negative number if it's less than other, or a positive number if it's greater than other.
operator fun compareTo(other: UByte): Int
operator fun compareTo(other: UShort): Int
operator fun compareTo(other: UInt): Int
operator fun compareTo(other: ULong): Int
dec
Decrements this value.
operator fun dec(): UShort
div
Divides this value by the other value.
operator fun div(other: UByte): UInt
operator fun div(other: UShort): UInt
operator fun div(other: UInt): UInt
operator fun div(other: ULong): ULong
inc
Increments this value.
operator fun inc(): UShort
inv
Inverts the bits in this value.
fun inv(): UShort
minus
Subtracts the other value from this value.
operator fun minus(other: UByte): UInt
operator fun minus(other: UShort): UInt
operator fun minus(other: UInt): UInt
operator fun minus(other: ULong): ULong
or
Performs a bitwise OR operation between the two values.
infix fun or(other: UShort): UShort
plus
Adds the other value to this value.
operator fun plus(other: UByte): UInt
operator fun plus(other: UShort): UInt
operator fun plus(other: UInt): UInt
operator fun plus(other: ULong): ULong
rangeTo
Creates a range from this value to the specified other value.
operator fun rangeTo(other: UShort): UIntRange
rem
Calculates the remainder of dividing this value by the other value.
operator fun rem(other: UByte): UInt
operator fun rem(other: UShort): UInt
operator fun rem(other: UInt): UInt
operator fun rem(other: ULong): ULong
times
Multiplies this value by the other value.
operator fun times(other: UByte): UInt
operator fun times(other: UShort): UInt
operator fun times(other: UInt): UInt
operator fun times(other: ULong): ULong
toByte
toDouble
toFloat
toInt
toLong
toShort
toString
Returns a string representation of the object.
fun toString(): String
toUByte
toUInt
toULong
toUShort
Returns this value.
fun toUShort(): UShort
xor
Performs a bitwise XOR operation between the two values.
infix fun xor(other: UShort): UShort
Companion Object Properties
MAX_VALUE
A constant holding the maximum value an instance of UShort can have.
const val MAX_VALUE: UShort
MIN_VALUE
A constant holding the minimum value an instance of UShort can have.
const val MIN_VALUE: UShort
SIZE_BITS
The number of bits used to represent an instance of UShort in a binary form.
const val SIZE_BITS: Int
SIZE_BYTES
The number of bytes used to represent an instance of UShort in a binary form.
const val SIZE_BYTES: Int
Extension Functions
coerceAtLeast
Ensures that this value is not less than the specified minimumValue.
fun UShort.coerceAtLeast(minimumValue: UShort): UShort
fun <T : Comparable<T>> T.coerceAtLeast(minimumValue: T): T
coerceAtMost
Ensures that this value is not greater than the specified maximumValue.
fun UShort.coerceAtMost(maximumValue: UShort): UShort
fun <T : Comparable<T>> T.coerceAtMost(maximumValue: T): T
coerceIn
Ensures that this value lies in the specified range minimumValue..maximumValue.
fun UShort.coerceIn( minimumValue: UShort, maximumValue: UShort ): UShort
fun <T : Comparable<T>> T.coerceIn( minimumValue: T?, maximumValue: T? ): T
Ensures that this value lies in the specified range.
fun <T : Comparable<T>> T.coerceIn( range: ClosedFloatingPointRange<T> ): T
fun <T : Comparable<T>> T.coerceIn(range: ClosedRange<T>): T
convert
fun <R : Any> UShort.convert(): R
countLeadingZeroBits
Counts the number of consecutive most significant bits that are zero in the binary representation of this UShort number.
fun UShort.countLeadingZeroBits(): Int
countOneBits
Counts the number of set bits in the binary representation of this UShort number.
fun UShort.countOneBits(): Int
countTrailingZeroBits
Counts the number of consecutive least significant bits that are zero in the binary representation of this UShort number.
fun UShort.countTrailingZeroBits(): Int
downTo
Returns a progression from this value down to the specified to value with the step -1.
infix fun UShort.downTo(to: UShort): UIntProgression
rangeTo
Creates a range from this Comparable value to the specified that value.
operator fun <T : Comparable<T>> T.rangeTo( that: T ): ClosedRange<T>
rotateLeft
rotateRight
takeHighestOneBit
Returns a number having a single bit set in the position of the most significant set bit of this UShort number, or zero, if this number is zero.
fun UShort.takeHighestOneBit(): UShort
takeLowestOneBit
Returns a number having a single bit set in the position of the least significant set bit of this UShort number, or zero, if this number is zero.
fun UShort.takeLowestOneBit(): UShort
toString
© 2010–2020 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/-u-short/index.html