Int

A signed 32-bit integer with values from -2,147,483,648 through 2,147,483,647.

Integer addition, subtraction and multiplication wrap on overflow. Division truncates towards zero; integer division and remainder by zero throw ArithmeticException. Shift counts use only their lowest five bits. Mixed arithmetic uses the signature's result type.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
val Int.sign: Int

Functions

Link copied to clipboard
infix external fun and(other: Int): Int

Returns the bitwise AND of this value and other.

Link copied to clipboard
infix fun Int.by(height: Int): Size2i

A size-oriented synonym for xy; negative components remain valid vectors.

Link copied to clipboard
operator external fun compareTo(other: Byte): Int
operator external fun compareTo(other: Double): Int
operator external fun compareTo(other: Float): Int
open operator external override fun compareTo(other: Int): Int
operator external fun compareTo(other: Long): Int
operator external fun compareTo(other: Short): Int

Compares this value with other after numeric promotion.

Link copied to clipboard
operator external fun dec(): Int

Returns this value minus one.

Link copied to clipboard
operator external fun div(other: Byte): Int
operator external fun div(other: Double): Double
operator external fun div(other: Float): Float
operator external fun div(other: Int): Int
operator external fun div(other: Long): Long
operator external fun div(other: Short): Int

Divides this value by other.

Link copied to clipboard
infix fun Int.downTo(other: Byte): IntProgression
infix fun Int.downTo(other: Int): IntProgression
infix fun Int.downTo(other: Long): LongProgression
infix fun Int.downTo(other: Short): IntProgression

Creates a descending progression from this value down to other, inclusive.

Link copied to clipboard
operator external fun inc(): Int

Returns this value plus one.

Link copied to clipboard
external fun inv(): Int

Inverts all 32 bits of this value.

Link copied to clipboard
operator external fun minus(other: Byte): Int
operator external fun minus(other: Double): Double
operator external fun minus(other: Float): Float
operator external fun minus(other: Int): Int
operator external fun minus(other: Long): Long
operator external fun minus(other: Short): Int

Subtracts other from this value.

Link copied to clipboard
infix external fun or(other: Int): Int

Returns the bitwise OR of this value and other.

Link copied to clipboard
operator external fun plus(other: Byte): Int
operator external fun plus(other: Double): Double
operator external fun plus(other: Float): Float
operator external fun plus(other: Int): Int
operator external fun plus(other: Long): Long
operator external fun plus(other: Short): Int

Adds other to this value.

Link copied to clipboard
operator fun Int.rangeTo(other: Byte): IntRange
operator fun Int.rangeTo(other: Int): IntRange
operator fun Int.rangeTo(other: Long): LongRange
operator fun Int.rangeTo(other: Short): IntRange

Creates an ascending range from this value up to other, inclusive.

Link copied to clipboard
operator fun Int.rangeUntil(other: Byte): IntRange
operator fun Int.rangeUntil(other: Int): IntRange
operator fun Int.rangeUntil(other: Long): LongRange
operator fun Int.rangeUntil(other: Short): IntRange

Creates an ascending range from this value up to other, exclusive.

Link copied to clipboard
operator external fun rem(other: Byte): Int
operator external fun rem(other: Double): Double
operator external fun rem(other: Float): Float
operator external fun rem(other: Int): Int
operator external fun rem(other: Long): Long
operator external fun rem(other: Short): Int

Returns the remainder after dividing this value by other.

Link copied to clipboard
infix external fun shl(bitCount: Int): Int

Shifts this value left, discarding bits that leave the value and filling low bits with zeros.

Link copied to clipboard
infix external fun shr(bitCount: Int): Int

Shifts this value right, filling high bits with the sign bit.

Link copied to clipboard
operator external fun times(other: Byte): Int
operator external fun times(other: Double): Double
operator external fun times(other: Float): Float
operator external fun times(other: Int): Int
operator external fun times(other: Long): Long
operator external fun times(other: Short): Int

Multiplies this value by other.

Link copied to clipboard
operator fun Int.times(vector: Vector2i): Vector2i
operator fun Int.times(vector: Vector3i): Vector3i
Link copied to clipboard
external fun toByte(): Byte

Converts this value to Byte.

Link copied to clipboard
external fun toChar(): Char

Converts this value to a UTF-16 code unit using its lowest 16 integer bits.

Link copied to clipboard
external fun toDouble(): Double

Converts this value to Double.

Link copied to clipboard
external fun toFloat(): Float

Converts this value to Float.

Link copied to clipboard
external fun toInt(): Int

Returns this value unchanged.

Link copied to clipboard
external fun toLong(): Long

Converts this value to Long.

Link copied to clipboard
external fun toShort(): Short

Converts this value to Short.

Link copied to clipboard
external fun toUByte(): UByte

Converts this value to UByte.

Link copied to clipboard
external fun toUInt(): UInt

Converts this value to UInt.

Link copied to clipboard
external fun toULong(): ULong

Converts this value to ULong.

Link copied to clipboard
external fun toUShort(): UShort

Converts this value to UShort.

Link copied to clipboard
operator external fun unaryMinus(): Int

Returns the negation of this value.

Link copied to clipboard
operator external fun unaryPlus(): Int

Returns this value with the type shown in the signature.

Link copied to clipboard
infix fun Int.until(other: Byte): IntRange
infix fun Int.until(other: Int): IntRange
infix fun Int.until(other: Long): LongRange
infix fun Int.until(other: Short): IntRange

Creates an ascending range from this value up to other, exclusive.

Link copied to clipboard
infix external fun ushr(bitCount: Int): Int

Shifts this value right, filling high bits with zeros.

Link copied to clipboard
infix external fun xor(other: Int): Int

Returns the bitwise exclusive OR of this value and other.

Link copied to clipboard
infix fun Int.xy(y: Int): Vector2i