Short

A signed 16-bit integer with values from -32,768 through 32,767.

Arithmetic with Byte, Short or Int operands produces Int; wider operands determine the result type shown in the signature. inc, dec and conversion back to Short wrap to 16 bits. Bitwise extensions are available in kotlin.experimental.

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
infix fun Short.and(other: Short): Short

Returns the bitwise AND of this value and other.

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
operator external fun compareTo(other: Int): Int
operator external fun compareTo(other: Long): Int
open operator external override fun compareTo(other: Short): Int

Compares this value with other after numeric promotion.

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

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 Short.downTo(other: Byte): IntProgression
infix fun Short.downTo(other: Int): IntProgression
infix fun Short.downTo(other: Long): LongProgression
infix fun Short.downTo(other: Short): IntProgression

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

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

Returns this value plus one.

Link copied to clipboard
fun Short.inv(): Short

Inverts all 16 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 fun Short.or(other: Short): Short

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 Short.rangeTo(other: Byte): IntRange
operator fun Short.rangeTo(other: Int): IntRange
operator fun Short.rangeTo(other: Long): LongRange
operator fun Short.rangeTo(other: Short): IntRange

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

Link copied to clipboard
operator fun Short.rangeUntil(other: Byte): IntRange
operator fun Short.rangeUntil(other: Int): IntRange
operator fun Short.rangeUntil(other: Long): LongRange
operator fun Short.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
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
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

Converts this value to Int.

Link copied to clipboard
external fun toLong(): Long

Converts this value to Long.

Link copied to clipboard
external fun toShort(): Short

Returns this value unchanged.

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 Short.until(other: Byte): IntRange
infix fun Short.until(other: Int): IntRange
infix fun Short.until(other: Long): LongRange
infix fun Short.until(other: Short): IntRange

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

Link copied to clipboard
infix fun Short.xor(other: Short): Short

Returns the bitwise exclusive OR of this value and other.