Scoop API

scoop:scoop.core:0.1.0

Int

struct Int

source · line 4
public
public struct Int : Add<Int, Int>, Sub<Int, Int>, Mul<Int, Int>, Div<Int, Int>, Rem<Int, Int>, UnaryPlus<Int>, UnaryMinus<Int>, Increment<Int>, Decrement<Int>, Compare<Int>, RangeTo<Int, IntRange>, RangeUntil<Int, IntRange>, Equals<Int>, ToString, Hash

A signed integer value with arithmetic and comparison operations.

Extensions

function toByte

source · line 164
public
@NoGC
    @Intrinsic("int_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 plus

source · line 72
public
@NoGC
    @Intrinsic("int_add")
    public override operator fun plus(other: Int): Int
  • Overrides plus · Add

Returns the sum modulo 2^32; overflow does not throw.

function toUInt

source · line 212
public
@NoGC
    @Intrinsic("int_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 toLong

source · line 188
public
@NoGC
    @Intrinsic("int_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 251
public
public override fun toString(): String

Returns the locale-independent decimal representation of this integer.

function shr

source · line 149
public
@NoGC
    @Intrinsic("int_shr")
    public infix fun shr(count: Long): Int

Shifts right using the low 5 bits of the Long count, replicating the sign bit.

function rem

source · line 101
public
@Intrinsic("int_rem")
    public override operator fun rem(other: Int): Int
  • Overrides rem · Rem

Returns the remainder associated with division truncated toward zero. A zero divisor throws ArithmeticException. A nonzero remainder has the dividend's sign.

function toFloat

source · line 21
public
@NoGC @Intrinsic("int_to_float")
    public fun toFloat(): Float

Rounds the integer directly to IEEE binary32 using round-to-nearest, ties-to-even.

function toDouble

source · line 27
public
@NoGC @Intrinsic("int_to_double")
    public fun toDouble(): Double

Rounds the integer directly to IEEE binary64 using round-to-nearest, ties-to-even.

function unaryPlus

source · line 44
public
@NoGC
    @Intrinsic("int_unary_plus")
    public override operator fun unaryPlus(): Int

Returns the unchanged integer value.

function xor

source · line 128
public
@NoGC
    @Intrinsic("int_xor")
    public infix fun xor(other: Int): Int

Sets each result bit where the corresponding 32-bit operand bits differ.

function minus

source · line 79
public
@NoGC
    @Intrinsic("int_sub")
    public override operator fun minus(other: Int): Int

Returns the difference modulo 2^32; overflow does not throw.

function inv

source · line 135
public
@NoGC
    @Intrinsic("int_inv")
    public fun inv(): Int

Flips all 32 bits of the representation.

function inc

source · line 58
public
@NoGC
    @Intrinsic("int_inc")
    public override operator fun inc(): Int
  • Overrides inc · Increment

Returns the value plus one, wrapping modulo 2^32.

function equals

source · line 36
public
@NoGC
    @Intrinsic("int_equals")
    public override operator fun equals(other: Int): Boolean

Compares the mathematical values of two integers of the same type.

function shl

source · line 142
public
@NoGC
    @Intrinsic("int_shl")
    public infix fun shl(count: Long): Int

Shifts left using the low 5 bits of the Long count; shifted-out bits are discarded.

function div

source · line 94
public
@Intrinsic("int_div")
    public override operator fun div(other: Int): Int
  • Overrides div · Div

Returns the quotient truncated toward zero. A zero divisor throws ArithmeticException. The minimum value divided by -1 wraps to the minimum value.

function unaryMinus

source · line 51
public
@NoGC
    @Intrinsic("int_unary_minus")
    public override operator fun unaryMinus(): Int

Returns the additive inverse modulo 2^32, including at the representation boundary.

function toInt

source · line 180
public
@NoGC
    @Intrinsic("int_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 toUShort

source · line 204
public
@NoGC
    @Intrinsic("int_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 toULong

source · line 220
public
@NoGC
    @Intrinsic("int_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 hash

source · line 256
public
public override fun hash(): Long
  • Overrides hash · Hash

Returns a hash consistent with same-type integer equality.

function times

source · line 86
public
@NoGC
    @Intrinsic("int_mul")
    public override operator fun times(other: Int): Int

Returns the product modulo 2^32; overflow does not throw.

function toUByte

source · line 196
public
@NoGC
    @Intrinsic("int_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 dec

source · line 65
public
@NoGC
    @Intrinsic("int_dec")
    public override operator fun dec(): Int
  • Overrides dec · Decrement

Returns the value minus one, wrapping modulo 2^32.

function compareTo

source · line 107
public
@NoGC
    @Intrinsic("int_compare_to")
    public override operator fun compareTo(other: Int): Long

Returns -1, 0, or 1 using signed mathematical ordering.

function toShort

source · line 172
public
@NoGC
    @Intrinsic("int_to_int16")
    public fun toShort(): Short

Converts modulo 2^16 and interprets the result as a 16-bit signed integer. The conversion always succeeds.