struct UInt16
source · line 7public struct UInt16 : Add<UInt16, UInt16>, Sub<UInt16, UInt16>, Mul<UInt16, UInt16>, Div<UInt16, UInt16>, Rem<UInt16, UInt16>, UnaryPlus<UInt16>, UnaryMinus<UInt16>, Increment<UInt16>, Decrement<UInt16>, Compare<UInt16>, RangeTo<UInt16, UIntRange>, RangeUntil<UInt16, UIntRange>, Equals<UInt16>, ToString, Hash
- Supertype
Add<UInt16, UInt16> - Supertype
Sub<UInt16, UInt16> - Supertype
Mul<UInt16, UInt16> - Supertype
Div<UInt16, UInt16> - Supertype
Rem<UInt16, UInt16> - Supertype
UnaryPlus<UInt16> - Supertype
UnaryMinus<UInt16> - Supertype
Increment<UInt16> - Supertype
Decrement<UInt16> - Supertype
Compare<UInt16> - Supertype
RangeTo<UInt16, UIntRange> - Supertype
RangeUntil<UInt16, UIntRange> - Supertype
Equals<UInt16> - Supertype
ToString - Supertype
Hash
A 16-bit unsigned integer. Arithmetic wraps modulo 2^16; division by zero throws ArithmeticException. Conversions are explicit and preserve the language's fixed-width rules on every target.
Extensions
public fun UShort.toBigDecimal(): BigDecimal· scoop:scoop.math:0.1.0public fun UShort.toBigInteger(): BigInteger· scoop:scoop.math:0.1.0public fun UInt16.toString(radix: Int): String· scoop:scoop.std:0.1.0
function compareTo
source · line 106@NoGC
@Intrinsic("uint16_compare_to")
public override operator fun compareTo(other: UInt16): Long
- Overrides
compareTo· Compare
Returns -1, 0, or 1 using unsigned mathematical ordering.
parameter other
source · line 108other: UInt16
function div
source · line 93@Intrinsic("uint16_div")
public override operator fun div(other: UInt16): UInt16
- Overrides
div· Div
Returns the quotient truncated toward zero. A zero divisor throws ArithmeticException.
parameter other
source · line 94other: UInt16
function until
source · line 231public infix fun until(endpoint: UInt16): UIntRange
Creates an ascending range with an exclusive endpoint.
parameter endpoint
source · line 231endpoint: UInt16
function equals
source · line 36@NoGC
@Intrinsic("uint16_equals")
public override operator fun equals(other: UInt16): Boolean
- Overrides
equals· Equals
Compares the mathematical values of two integers of the same type.
parameter other
source · line 38other: UInt16
function or
source · line 120@NoGC
@Intrinsic("uint16_or")
public infix fun or(other: UInt16): UInt16
Returns the bitwise union of the 16-bit operands.
parameter other
source · line 122other: UInt16
function inc
source · line 58@NoGC
@Intrinsic("uint16_inc")
public override operator fun inc(): UInt16
- Overrides
inc· Increment
Returns the value plus one, wrapping modulo 2^16.
function toInt
source · line 172@NoGC
@Intrinsic("uint16_to_int")
public fun toInt(): Int
Converts modulo 2^32 and interprets the result as a 32-bit signed integer. The conversion always succeeds.
function rangeTo
source · line 219public override operator fun rangeTo(endpoint: UInt16): UIntRange
- Overrides
rangeTo· RangeTo
Creates an ascending range including both this value and the endpoint.
parameter endpoint
source · line 219endpoint: UInt16
function and
source · line 113@NoGC
@Intrinsic("uint16_and")
public infix fun and(other: UInt16): UInt16
Returns the bitwise intersection of the 16-bit operands.
parameter other
source · line 115other: UInt16
function inv
source · line 134@NoGC
@Intrinsic("uint16_inv")
public fun inv(): UInt16
Flips all 16 bits of the representation.
function dec
source · line 65@NoGC
@Intrinsic("uint16_dec")
public override operator fun dec(): UInt16
- Overrides
dec· Decrement
Returns the value minus one, wrapping modulo 2^16.
function toFloat
source · line 24@NoGC @Intrinsic("uint16_to_float")
public fun toFloat(): Float
Rounds the integer directly to IEEE binary32 using round-to-nearest, ties-to-even.
function unaryMinus
source · line 51@NoGC
@Intrinsic("uint16_unary_minus")
public override operator fun unaryMinus(): UInt16
- Overrides
unaryMinus· UnaryMinus
Returns the additive inverse modulo 2^16, including at the representation boundary.
function unaryPlus
source · line 44@NoGC
@Intrinsic("uint16_unary_plus")
public override operator fun unaryPlus(): UInt16
- Overrides
unaryPlus· UnaryPlus
Returns the unchanged integer value.
function xor
source · line 127@NoGC
@Intrinsic("uint16_xor")
public infix fun xor(other: UInt16): UInt16
Sets each result bit where the corresponding 16-bit operand bits differ.
parameter other
source · line 129other: UInt16
function downTo
source · line 237public infix fun downTo(endpoint: UInt16): UIntRange
Creates a descending range including both endpoints.
parameter endpoint
source · line 237endpoint: UInt16
function times
source · line 86@NoGC
@Intrinsic("uint16_mul")
public override operator fun times(other: UInt16): UInt16
- Overrides
times· Mul
Returns the product modulo 2^16; overflow does not throw.
parameter other
source · line 88other: UInt16
function plus
source · line 72@NoGC
@Intrinsic("uint16_add")
public override operator fun plus(other: UInt16): UInt16
- Overrides
plus· Add
Returns the sum modulo 2^16; overflow does not throw.
parameter other
source · line 74other: UInt16
function toUByte
source · line 188@NoGC
@Intrinsic("uint16_to_uint8")
public fun toUByte(): UByte
Converts modulo 2^8 and interprets the result as a 8-bit unsigned integer. The conversion always succeeds.
function hash
source · line 248public override fun hash(): Long
- Overrides
hash· Hash
Returns a hash consistent with same-type integer equality.
function shr
source · line 148@NoGC
@Intrinsic("uint16_shr")
public infix fun shr(count: Long): UInt16
Shifts right using the low 4 bits of the Long count, filling with zero bits.
parameter count
source · line 150count: Long
function toDouble
source · line 30@NoGC @Intrinsic("uint16_to_double")
public fun toDouble(): Double
Rounds the integer directly to IEEE binary64 using round-to-nearest, ties-to-even.
function minus
source · line 79@NoGC
@Intrinsic("uint16_sub")
public override operator fun minus(other: UInt16): UInt16
- Overrides
minus· Sub
Returns the difference modulo 2^16; overflow does not throw.
parameter other
source · line 81other: UInt16
function toLong
source · line 180@NoGC
@Intrinsic("uint16_to_long")
public fun toLong(): Long
Converts modulo 2^64 and interprets the result as a 64-bit signed integer. The conversion always succeeds.
function toString
source · line 243public override fun toString(): String
- Overrides
toString· ToString
Returns the locale-independent decimal representation of this integer.
function shl
source · line 141@NoGC
@Intrinsic("uint16_shl")
public infix fun shl(count: Long): UInt16
Shifts left using the low 4 bits of the Long count; shifted-out bits are discarded.
parameter count
source · line 143count: Long
function toByte
source · line 156@NoGC
@Intrinsic("uint16_to_int8")
public fun toByte(): Byte
Converts modulo 2^8 and interprets the result as a 8-bit signed integer. The conversion always succeeds.
function toShort
source · line 164@NoGC
@Intrinsic("uint16_to_int16")
public fun toShort(): Short
Converts modulo 2^16 and interprets the result as a 16-bit signed integer. The conversion always succeeds.
function toUShort
source · line 196@NoGC
@Intrinsic("uint16_to_uint16")
public fun toUShort(): UShort
Converts modulo 2^16 and interprets the result as a 16-bit unsigned integer. The conversion always succeeds.
function rangeUntil
source · line 225public override operator fun rangeUntil(endpoint: UInt16): UIntRange
- Overrides
rangeUntil· RangeUntil
Creates an ascending range including this value and excluding the endpoint.
parameter endpoint
source · line 225endpoint: UInt16
function toULong
source · line 212@NoGC
@Intrinsic("uint16_to_ulong")
public fun toULong(): ULong
Converts modulo 2^64 and interprets the result as a 64-bit unsigned integer. The conversion always succeeds.
function rem
source · line 100@Intrinsic("uint16_rem")
public override operator fun rem(other: UInt16): UInt16
- Overrides
rem· Rem
Returns the remainder associated with division truncated toward zero. A zero divisor throws ArithmeticException.
parameter other
source · line 101other: UInt16
function toUInt
source · line 204@NoGC
@Intrinsic("uint16_to_uint")
public fun toUInt(): UInt
Converts modulo 2^32 and interprets the result as a 32-bit unsigned integer. The conversion always succeeds.