struct Int16
source · line 7public struct Int16 : Add<Int16, Int16>, Sub<Int16, Int16>, Mul<Int16, Int16>, Div<Int16, Int16>, Rem<Int16, Int16>, UnaryPlus<Int16>, UnaryMinus<Int16>, Increment<Int16>, Decrement<Int16>, Compare<Int16>, RangeTo<Int16, IntRange>, RangeUntil<Int16, IntRange>, Equals<Int16>, ToString, Hash
- Supertype
Add<Int16, Int16> - Supertype
Sub<Int16, Int16> - Supertype
Mul<Int16, Int16> - Supertype
Div<Int16, Int16> - Supertype
Rem<Int16, Int16> - Supertype
UnaryPlus<Int16> - Supertype
UnaryMinus<Int16> - Supertype
Increment<Int16> - Supertype
Decrement<Int16> - Supertype
Compare<Int16> - Supertype
RangeTo<Int16, IntRange> - Supertype
RangeUntil<Int16, IntRange> - Supertype
Equals<Int16> - Supertype
ToString - Supertype
Hash
A 16-bit signed 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 Short.toBigDecimal(): BigDecimal· scoop:scoop.math:0.1.0public fun Int16.toString(radix: Int): String· scoop:scoop.std:0.1.0public fun Short.toBigInteger(): BigInteger· scoop:scoop.math:0.1.0
function hash
source · line 256public override fun hash(): Long
- Overrides
hash· Hash
Returns a hash consistent with same-type integer equality.
function and
source · line 114@NoGC
@Intrinsic("int16_and")
public infix fun and(other: Int16): Int16
Returns the bitwise intersection of the 16-bit operands.
parameter other
source · line 116other: Int16
function compareTo
source · line 107@NoGC
@Intrinsic("int16_compare_to")
public override operator fun compareTo(other: Int16): Long
- Overrides
compareTo· Compare
Returns -1, 0, or 1 using signed mathematical ordering.
parameter other
source · line 109other: Int16
function rem
source · line 101@Intrinsic("int16_rem")
public override operator fun rem(other: Int16): Int16
- 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.
parameter other
source · line 102other: Int16
function downTo
source · line 245public infix fun downTo(endpoint: Int16): IntRange
Creates a descending range including both endpoints.
parameter endpoint
source · line 245endpoint: Int16
function toUByte
source · line 196@NoGC
@Intrinsic("int16_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 toULong
source · line 220@NoGC
@Intrinsic("int16_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 toUInt
source · line 212@NoGC
@Intrinsic("int16_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 or
source · line 121@NoGC
@Intrinsic("int16_or")
public infix fun or(other: Int16): Int16
Returns the bitwise union of the 16-bit operands.
parameter other
source · line 123other: Int16
function inv
source · line 135@NoGC
@Intrinsic("int16_inv")
public fun inv(): Int16
Flips all 16 bits of the representation.
function equals
source · line 36@NoGC
@Intrinsic("int16_equals")
public override operator fun equals(other: Int16): Boolean
- Overrides
equals· Equals
Compares the mathematical values of two integers of the same type.
parameter other
source · line 38other: Int16
function toLong
source · line 188@NoGC
@Intrinsic("int16_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 times
source · line 86@NoGC
@Intrinsic("int16_mul")
public override operator fun times(other: Int16): Int16
- Overrides
times· Mul
Returns the product modulo 2^16; overflow does not throw.
parameter other
source · line 88other: Int16
function toFloat
source · line 24@NoGC @Intrinsic("int16_to_float")
public fun toFloat(): Float
Rounds the integer directly to IEEE binary32 using round-to-nearest, ties-to-even.
function toByte
source · line 164@NoGC
@Intrinsic("int16_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 rangeUntil
source · line 233public override operator fun rangeUntil(endpoint: Int16): IntRange
- Overrides
rangeUntil· RangeUntil
Creates an ascending range including this value and excluding the endpoint.
parameter endpoint
source · line 233endpoint: Int16
function toString
source · line 251public override fun toString(): String
- Overrides
toString· ToString
Returns the locale-independent decimal representation of this integer.
function div
source · line 94@Intrinsic("int16_div")
public override operator fun div(other: Int16): Int16
- 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.
parameter other
source · line 95other: Int16
function rangeTo
source · line 227public override operator fun rangeTo(endpoint: Int16): IntRange
- Overrides
rangeTo· RangeTo
Creates an ascending range including both this value and the endpoint.
parameter endpoint
source · line 227endpoint: Int16
function minus
source · line 79@NoGC
@Intrinsic("int16_sub")
public override operator fun minus(other: Int16): Int16
- Overrides
minus· Sub
Returns the difference modulo 2^16; overflow does not throw.
parameter other
source · line 81other: Int16
function toDouble
source · line 30@NoGC @Intrinsic("int16_to_double")
public fun toDouble(): Double
Rounds the integer directly to IEEE binary64 using round-to-nearest, ties-to-even.
function shr
source · line 149@NoGC
@Intrinsic("int16_shr")
public infix fun shr(count: Long): Int16
Shifts right using the low 4 bits of the Long count, replicating the sign bit.
parameter count
source · line 151count: Long
function ushr
source · line 156@NoGC
@Intrinsic("int16_ushr")
public infix fun ushr(count: Long): Int16
Shifts right with zero fill using the low 4 bits of the Long count.
parameter count
source · line 158count: Long
function toUShort
source · line 204@NoGC
@Intrinsic("int16_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 unaryMinus
source · line 51@NoGC
@Intrinsic("int16_unary_minus")
public override operator fun unaryMinus(): Int16
- Overrides
unaryMinus· UnaryMinus
Returns the additive inverse modulo 2^16, including at the representation boundary.
function plus
source · line 72@NoGC
@Intrinsic("int16_add")
public override operator fun plus(other: Int16): Int16
- Overrides
plus· Add
Returns the sum modulo 2^16; overflow does not throw.
parameter other
source · line 74other: Int16
function dec
source · line 65@NoGC
@Intrinsic("int16_dec")
public override operator fun dec(): Int16
- Overrides
dec· Decrement
Returns the value minus one, wrapping modulo 2^16.
function toInt
source · line 180@NoGC
@Intrinsic("int16_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 unaryPlus
source · line 44@NoGC
@Intrinsic("int16_unary_plus")
public override operator fun unaryPlus(): Int16
- Overrides
unaryPlus· UnaryPlus
Returns the unchanged integer value.
function xor
source · line 128@NoGC
@Intrinsic("int16_xor")
public infix fun xor(other: Int16): Int16
Sets each result bit where the corresponding 16-bit operand bits differ.
parameter other
source · line 130other: Int16
function until
source · line 239public infix fun until(endpoint: Int16): IntRange
Creates an ascending range with an exclusive endpoint.
parameter endpoint
source · line 239endpoint: Int16
function toShort
source · line 172@NoGC
@Intrinsic("int16_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 shl
source · line 142@NoGC
@Intrinsic("int16_shl")
public infix fun shl(count: Long): Int16
Shifts left using the low 4 bits of the Long count; shifted-out bits are discarded.
parameter count
source · line 144count: Long
function inc
source · line 58@NoGC
@Intrinsic("int16_inc")
public override operator fun inc(): Int16
- Overrides
inc· Increment
Returns the value plus one, wrapping modulo 2^16.