struct UInt
source · line 7public struct UInt : Add<UInt, UInt>, Sub<UInt, UInt>, Mul<UInt, UInt>, Div<UInt, UInt>, Rem<UInt, UInt>, UnaryPlus<UInt>, UnaryMinus<UInt>, Increment<UInt>, Decrement<UInt>, Compare<UInt>, RangeTo<UInt, UIntRange>, RangeUntil<UInt, UIntRange>, Equals<UInt>, ToString, Hash
- Supertype
Add<UInt, UInt> - Supertype
Sub<UInt, UInt> - Supertype
Mul<UInt, UInt> - Supertype
Div<UInt, UInt> - Supertype
Rem<UInt, UInt> - Supertype
UnaryPlus<UInt> - Supertype
UnaryMinus<UInt> - Supertype
Increment<UInt> - Supertype
Decrement<UInt> - Supertype
Compare<UInt> - Supertype
RangeTo<UInt, UIntRange> - Supertype
RangeUntil<UInt, UIntRange> - Supertype
Equals<UInt> - Supertype
ToString - Supertype
Hash
A 32-bit unsigned integer. Arithmetic wraps modulo 2^32; division by zero throws ArithmeticException. Conversions are explicit and preserve the language's fixed-width rules on every target.
Extensions
public fun UInt.toBigInteger(): BigInteger· scoop:scoop.math:0.1.0public fun UInt.toString(radix: Int): String· scoop:scoop.std:0.1.0public fun UInt.toBigDecimal(): BigDecimal· scoop:scoop.math:0.1.0
function toDouble
source · line 30@NoGC @Intrinsic("uint_to_double")
public fun toDouble(): Double
Rounds the integer directly to IEEE binary64 using round-to-nearest, ties-to-even.
function toUInt
source · line 204@NoGC
@Intrinsic("uint_to_uint")
public fun toUInt(): UInt
Converts modulo 2^32 and interprets the result as a 32-bit unsigned 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 or
source · line 120@NoGC
@Intrinsic("uint_or")
public infix fun or(other: UInt): UInt
Returns the bitwise union of the 32-bit operands.
parameter other
source · line 122other: UInt
function toUShort
source · line 196@NoGC
@Intrinsic("uint_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 inc
source · line 58@NoGC
@Intrinsic("uint_inc")
public override operator fun inc(): UInt
- Overrides
inc· Increment
Returns the value plus one, wrapping modulo 2^32.
function xor
source · line 127@NoGC
@Intrinsic("uint_xor")
public infix fun xor(other: UInt): UInt
Sets each result bit where the corresponding 32-bit operand bits differ.
parameter other
source · line 129other: UInt
function toLong
source · line 180@NoGC
@Intrinsic("uint_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 rem
source · line 100@Intrinsic("uint_rem")
public override operator fun rem(other: UInt): UInt
- Overrides
rem· Rem
Returns the remainder associated with division truncated toward zero. A zero divisor throws ArithmeticException.
parameter other
source · line 101other: UInt
function div
source · line 93@Intrinsic("uint_div")
public override operator fun div(other: UInt): UInt
- Overrides
div· Div
Returns the quotient truncated toward zero. A zero divisor throws ArithmeticException.
parameter other
source · line 94other: UInt
function toFloat
source · line 24@NoGC @Intrinsic("uint_to_float")
public fun toFloat(): Float
Rounds the integer directly to IEEE binary32 using round-to-nearest, ties-to-even.
function shr
source · line 148@NoGC
@Intrinsic("uint_shr")
public infix fun shr(count: Long): UInt
Shifts right using the low 5 bits of the Long count, filling with zero bits.
parameter count
source · line 150count: Long
function unaryPlus
source · line 44@NoGC
@Intrinsic("uint_unary_plus")
public override operator fun unaryPlus(): UInt
- Overrides
unaryPlus· UnaryPlus
Returns the unchanged integer value.
function downTo
source · line 237public infix fun downTo(endpoint: UInt): UIntRange
Creates a descending range including both endpoints.
parameter endpoint
source · line 237endpoint: UInt
function equals
source · line 36@NoGC
@Intrinsic("uint_equals")
public override operator fun equals(other: UInt): Boolean
- Overrides
equals· Equals
Compares the mathematical values of two integers of the same type.
parameter other
source · line 38other: UInt
function minus
source · line 79@NoGC
@Intrinsic("uint_sub")
public override operator fun minus(other: UInt): UInt
- Overrides
minus· Sub
Returns the difference modulo 2^32; overflow does not throw.
parameter other
source · line 81other: UInt
function compareTo
source · line 106@NoGC
@Intrinsic("uint_compare_to")
public override operator fun compareTo(other: UInt): Long
- Overrides
compareTo· Compare
Returns -1, 0, or 1 using unsigned mathematical ordering.
parameter other
source · line 108other: UInt
function toULong
source · line 212@NoGC
@Intrinsic("uint_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 rangeUntil
source · line 225public override operator fun rangeUntil(endpoint: UInt): UIntRange
- Overrides
rangeUntil· RangeUntil
Creates an ascending range including this value and excluding the endpoint.
parameter endpoint
source · line 225endpoint: UInt
function and
source · line 113@NoGC
@Intrinsic("uint_and")
public infix fun and(other: UInt): UInt
Returns the bitwise intersection of the 32-bit operands.
parameter other
source · line 115other: UInt
function shl
source · line 141@NoGC
@Intrinsic("uint_shl")
public infix fun shl(count: Long): UInt
Shifts left using the low 5 bits of the Long count; shifted-out bits are discarded.
parameter count
source · line 143count: Long
function unaryMinus
source · line 51@NoGC
@Intrinsic("uint_unary_minus")
public override operator fun unaryMinus(): UInt
- Overrides
unaryMinus· UnaryMinus
Returns the additive inverse modulo 2^32, including at the representation boundary.
function toShort
source · line 164@NoGC
@Intrinsic("uint_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 toInt
source · line 172@NoGC
@Intrinsic("uint_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 dec
source · line 65@NoGC
@Intrinsic("uint_dec")
public override operator fun dec(): UInt
- Overrides
dec· Decrement
Returns the value minus one, wrapping modulo 2^32.
function rangeTo
source · line 219public override operator fun rangeTo(endpoint: UInt): UIntRange
- Overrides
rangeTo· RangeTo
Creates an ascending range including both this value and the endpoint.
parameter endpoint
source · line 219endpoint: UInt
function plus
source · line 72@NoGC
@Intrinsic("uint_add")
public override operator fun plus(other: UInt): UInt
- Overrides
plus· Add
Returns the sum modulo 2^32; overflow does not throw.
parameter other
source · line 74other: UInt
function inv
source · line 134@NoGC
@Intrinsic("uint_inv")
public fun inv(): UInt
Flips all 32 bits of the representation.
function hash
source · line 248public override fun hash(): Long
- Overrides
hash· Hash
Returns a hash consistent with same-type integer equality.
function toUByte
source · line 188@NoGC
@Intrinsic("uint_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 times
source · line 86@NoGC
@Intrinsic("uint_mul")
public override operator fun times(other: UInt): UInt
- Overrides
times· Mul
Returns the product modulo 2^32; overflow does not throw.
parameter other
source · line 88other: UInt
function toByte
source · line 156@NoGC
@Intrinsic("uint_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 until
source · line 231public infix fun until(endpoint: UInt): UIntRange
Creates an ascending range with an exclusive endpoint.
parameter endpoint
source · line 231endpoint: UInt