diff --git a/compiler/testData/ir/irText/js/external/kt38765.fir.ir.txt b/compiler/testData/ir/irText/js/external/kt38765.fir.ir.txt index 5ea48f0a227..3f51ae16617 100644 --- a/compiler/testData/ir/irText/js/external/kt38765.fir.ir.txt +++ b/compiler/testData/ir/irText/js/external/kt38765.fir.ir.txt @@ -104,6 +104,8 @@ FILE fqName:events fileName:/kt38765.kt public open fun toString (): kotlin.String declared in kotlin.Enum $this: VALUE_PARAMETER name: type:kotlin.Enum PROPERTY FAKE_OVERRIDE name:name visibility:public modality:FINAL [fake_override,val] + annotations: + IntrinsicConstEvaluation overridden: public final name: kotlin.String [val] FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:kotlin.Enum) returnType:kotlin.String [fake_override] diff --git a/core/builtins/native/kotlin/Primitives.kt b/core/builtins/native/kotlin/Primitives.kt index 7df63ef3146..bdd150143f4 100644 --- a/core/builtins/native/kotlin/Primitives.kt +++ b/core/builtins/native/kotlin/Primitives.kt @@ -87,18 +87,23 @@ public class Byte private constructor() : Number(), Comparable { /** Adds the other value to this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Byte): Int + /** Adds the other value to this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Short): Int + /** Adds the other value to this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Int): Int + /** Adds the other value to this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Long): Long + /** Adds the other value to this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Float): Float + /** Adds the other value to this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Double): Double @@ -106,18 +111,23 @@ public class Byte private constructor() : Number(), Comparable { /** Subtracts the other value from this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Byte): Int + /** Subtracts the other value from this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Short): Int + /** Subtracts the other value from this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Int): Int + /** Subtracts the other value from this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Long): Long + /** Subtracts the other value from this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Float): Float + /** Subtracts the other value from this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Double): Double @@ -125,18 +135,23 @@ public class Byte private constructor() : Number(), Comparable { /** Multiplies this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Byte): Int + /** Multiplies this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Short): Int + /** Multiplies this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Int): Int + /** Multiplies this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Long): Long + /** Multiplies this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Float): Float + /** Multiplies this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Double): Double @@ -144,18 +159,23 @@ public class Byte private constructor() : Number(), Comparable { /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Byte): Int + /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Short): Int + /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Int): Int + /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Long): Long + /** Divides this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Float): Float + /** Divides this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Double): Double @@ -168,6 +188,7 @@ public class Byte private constructor() : Number(), Comparable { @SinceKotlin("1.1") @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Byte): Int + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * @@ -176,6 +197,7 @@ public class Byte private constructor() : Number(), Comparable { @SinceKotlin("1.1") @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Short): Int + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * @@ -184,6 +206,7 @@ public class Byte private constructor() : Number(), Comparable { @SinceKotlin("1.1") @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Int): Int + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * @@ -192,6 +215,7 @@ public class Byte private constructor() : Number(), Comparable { @SinceKotlin("1.1") @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Long): Long + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * @@ -200,6 +224,7 @@ public class Byte private constructor() : Number(), Comparable { @SinceKotlin("1.1") @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Float): Float + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * @@ -226,17 +251,21 @@ public class Byte private constructor() : Number(), Comparable { /** Returns this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun unaryPlus(): Int + /** Returns the negative of this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun unaryMinus(): Int - /** Creates a range from this value to the specified [other] value. */ + /** Creates a range from this value to the specified [other] value. */ public operator fun rangeTo(other: Byte): IntRange - /** Creates a range from this value to the specified [other] value. */ + + /** Creates a range from this value to the specified [other] value. */ public operator fun rangeTo(other: Short): IntRange - /** Creates a range from this value to the specified [other] value. */ + + /** Creates a range from this value to the specified [other] value. */ public operator fun rangeTo(other: Int): IntRange - /** Creates a range from this value to the specified [other] value. */ + + /** Creates a range from this value to the specified [other] value. */ public operator fun rangeTo(other: Long): LongRange /** @@ -278,6 +307,7 @@ public class Byte private constructor() : Number(), Comparable { /** Returns this value. */ @kotlin.internal.IntrinsicConstEvaluation public override fun toByte(): Byte + /** * Converts this [Byte] value to [Char]. * @@ -290,6 +320,7 @@ public class Byte private constructor() : Number(), Comparable { @DeprecatedSinceKotlin(warningSince = "1.5", errorSince = "2.3") @kotlin.internal.IntrinsicConstEvaluation public override fun toChar(): Char + /** * Converts this [Byte] value to [Short]. * @@ -300,6 +331,7 @@ public class Byte private constructor() : Number(), Comparable { */ @kotlin.internal.IntrinsicConstEvaluation public override fun toShort(): Short + /** * Converts this [Byte] value to [Int]. * @@ -310,6 +342,7 @@ public class Byte private constructor() : Number(), Comparable { */ @kotlin.internal.IntrinsicConstEvaluation public override fun toInt(): Int + /** * Converts this [Byte] value to [Long]. * @@ -320,6 +353,7 @@ public class Byte private constructor() : Number(), Comparable { */ @kotlin.internal.IntrinsicConstEvaluation public override fun toLong(): Long + /** * Converts this [Byte] value to [Float]. * @@ -327,6 +361,7 @@ public class Byte private constructor() : Number(), Comparable { */ @kotlin.internal.IntrinsicConstEvaluation public override fun toFloat(): Float + /** * Converts this [Byte] value to [Double]. * @@ -422,18 +457,23 @@ public class Short private constructor() : Number(), Comparable { /** Adds the other value to this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Byte): Int + /** Adds the other value to this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Short): Int + /** Adds the other value to this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Int): Int + /** Adds the other value to this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Long): Long + /** Adds the other value to this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Float): Float + /** Adds the other value to this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Double): Double @@ -441,18 +481,23 @@ public class Short private constructor() : Number(), Comparable { /** Subtracts the other value from this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Byte): Int + /** Subtracts the other value from this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Short): Int + /** Subtracts the other value from this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Int): Int + /** Subtracts the other value from this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Long): Long + /** Subtracts the other value from this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Float): Float + /** Subtracts the other value from this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Double): Double @@ -460,18 +505,23 @@ public class Short private constructor() : Number(), Comparable { /** Multiplies this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Byte): Int + /** Multiplies this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Short): Int + /** Multiplies this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Int): Int + /** Multiplies this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Long): Long + /** Multiplies this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Float): Float + /** Multiplies this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Double): Double @@ -479,18 +529,23 @@ public class Short private constructor() : Number(), Comparable { /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Byte): Int + /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Short): Int + /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Int): Int + /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Long): Long + /** Divides this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Float): Float + /** Divides this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Double): Double @@ -503,6 +558,7 @@ public class Short private constructor() : Number(), Comparable { @SinceKotlin("1.1") @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Byte): Int + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * @@ -511,6 +567,7 @@ public class Short private constructor() : Number(), Comparable { @SinceKotlin("1.1") @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Short): Int + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * @@ -519,6 +576,7 @@ public class Short private constructor() : Number(), Comparable { @SinceKotlin("1.1") @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Int): Int + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * @@ -527,6 +585,7 @@ public class Short private constructor() : Number(), Comparable { @SinceKotlin("1.1") @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Long): Long + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * @@ -535,6 +594,7 @@ public class Short private constructor() : Number(), Comparable { @SinceKotlin("1.1") @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Float): Float + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * @@ -561,17 +621,21 @@ public class Short private constructor() : Number(), Comparable { /** Returns this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun unaryPlus(): Int + /** Returns the negative of this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun unaryMinus(): Int - /** Creates a range from this value to the specified [other] value. */ + /** Creates a range from this value to the specified [other] value. */ public operator fun rangeTo(other: Byte): IntRange - /** Creates a range from this value to the specified [other] value. */ + + /** Creates a range from this value to the specified [other] value. */ public operator fun rangeTo(other: Short): IntRange - /** Creates a range from this value to the specified [other] value. */ + + /** Creates a range from this value to the specified [other] value. */ public operator fun rangeTo(other: Int): IntRange - /** Creates a range from this value to the specified [other] value. */ + + /** Creates a range from this value to the specified [other] value. */ public operator fun rangeTo(other: Long): LongRange /** @@ -620,6 +684,7 @@ public class Short private constructor() : Number(), Comparable { */ @kotlin.internal.IntrinsicConstEvaluation public override fun toByte(): Byte + /** * Converts this [Short] value to [Char]. * @@ -630,9 +695,11 @@ public class Short private constructor() : Number(), Comparable { @DeprecatedSinceKotlin(warningSince = "1.5", errorSince = "2.3") @kotlin.internal.IntrinsicConstEvaluation public override fun toChar(): Char + /** Returns this value. */ @kotlin.internal.IntrinsicConstEvaluation public override fun toShort(): Short + /** * Converts this [Short] value to [Int]. * @@ -643,6 +710,7 @@ public class Short private constructor() : Number(), Comparable { */ @kotlin.internal.IntrinsicConstEvaluation public override fun toInt(): Int + /** * Converts this [Short] value to [Long]. * @@ -653,6 +721,7 @@ public class Short private constructor() : Number(), Comparable { */ @kotlin.internal.IntrinsicConstEvaluation public override fun toLong(): Long + /** * Converts this [Short] value to [Float]. * @@ -660,6 +729,7 @@ public class Short private constructor() : Number(), Comparable { */ @kotlin.internal.IntrinsicConstEvaluation public override fun toFloat(): Float + /** * Converts this [Short] value to [Double]. * @@ -755,18 +825,23 @@ public class Int private constructor() : Number(), Comparable { /** Adds the other value to this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Byte): Int + /** Adds the other value to this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Short): Int + /** Adds the other value to this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Int): Int + /** Adds the other value to this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Long): Long + /** Adds the other value to this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Float): Float + /** Adds the other value to this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Double): Double @@ -774,18 +849,23 @@ public class Int private constructor() : Number(), Comparable { /** Subtracts the other value from this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Byte): Int + /** Subtracts the other value from this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Short): Int + /** Subtracts the other value from this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Int): Int + /** Subtracts the other value from this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Long): Long + /** Subtracts the other value from this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Float): Float + /** Subtracts the other value from this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Double): Double @@ -793,18 +873,23 @@ public class Int private constructor() : Number(), Comparable { /** Multiplies this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Byte): Int + /** Multiplies this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Short): Int + /** Multiplies this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Int): Int + /** Multiplies this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Long): Long + /** Multiplies this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Float): Float + /** Multiplies this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Double): Double @@ -812,18 +897,23 @@ public class Int private constructor() : Number(), Comparable { /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Byte): Int + /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Short): Int + /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Int): Int + /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Long): Long + /** Divides this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Float): Float + /** Divides this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Double): Double @@ -836,6 +926,7 @@ public class Int private constructor() : Number(), Comparable { @SinceKotlin("1.1") @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Byte): Int + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * @@ -844,6 +935,7 @@ public class Int private constructor() : Number(), Comparable { @SinceKotlin("1.1") @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Short): Int + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * @@ -852,6 +944,7 @@ public class Int private constructor() : Number(), Comparable { @SinceKotlin("1.1") @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Int): Int + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * @@ -860,6 +953,7 @@ public class Int private constructor() : Number(), Comparable { @SinceKotlin("1.1") @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Long): Long + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * @@ -868,6 +962,7 @@ public class Int private constructor() : Number(), Comparable { @SinceKotlin("1.1") @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Float): Float + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * @@ -894,17 +989,21 @@ public class Int private constructor() : Number(), Comparable { /** Returns this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun unaryPlus(): Int + /** Returns the negative of this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun unaryMinus(): Int - /** Creates a range from this value to the specified [other] value. */ + /** Creates a range from this value to the specified [other] value. */ public operator fun rangeTo(other: Byte): IntRange - /** Creates a range from this value to the specified [other] value. */ + + /** Creates a range from this value to the specified [other] value. */ public operator fun rangeTo(other: Short): IntRange - /** Creates a range from this value to the specified [other] value. */ + + /** Creates a range from this value to the specified [other] value. */ public operator fun rangeTo(other: Int): IntRange - /** Creates a range from this value to the specified [other] value. */ + + /** Creates a range from this value to the specified [other] value. */ public operator fun rangeTo(other: Long): LongRange /** @@ -973,12 +1072,15 @@ public class Int private constructor() : Number(), Comparable { /** Performs a bitwise AND operation between the two values. */ @kotlin.internal.IntrinsicConstEvaluation public infix fun and(other: Int): Int + /** Performs a bitwise OR operation between the two values. */ @kotlin.internal.IntrinsicConstEvaluation public infix fun or(other: Int): Int + /** Performs a bitwise XOR operation between the two values. */ @kotlin.internal.IntrinsicConstEvaluation public infix fun xor(other: Int): Int + /** Inverts the bits in this value. */ @kotlin.internal.IntrinsicConstEvaluation public fun inv(): Int @@ -993,6 +1095,7 @@ public class Int private constructor() : Number(), Comparable { */ @kotlin.internal.IntrinsicConstEvaluation public override fun toByte(): Byte + /** * Converts this [Int] value to [Char]. * @@ -1004,6 +1107,7 @@ public class Int private constructor() : Number(), Comparable { @Suppress("OVERRIDE_DEPRECATION") @kotlin.internal.IntrinsicConstEvaluation public override fun toChar(): Char + /** * Converts this [Int] value to [Short]. * @@ -1014,9 +1118,11 @@ public class Int private constructor() : Number(), Comparable { */ @kotlin.internal.IntrinsicConstEvaluation public override fun toShort(): Short + /** Returns this value. */ @kotlin.internal.IntrinsicConstEvaluation public override fun toInt(): Int + /** * Converts this [Int] value to [Long]. * @@ -1027,6 +1133,7 @@ public class Int private constructor() : Number(), Comparable { */ @kotlin.internal.IntrinsicConstEvaluation public override fun toLong(): Long + /** * Converts this [Int] value to [Float]. * @@ -1036,6 +1143,7 @@ public class Int private constructor() : Number(), Comparable { */ @kotlin.internal.IntrinsicConstEvaluation public override fun toFloat(): Float + /** * Converts this [Int] value to [Double]. * @@ -1131,18 +1239,23 @@ public class Long private constructor() : Number(), Comparable { /** Adds the other value to this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Byte): Long + /** Adds the other value to this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Short): Long + /** Adds the other value to this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Int): Long + /** Adds the other value to this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Long): Long + /** Adds the other value to this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Float): Float + /** Adds the other value to this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Double): Double @@ -1150,18 +1263,23 @@ public class Long private constructor() : Number(), Comparable { /** Subtracts the other value from this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Byte): Long + /** Subtracts the other value from this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Short): Long + /** Subtracts the other value from this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Int): Long + /** Subtracts the other value from this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Long): Long + /** Subtracts the other value from this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Float): Float + /** Subtracts the other value from this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Double): Double @@ -1169,18 +1287,23 @@ public class Long private constructor() : Number(), Comparable { /** Multiplies this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Byte): Long + /** Multiplies this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Short): Long + /** Multiplies this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Int): Long + /** Multiplies this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Long): Long + /** Multiplies this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Float): Float + /** Multiplies this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Double): Double @@ -1188,18 +1311,23 @@ public class Long private constructor() : Number(), Comparable { /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Byte): Long + /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Short): Long + /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Int): Long + /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Long): Long + /** Divides this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Float): Float + /** Divides this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Double): Double @@ -1212,6 +1340,7 @@ public class Long private constructor() : Number(), Comparable { @SinceKotlin("1.1") @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Byte): Long + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * @@ -1220,6 +1349,7 @@ public class Long private constructor() : Number(), Comparable { @SinceKotlin("1.1") @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Short): Long + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * @@ -1228,6 +1358,7 @@ public class Long private constructor() : Number(), Comparable { @SinceKotlin("1.1") @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Int): Long + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * @@ -1236,6 +1367,7 @@ public class Long private constructor() : Number(), Comparable { @SinceKotlin("1.1") @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Long): Long + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * @@ -1244,6 +1376,7 @@ public class Long private constructor() : Number(), Comparable { @SinceKotlin("1.1") @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Float): Float + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * @@ -1270,17 +1403,21 @@ public class Long private constructor() : Number(), Comparable { /** Returns this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun unaryPlus(): Long + /** Returns the negative of this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun unaryMinus(): Long - /** Creates a range from this value to the specified [other] value. */ + /** Creates a range from this value to the specified [other] value. */ public operator fun rangeTo(other: Byte): LongRange - /** Creates a range from this value to the specified [other] value. */ + + /** Creates a range from this value to the specified [other] value. */ public operator fun rangeTo(other: Short): LongRange - /** Creates a range from this value to the specified [other] value. */ + + /** Creates a range from this value to the specified [other] value. */ public operator fun rangeTo(other: Int): LongRange - /** Creates a range from this value to the specified [other] value. */ + + /** Creates a range from this value to the specified [other] value. */ public operator fun rangeTo(other: Long): LongRange /** @@ -1349,12 +1486,15 @@ public class Long private constructor() : Number(), Comparable { /** Performs a bitwise AND operation between the two values. */ @kotlin.internal.IntrinsicConstEvaluation public infix fun and(other: Long): Long + /** Performs a bitwise OR operation between the two values. */ @kotlin.internal.IntrinsicConstEvaluation public infix fun or(other: Long): Long + /** Performs a bitwise XOR operation between the two values. */ @kotlin.internal.IntrinsicConstEvaluation public infix fun xor(other: Long): Long + /** Inverts the bits in this value. */ @kotlin.internal.IntrinsicConstEvaluation public fun inv(): Long @@ -1369,6 +1509,7 @@ public class Long private constructor() : Number(), Comparable { */ @kotlin.internal.IntrinsicConstEvaluation public override fun toByte(): Byte + /** * Converts this [Long] value to [Char]. * @@ -1381,6 +1522,7 @@ public class Long private constructor() : Number(), Comparable { @DeprecatedSinceKotlin(warningSince = "1.5", errorSince = "2.3") @kotlin.internal.IntrinsicConstEvaluation public override fun toChar(): Char + /** * Converts this [Long] value to [Short]. * @@ -1391,6 +1533,7 @@ public class Long private constructor() : Number(), Comparable { */ @kotlin.internal.IntrinsicConstEvaluation public override fun toShort(): Short + /** * Converts this [Long] value to [Int]. * @@ -1401,9 +1544,11 @@ public class Long private constructor() : Number(), Comparable { */ @kotlin.internal.IntrinsicConstEvaluation public override fun toInt(): Int + /** Returns this value. */ @kotlin.internal.IntrinsicConstEvaluation public override fun toLong(): Long + /** * Converts this [Long] value to [Float]. * @@ -1413,6 +1558,7 @@ public class Long private constructor() : Number(), Comparable { */ @kotlin.internal.IntrinsicConstEvaluation public override fun toFloat(): Float + /** * Converts this [Long] value to [Double]. * @@ -1525,18 +1671,23 @@ public class Float private constructor() : Number(), Comparable { /** Adds the other value to this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Byte): Float + /** Adds the other value to this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Short): Float + /** Adds the other value to this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Int): Float + /** Adds the other value to this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Long): Float + /** Adds the other value to this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Float): Float + /** Adds the other value to this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Double): Double @@ -1544,18 +1695,23 @@ public class Float private constructor() : Number(), Comparable { /** Subtracts the other value from this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Byte): Float + /** Subtracts the other value from this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Short): Float + /** Subtracts the other value from this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Int): Float + /** Subtracts the other value from this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Long): Float + /** Subtracts the other value from this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Float): Float + /** Subtracts the other value from this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Double): Double @@ -1563,18 +1719,23 @@ public class Float private constructor() : Number(), Comparable { /** Multiplies this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Byte): Float + /** Multiplies this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Short): Float + /** Multiplies this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Int): Float + /** Multiplies this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Long): Float + /** Multiplies this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Float): Float + /** Multiplies this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Double): Double @@ -1582,18 +1743,23 @@ public class Float private constructor() : Number(), Comparable { /** Divides this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Byte): Float + /** Divides this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Short): Float + /** Divides this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Int): Float + /** Divides this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Long): Float + /** Divides this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Float): Float + /** Divides this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Double): Double @@ -1606,6 +1772,7 @@ public class Float private constructor() : Number(), Comparable { @SinceKotlin("1.1") @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Byte): Float + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * @@ -1614,6 +1781,7 @@ public class Float private constructor() : Number(), Comparable { @SinceKotlin("1.1") @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Short): Float + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * @@ -1622,6 +1790,7 @@ public class Float private constructor() : Number(), Comparable { @SinceKotlin("1.1") @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Int): Float + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * @@ -1630,6 +1799,7 @@ public class Float private constructor() : Number(), Comparable { @SinceKotlin("1.1") @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Long): Float + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * @@ -1638,6 +1808,7 @@ public class Float private constructor() : Number(), Comparable { @SinceKotlin("1.1") @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Float): Float + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * @@ -1664,11 +1835,11 @@ public class Float private constructor() : Number(), Comparable { /** Returns this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun unaryPlus(): Float + /** Returns the negative of this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun unaryMinus(): Float - /** * Converts this [Float] value to [Byte]. * @@ -1678,6 +1849,7 @@ public class Float private constructor() : Number(), Comparable { @DeprecatedSinceKotlin(warningSince = "1.3", errorSince = "1.5") @kotlin.internal.IntrinsicConstEvaluation public override fun toByte(): Byte + /** * Converts this [Float] value to [Char]. * @@ -1687,6 +1859,7 @@ public class Float private constructor() : Number(), Comparable { @DeprecatedSinceKotlin(warningSince = "1.5", errorSince = "2.3") @kotlin.internal.IntrinsicConstEvaluation public override fun toChar(): Char + /** * Converts this [Float] value to [Short]. * @@ -1696,6 +1869,7 @@ public class Float private constructor() : Number(), Comparable { @DeprecatedSinceKotlin(warningSince = "1.3", errorSince = "1.5") @kotlin.internal.IntrinsicConstEvaluation public override fun toShort(): Short + /** * Converts this [Float] value to [Int]. * @@ -1705,6 +1879,7 @@ public class Float private constructor() : Number(), Comparable { */ @kotlin.internal.IntrinsicConstEvaluation public override fun toInt(): Int + /** * Converts this [Float] value to [Long]. * @@ -1714,9 +1889,11 @@ public class Float private constructor() : Number(), Comparable { */ @kotlin.internal.IntrinsicConstEvaluation public override fun toLong(): Long + /** Returns this value. */ @kotlin.internal.IntrinsicConstEvaluation public override fun toFloat(): Float + /** * Converts this [Float] value to [Double]. * @@ -1827,18 +2004,23 @@ public class Double private constructor() : Number(), Comparable { /** Adds the other value to this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Byte): Double + /** Adds the other value to this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Short): Double + /** Adds the other value to this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Int): Double + /** Adds the other value to this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Long): Double + /** Adds the other value to this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Float): Double + /** Adds the other value to this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Double): Double @@ -1846,18 +2028,23 @@ public class Double private constructor() : Number(), Comparable { /** Subtracts the other value from this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Byte): Double + /** Subtracts the other value from this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Short): Double + /** Subtracts the other value from this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Int): Double + /** Subtracts the other value from this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Long): Double + /** Subtracts the other value from this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Float): Double + /** Subtracts the other value from this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Double): Double @@ -1865,18 +2052,23 @@ public class Double private constructor() : Number(), Comparable { /** Multiplies this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Byte): Double + /** Multiplies this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Short): Double + /** Multiplies this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Int): Double + /** Multiplies this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Long): Double + /** Multiplies this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Float): Double + /** Multiplies this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Double): Double @@ -1884,18 +2076,23 @@ public class Double private constructor() : Number(), Comparable { /** Divides this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Byte): Double + /** Divides this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Short): Double + /** Divides this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Int): Double + /** Divides this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Long): Double + /** Divides this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Float): Double + /** Divides this value by the other value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Double): Double @@ -1908,6 +2105,7 @@ public class Double private constructor() : Number(), Comparable { @SinceKotlin("1.1") @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Byte): Double + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * @@ -1916,6 +2114,7 @@ public class Double private constructor() : Number(), Comparable { @SinceKotlin("1.1") @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Short): Double + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * @@ -1924,6 +2123,7 @@ public class Double private constructor() : Number(), Comparable { @SinceKotlin("1.1") @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Int): Double + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * @@ -1932,6 +2132,7 @@ public class Double private constructor() : Number(), Comparable { @SinceKotlin("1.1") @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Long): Double + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * @@ -1940,6 +2141,7 @@ public class Double private constructor() : Number(), Comparable { @SinceKotlin("1.1") @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Float): Double + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * @@ -1966,11 +2168,11 @@ public class Double private constructor() : Number(), Comparable { /** Returns this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun unaryPlus(): Double + /** Returns the negative of this value. */ @kotlin.internal.IntrinsicConstEvaluation public operator fun unaryMinus(): Double - /** * Converts this [Double] value to [Byte]. * @@ -1980,6 +2182,7 @@ public class Double private constructor() : Number(), Comparable { @DeprecatedSinceKotlin(warningSince = "1.3", errorSince = "1.5") @kotlin.internal.IntrinsicConstEvaluation public override fun toByte(): Byte + /** * Converts this [Double] value to [Char]. * @@ -1989,6 +2192,7 @@ public class Double private constructor() : Number(), Comparable { @DeprecatedSinceKotlin(warningSince = "1.5", errorSince = "2.3") @kotlin.internal.IntrinsicConstEvaluation public override fun toChar(): Char + /** * Converts this [Double] value to [Short]. * @@ -1998,6 +2202,7 @@ public class Double private constructor() : Number(), Comparable { @DeprecatedSinceKotlin(warningSince = "1.3", errorSince = "1.5") @kotlin.internal.IntrinsicConstEvaluation public override fun toShort(): Short + /** * Converts this [Double] value to [Int]. * @@ -2007,6 +2212,7 @@ public class Double private constructor() : Number(), Comparable { */ @kotlin.internal.IntrinsicConstEvaluation public override fun toInt(): Int + /** * Converts this [Double] value to [Long]. * @@ -2016,6 +2222,7 @@ public class Double private constructor() : Number(), Comparable { */ @kotlin.internal.IntrinsicConstEvaluation public override fun toLong(): Long + /** * Converts this [Double] value to [Float]. * @@ -2025,6 +2232,7 @@ public class Double private constructor() : Number(), Comparable { */ @kotlin.internal.IntrinsicConstEvaluation public override fun toFloat(): Float + /** Returns this value. */ @kotlin.internal.IntrinsicConstEvaluation public override fun toDouble(): Double @@ -2035,4 +2243,3 @@ public class Double private constructor() : Number(), Comparable { @kotlin.internal.IntrinsicConstEvaluation public override fun toString(): String } - diff --git a/generators/builtins/floorDivMod.kt b/generators/builtins/floorDivMod.kt new file mode 100644 index 00000000000..a3d465c43b7 --- /dev/null +++ b/generators/builtins/floorDivMod.kt @@ -0,0 +1,127 @@ +/* + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.generators.builtins.numbers + +import org.jetbrains.kotlin.generators.builtins.PrimitiveType +import org.jetbrains.kotlin.generators.builtins.convert +import org.jetbrains.kotlin.generators.builtins.generateBuiltIns.BuiltInsSourceGenerator +import org.jetbrains.kotlin.generators.builtins.numbers.primitives.BasePrimitivesGenerator +import org.jetbrains.kotlin.generators.builtins.printDoc +import java.io.PrintWriter + +class GenerateFloorDivMod(out: PrintWriter) : BuiltInsSourceGenerator(out) { + + override fun getMultifileClassName() = "NumbersKt" + override fun generateBody() { + out.println("import kotlin.math.sign") + out.println() + + val integerTypes = PrimitiveType.integral intersect PrimitiveType.onlyNumeric + for (thisType in integerTypes) { + for (otherType in integerTypes) { + generateFloorDiv(thisType, otherType) + generateMod(thisType, otherType) + } + } + + val fpTypes = PrimitiveType.floatingPoint + for (thisType in fpTypes) { + for (otherType in fpTypes) { + generateFpMod(thisType, otherType) + } + } + + } + + + private fun generateFloorDiv(thisKind: PrimitiveType, otherKind: PrimitiveType) { + val returnType = getOperatorReturnType(thisKind, otherKind) + val returnTypeName = returnType.capitalized + out.printDoc(BasePrimitivesGenerator.binaryOperatorDoc("floorDiv", thisKind, otherKind), "") + out.println("""@SinceKotlin("1.5")""") + out.println("@kotlin.internal.InlineOnly") + out.println("@kotlin.internal.IntrinsicConstEvaluation") + val declaration = "public inline fun ${thisKind.capitalized}.floorDiv(other: ${otherKind.capitalized}): $returnTypeName" + if (thisKind == otherKind && thisKind >= PrimitiveType.INT) { + out.println( + """ + $declaration { + var q = this / other + if (this xor other < 0 && q * other != this) q-- + return q + } + """.trimIndent() + ) + } else { + out.println("$declaration = ") + out.println(" ${ + convert("this", thisKind, returnType)}.floorDiv(${convert("other", otherKind, returnType)})") + } + out.println() + } + + private fun generateMod(thisKind: PrimitiveType, otherKind: PrimitiveType) { + val operationType = getOperatorReturnType(thisKind, otherKind) + val returnType = otherKind + out.printDoc(BasePrimitivesGenerator.binaryOperatorDoc("mod", thisKind, otherKind),"") + out.println("""@SinceKotlin("1.5")""") + out.println("@kotlin.internal.InlineOnly") + out.println("@kotlin.internal.IntrinsicConstEvaluation") + val declaration = "public inline fun ${thisKind.capitalized}.mod(other: ${otherKind.capitalized}): ${returnType.capitalized}" + if (thisKind == otherKind && thisKind >= PrimitiveType.INT) { + out.println( + """ + $declaration { + val r = this % other + return r + (other and (((r xor other) and (r or -r)) shr ${operationType.bitSize - 1})) + } + """.trimIndent() + ) + } else { + out.println("$declaration = ") + out.println(" " + convert( + "${convert("this", thisKind, operationType)}.mod(${convert("other", otherKind, operationType)})", + operationType, returnType + )) + } + out.println() + } + + private fun generateFpMod(thisKind: PrimitiveType, otherKind: PrimitiveType) { + val operationType = getOperatorReturnType(thisKind, otherKind) + out.printDoc(BasePrimitivesGenerator.binaryOperatorDoc("mod", thisKind, otherKind), "") + out.println("""@SinceKotlin("1.5")""") + out.println("@kotlin.internal.InlineOnly") + out.println("@kotlin.internal.IntrinsicConstEvaluation") + val declaration = "public inline fun ${thisKind.capitalized}.mod(other: ${otherKind.capitalized}): ${operationType.capitalized}" + if (thisKind == otherKind && thisKind >= PrimitiveType.INT) { + out.println( + """ + $declaration { + val r = this % other + return if (r != ${convert("0.0", PrimitiveType.DOUBLE, operationType)} && r.sign != other.sign) r + other else r + } + """.trimIndent() + ) + } else { + out.println("$declaration = ") + out.println(" ${convert("this", thisKind, operationType)}.mod(${convert("other", otherKind, operationType)})") + } + out.println() + } + +} + + +private fun maxByDomainCapacity(type1: PrimitiveType, type2: PrimitiveType): PrimitiveType + = if (type1.ordinal > type2.ordinal) type1 else type2 + +private fun getOperatorReturnType(kind1: PrimitiveType, kind2: PrimitiveType): PrimitiveType { + require(kind1 != PrimitiveType.BOOLEAN) { "kind1 must not be BOOLEAN" } + require(kind2 != PrimitiveType.BOOLEAN) { "kind2 must not be BOOLEAN" } + return maxByDomainCapacity(maxByDomainCapacity(kind1, kind2), PrimitiveType.INT) +} + diff --git a/generators/builtins/generateBuiltIns.kt b/generators/builtins/generateBuiltIns.kt index 324f4d8d64b..8346851fa2b 100644 --- a/generators/builtins/generateBuiltIns.kt +++ b/generators/builtins/generateBuiltIns.kt @@ -10,7 +10,10 @@ import org.jetbrains.kotlin.generators.builtins.arrays.GenerateArrays import org.jetbrains.kotlin.generators.builtins.functions.GenerateFunctions import org.jetbrains.kotlin.generators.builtins.iterators.GenerateIterators import org.jetbrains.kotlin.generators.builtins.numbers.GenerateFloorDivMod -import org.jetbrains.kotlin.generators.builtins.numbers.GeneratePrimitives +import org.jetbrains.kotlin.generators.builtins.numbers.primitives.JsPrimitivesGenerator +import org.jetbrains.kotlin.generators.builtins.numbers.primitives.JvmPrimitivesGenerator +import org.jetbrains.kotlin.generators.builtins.numbers.primitives.NativePrimitivesGenerator +import org.jetbrains.kotlin.generators.builtins.numbers.primitives.WasmPrimitivesGenerator import org.jetbrains.kotlin.generators.builtins.progressionIterators.GenerateProgressionIterators import org.jetbrains.kotlin.generators.builtins.progressions.GenerateProgressions import org.jetbrains.kotlin.generators.builtins.ranges.GenerateRanges @@ -22,20 +25,27 @@ fun assertExists(file: File) { if (!file.exists()) error("Output dir does not exist: ${file.absolutePath}") } -val BUILT_INS_NATIVE_DIR = File("core/builtins/native/") +val BUILT_INS_NATIVE_DIR_JVM = File("core/builtins/native/") +val BUILT_INS_NATIVE_DIR_JS = File("libraries/stdlib/js-ir/builtins/") +val BUILT_INS_NATIVE_DIR_WASM = File("libraries/stdlib/wasm/builtins/") +val BUILT_INS_NATIVE_DIR_NATIVE = File("kotlin-native/runtime/src/main/kotlin/") val BUILT_INS_SRC_DIR = File("core/builtins/src/") val RUNTIME_JVM_DIR = File("libraries/stdlib/jvm/runtime/") val UNSIGNED_TYPES_DIR = File("libraries/stdlib/unsigned/src") val STDLIB_DIR = File("libraries/stdlib/src") -abstract class BuiltInsSourceGenerator(val out: PrintWriter) { +interface BuiltInsGenerator { + fun generate() +} + +abstract class BuiltInsSourceGenerator(val out: PrintWriter) : BuiltInsGenerator { protected abstract fun generateBody(): Unit protected open fun getPackage(): String = "kotlin" protected open fun getMultifileClassName(): String? = null - fun generate() { + override fun generate() { out.println(File("license/COPYRIGHT_HEADER.txt").readText()) out.println() // Don't include generator class name in the message: these are built-in sources, @@ -54,15 +64,21 @@ abstract class BuiltInsSourceGenerator(val out: PrintWriter) { } } -fun generateBuiltIns(generate: (File, (PrintWriter) -> BuiltInsSourceGenerator) -> Unit) { - assertExists(BUILT_INS_NATIVE_DIR) +fun generateBuiltIns(generate: (File, (PrintWriter) -> BuiltInsGenerator) -> Unit) { + assertExists(BUILT_INS_NATIVE_DIR_JVM) + assertExists(BUILT_INS_NATIVE_DIR_JS) + assertExists(BUILT_INS_NATIVE_DIR_WASM) + assertExists(BUILT_INS_NATIVE_DIR_NATIVE) assertExists(BUILT_INS_SRC_DIR) assertExists(RUNTIME_JVM_DIR) assertExists(UNSIGNED_TYPES_DIR) generate(File(RUNTIME_JVM_DIR, "kotlin/jvm/functions/Functions.kt")) { GenerateFunctions(it) } - generate(File(BUILT_INS_NATIVE_DIR, "kotlin/Arrays.kt")) { GenerateArrays(it) } - generate(File(BUILT_INS_NATIVE_DIR, "kotlin/Primitives.kt")) { GeneratePrimitives(it) } + generate(File(BUILT_INS_NATIVE_DIR_JVM, "kotlin/Arrays.kt")) { GenerateArrays(it) } + generate(File(BUILT_INS_NATIVE_DIR_JVM, "kotlin/Primitives.kt")) { JvmPrimitivesGenerator(it) } + generate(File(BUILT_INS_NATIVE_DIR_JS, "Primitives.kt")) { JsPrimitivesGenerator(it) } + generate(File(BUILT_INS_NATIVE_DIR_WASM, "kotlin/Primitives.kt")) { WasmPrimitivesGenerator(it) } + generate(File(BUILT_INS_NATIVE_DIR_NATIVE, "kotlin/Primitives.kt")) { NativePrimitivesGenerator(it) } generate(File(STDLIB_DIR, "kotlin/collections/PrimitiveIterators.kt")) { GenerateIterators(it) } generate(File(RUNTIME_JVM_DIR, "kotlin/jvm/internal/ArrayIterators.kt")) { GenerateArrayIterators(it) } generate(File(STDLIB_DIR, "kotlin/ranges/ProgressionIterators.kt")) { GenerateProgressionIterators(it) } diff --git a/generators/builtins/primitives.kt b/generators/builtins/primitives.kt deleted file mode 100644 index 1963a3545c2..00000000000 --- a/generators/builtins/primitives.kt +++ /dev/null @@ -1,607 +0,0 @@ -/* - * Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.generators.builtins.numbers - -import org.jetbrains.kotlin.generators.builtins.PrimitiveType -import org.jetbrains.kotlin.generators.builtins.convert -import org.jetbrains.kotlin.generators.builtins.generateBuiltIns.BuiltInsSourceGenerator -import org.jetbrains.kotlin.generators.builtins.printDoc -import java.io.PrintWriter - -class GeneratePrimitives(out: PrintWriter) : BuiltInsSourceGenerator(out) { - companion object { - internal val binaryOperators: List = listOf( - "plus", - "minus", - "times", - "div", - "rem", - ) - internal val unaryPlusMinusOperators: Map = mapOf( - "unaryPlus" to "Returns this value.", - "unaryMinus" to "Returns the negative of this value.") - internal val shiftOperators: Map = mapOf( - "shl" to "Shifts this value left by the [bitCount] number of bits.", - "shr" to "Shifts this value right by the [bitCount] number of bits, filling the leftmost bits with copies of the sign bit.", - "ushr" to "Shifts this value right by the [bitCount] number of bits, filling the leftmost bits with zeros.") - internal val bitwiseOperators: Map = mapOf( - "and" to "Performs a bitwise AND operation between the two values.", - "or" to "Performs a bitwise OR operation between the two values.", - "xor" to "Performs a bitwise XOR operation between the two values.") - - - internal fun shiftOperatorsDocDetail(kind: PrimitiveType): String { - val bitsUsed = when (kind) { - PrimitiveType.INT -> "five" - PrimitiveType.LONG -> "six" - else -> throw IllegalArgumentException("Bit shift operation is not implemented for $kind") - } - return """ - * Note that only the $bitsUsed lowest-order bits of the [bitCount] are used as the shift distance. - * The shift distance actually used is therefore always in the range `0..${kind.bitSize - 1}`. - """ - } - - internal fun incDecOperatorsDoc(name: String): String { - val diff = if (name == "inc") "incremented" else "decremented" - - return """ - /** - * Returns this value $diff by one. - * - * @sample samples.misc.Builtins.$name - */ - """ - } - - internal fun binaryOperatorDoc(operator: String, operand1: PrimitiveType, operand2: PrimitiveType): String = when (operator) { - "plus" -> "Adds the other value to this value." - "minus" -> "Subtracts the other value from this value." - "times" -> "Multiplies this value by the other value." - "div" -> { - if (operand1.isIntegral && operand2.isIntegral) - "Divides this value by the other value, truncating the result to an integer that is closer to zero." - else - "Divides this value by the other value." - } - "floorDiv" -> - "Divides this value by the other value, flooring the result to an integer that is closer to negative infinity." - "rem" -> { - """ - Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). - - The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. - """.trimIndent() - } - "mod" -> { - """ - Calculates the remainder of flooring division of this value (dividend) by the other value (divisor). - - The result is either zero or has the same sign as the _divisor_ and has the absolute value less than the absolute value of the divisor. - """.trimIndent() + if (operand1.isFloatingPoint) - "\n\n" + "If the result cannot be represented exactly, it is rounded to the nearest representable number. In this case the absolute value of the result can be less than or _equal to_ the absolute value of the divisor." - else "" - } - else -> error("No documentation for operator $operator") - } - } - private val typeDescriptions: Map = mapOf( - PrimitiveType.DOUBLE to "double-precision 64-bit IEEE 754 floating point number", - PrimitiveType.FLOAT to "single-precision 32-bit IEEE 754 floating point number", - PrimitiveType.LONG to "64-bit signed integer", - PrimitiveType.INT to "32-bit signed integer", - PrimitiveType.SHORT to "16-bit signed integer", - PrimitiveType.BYTE to "8-bit signed integer", - PrimitiveType.CHAR to "16-bit Unicode character" - ) - - private fun primitiveConstants(type: PrimitiveType): List = when (type) { - PrimitiveType.INT -> listOf(java.lang.Integer.MIN_VALUE, java.lang.Integer.MAX_VALUE) - PrimitiveType.BYTE -> listOf(java.lang.Byte.MIN_VALUE, java.lang.Byte.MAX_VALUE) - PrimitiveType.SHORT -> listOf(java.lang.Short.MIN_VALUE, java.lang.Short.MAX_VALUE) - PrimitiveType.LONG -> listOf((java.lang.Long.MIN_VALUE + 1).toString() + "L - 1L", java.lang.Long.MAX_VALUE.toString() + "L") - PrimitiveType.DOUBLE -> listOf(java.lang.Double.MIN_VALUE, java.lang.Double.MAX_VALUE, "1.0/0.0", "-1.0/0.0", "-(0.0/0.0)") - PrimitiveType.FLOAT -> listOf(java.lang.Float.MIN_VALUE, java.lang.Float.MAX_VALUE, "1.0F/0.0F", "-1.0F/0.0F", "-(0.0F/0.0F)").map { it as? String ?: "${it}F" } - else -> throw IllegalArgumentException("type: $type") - } - - override fun generateBody() { - for (kind in PrimitiveType.onlyNumeric) { - val className = kind.capitalized - generateDoc(kind) - out.println("public class $className private constructor() : Number(), Comparable<$className> {") - - out.print(" companion object {") - if (kind == PrimitiveType.FLOAT || kind == PrimitiveType.DOUBLE) { - val (minValue, maxValue, posInf, negInf, nan) = primitiveConstants(kind) - out.println(""" - /** - * A constant holding the smallest *positive* nonzero value of $className. - */ - public const val MIN_VALUE: $className = $minValue - - /** - * A constant holding the largest positive finite value of $className. - */ - public const val MAX_VALUE: $className = $maxValue - - /** - * A constant holding the positive infinity value of $className. - */ - public const val POSITIVE_INFINITY: $className = $posInf - - /** - * A constant holding the negative infinity value of $className. - */ - public const val NEGATIVE_INFINITY: $className = $negInf - - /** - * A constant holding the "not a number" value of $className. - */ - public const val NaN: $className = $nan""") - } - if (kind == PrimitiveType.INT || kind == PrimitiveType.LONG || kind == PrimitiveType.SHORT || kind == PrimitiveType.BYTE) { - val (minValue, maxValue) = primitiveConstants(kind) - out.println(""" - /** - * A constant holding the minimum value an instance of $className can have. - */ - public const val MIN_VALUE: $className = $minValue - - /** - * A constant holding the maximum value an instance of $className can have. - */ - public const val MAX_VALUE: $className = $maxValue""") - } - if (kind.isIntegral || kind.isFloatingPoint) { - val sizeSince = if (kind.isFloatingPoint) "1.4" else "1.3" - out.println(""" - /** - * The number of bytes used to represent an instance of $className in a binary form. - */ - @SinceKotlin("$sizeSince") - public const val SIZE_BYTES: Int = ${kind.byteSize} - - /** - * The number of bits used to represent an instance of $className in a binary form. - */ - @SinceKotlin("$sizeSince") - public const val SIZE_BITS: Int = ${kind.bitSize}""") - } - out.println(""" }""") - - generateCompareTo(kind) - - generateBinaryOperators(kind) - generateUnaryOperators(kind) - generateRangeTo(kind) - generateRangeUntil(kind) - - if (kind == PrimitiveType.INT || kind == PrimitiveType.LONG) { - generateBitShiftOperators(kind) - } - if (kind == PrimitiveType.INT || kind == PrimitiveType.LONG /* || kind == PrimitiveType.BYTE || kind == PrimitiveType.SHORT */) { - generateBitwiseOperators(className, since = if (kind == PrimitiveType.BYTE || kind == PrimitiveType.SHORT) "1.1" else null) - } - - generateConversions(kind) - generateEquals() - generateToString() - - out.println("}\n") - } - } - - private fun generateDoc(kind: PrimitiveType) { - out.println("/**") - out.println(" * Represents a ${typeDescriptions[kind]}.") - out.println(" * On the JVM, non-nullable values of this type are represented as values of the primitive type `${kind.name.lowercase()}`.") - out.println(" */") - } - - private fun generateCompareTo(thisKind: PrimitiveType) { - for (otherKind in PrimitiveType.onlyNumeric) { - out.println(""" - /** - * Compares this value with the specified value for order. - * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, - * or a positive number if it's greater than other. - */""") - out.println(" @kotlin.internal.IntrinsicConstEvaluation") - out.print(" public ") - if (otherKind == thisKind) out.print("override ") - out.println("operator fun compareTo(other: ${otherKind.capitalized}): Int") - } - out.println() - } - - private fun generateBinaryOperators(thisKind: PrimitiveType) { - for (name in binaryOperators) { - generateOperator(name, thisKind) - } - } - - private fun generateOperator(name: String, thisKind: PrimitiveType) { - for (otherKind in PrimitiveType.onlyNumeric) { - val returnType = getOperatorReturnType(thisKind, otherKind) - - out.printDoc(binaryOperatorDoc(name, thisKind, otherKind), " ") - when (name) { - "rem" -> - out.println(" @SinceKotlin(\"1.1\")") - } - out.println(" @kotlin.internal.IntrinsicConstEvaluation") - out.println(" public operator fun $name(other: ${otherKind.capitalized}): ${returnType.capitalized}") - } - out.println() - } - - private fun generateRangeTo(thisKind: PrimitiveType) { - for (otherKind in PrimitiveType.onlyNumeric) { - val returnType = maxByDomainCapacity(maxByDomainCapacity(thisKind, otherKind), PrimitiveType.INT) - if (returnType == PrimitiveType.DOUBLE || returnType == PrimitiveType.FLOAT) - continue - out.println(" /** Creates a range from this value to the specified [other] value. */") - out.println(" public operator fun rangeTo(other: ${otherKind.capitalized}): ${returnType.capitalized}Range") - } - out.println() - - } - - private fun generateRangeUntil(thisKind: PrimitiveType) { - for (otherKind in PrimitiveType.onlyNumeric) { - val returnType = maxByDomainCapacity(maxByDomainCapacity(thisKind, otherKind), PrimitiveType.INT) - if (returnType == PrimitiveType.DOUBLE || returnType == PrimitiveType.FLOAT) - continue - out.println(" /**") - out.println(" * Creates a range from this value up to but excluding the specified [other] value.") - out.println(" *") - out.println(" * If the [other] value is less than or equal to `this` value, then the returned range is empty.") - out.println(" */") - out.println(" @SinceKotlin(\"1.7\")") - out.println(" @ExperimentalStdlibApi") - out.println(" public operator fun rangeUntil(other: ${otherKind.capitalized}): ${returnType.capitalized}Range") - out.println() - } - } - - private fun generateUnaryOperators(kind: PrimitiveType) { - for (name in listOf("inc", "dec")) { - out.println(incDecOperatorsDoc(name).replaceIndent(" ")) - out.println(" public operator fun $name(): ${kind.capitalized}") - out.println() - } - - for ((name, doc) in unaryPlusMinusOperators) { - val returnType = if (kind in listOf(PrimitiveType.SHORT, PrimitiveType.BYTE, PrimitiveType.CHAR)) "Int" else kind.capitalized - out.println(" /** $doc */") - out.println(" @kotlin.internal.IntrinsicConstEvaluation") - out.println(" public operator fun $name(): $returnType") - } - out.println() - } - - private fun generateBitShiftOperators(kind: PrimitiveType) { - val className = kind.capitalized - val detail = shiftOperatorsDocDetail(kind) - for ((name, doc) in shiftOperators) { - out.println(" /**") - out.println(" * $doc") - out.println(" *") - out.println(detail.replaceIndent(" ")) - out.println(" */") - out.println(" @kotlin.internal.IntrinsicConstEvaluation") - out.println(" public infix fun $name(bitCount: Int): $className") - out.println() - } - } - private fun generateBitwiseOperators(className: String, since: String?) { - for ((name, doc) in bitwiseOperators) { - out.println(" /** $doc */") - since?.let { out.println(" @SinceKotlin(\"$it\")") } - out.println(" @kotlin.internal.IntrinsicConstEvaluation") - out.println(" public infix fun $name(other: $className): $className") - } - out.println(" /** Inverts the bits in this value. */") - since?.let { out.println(" @SinceKotlin(\"$it\")") } - out.println(" @kotlin.internal.IntrinsicConstEvaluation") - out.println(" public fun inv(): $className") - out.println() - } - - - private fun compareByDomainCapacity(type1: PrimitiveType, type2: PrimitiveType): Int = - if (type1.isIntegral && type2.isIntegral) type1.byteSize - type2.byteSize else type1.ordinal - type2.ordinal - - private fun docForConversionFromFloatingToIntegral(fromFloating: PrimitiveType, toIntegral: PrimitiveType): String { - require(fromFloating.isFloatingPoint) - require(toIntegral.isIntegral) - - val thisName = fromFloating.capitalized - val otherName = toIntegral.capitalized - - return if (compareByDomainCapacity(toIntegral, PrimitiveType.INT) < 0) { - """ - * The resulting `$otherName` value is equal to `this.toInt().to$otherName()`. - */ - """ - } else { - """ - * The fractional part, if any, is rounded down towards zero. - * Returns zero if this `$thisName` value is `NaN`, [$otherName.MIN_VALUE] if it's less than `$otherName.MIN_VALUE`, - * [$otherName.MAX_VALUE] if it's bigger than `$otherName.MAX_VALUE`. - */ - """ - } - } - - private fun docForConversionFromFloatingToFloating(fromFloating: PrimitiveType, toFloating: PrimitiveType): String { - require(fromFloating.isFloatingPoint) - require(toFloating.isFloatingPoint) - - val thisName = fromFloating.capitalized - val otherName = toFloating.capitalized - - return if (compareByDomainCapacity(toFloating, fromFloating) < 0) { - """ - * The resulting value is the closest `$otherName` to this `$thisName` value. - * In case when this `$thisName` value is exactly between two `$otherName`s, - * the one with zero at least significant bit of mantissa is selected. - */ - """ - } else { - """ - * The resulting `$otherName` value represents the same numerical value as this `$thisName`. - */ - """ - } - } - - private fun docForConversionFromIntegralToIntegral(fromIntegral: PrimitiveType, toIntegral: PrimitiveType): String { - require(fromIntegral.isIntegral) - require(toIntegral.isIntegral) - - val thisName = fromIntegral.capitalized - val otherName = toIntegral.capitalized - - return if (toIntegral == PrimitiveType.CHAR) { - if (fromIntegral == PrimitiveType.SHORT) { - """ - * The resulting `Char` code is equal to this value reinterpreted as an unsigned number, - * i.e. it has the same binary representation as this `Short`. - */ - """ - } else if (fromIntegral == PrimitiveType.BYTE) { - """ - * If this value is non-negative, the resulting `Char` code is equal to this value. - * - * The least significant 8 bits of the resulting `Char` code are the same as the bits of this `Byte` value, - * whereas the most significant 8 bits are filled with the sign bit of this value. - */ - """ - } else { - """ - * If this value is in the range of `Char` codes `Char.MIN_VALUE..Char.MAX_VALUE`, - * the resulting `Char` code is equal to this value. - * - * The resulting `Char` code is represented by the least significant 16 bits of this `$thisName` value. - */ - """ - } - } else if (compareByDomainCapacity(toIntegral, fromIntegral) < 0) { - """ - * If this value is in [$otherName.MIN_VALUE]..[$otherName.MAX_VALUE], the resulting `$otherName` value represents - * the same numerical value as this `$thisName`. - * - * The resulting `$otherName` value is represented by the least significant ${toIntegral.bitSize} bits of this `$thisName` value. - */ - """ - } else { - """ - * The resulting `$otherName` value represents the same numerical value as this `$thisName`. - * - * The least significant ${fromIntegral.bitSize} bits of the resulting `$otherName` value are the same as the bits of this `$thisName` value, - * whereas the most significant ${toIntegral.bitSize - fromIntegral.bitSize} bits are filled with the sign bit of this value. - */ - """ - } - } - - private fun docForConversionFromIntegralToFloating(fromIntegral: PrimitiveType, toFloating: PrimitiveType): String { - require(fromIntegral.isIntegral) - require(toFloating.isFloatingPoint) - - val thisName = fromIntegral.capitalized - val otherName = toFloating.capitalized - - return if (fromIntegral == PrimitiveType.LONG || fromIntegral == PrimitiveType.INT && toFloating == PrimitiveType.FLOAT) { - """ - * The resulting value is the closest `$otherName` to this `$thisName` value. - * In case when this `$thisName` value is exactly between two `$otherName`s, - * the one with zero at least significant bit of mantissa is selected. - */ - """ - } else { - """ - * The resulting `$otherName` value represents the same numerical value as this `$thisName`. - */ - """ - } - } - - private fun generateConversions(kind: PrimitiveType) { - fun isFpToIntConversionDeprecated(otherKind: PrimitiveType): Boolean { - return kind in PrimitiveType.floatingPoint && otherKind in listOf(PrimitiveType.BYTE, PrimitiveType.SHORT) - } - - val thisName = kind.capitalized - for (otherKind in PrimitiveType.exceptBoolean) { - val otherName = otherKind.capitalized - val doc = if (kind == otherKind) { - " /** Returns this value. */" - } else { - val detail = if (kind in PrimitiveType.integral) { - if (otherKind.isIntegral) { - docForConversionFromIntegralToIntegral(kind, otherKind) - } else { - docForConversionFromIntegralToFloating(kind, otherKind) - } - } else { - if (otherKind.isIntegral) { - docForConversionFromFloatingToIntegral(kind, otherKind) - } else { - docForConversionFromFloatingToFloating(kind, otherKind) - } - } - - " /**\n * Converts this [$thisName] value to [$otherName].\n *\n" + detail.replaceIndent(" ") - } - out.println(doc) - - if (isFpToIntConversionDeprecated(otherKind)) { - out.println(" @Deprecated(\"Unclear conversion. To achieve the same result convert to Int explicitly and then to $otherName.\", ReplaceWith(\"toInt().to$otherName()\"))") - out.println(" @DeprecatedSinceKotlin(warningSince = \"1.3\", errorSince = \"1.5\")") - } - if (otherKind == PrimitiveType.CHAR) { - if (kind == PrimitiveType.INT) { - out.println(" @Suppress(\"OVERRIDE_DEPRECATION\")") - } else { - out.println(" @Deprecated(\"Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.\", ReplaceWith(\"this.toInt().toChar()\"))") - out.println(" @DeprecatedSinceKotlin(warningSince = \"1.5\", errorSince = \"2.3\")") - } - } - - out.println(" @kotlin.internal.IntrinsicConstEvaluation") - out.println(" public override fun to$otherName(): $otherName") - } - out.println() - } - - private fun generateEquals() { - out.println(" @kotlin.internal.IntrinsicConstEvaluation") - out.println(" public override fun equals(other: Any?): Boolean") - out.println() - } - - private fun generateToString() { - out.println(" @kotlin.internal.IntrinsicConstEvaluation") - out.println(" public override fun toString(): String") - } -} - -class GenerateFloorDivMod(out: PrintWriter) : BuiltInsSourceGenerator(out) { - - override fun getMultifileClassName() = "NumbersKt" - override fun generateBody() { - out.println("import kotlin.math.sign") - out.println() - - val integerTypes = PrimitiveType.integral intersect PrimitiveType.onlyNumeric - for (thisType in integerTypes) { - for (otherType in integerTypes) { - generateFloorDiv(thisType, otherType) - generateMod(thisType, otherType) - } - } - - val fpTypes = PrimitiveType.floatingPoint - for (thisType in fpTypes) { - for (otherType in fpTypes) { - generateFpMod(thisType, otherType) - } - } - - } - - - private fun generateFloorDiv(thisKind: PrimitiveType, otherKind: PrimitiveType) { - val returnType = getOperatorReturnType(thisKind, otherKind) - val returnTypeName = returnType.capitalized - out.printDoc(GeneratePrimitives.binaryOperatorDoc("floorDiv", thisKind, otherKind), "") - out.println("""@SinceKotlin("1.5")""") - out.println("@kotlin.internal.InlineOnly") - out.println("@kotlin.internal.IntrinsicConstEvaluation") - val declaration = "public inline fun ${thisKind.capitalized}.floorDiv(other: ${otherKind.capitalized}): $returnTypeName" - if (thisKind == otherKind && thisKind >= PrimitiveType.INT) { - out.println( - """ - $declaration { - var q = this / other - if (this xor other < 0 && q * other != this) q-- - return q - } - """.trimIndent() - ) - } else { - out.println("$declaration = ") - out.println(" ${ - convert("this", thisKind, returnType)}.floorDiv(${convert("other", otherKind, returnType)})") - } - out.println() - } - - private fun generateMod(thisKind: PrimitiveType, otherKind: PrimitiveType) { - val operationType = getOperatorReturnType(thisKind, otherKind) - val returnType = otherKind - out.printDoc(GeneratePrimitives.binaryOperatorDoc("mod", thisKind, otherKind),"") - out.println("""@SinceKotlin("1.5")""") - out.println("@kotlin.internal.InlineOnly") - out.println("@kotlin.internal.IntrinsicConstEvaluation") - val declaration = "public inline fun ${thisKind.capitalized}.mod(other: ${otherKind.capitalized}): ${returnType.capitalized}" - if (thisKind == otherKind && thisKind >= PrimitiveType.INT) { - out.println( - """ - $declaration { - val r = this % other - return r + (other and (((r xor other) and (r or -r)) shr ${operationType.bitSize - 1})) - } - """.trimIndent() - ) - } else { - out.println("$declaration = ") - out.println(" " + convert( - "${convert("this", thisKind, operationType)}.mod(${convert("other", otherKind, operationType)})", - operationType, returnType - )) - } - out.println() - } - - private fun generateFpMod(thisKind: PrimitiveType, otherKind: PrimitiveType) { - val operationType = getOperatorReturnType(thisKind, otherKind) - out.printDoc(GeneratePrimitives.binaryOperatorDoc("mod", thisKind, otherKind), "") - out.println("""@SinceKotlin("1.5")""") - out.println("@kotlin.internal.InlineOnly") - out.println("@kotlin.internal.IntrinsicConstEvaluation") - val declaration = "public inline fun ${thisKind.capitalized}.mod(other: ${otherKind.capitalized}): ${operationType.capitalized}" - if (thisKind == otherKind && thisKind >= PrimitiveType.INT) { - out.println( - """ - $declaration { - val r = this % other - return if (r != ${convert("0.0", PrimitiveType.DOUBLE, operationType)} && r.sign != other.sign) r + other else r - } - """.trimIndent() - ) - } else { - out.println("$declaration = ") - out.println(" ${convert("this", thisKind, operationType)}.mod(${convert("other", otherKind, operationType)})") - } - out.println() - } - -} - - -private fun maxByDomainCapacity(type1: PrimitiveType, type2: PrimitiveType): PrimitiveType - = if (type1.ordinal > type2.ordinal) type1 else type2 - -private fun getOperatorReturnType(kind1: PrimitiveType, kind2: PrimitiveType): PrimitiveType { - require(kind1 != PrimitiveType.BOOLEAN) { "kind1 must not be BOOLEAN" } - require(kind2 != PrimitiveType.BOOLEAN) { "kind2 must not be BOOLEAN" } - return maxByDomainCapacity(maxByDomainCapacity(kind1, kind2), PrimitiveType.INT) -} - diff --git a/generators/builtins/primitives/BasePrimitivesGenerator.kt b/generators/builtins/primitives/BasePrimitivesGenerator.kt new file mode 100644 index 00000000000..040d803b9b1 --- /dev/null +++ b/generators/builtins/primitives/BasePrimitivesGenerator.kt @@ -0,0 +1,623 @@ +/* + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.generators.builtins.numbers.primitives + +import org.jetbrains.kotlin.generators.builtins.PrimitiveType +import org.jetbrains.kotlin.generators.builtins.generateBuiltIns.BuiltInsGenerator +import java.io.PrintWriter + +abstract class BasePrimitivesGenerator(private val writer: PrintWriter) : BuiltInsGenerator { + companion object { + internal val binaryOperators: List = listOf( + "plus", + "minus", + "times", + "div", + "rem", + ) + internal val unaryPlusMinusOperators: Map = mapOf( + "unaryPlus" to "Returns this value.", + "unaryMinus" to "Returns the negative of this value." + ) + internal val shiftOperators: Map = mapOf( + "shl" to "Shifts this value left by the [bitCount] number of bits.", + "shr" to "Shifts this value right by the [bitCount] number of bits, filling the leftmost bits with copies of the sign bit.", + "ushr" to "Shifts this value right by the [bitCount] number of bits, filling the leftmost bits with zeros.") + internal val bitwiseOperators: Map = mapOf( + "and" to "Performs a bitwise AND operation between the two values.", + "or" to "Performs a bitwise OR operation between the two values.", + "xor" to "Performs a bitwise XOR operation between the two values.") + + internal fun shiftOperatorsDocDetail(kind: PrimitiveType): String { + val bitsUsed = when (kind) { + PrimitiveType.INT -> "five" + PrimitiveType.LONG -> "six" + else -> throw IllegalArgumentException("Bit shift operation is not implemented for $kind") + } + return """ + Note that only the $bitsUsed lowest-order bits of the [bitCount] are used as the shift distance. + The shift distance actually used is therefore always in the range `0..${kind.bitSize - 1}`. + """.trimIndent() + } + + internal fun incDecOperatorsDoc(name: String): String { + val diff = if (name == "inc") "incremented" else "decremented" + + return """ + Returns this value $diff by one. + + @sample samples.misc.Builtins.$name + """.trimIndent() + } + + internal fun binaryOperatorDoc(operator: String, operand1: PrimitiveType, operand2: PrimitiveType): String = when (operator) { + "plus" -> "Adds the other value to this value." + "minus" -> "Subtracts the other value from this value." + "times" -> "Multiplies this value by the other value." + "div" -> { + if (operand1.isIntegral && operand2.isIntegral) + "Divides this value by the other value, truncating the result to an integer that is closer to zero." + else + "Divides this value by the other value." + } + "floorDiv" -> + "Divides this value by the other value, flooring the result to an integer that is closer to negative infinity." + "rem" -> { + """ + Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). + + The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. + """.trimIndent() + } + "mod" -> { + """ + Calculates the remainder of flooring division of this value (dividend) by the other value (divisor). + + The result is either zero or has the same sign as the _divisor_ and has the absolute value less than the absolute value of the divisor. + """.trimIndent() + if (operand1.isFloatingPoint) + "\n\n" + "If the result cannot be represented exactly, it is rounded to the nearest representable number. In this case the absolute value of the result can be less than or _equal to_ the absolute value of the divisor." + else "" + } + else -> error("No documentation for operator $operator") + } + + private fun compareByDomainCapacity(type1: PrimitiveType, type2: PrimitiveType): Int { + return if (type1.isIntegral && type2.isIntegral) type1.byteSize - type2.byteSize else type1.ordinal - type2.ordinal + } + + private fun docForConversionFromFloatingToIntegral(fromFloating: PrimitiveType, toIntegral: PrimitiveType): String { + require(fromFloating.isFloatingPoint) + require(toIntegral.isIntegral) + + val thisName = fromFloating.capitalized + val otherName = toIntegral.capitalized + + return if (compareByDomainCapacity(toIntegral, PrimitiveType.INT) < 0) { + """ + The resulting `$otherName` value is equal to `this.toInt().to$otherName()`. + """.trimIndent() + } else { + """ + The fractional part, if any, is rounded down towards zero. + Returns zero if this `$thisName` value is `NaN`, [$otherName.MIN_VALUE] if it's less than `$otherName.MIN_VALUE`, + [$otherName.MAX_VALUE] if it's bigger than `$otherName.MAX_VALUE`. + """.trimIndent() + } + } + + private fun docForConversionFromFloatingToFloating(fromFloating: PrimitiveType, toFloating: PrimitiveType): String { + require(fromFloating.isFloatingPoint) + require(toFloating.isFloatingPoint) + + val thisName = fromFloating.capitalized + val otherName = toFloating.capitalized + + return if (compareByDomainCapacity(toFloating, fromFloating) < 0) { + """ + The resulting value is the closest `$otherName` to this `$thisName` value. + In case when this `$thisName` value is exactly between two `$otherName`s, + the one with zero at least significant bit of mantissa is selected. + """.trimIndent() + } else { + """ + The resulting `$otherName` value represents the same numerical value as this `$thisName`. + """.trimIndent() + } + } + + private fun docForConversionFromIntegralToIntegral(fromIntegral: PrimitiveType, toIntegral: PrimitiveType): String { + require(fromIntegral.isIntegral) + require(toIntegral.isIntegral) + + val thisName = fromIntegral.capitalized + val otherName = toIntegral.capitalized + + return if (toIntegral == PrimitiveType.CHAR) { + if (fromIntegral == PrimitiveType.SHORT) { + """ + The resulting `Char` code is equal to this value reinterpreted as an unsigned number, + i.e. it has the same binary representation as this `Short`. + """.trimIndent() + } else if (fromIntegral == PrimitiveType.BYTE) { + """ + If this value is non-negative, the resulting `Char` code is equal to this value. + + The least significant 8 bits of the resulting `Char` code are the same as the bits of this `Byte` value, + whereas the most significant 8 bits are filled with the sign bit of this value. + """.trimIndent() + } else { + """ + If this value is in the range of `Char` codes `Char.MIN_VALUE..Char.MAX_VALUE`, + the resulting `Char` code is equal to this value. + + The resulting `Char` code is represented by the least significant 16 bits of this `$thisName` value. + """.trimIndent() + } + } else if (compareByDomainCapacity(toIntegral, fromIntegral) < 0) { + """ + If this value is in [$otherName.MIN_VALUE]..[$otherName.MAX_VALUE], the resulting `$otherName` value represents + the same numerical value as this `$thisName`. + + The resulting `$otherName` value is represented by the least significant ${toIntegral.bitSize} bits of this `$thisName` value. + """.trimIndent() + } else { + """ + The resulting `$otherName` value represents the same numerical value as this `$thisName`. + + The least significant ${fromIntegral.bitSize} bits of the resulting `$otherName` value are the same as the bits of this `$thisName` value, + whereas the most significant ${toIntegral.bitSize - fromIntegral.bitSize} bits are filled with the sign bit of this value. + """.trimIndent() + } + } + + private fun docForConversionFromIntegralToFloating(fromIntegral: PrimitiveType, toFloating: PrimitiveType): String { + require(fromIntegral.isIntegral) + require(toFloating.isFloatingPoint) + + val thisName = fromIntegral.capitalized + val otherName = toFloating.capitalized + + return if (fromIntegral == PrimitiveType.LONG || fromIntegral == PrimitiveType.INT && toFloating == PrimitiveType.FLOAT) { + """ + The resulting value is the closest `$otherName` to this `$thisName` value. + In case when this `$thisName` value is exactly between two `$otherName`s, + the one with zero at least significant bit of mantissa is selected. + """.trimIndent() + } else { + """ + The resulting `$otherName` value represents the same numerical value as this `$thisName`. + """.trimIndent() + } + } + + private fun maxByDomainCapacity(type1: PrimitiveType, type2: PrimitiveType): PrimitiveType { + return if (type1.ordinal > type2.ordinal) type1 else type2 + } + + fun getOperatorReturnType(kind1: PrimitiveType, kind2: PrimitiveType): PrimitiveType { + require(kind1 != PrimitiveType.BOOLEAN) { "kind1 must not be BOOLEAN" } + require(kind2 != PrimitiveType.BOOLEAN) { "kind2 must not be BOOLEAN" } + return maxByDomainCapacity(maxByDomainCapacity(kind1, kind2), PrimitiveType.INT) + } + } + + private val typeDescriptions: Map = mapOf( + PrimitiveType.DOUBLE to "double-precision 64-bit IEEE 754 floating point number", + PrimitiveType.FLOAT to "single-precision 32-bit IEEE 754 floating point number", + PrimitiveType.LONG to "64-bit signed integer", + PrimitiveType.INT to "32-bit signed integer", + PrimitiveType.SHORT to "16-bit signed integer", + PrimitiveType.BYTE to "8-bit signed integer", + PrimitiveType.CHAR to "16-bit Unicode character" + ) + + open fun primitiveConstants(type: PrimitiveType): List = when (type) { + PrimitiveType.INT -> listOf(java.lang.Integer.MIN_VALUE, java.lang.Integer.MAX_VALUE) + PrimitiveType.BYTE -> listOf(java.lang.Byte.MIN_VALUE, java.lang.Byte.MAX_VALUE) + PrimitiveType.SHORT -> listOf(java.lang.Short.MIN_VALUE, java.lang.Short.MAX_VALUE) + PrimitiveType.LONG -> listOf((java.lang.Long.MIN_VALUE + 1).toString() + "L - 1L", java.lang.Long.MAX_VALUE.toString() + "L") + PrimitiveType.DOUBLE -> listOf(java.lang.Double.MIN_VALUE, java.lang.Double.MAX_VALUE, "1.0/0.0", "-1.0/0.0", "-(0.0/0.0)") + PrimitiveType.FLOAT -> listOf(java.lang.Float.MIN_VALUE, java.lang.Float.MAX_VALUE, "1.0F/0.0F", "-1.0F/0.0F", "-(0.0F/0.0F)").map { it as? String ?: "${it}F" } + else -> throw IllegalArgumentException("type: $type") + } + + open fun PrimitiveType.shouldGenerate(): Boolean = true + + override fun generate() { + writer.print(FileDescription(classes = generateClasses()).apply { this.modifyGeneratedFile() }.toString()) + } + + private fun generateClasses(): List { + return buildList { + for (thisKind in PrimitiveType.onlyNumeric.filter { it.shouldGenerate() }) { + val className = thisKind.capitalized + val doc = "Represents a ${typeDescriptions[thisKind]}." + + val methods = buildList { + this.addAll(generateCompareTo(thisKind)) + this.addAll(generateBinaryOperators(thisKind)) + this.addAll(generateUnaryOperators(thisKind)) + this.addAll(generateRangeTo(thisKind)) + this.addAll(generateRangeUntil(thisKind)) + + if (thisKind == PrimitiveType.INT || thisKind == PrimitiveType.LONG) { + this.addAll(generateBitShiftOperators(thisKind)) + this.addAll(generateBitwiseOperators(thisKind)) + } + + this.addAll(generateConversions(thisKind)) + this += generateEquals(thisKind) + this += generateToString(thisKind) + this.addAll(generateAdditionalMethods(thisKind)) + } + + this += ClassDescription( + doc, + annotations = mutableListOf(), + name = className, + companionObject = generateCompanionObject(thisKind), + methods = methods + ).apply { this.modifyGeneratedClass(thisKind) } + } + } + } + + private fun generateCompanionObject(thisKind: PrimitiveType): CompanionObjectDescription { + val properties = buildList { + val className = thisKind.capitalized + if (thisKind == PrimitiveType.FLOAT || thisKind == PrimitiveType.DOUBLE) { + val (minValue, maxValue, posInf, negInf, nan) = primitiveConstants(thisKind) + this += PropertyDescription( + doc = "A constant holding the smallest *positive* nonzero value of $className.", + name = "MIN_VALUE", + type = className, + value = minValue.toString() + ) + + this += PropertyDescription( + doc = "A constant holding the largest positive finite value of $className.", + name = "MAX_VALUE", + type = className, + value = maxValue.toString() + ) + + this += PropertyDescription( + doc = "A constant holding the positive infinity value of $className.", + name = "POSITIVE_INFINITY", + type = className, + value = posInf.toString() + ) + + this += PropertyDescription( + doc = "A constant holding the negative infinity value of $className.", + name = "NEGATIVE_INFINITY", + type = className, + value = negInf.toString() + ) + + this += PropertyDescription( + doc = "A constant holding the \"not a number\" value of $className.", + name = "NaN", + type = className, + value = nan.toString() + ) + } + + if (thisKind == PrimitiveType.INT || thisKind == PrimitiveType.LONG || thisKind == PrimitiveType.SHORT || thisKind == PrimitiveType.BYTE) { + val (minValue, maxValue) = primitiveConstants(thisKind) + this += PropertyDescription( + doc = "A constant holding the minimum value an instance of $className can have.", + name = "MIN_VALUE", + type = className, + value = minValue.toString() + ) + + this += PropertyDescription( + doc = "A constant holding the maximum value an instance of $className can have.", + name = "MAX_VALUE", + type = className, + value = maxValue.toString() + ) + } + + val sizeSince = if (thisKind.isFloatingPoint) "1.4" else "1.3" + this += PropertyDescription( + doc = "The number of bytes used to represent an instance of $className in a binary form.", + annotations = mutableListOf("SinceKotlin(\"$sizeSince\")"), + name = "SIZE_BYTES", + type = "Int", + value = thisKind.byteSize.toString() + ) + + this += PropertyDescription( + doc = "The number of bits used to represent an instance of $className in a binary form.", + annotations = mutableListOf("SinceKotlin(\"$sizeSince\")"), + name = "SIZE_BITS", + type = "Int", + value = thisKind.bitSize.toString() + ) + } + + properties.forEach { it.modifyGeneratedCompanionObjectProperty(thisKind) } + return CompanionObjectDescription(properties = properties).apply { this.modifyGeneratedCompanionObject(thisKind) } + } + + private fun generateCompareTo(thisKind: PrimitiveType): List { + return buildList { + for (otherKind in PrimitiveType.onlyNumeric) { + val doc = """ + Compares this value with the specified value for order. + Returns zero if this value is equal to the specified other value, a negative number if it's less than other, + or a positive number if it's greater than other. + """.trimIndent() + + val signature = MethodSignature( + isOverride = otherKind == thisKind, + isOperator = true, + name = "compareTo", + arg = MethodParameter("other", otherKind.capitalized), + returnType = PrimitiveType.INT.capitalized + ) + + this += MethodDescription( + doc = doc, + annotations = mutableListOf("kotlin.internal.IntrinsicConstEvaluation"), + signature = signature + ).apply { this.modifyGeneratedCompareTo(thisKind, otherKind) } + } + } + } + + private fun generateBinaryOperators(thisKind: PrimitiveType): List { + return buildList { + for (name in binaryOperators) { + this += generateOperator(name, thisKind) + } + } + } + + private fun generateOperator(name: String, thisKind: PrimitiveType): List { + return buildList { + for (otherKind in PrimitiveType.onlyNumeric) { + val returnType = getOperatorReturnType(thisKind, otherKind) + + val annotations = buildList { + if (name == "rem") add("SinceKotlin(\"1.1\")") + add("kotlin.internal.IntrinsicConstEvaluation") + } + + this += MethodDescription( + doc = binaryOperatorDoc(name, thisKind, otherKind), + annotations = annotations.toMutableList(), + signature = MethodSignature( + isOperator = true, + name = name, + arg = MethodParameter("other", otherKind.capitalized), + returnType = returnType.capitalized + ) + ).apply { this.modifyGeneratedBinaryOperation(thisKind, otherKind) } + } + } + } + + private fun generateUnaryOperators(thisKind: PrimitiveType): List { + return buildList { + for (name in listOf("inc", "dec")) { + this += MethodDescription( + doc = incDecOperatorsDoc(name), + signature = MethodSignature(isOperator = true, name = name, arg = null, returnType = thisKind.capitalized) + ).apply { this.modifyGeneratedUnaryOperation(thisKind) } + } + + for ((name, doc) in unaryPlusMinusOperators) { + val returnType = when (thisKind) { + in listOf(PrimitiveType.SHORT, PrimitiveType.BYTE, PrimitiveType.CHAR) -> PrimitiveType.INT.capitalized + else -> thisKind.capitalized + } + this += MethodDescription( + doc = doc, + annotations = mutableListOf("kotlin.internal.IntrinsicConstEvaluation"), + signature = MethodSignature(isOperator = true, name = name, arg = null, returnType = returnType) + ).apply { this.modifyGeneratedUnaryOperation(thisKind) } + } + } + } + + private fun generateRangeTo(thisKind: PrimitiveType): List { + return buildList { + for (otherKind in PrimitiveType.onlyNumeric) { + val returnType = maxByDomainCapacity(maxByDomainCapacity(thisKind, otherKind), PrimitiveType.INT) + + if (returnType == PrimitiveType.DOUBLE || returnType == PrimitiveType.FLOAT) { + continue + } + + this += MethodDescription( + doc = "Creates a range from this value to the specified [other] value.", + signature = MethodSignature( + isOperator = true, + name = "rangeTo", + arg = MethodParameter("other", otherKind.capitalized), + returnType = "${returnType.capitalized}Range" + ) + ).apply { this.modifyGeneratedRangeTo(thisKind) } + } + } + } + + private fun generateRangeUntil(thisKind: PrimitiveType): List { + return buildList { + for (otherKind in PrimitiveType.onlyNumeric) { + val returnType = maxByDomainCapacity(maxByDomainCapacity(thisKind, otherKind), PrimitiveType.INT) + + if (returnType == PrimitiveType.DOUBLE || returnType == PrimitiveType.FLOAT) { + continue + } + + this += MethodDescription( + doc = """ + Creates a range from this value up to but excluding the specified [other] value. + + If the [other] value is less than or equal to `this` value, then the returned range is empty. + """.trimIndent(), + annotations = mutableListOf("SinceKotlin(\"1.7\")", "ExperimentalStdlibApi"), + signature = MethodSignature( + isOperator = true, + name = "rangeUntil", + arg = MethodParameter("other", otherKind.capitalized), + returnType = "${returnType.capitalized}Range" + ) + ).apply { this.modifyGeneratedRangeUntil(thisKind) } + } + } + } + + private fun generateBitShiftOperators(thisKind: PrimitiveType): List { + return buildList { + val className = thisKind.capitalized + val detail = shiftOperatorsDocDetail(thisKind) + for ((name, doc) in shiftOperators) { + this += MethodDescription( + doc = doc + END_LINE + END_LINE + detail, + annotations = mutableListOf("kotlin.internal.IntrinsicConstEvaluation"), + signature = MethodSignature( + isInfix = true, + name = name, + arg = MethodParameter("bitCount", PrimitiveType.INT.capitalized), + returnType = className + ) + ).apply { this.modifyGeneratedBitShiftOperators(thisKind) } + } + } + } + + private fun generateBitwiseOperators(thisKind: PrimitiveType): List { + return buildList { + for ((name, doc) in bitwiseOperators) { + this += MethodDescription( + doc = doc, + annotations = mutableListOf("kotlin.internal.IntrinsicConstEvaluation"), + signature = MethodSignature( + isInfix = true, + name = name, + arg = MethodParameter("other", thisKind.capitalized), + returnType = thisKind.capitalized + ) + ).apply { this.modifyGeneratedBitwiseOperators(thisKind) } + } + + this += MethodDescription( + doc = "Inverts the bits in this value.", + annotations = mutableListOf("kotlin.internal.IntrinsicConstEvaluation"), + signature = MethodSignature( + name = "inv", + arg = null, + returnType = thisKind.capitalized + ) + ).apply { this.modifyGeneratedBitwiseOperators(thisKind) } + } + } + + private fun generateConversions(thisKind: PrimitiveType): List { + fun isFpToIntConversionDeprecated(otherKind: PrimitiveType): Boolean { + return thisKind in PrimitiveType.floatingPoint && otherKind in listOf(PrimitiveType.BYTE, PrimitiveType.SHORT) + } + + fun isCharConversionDeprecated(otherKind: PrimitiveType): Boolean { + return thisKind != PrimitiveType.INT && otherKind == PrimitiveType.CHAR + } + + return buildList { + val thisName = thisKind.capitalized + for (otherKind in PrimitiveType.exceptBoolean) { + val otherName = otherKind.capitalized + val doc = if (thisKind == otherKind) { + "Returns this value." + } else { + val detail = if (thisKind in PrimitiveType.integral) { + if (otherKind.isIntegral) { + docForConversionFromIntegralToIntegral(thisKind, otherKind) + } else { + docForConversionFromIntegralToFloating(thisKind, otherKind) + } + } else { + if (otherKind.isIntegral) { + docForConversionFromFloatingToIntegral(thisKind, otherKind) + } else { + docForConversionFromFloatingToFloating(thisKind, otherKind) + } + } + + "Converts this [$thisName] value to [$otherName].$END_LINE$END_LINE" + detail + } + + val annotations = mutableListOf() + if (isFpToIntConversionDeprecated(otherKind)) { + annotations += "Deprecated(\"Unclear conversion. To achieve the same result convert to Int explicitly and then to $otherName.\", ReplaceWith(\"toInt().to$otherName()\"))" + annotations += "DeprecatedSinceKotlin(warningSince = \"1.3\", errorSince = \"1.5\")" + } + if (isCharConversionDeprecated(otherKind)) { + annotations += "Deprecated(\"Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.\", ReplaceWith(\"this.toInt().toChar()\"))" + annotations += "DeprecatedSinceKotlin(warningSince = \"1.5\")" + } + + annotations += "kotlin.internal.IntrinsicConstEvaluation" + this += MethodDescription( + doc = doc, + annotations = annotations, + signature = MethodSignature( + isOverride = true, + name = "to$otherName", + arg = null, + returnType = otherName + ) + ).apply { this.modifyGeneratedConversions(thisKind) } + } + } + } + + private fun generateEquals(thisKind: PrimitiveType): MethodDescription { + return MethodDescription( + doc = null, + annotations = mutableListOf("kotlin.internal.IntrinsicConstEvaluation"), + signature = MethodSignature( + isOverride = true, + name = "equals", + arg = MethodParameter("other", "Any?"), + returnType = "Boolean" + ) + ).apply { this.modifyGeneratedEquals(thisKind) } + } + + private fun generateToString(thisKind: PrimitiveType): MethodDescription { + return MethodDescription( + doc = null, + annotations = mutableListOf("kotlin.internal.IntrinsicConstEvaluation"), + signature = MethodSignature( + isOverride = true, + name = "toString", + arg = null, + returnType = "String" + ) + ).apply { modifyGeneratedToString(thisKind) } + } + + internal open fun FileDescription.modifyGeneratedFile() {} + internal open fun ClassDescription.modifyGeneratedClass(thisKind: PrimitiveType) {} + internal open fun CompanionObjectDescription.modifyGeneratedCompanionObject(thisKind: PrimitiveType) {} + internal open fun PropertyDescription.modifyGeneratedCompanionObjectProperty(thisKind: PrimitiveType) {} + internal open fun MethodDescription.modifyGeneratedCompareTo(thisKind: PrimitiveType, otherKind: PrimitiveType) {} + internal open fun MethodDescription.modifyGeneratedBinaryOperation(thisKind: PrimitiveType, otherKind: PrimitiveType) {} + internal open fun MethodDescription.modifyGeneratedUnaryOperation(thisKind: PrimitiveType) {} + internal open fun MethodDescription.modifyGeneratedRangeTo(thisKind: PrimitiveType) {} + internal open fun MethodDescription.modifyGeneratedRangeUntil(thisKind: PrimitiveType) {} + internal open fun MethodDescription.modifyGeneratedBitShiftOperators(thisKind: PrimitiveType) {} + internal open fun MethodDescription.modifyGeneratedBitwiseOperators(thisKind: PrimitiveType) {} + internal open fun MethodDescription.modifyGeneratedConversions(thisKind: PrimitiveType) {} + internal open fun MethodDescription.modifyGeneratedEquals(thisKind: PrimitiveType) {} + internal open fun MethodDescription.modifyGeneratedToString(thisKind: PrimitiveType) {} + internal open fun generateAdditionalMethods(thisKind: PrimitiveType): List = emptyList() +} diff --git a/generators/builtins/primitives/JsPrimitivesGenerator.kt b/generators/builtins/primitives/JsPrimitivesGenerator.kt new file mode 100644 index 00000000000..d6b287dc1c5 --- /dev/null +++ b/generators/builtins/primitives/JsPrimitivesGenerator.kt @@ -0,0 +1,39 @@ +/* + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.generators.builtins.numbers.primitives + +import org.jetbrains.kotlin.generators.builtins.PrimitiveType +import java.io.PrintWriter + +class JsPrimitivesGenerator(writer: PrintWriter) : BasePrimitivesGenerator(writer) { + override fun PrimitiveType.shouldGenerate(): Boolean { + return this != PrimitiveType.LONG + } + + override fun FileDescription.modifyGeneratedFile() { + addSuppress("NON_ABSTRACT_FUNCTION_WITH_NO_BODY") + addSuppress("UNUSED_PARAMETER") + } + + override fun PropertyDescription.modifyGeneratedCompanionObjectProperty(thisKind: PrimitiveType) { + if (this.name in setOf("POSITIVE_INFINITY", "NEGATIVE_INFINITY", "NaN")) { + this.addAnnotation("Suppress(\"DIVISION_BY_ZERO\")") + } + } + + override fun generateAdditionalMethods(thisKind: PrimitiveType): List { + val hashCode = MethodDescription( + doc = null, + signature = MethodSignature( + isOverride = true, + name = "hashCode", + arg = null, + returnType = PrimitiveType.INT.capitalized + ) + ) + return listOf(hashCode) + } +} \ No newline at end of file diff --git a/generators/builtins/primitives/JvmPrimitivesGenerator.kt b/generators/builtins/primitives/JvmPrimitivesGenerator.kt new file mode 100644 index 00000000000..face653789d --- /dev/null +++ b/generators/builtins/primitives/JvmPrimitivesGenerator.kt @@ -0,0 +1,15 @@ +/* + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.generators.builtins.numbers.primitives + +import org.jetbrains.kotlin.generators.builtins.PrimitiveType +import java.io.PrintWriter + +class JvmPrimitivesGenerator(writer: PrintWriter) : BasePrimitivesGenerator(writer) { + override fun ClassDescription.modifyGeneratedClass(thisKind: PrimitiveType) { + this.addDoc("On the JVM, non-nullable values of this type are represented as values of the primitive type `${thisKind.name.lowercase()}`.") + } +} \ No newline at end of file diff --git a/generators/builtins/primitives/NativePrimitivesGenerator.kt b/generators/builtins/primitives/NativePrimitivesGenerator.kt new file mode 100644 index 00000000000..9af135848a1 --- /dev/null +++ b/generators/builtins/primitives/NativePrimitivesGenerator.kt @@ -0,0 +1,249 @@ +/* + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.generators.builtins.numbers.primitives + +import org.jetbrains.kotlin.generators.builtins.PrimitiveType +import java.io.PrintWriter +import java.util.* + +class NativePrimitivesGenerator(writer: PrintWriter) : BasePrimitivesGenerator(writer) { + override fun FileDescription.modifyGeneratedFile() { + this.addSuppress("OVERRIDE_BY_INLINE") + this.addSuppress("NOTHING_TO_INLINE") + this.addImport("kotlin.native.internal.*") + } + + override fun ClassDescription.modifyGeneratedClass(thisKind: PrimitiveType) { + this.isFinal = true + } + + override fun CompanionObjectDescription.modifyGeneratedCompanionObject(thisKind: PrimitiveType) { + if (thisKind !in PrimitiveType.floatingPoint) { + this.addAnnotation("CanBePrecreated") + } + } + + override fun primitiveConstants(type: PrimitiveType): List { + return when (type) { + PrimitiveType.FLOAT -> listOf( + String.format(Locale.US, "%.17eF", java.lang.Float.MIN_VALUE), + String.format(Locale.US, "%.17eF", java.lang.Float.MAX_VALUE), + "1.0F/0.0F", "-1.0F/0.0F", "-(0.0F/0.0F)" + ) + else -> super.primitiveConstants(type) + } + } + + override fun PropertyDescription.modifyGeneratedCompanionObjectProperty(thisKind: PrimitiveType) { + if (this.name in setOf("POSITIVE_INFINITY", "NEGATIVE_INFINITY", "NaN")) { + this.addAnnotation("Suppress(\"DIVISION_BY_ZERO\")") + } + } + + override fun MethodDescription.modifyGeneratedCompareTo(thisKind: PrimitiveType, otherKind: PrimitiveType) { + if (otherKind == thisKind) { + if (thisKind in PrimitiveType.floatingPoint) { + val argName = this.signature.arg!!.name + """ + // if any of values in NaN both comparisons return false + if (this > $argName) return 1 + if (this < $argName) return -1 + + val thisBits = this.toBits() + val otherBits = $argName.toBits() + + // Canonical NaN bits representation higher than any other bit represent value + return thisBits.compareTo(otherBits) + """.trimIndent().addAsMultiLineBody() + } else { + setAsExternal() + } + return + } + + this.signature.isInline = thisKind !in PrimitiveType.floatingPoint + val thisCasted = "this" + thisKind.castToIfNecessary(otherKind) + val otherCasted = this.signature.arg!!.name + otherKind.castToIfNecessary(thisKind) + if (thisKind == PrimitiveType.FLOAT && otherKind == PrimitiveType.DOUBLE) { + "- ${otherCasted}.compareTo(this)" + } else { + "$thisCasted.compareTo($otherCasted)" + }.addAsSingleLineBody(bodyOnNewLine = true) + } + + override fun MethodDescription.modifyGeneratedBinaryOperation(thisKind: PrimitiveType, otherKind: PrimitiveType) { + val sign = this.signature.name.asSign() + + if (thisKind != PrimitiveType.BYTE && thisKind != PrimitiveType.SHORT && thisKind == otherKind) { + return setAsExternal() + } + + this.signature.isInline = true + val returnTypeAsPrimitive = PrimitiveType.valueOf(this.signature.returnType.uppercase()) + val thisCasted = "this" + thisKind.castToIfNecessary(returnTypeAsPrimitive) + val otherCasted = this.signature.arg!!.name + this.signature.arg.getTypeAsPrimitive().castToIfNecessary(returnTypeAsPrimitive) + "$thisCasted $sign $otherCasted".addAsSingleLineBody(bodyOnNewLine = true) + } + + override fun MethodDescription.modifyGeneratedUnaryOperation(thisKind: PrimitiveType) { + if (this.signature.name in setOf("inc", "dec") || thisKind == PrimitiveType.INT || + thisKind in PrimitiveType.floatingPoint || (this.signature.name == "unaryMinus" && thisKind == PrimitiveType.LONG) + ) { + return setAsExternal() + } + + this.signature.isInline = true + val returnTypeAsPrimitive = PrimitiveType.valueOf(this.signature.returnType.uppercase()) + val thisCasted = "this" + thisKind.castToIfNecessary(returnTypeAsPrimitive) + val sign = if (this.signature.name == "unaryMinus") "-" else "" + "$sign$thisCasted".addAsSingleLineBody(bodyOnNewLine = true) + } + + override fun MethodDescription.modifyGeneratedRangeTo(thisKind: PrimitiveType) { + val rangeType = PrimitiveType.valueOf(this.signature.returnType.replace("Range", "").uppercase()) + val thisCasted = "this" + thisKind.castToIfNecessary(rangeType) + val otherCasted = this.signature.arg!!.name + this.signature.arg.getTypeAsPrimitive().castToIfNecessary(rangeType) + "return ${this.signature.returnType}($thisCasted, $otherCasted)".addAsMultiLineBody() + } + + override fun MethodDescription.modifyGeneratedRangeUntil(thisKind: PrimitiveType) { + "this until ${this.signature.arg!!.name}".addAsSingleLineBody(bodyOnNewLine = false) + } + + override fun MethodDescription.modifyGeneratedBitShiftOperators(thisKind: PrimitiveType) { + setAsExternal() + } + + override fun MethodDescription.modifyGeneratedBitwiseOperators(thisKind: PrimitiveType) { + setAsExternal() + } + + override fun MethodDescription.modifyGeneratedConversions(thisKind: PrimitiveType) { + val returnTypeAsPrimitive = PrimitiveType.valueOf(this.signature.returnType.uppercase()) + when { + returnTypeAsPrimitive == thisKind -> { + this.signature.isInline = true + "this".addAsSingleLineBody(bodyOnNewLine = true) + } + thisKind !in PrimitiveType.floatingPoint -> { + this.signature.isExternal = true + val intrinsicType = when { + returnTypeAsPrimitive in PrimitiveType.floatingPoint -> "SIGNED_TO_FLOAT" + returnTypeAsPrimitive.byteSize < thisKind.byteSize -> "INT_TRUNCATE" + returnTypeAsPrimitive.byteSize > thisKind.byteSize -> "SIGN_EXTEND" + else -> "ZERO_EXTEND" + } + this.addAnnotation("TypedIntrinsic(IntrinsicType.$intrinsicType)") + } + else -> { + if (returnTypeAsPrimitive in setOf(PrimitiveType.BYTE, PrimitiveType.SHORT, PrimitiveType.CHAR)) { + "this.toInt().to${this.signature.returnType}()".addAsSingleLineBody(bodyOnNewLine = false) + return + } + + this.signature.isExternal = true + when { + returnTypeAsPrimitive in setOf(PrimitiveType.INT, PrimitiveType.LONG) -> { + this.addAnnotation("GCUnsafeCall(\"Kotlin_${thisKind.capitalized}_to${this.signature.returnType}\")") + } + thisKind.byteSize > returnTypeAsPrimitive.byteSize -> { + this.addAnnotation("TypedIntrinsic(IntrinsicType.FLOAT_TRUNCATE)") + } + thisKind.byteSize < returnTypeAsPrimitive.byteSize -> { + this.addAnnotation("TypedIntrinsic(IntrinsicType.FLOAT_EXTEND)") + } + } + } + } + } + + override fun MethodDescription.modifyGeneratedEquals(thisKind: PrimitiveType) { + val argName = this.signature.arg!!.name + val additionalCheck = if (thisKind in PrimitiveType.floatingPoint) { + "this.equals(other)" + } else { + "kotlin.native.internal.areEqualByValue(this, $argName)" + } + " $argName is ${thisKind.capitalized} && $additionalCheck".addAsSingleLineBody(bodyOnNewLine = true) + } + + override fun MethodDescription.modifyGeneratedToString(thisKind: PrimitiveType) { + if (thisKind in PrimitiveType.floatingPoint) { + "NumberConverter.convert(this)".addAsSingleLineBody(bodyOnNewLine = false) + } else { + this.signature.isExternal = true + this.addAnnotation("GCUnsafeCall(\"Kotlin_${thisKind.capitalized}_toString\")") + } + } + + override fun generateAdditionalMethods(thisKind: PrimitiveType): List { + val hashCode = MethodDescription( + doc = null, + signature = MethodSignature( + isOverride = true, + name = "hashCode", + arg = null, + returnType = PrimitiveType.INT.capitalized + ) + ).apply { + when (thisKind) { + PrimitiveType.LONG -> "return ((this ushr 32) xor this).toInt()".addAsMultiLineBody() + PrimitiveType.FLOAT -> "toBits()".addAsSingleLineBody() + PrimitiveType.DOUBLE -> "toBits().hashCode()".addAsSingleLineBody() + else -> "return this${thisKind.castToIfNecessary(PrimitiveType.INT)}".addAsMultiLineBody() + } + } + + val customEquals = MethodDescription( + doc = null, + annotations = mutableListOf("kotlin.internal.IntrinsicConstEvaluation"), + signature = MethodSignature( + name = "equals", + arg = MethodParameter("other", thisKind.capitalized), + returnType = PrimitiveType.BOOLEAN.capitalized + ) + ).apply { + when (thisKind) { + in PrimitiveType.floatingPoint -> "toBits() == other.toBits()".addAsSingleLineBody(bodyOnNewLine = false) + else -> "kotlin.native.internal.areEqualByValue(this, other)".addAsSingleLineBody(bodyOnNewLine = false) + } + } + + val bits = MethodDescription( + doc = null, + signature = MethodSignature( + isExternal = true, + visibility = MethodVisibility.INTERNAL, + name = "bits", + arg = null, + returnType = if (thisKind == PrimitiveType.FLOAT) PrimitiveType.INT.capitalized else PrimitiveType.LONG.capitalized + ) + ).apply { + this.addAnnotation("TypedIntrinsic(IntrinsicType.REINTERPRET)") + this.addAnnotation("PublishedApi") + } + + return if (thisKind in PrimitiveType.floatingPoint) { + listOf(customEquals, hashCode, bits) + } else { + listOf(customEquals, hashCode) + } + } + + companion object { + private fun String.toNativeOperator(): String { + if (this == "div" || this == "rem") return "SIGNED_${this.uppercase(Locale.getDefault())}" + if (this == "compareTo") return "SIGNED_COMPARE_TO" + if (this.startsWith("unary")) return "UNARY_${this.replace("unary", "").uppercase(Locale.getDefault())}" + return this.uppercase(Locale.getDefault()) + } + + private fun MethodDescription.setAsExternal() { + addAnnotation("TypedIntrinsic(IntrinsicType.${this.signature.name.toNativeOperator()})") + this.signature.isExternal = true + } + } +} \ No newline at end of file diff --git a/generators/builtins/primitives/WasmPrimitivesGenerator.kt b/generators/builtins/primitives/WasmPrimitivesGenerator.kt new file mode 100644 index 00000000000..56482d8ee61 --- /dev/null +++ b/generators/builtins/primitives/WasmPrimitivesGenerator.kt @@ -0,0 +1,349 @@ +/* + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.generators.builtins.numbers.primitives + +import org.jetbrains.kotlin.generators.builtins.PrimitiveType +import java.io.PrintWriter +import java.util.* + +class WasmPrimitivesGenerator(writer: PrintWriter) : BasePrimitivesGenerator(writer) { + override fun FileDescription.modifyGeneratedFile() { + this.addSuppress("OVERRIDE_BY_INLINE") + this.addSuppress("NOTHING_TO_INLINE") + this.addSuppress("unused") + this.addSuppress("UNUSED_PARAMETER") + this.addImport("kotlin.wasm.internal.*") + } + + override fun ClassDescription.modifyGeneratedClass(thisKind: PrimitiveType) { + addAnnotation("WasmAutoboxed") + // used here little hack with name extension just to avoid creation of specialized "ConstructorParameterDescription" + constructorArg = MethodParameter("private val value", thisKind.capitalized) + } + + override fun CompanionObjectDescription.modifyGeneratedCompanionObject(thisKind: PrimitiveType) { + isPublic = true + } + + override fun primitiveConstants(type: PrimitiveType): List { + return when (type) { + PrimitiveType.FLOAT -> listOf( + String.format(Locale.US, "%.17eF", java.lang.Float.MIN_VALUE), + String.format(Locale.US, "%.17eF", java.lang.Float.MAX_VALUE), + "1.0F/0.0F", "-1.0F/0.0F", "-(0.0F/0.0F)" + ) + else -> super.primitiveConstants(type) + } + } + + override fun PropertyDescription.modifyGeneratedCompanionObjectProperty(thisKind: PrimitiveType) { + if (this.name in setOf("POSITIVE_INFINITY", "NEGATIVE_INFINITY", "NaN")) { + this.addAnnotation("Suppress(\"DIVISION_BY_ZERO\")") + } + } + + override fun MethodDescription.modifyGeneratedCompareTo(thisKind: PrimitiveType, otherKind: PrimitiveType) { + if (thisKind != otherKind || thisKind !in PrimitiveType.floatingPoint) { + this.signature.isInline = true + } + + val argName = this.signature.arg!!.name + if (otherKind == thisKind) { + if (thisKind in PrimitiveType.floatingPoint) { + """ + // if any of values in NaN both comparisons return false + if (this > $argName) return 1 + if (this < $argName) return -1 + + val thisBits = this.toBits() + val otherBits = $argName.toBits() + + // Canonical NaN bits representation higher than any other bit represent value + return thisBits.compareTo(otherBits) + """.trimIndent().addAsMultiLineBody() + } else { + val body = when (thisKind) { + PrimitiveType.BYTE -> "wasm_i32_compareTo(this.toInt(), $argName.toInt())" + PrimitiveType.SHORT -> "this.toInt().compareTo($argName.toInt())" + PrimitiveType.INT, PrimitiveType.LONG -> "wasm_${thisKind.prefixLowercase}_compareTo(this, $argName)" + else -> throw IllegalArgumentException("Unsupported type $thisKind for generation `compareTo` method") + } + body.addAsSingleLineBody(bodyOnNewLine = true) + } + return + } + + val thisCasted = "this" + thisKind.castToIfNecessary(otherKind) + val otherCasted = argName + otherKind.castToIfNecessary(thisKind) + when { + thisKind == PrimitiveType.FLOAT && otherKind == PrimitiveType.DOUBLE -> "- ${otherCasted}.compareTo(this)" + else -> "$thisCasted.compareTo($otherCasted)" + }.addAsSingleLineBody(bodyOnNewLine = true) + } + + override fun MethodDescription.modifyGeneratedBinaryOperation(thisKind: PrimitiveType, otherKind: PrimitiveType) { + val sign = this.signature.name.asSign() + val argName = this.signature.arg!!.name + if (thisKind != PrimitiveType.BYTE && thisKind != PrimitiveType.SHORT && thisKind == otherKind) { + val type = thisKind.capitalized + + when (val methodName = this.signature.name) { + "div" -> { + val oneConst = if (thisKind == PrimitiveType.LONG) "-1L" else "-1" + when (thisKind) { + PrimitiveType.INT, PrimitiveType.LONG -> "if (this == $type.MIN_VALUE && $argName == $oneConst) $type.MIN_VALUE else wasm_${thisKind.prefixLowercase}_div_s(this, $argName)" + else -> return implementAsIntrinsic(thisKind, methodName) + } + } + "rem" -> when (thisKind) { + in PrimitiveType.floatingPoint -> "this - (wasm_${thisKind.prefixLowercase}_nearest(this / $argName) * $argName)" + else -> return implementAsIntrinsic(thisKind, methodName) + } + else -> return implementAsIntrinsic(thisKind, methodName) + }.addAsSingleLineBody(bodyOnNewLine = true) + return + } + + this.signature.isInline = true + val returnTypeAsPrimitive = PrimitiveType.valueOf(this.signature.returnType.uppercase()) + val thisCasted = "this" + thisKind.castToIfNecessary(returnTypeAsPrimitive) + val otherCasted = argName + this.signature.arg.getTypeAsPrimitive().castToIfNecessary(returnTypeAsPrimitive) + "$thisCasted $sign $otherCasted".addAsSingleLineBody(bodyOnNewLine = true) + } + + override fun MethodDescription.modifyGeneratedUnaryOperation(thisKind: PrimitiveType) { + val methodName = this.signature.name + if (thisKind == PrimitiveType.INT && methodName == "dec") { + setAdditionalDoc("TODO: Fix test compiler/testData/codegen/box/functions/invoke/invoke.kt with inline dec") + } else { + this.signature.isInline = true + } + + if (methodName in setOf("inc", "dec")) { + val sign = if (methodName == "inc") "+" else "-" + when (thisKind) { + PrimitiveType.BYTE, PrimitiveType.SHORT -> "(this $sign 1).to${thisKind.capitalized}()".addAsSingleLineBody(bodyOnNewLine = true) + PrimitiveType.INT -> "this $sign 1".addAsSingleLineBody(bodyOnNewLine = true) + PrimitiveType.LONG -> "this $sign 1L".addAsSingleLineBody(bodyOnNewLine = true) + PrimitiveType.FLOAT -> "this $sign 1.0f".addAsSingleLineBody(bodyOnNewLine = true) + PrimitiveType.DOUBLE -> "this $sign 1.0".addAsSingleLineBody(bodyOnNewLine = true) + else -> Unit + } + } + + if (methodName in setOf("unaryMinus", "unaryPlus")) { + if (thisKind in PrimitiveType.floatingPoint && methodName == "unaryMinus") { + return implementAsIntrinsic(thisKind, methodName) + } + + val returnTypeAsPrimitive = PrimitiveType.valueOf(this.signature.returnType.uppercase()) + val thisCasted = "this" + thisKind.castToIfNecessary(returnTypeAsPrimitive) + val sign = if (methodName == "unaryMinus") { + when (thisKind) { + PrimitiveType.INT -> "0 - " + PrimitiveType.LONG -> "0L - " + else -> "-" + } + } else "" + "$sign$thisCasted".addAsSingleLineBody(bodyOnNewLine = true) + } + } + + override fun MethodDescription.modifyGeneratedRangeTo(thisKind: PrimitiveType) { + val rangeType = PrimitiveType.valueOf(this.signature.returnType.replace("Range", "").uppercase()) + val thisCasted = "this" + thisKind.castToIfNecessary(rangeType) + val otherCasted = this.signature.arg!!.name + this.signature.arg.getTypeAsPrimitive().castToIfNecessary(rangeType) + "return ${this.signature.returnType}($thisCasted, $otherCasted)".addAsMultiLineBody() + } + + override fun MethodDescription.modifyGeneratedRangeUntil(thisKind: PrimitiveType) { + "this until ${this.signature.arg!!.name}".addAsSingleLineBody(bodyOnNewLine = false) + } + + override fun MethodDescription.modifyGeneratedBitShiftOperators(thisKind: PrimitiveType) { + if (thisKind == PrimitiveType.INT) { + implementAsIntrinsic(thisKind, this.signature.name) + } else if (thisKind == PrimitiveType.LONG) { + this.signature.isInline = true + "wasm_i64_${this.signature.name.toWasmOperator().lowercase()}(this, ${signature.arg!!.name}.toLong())".addAsSingleLineBody(bodyOnNewLine = true) + } + } + + override fun MethodDescription.modifyGeneratedBitwiseOperators(thisKind: PrimitiveType) { + if (this.signature.name == "inv") { + this.signature.isInline = true + val oneConst = if (thisKind == PrimitiveType.LONG) "-1L" else "-1" + "this.xor($oneConst)".addAsSingleLineBody(bodyOnNewLine = true) + return + } + + implementAsIntrinsic(thisKind, this.signature.name) + } + + override fun MethodDescription.modifyGeneratedConversions(thisKind: PrimitiveType) { + val returnTypeAsPrimitive = PrimitiveType.valueOf(this.signature.returnType.uppercase()) + if (returnTypeAsPrimitive == thisKind) { + this.signature.isInline = true + "this".addAsSingleLineBody(bodyOnNewLine = true) + return + } + + when (thisKind) { + PrimitiveType.BYTE, PrimitiveType.SHORT -> when (returnTypeAsPrimitive) { + // byte to byte conversion impossible here due to earlier check on type equality + PrimitiveType.BYTE -> "this.toInt().toByte()".also { this.signature.isInline = true } + PrimitiveType.CHAR -> "reinterpretAsInt().reinterpretAsChar()" + PrimitiveType.SHORT -> "reinterpretAsInt().reinterpretAsShort()" + PrimitiveType.INT -> "reinterpretAsInt()" + PrimitiveType.LONG -> "wasm_i64_extend_i32_s(this.toInt())" + PrimitiveType.FLOAT -> "wasm_f32_convert_i32_s(this.toInt())" + PrimitiveType.DOUBLE -> "wasm_f64_convert_i32_s(this.toInt())" + else -> throw IllegalArgumentException("Unsupported type $returnTypeAsPrimitive for generation conversion method from type $thisKind") + } + PrimitiveType.INT -> when (returnTypeAsPrimitive) { + PrimitiveType.BYTE -> "((this shl 24) shr 24).reinterpretAsByte()" + PrimitiveType.CHAR -> "(this and 0xFFFF).reinterpretAsChar()" + PrimitiveType.SHORT -> "((this shl 16) shr 16).reinterpretAsShort()" + PrimitiveType.LONG -> "wasm_i64_extend_i32_s(this)" + PrimitiveType.FLOAT -> "wasm_f32_convert_i32_s(this)" + PrimitiveType.DOUBLE -> "wasm_f64_convert_i32_s(this)" + else -> throw IllegalArgumentException("Unsupported type $returnTypeAsPrimitive for generation conversion method from type $thisKind") + } + PrimitiveType.LONG -> when (returnTypeAsPrimitive) { + PrimitiveType.BYTE, PrimitiveType.CHAR, PrimitiveType.SHORT -> "this.toInt().to${returnTypeAsPrimitive.capitalized}()" + .also { this.signature.isInline = true } + PrimitiveType.INT -> "wasm_i32_wrap_i64(this)" + PrimitiveType.FLOAT -> "wasm_f32_convert_i64_s(this)" + PrimitiveType.DOUBLE -> "wasm_f64_convert_i64_s(this)" + else -> throw IllegalArgumentException("Unsupported type $returnTypeAsPrimitive for generation conversion method from type $thisKind") + } + in PrimitiveType.floatingPoint -> when (returnTypeAsPrimitive) { + PrimitiveType.BYTE, PrimitiveType.CHAR, PrimitiveType.SHORT -> "this.toInt().to${returnTypeAsPrimitive.capitalized}()" + .also { this.signature.isInline = true } + PrimitiveType.INT -> "wasm_i32_trunc_sat_${thisKind.prefixLowercase}_s(this)" + PrimitiveType.LONG -> "wasm_i64_trunc_sat_${thisKind.prefixLowercase}_s(this)" + PrimitiveType.FLOAT -> "wasm_f32_demote_f64(this)" + PrimitiveType.DOUBLE -> "wasm_f64_promote_f32(this)" + else -> throw IllegalArgumentException("Unsupported type $returnTypeAsPrimitive for generation conversion method from type $thisKind") + } + else -> throw IllegalArgumentException("Unsupported type $thisKind to generate conversion methods") + }.addAsSingleLineBody(bodyOnNewLine = false) + } + + override fun MethodDescription.modifyGeneratedEquals(thisKind: PrimitiveType) { + val argName = this.signature.arg!!.name + val additionalCheck = when (thisKind) { + PrimitiveType.LONG -> "wasm_i64_eq(this, $argName)" + PrimitiveType.FLOAT -> "this.equals(other)" + PrimitiveType.DOUBLE -> "this.toBits() == other.toBits()" + else -> { + "wasm_i32_eq(this${thisKind.castToIfNecessary(PrimitiveType.INT)}, $argName${thisKind.castToIfNecessary(PrimitiveType.INT)})" + } + } + "\t$argName is ${thisKind.capitalized} && $additionalCheck".addAsSingleLineBody(bodyOnNewLine = true) + } + + override fun MethodDescription.modifyGeneratedToString(thisKind: PrimitiveType) { + when (thisKind) { + in PrimitiveType.floatingPoint -> "dtoa(this${thisKind.castToIfNecessary(PrimitiveType.DOUBLE)})" + PrimitiveType.INT, PrimitiveType.LONG -> "itoa${thisKind.bitSize}(this, 10)" + else -> "this.toInt().toString()" + }.addAsSingleLineBody(bodyOnNewLine = true) + } + + override fun generateAdditionalMethods(thisKind: PrimitiveType): List { + val hashCode = MethodDescription( + doc = null, + signature = MethodSignature( + isOverride = true, + isInline = true, + name = "hashCode", + arg = null, + returnType = PrimitiveType.INT.capitalized + ) + ).apply { + when (thisKind) { + PrimitiveType.LONG -> "return ((this ushr 32) xor this).toInt()".addAsMultiLineBody() + PrimitiveType.FLOAT -> "toBits()".addAsSingleLineBody() + PrimitiveType.DOUBLE -> "toBits().hashCode()".addAsSingleLineBody() + else -> "return this${thisKind.castToIfNecessary(PrimitiveType.INT)}".addAsMultiLineBody() + } + } + + val customEquals = MethodDescription( + doc = null, + annotations = mutableListOf("kotlin.internal.IntrinsicConstEvaluation"), + signature = MethodSignature( + isInline = thisKind in PrimitiveType.floatingPoint, + name = "equals", + arg = MethodParameter("other", thisKind.capitalized), + returnType = PrimitiveType.BOOLEAN.capitalized + ) + ).apply { + when (thisKind) { + in PrimitiveType.floatingPoint -> "toBits() == other.toBits()".addAsSingleLineBody(bodyOnNewLine = false) + else -> implementAsIntrinsic(thisKind, this.signature.name) + } + } + + val reinterprets = setOf(PrimitiveType.INT, PrimitiveType.BOOLEAN, PrimitiveType.BYTE, PrimitiveType.SHORT, PrimitiveType.CHAR) + .map { + MethodDescription( + doc = null, + annotations = mutableListOf("WasmNoOpCast", "PublishedApi"), + signature = MethodSignature( + visibility = MethodVisibility.INTERNAL, + name = "reinterpretAs${it.capitalized}", + arg = null, + returnType = it.capitalized + ) + ).apply { "implementedAsIntrinsic".addAsSingleLineBody(bodyOnNewLine = true) } + } + + val reinterpretInt = reinterprets.first() + val otherReinterprets = reinterprets.drop(1).toTypedArray() + + return when (thisKind) { + PrimitiveType.BYTE, PrimitiveType.SHORT -> listOf(customEquals, hashCode, reinterpretInt) + PrimitiveType.INT -> listOf(customEquals, hashCode, *otherReinterprets) + else -> listOf(customEquals, hashCode) + } + } + + companion object { + private fun String.toWasmOperator(): String { + return when (this) { + "plus" -> "ADD" + "minus" -> "SUB" + "times" -> "MUL" + "rem" -> "REM_S" + "unaryMinus" -> "NEG" + "shr" -> "SHR_S" + "ushr" -> "SHR_U" + "equals" -> "EQ" + else -> this.uppercase() + } + } + + private fun MethodDescription.implementAsIntrinsic(thisKind: PrimitiveType, methodName: String) { + this.signature.isInline = false + addAnnotation("WasmOp(WasmOp.${thisKind.prefixUppercase}_${methodName.toWasmOperator()})") + "implementedAsIntrinsic".addAsSingleLineBody(bodyOnNewLine = true) + } + + private val PrimitiveType.prefixUppercase: String + get() = when (this) { + PrimitiveType.BYTE, PrimitiveType.SHORT, PrimitiveType.INT -> "I32" + PrimitiveType.LONG -> "I64" + PrimitiveType.FLOAT -> "F32" + PrimitiveType.DOUBLE -> "F64" + else -> "" + } + + private val PrimitiveType.prefixLowercase: String + get() = prefixUppercase.lowercase() + } +} \ No newline at end of file diff --git a/generators/builtins/primitives/declarations.kt b/generators/builtins/primitives/declarations.kt new file mode 100644 index 00000000000..e5ce47331df --- /dev/null +++ b/generators/builtins/primitives/declarations.kt @@ -0,0 +1,214 @@ +/* + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.generators.builtins.numbers.primitives + +import org.jetbrains.kotlin.generators.builtins.PrimitiveType +import java.io.File + +internal val END_LINE = "\n" + +private fun String.shift(): String { + return this.split(END_LINE).joinToString(separator = END_LINE) { if (it.isEmpty()) it else " $it" } +} + +internal abstract class AnnotatedAndDocumented { + protected abstract var doc: String? + protected abstract val annotations: MutableList + private var additionalDoc: String? = null + + fun addDoc(doc: String) { + if (this.doc == null) { + this.doc = doc + } else { + this.doc += "$END_LINE$doc" + } + } + + fun addAnnotation(annotation: String) { + annotations += annotation + } + + fun setAdditionalDoc(doc: String) { + additionalDoc = doc + } + + fun StringBuilder.printDocumentationAndAnnotations(forceMultiLineDoc: Boolean = false) { + if (doc != null) { + appendLine(doc!!.printAsDoc(forceMultiLineDoc)) + } + + if (annotations.isNotEmpty()) { + appendLine(annotations.joinToString(separator = END_LINE) { "@$it" }) + } + + if (additionalDoc != null) { + appendLine("// $additionalDoc") + } + } + + private fun String.printAsDoc(forceMultiLine: Boolean = false): String { + if (this.contains(END_LINE) || forceMultiLine) { + return this.split(END_LINE).joinToString( + separator = END_LINE, prefix = "/**$END_LINE", postfix = "$END_LINE */" + ) { if (it.isEmpty()) " *" else " * $it" } + } + return "/** $this */" + } +} + +internal data class FileDescription( + private val suppresses: MutableList = mutableListOf(), + private val imports: MutableList = mutableListOf(), + val classes: List +) { + fun addSuppress(suppress: String) { + suppresses += suppress + } + + fun addImport(newImport: String) { + imports += newImport + } + + override fun toString(): String { + return buildString { + appendLine(File("license/COPYRIGHT_HEADER.txt").readText()) + appendLine() + appendLine("// Auto-generated file. DO NOT EDIT!") + appendLine() + + if (suppresses.isNotEmpty()) { + appendLine(suppresses.joinToString(separator = ", ", prefix = "@file:Suppress(", postfix = ")") { "\"$it\"" }) + appendLine() + } + + appendLine("package kotlin") + appendLine() + + if (imports.isNotEmpty()) { + appendLine(imports.joinToString(separator = END_LINE) { "import $it" }) + appendLine() + } + + append(classes.joinToString(separator = END_LINE)) + } + } +} + +internal data class ClassDescription( + override var doc: String?, + override val annotations: MutableList, + var isFinal: Boolean = false, + val name: String, + var constructorArg: MethodParameter? = null, + val companionObject: CompanionObjectDescription, + val methods: List +) : AnnotatedAndDocumented() { + override fun toString(): String { + return buildString { + this.printDocumentationAndAnnotations() + + append("public ") + if (isFinal) append("final ") + appendLine("class $name private constructor(${constructorArg?.toString() ?: ""}) : Number(), Comparable<$name> {") + appendLine(companionObject.toString().shift()) + appendLine(methods.joinToString(separator = END_LINE + END_LINE) { it.toString().shift() }) + appendLine("}") + } + } +} + +internal data class CompanionObjectDescription( + override var doc: String? = null, + override val annotations: MutableList = mutableListOf(), + var isPublic: Boolean = false, + val properties: List +) : AnnotatedAndDocumented() { + override fun toString(): String { + return buildString { + printDocumentationAndAnnotations() + if (isPublic) append("public ") + appendLine("companion object {") + appendLine(properties.joinToString(separator = END_LINE + END_LINE) { it.toString().shift() }) + appendLine("}") + } + } +} + +internal data class MethodSignature( + var isExternal: Boolean = false, + val visibility: MethodVisibility = MethodVisibility.PUBLIC, + var isOverride: Boolean = false, + var isInline: Boolean = false, + var isInfix: Boolean = false, + var isOperator: Boolean = false, + val name: String, + val arg: MethodParameter?, + val returnType: String +) { + + override fun toString(): String { + return buildString { + if (isExternal) append("external ") + append("${visibility.name.lowercase()} ") + if (isOverride) append("override ") + if (isInline) append("inline ") + if (isInfix) append("infix ") + if (isOperator) append("operator ") + append("fun $name(${arg ?: ""}): $returnType") + } + } +} + +internal enum class MethodVisibility { + PUBLIC, INTERNAL, PRIVATE +} + +internal data class MethodParameter(val name: String, val type: String) { + fun getTypeAsPrimitive(): PrimitiveType = PrimitiveType.valueOf(type.uppercase()) + + override fun toString(): String { + return "$name: $type" + } +} + +internal data class MethodDescription( + override var doc: String?, + override val annotations: MutableList = mutableListOf(), + val signature: MethodSignature, + private var body: String? = null +) : AnnotatedAndDocumented() { + override fun toString(): String { + return buildString { + printDocumentationAndAnnotations() + append(signature) + append(body ?: "") + } + } + + fun String.addAsSingleLineBody(bodyOnNewLine: Boolean = false) { + val skip = if (bodyOnNewLine) "$END_LINE\t" else "" + body = " = $skip$this" + } + + fun String.addAsMultiLineBody() { + body = " {$END_LINE${this.shift()}$END_LINE}" + } +} + +internal data class PropertyDescription( + override var doc: String?, + override val annotations: MutableList = mutableListOf(), + val name: String, + val type: String, + val value: String +) : AnnotatedAndDocumented() { + override fun toString(): String { + return buildString { + printDocumentationAndAnnotations(forceMultiLineDoc = true) + append("public const val $name: $type = $value") + } + } +} diff --git a/generators/builtins/primitives/utils.kt b/generators/builtins/primitives/utils.kt new file mode 100644 index 00000000000..ac4c89cefdc --- /dev/null +++ b/generators/builtins/primitives/utils.kt @@ -0,0 +1,33 @@ +/* + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.generators.builtins.numbers.primitives + +import org.jetbrains.kotlin.generators.builtins.PrimitiveType + +internal fun PrimitiveType.castToIfNecessary(otherType: PrimitiveType): String { + if (this !in PrimitiveType.onlyNumeric || otherType !in PrimitiveType.onlyNumeric) { + throw IllegalArgumentException("Cannot cast to non-numeric type") + } + + if (this == otherType) return "" + + if (this.ordinal < otherType.ordinal) { + return ".to${otherType.capitalized}()" + } + + return "" +} + +internal fun String.asSign(): String { + return when (this) { + "plus" -> "+" + "minus" -> "-" + "times" -> "*" + "div" -> "/" + "rem" -> "%" + else -> throw IllegalArgumentException("Unsupported binary operation: ${this}") + } +} diff --git a/generators/builtins/unsignedTypes.kt b/generators/builtins/unsignedTypes.kt index 9dff9f9fa36..c3a0b3a485c 100644 --- a/generators/builtins/unsignedTypes.kt +++ b/generators/builtins/unsignedTypes.kt @@ -9,7 +9,8 @@ import org.jetbrains.kotlin.generators.builtins.PrimitiveType import org.jetbrains.kotlin.generators.builtins.UnsignedType import org.jetbrains.kotlin.generators.builtins.convert import org.jetbrains.kotlin.generators.builtins.generateBuiltIns.BuiltInsSourceGenerator -import org.jetbrains.kotlin.generators.builtins.numbers.GeneratePrimitives +import org.jetbrains.kotlin.generators.builtins.numbers.primitives.BasePrimitivesGenerator +import org.jetbrains.kotlin.generators.builtins.numbers.primitives.END_LINE import org.jetbrains.kotlin.generators.builtins.printDoc import java.io.File import java.io.PrintWriter @@ -55,7 +56,7 @@ class UnsignedTypeGenerator(val type: UnsignedType, out: PrintWriter) : BuiltIns For unsigned types, the remainders of flooring division and truncating division are the same. """.trimIndent() } - else -> GeneratePrimitives.binaryOperatorDoc(operator, operand1.asSigned, operand2.asSigned) + else -> BasePrimitivesGenerator.binaryOperatorDoc(operator, operand1.asSigned, operand2.asSigned) } override fun generateBody() { @@ -146,7 +147,7 @@ class UnsignedTypeGenerator(val type: UnsignedType, out: PrintWriter) : BuiltIns } private fun generateBinaryOperators() { - for (name in GeneratePrimitives.binaryOperators) { + for (name in BasePrimitivesGenerator.binaryOperators) { generateOperator(name) } generateFloorDivMod("floorDiv") @@ -203,7 +204,7 @@ class UnsignedTypeGenerator(val type: UnsignedType, out: PrintWriter) : BuiltIns private fun generateUnaryOperators() { for (name in listOf("inc", "dec")) { - out.println(GeneratePrimitives.incDecOperatorsDoc(name).replaceIndent(" ")) + out.printDoc(BasePrimitivesGenerator.incDecOperatorsDoc(name), " ") out.println(" @kotlin.internal.InlineOnly") out.println(" public inline operator fun $name(): $className = $className(data.$name())") out.println() @@ -240,13 +241,9 @@ class UnsignedTypeGenerator(val type: UnsignedType, out: PrintWriter) : BuiltIns private fun generateBitShiftOperators() { fun generateShiftOperator(name: String, implementation: String = name) { - val doc = GeneratePrimitives.shiftOperators[implementation]!! - val detail = GeneratePrimitives.shiftOperatorsDocDetail(type.asSigned) - out.println(" /**") - out.println(" * $doc") - out.println(" *") - out.println(detail.replaceIndent(" ")) - out.println(" */") + val doc = BasePrimitivesGenerator.shiftOperators[implementation]!! + val detail = BasePrimitivesGenerator.shiftOperatorsDocDetail(type.asSigned) + out.printDoc(doc + END_LINE + END_LINE + detail, " ") out.println(" @kotlin.internal.InlineOnly") out.println(" public inline infix fun $name(bitCount: Int): $className = $className(data $implementation bitCount)") out.println() @@ -257,7 +254,7 @@ class UnsignedTypeGenerator(val type: UnsignedType, out: PrintWriter) : BuiltIns } private fun generateBitwiseOperators() { - for ((name, doc) in GeneratePrimitives.bitwiseOperators) { + for ((name, doc) in BasePrimitivesGenerator.bitwiseOperators) { out.println(" /** $doc */") out.println(" @kotlin.internal.InlineOnly") out.println(" public inline infix fun $name(other: $className): $className = $className(this.data $name other.data)") diff --git a/kotlin-native/runtime/src/main/kotlin/kotlin/Primitives.kt b/kotlin-native/runtime/src/main/kotlin/kotlin/Primitives.kt index 466db389745..1575efec9cb 100644 --- a/kotlin-native/runtime/src/main/kotlin/kotlin/Primitives.kt +++ b/kotlin-native/runtime/src/main/kotlin/kotlin/Primitives.kt @@ -1,17 +1,17 @@ /* - * Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ -@file:Suppress("OVERRIDE_BY_INLINE", "NOTHING_TO_INLINE") +// Auto-generated file. DO NOT EDIT! + +@file:Suppress("OVERRIDE_BY_INLINE", "NOTHING_TO_INLINE") package kotlin import kotlin.native.internal.* -/** - * Represents a 8-bit signed integer. - */ +/** Represents a 8-bit signed integer. */ public final class Byte private constructor() : Number(), Comparable { @CanBePrecreated companion object { @@ -43,162 +43,234 @@ public final class Byte private constructor() : Number(), Comparable { * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.SIGNED_COMPARE_TO) external public override operator fun compareTo(other: Byte): Int + /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun compareTo(other: Short): Int = - this.toShort().compareTo(other) + this.toShort().compareTo(other) + /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun compareTo(other: Int): Int = - this.toInt().compareTo(other) + this.toInt().compareTo(other) + /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun compareTo(other: Long): Int = - this.toLong().compareTo(other) + this.toLong().compareTo(other) + /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun compareTo(other: Float): Int = - this.toFloat().compareTo(other) + this.toFloat().compareTo(other) + /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun compareTo(other: Double): Int = - this.toDouble().compareTo(other) + this.toDouble().compareTo(other) /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Byte): Int = - this.toInt() + other.toInt() + this.toInt() + other.toInt() + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Short): Int = - this.toInt() + other.toInt() + this.toInt() + other.toInt() + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Int): Int = - this.toInt() + other + this.toInt() + other + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Long): Long = - this.toLong() + other + this.toLong() + other + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Float): Float = - this.toFloat() + other + this.toFloat() + other + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Double): Double = - this.toDouble() + other + this.toDouble() + other /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Byte): Int = - this.toInt() - other.toInt() + this.toInt() - other.toInt() + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Short): Int = - this.toInt() - other.toInt() + this.toInt() - other.toInt() + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Int): Int = - this.toInt() - other + this.toInt() - other + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Long): Long = - this.toLong() - other + this.toLong() - other + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Float): Float = - this.toFloat() - other + this.toFloat() - other + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Double): Double = - this.toDouble() - other + this.toDouble() - other /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Byte): Int = - this.toInt() * other.toInt() + this.toInt() * other.toInt() + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Short): Int = - this.toInt() * other.toInt() + this.toInt() * other.toInt() + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Int): Int = - this.toInt() * other + this.toInt() * other + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Long): Long = - this.toLong() * other + this.toLong() * other + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Float): Float = - this.toFloat() * other + this.toFloat() * other + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Double): Double = - this.toDouble() * other + this.toDouble() * other /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Byte): Int = - this.toInt() / other.toInt() + this.toInt() / other.toInt() + /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Short): Int = - this.toInt() / other.toInt() + this.toInt() / other.toInt() + /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Int): Int = - this.toInt() / other + this.toInt() / other + /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Long): Long = - this.toLong() / other + this.toLong() / other + /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Float): Float = - this.toFloat() / other + this.toFloat() / other + /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Double): Double = - this.toDouble() / other + this.toDouble() / other /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Byte): Int = - this.toInt() % other.toInt() + this.toInt() % other.toInt() + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Short): Int = - this.toInt() % other.toInt() + this.toInt() % other.toInt() + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Int): Int = - this.toInt() % other + this.toInt() % other + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Long): Long = - this.toLong() % other + this.toLong() % other + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Float): Float = - this.toFloat() % other + this.toFloat() % other + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Double): Double = - this.toDouble() % other + this.toDouble() % other /** * Returns this value incremented by one. @@ -207,6 +279,7 @@ public final class Byte private constructor() : Number(), Comparable { */ @TypedIntrinsic(IntrinsicType.INC) external public operator fun inc(): Byte + /** * Returns this value decremented by one. * @@ -214,12 +287,16 @@ public final class Byte private constructor() : Number(), Comparable { */ @TypedIntrinsic(IntrinsicType.DEC) external public operator fun dec(): Byte + /** Returns this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun unaryPlus(): Int = - this.toInt() + this.toInt() + /** Returns the negative of this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun unaryMinus(): Int = - -this.toInt() + -this.toInt() /** Creates a range from this value to the specified [other] value. */ public operator fun rangeTo(other: Byte): IntRange { @@ -233,12 +310,12 @@ public final class Byte private constructor() : Number(), Comparable { /** Creates a range from this value to the specified [other] value. */ public operator fun rangeTo(other: Int): IntRange { - return IntRange(this.toInt(), other.toInt()) + return IntRange(this.toInt(), other) } /** Creates a range from this value to the specified [other] value. */ public operator fun rangeTo(other: Long): LongRange { - return LongRange(this.toLong(), other.toLong()) + return LongRange(this.toLong(), other) } /** @@ -278,8 +355,10 @@ public final class Byte private constructor() : Number(), Comparable { public operator fun rangeUntil(other: Long): LongRange = this until other /** Returns this value. */ - public inline override fun toByte(): Byte = - this + @kotlin.internal.IntrinsicConstEvaluation + public override inline fun toByte(): Byte = + this + /** * Converts this [Byte] value to [Char]. * @@ -290,8 +369,10 @@ public final class Byte private constructor() : Number(), Comparable { */ @Deprecated("Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", ReplaceWith("this.toInt().toChar()")) @DeprecatedSinceKotlin(warningSince = "1.5", errorSince = "2.3") + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.SIGN_EXTEND) external public override fun toChar(): Char + /** * Converts this [Byte] value to [Short]. * @@ -300,8 +381,10 @@ public final class Byte private constructor() : Number(), Comparable { * The least significant 8 bits of the resulting `Short` value are the same as the bits of this `Byte` value, * whereas the most significant 8 bits are filled with the sign bit of this value. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.SIGN_EXTEND) external public override fun toShort(): Short + /** * Converts this [Byte] value to [Int]. * @@ -310,8 +393,10 @@ public final class Byte private constructor() : Number(), Comparable { * The least significant 8 bits of the resulting `Int` value are the same as the bits of this `Byte` value, * whereas the most significant 24 bits are filled with the sign bit of this value. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.SIGN_EXTEND) external public override fun toInt(): Int + /** * Converts this [Byte] value to [Long]. * @@ -320,41 +405,45 @@ public final class Byte private constructor() : Number(), Comparable { * The least significant 8 bits of the resulting `Long` value are the same as the bits of this `Byte` value, * whereas the most significant 56 bits are filled with the sign bit of this value. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.SIGN_EXTEND) external public override fun toLong(): Long + /** * Converts this [Byte] value to [Float]. * * The resulting `Float` value represents the same numerical value as this `Byte`. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.SIGNED_TO_FLOAT) external public override fun toFloat(): Float + /** * Converts this [Byte] value to [Double]. * * The resulting `Double` value represents the same numerical value as this `Byte`. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.SIGNED_TO_FLOAT) external public override fun toDouble(): Double - - // Konan-specific. - public fun equals(other: Byte): Boolean = kotlin.native.internal.areEqualByValue(this, other) - + @kotlin.internal.IntrinsicConstEvaluation public override fun equals(other: Any?): Boolean = - other is Byte && kotlin.native.internal.areEqualByValue(this, other) + other is Byte && kotlin.native.internal.areEqualByValue(this, other) + @kotlin.internal.IntrinsicConstEvaluation @GCUnsafeCall("Kotlin_Byte_toString") external public override fun toString(): String + @kotlin.internal.IntrinsicConstEvaluation + public fun equals(other: Byte): Boolean = kotlin.native.internal.areEqualByValue(this, other) + public override fun hashCode(): Int { return this.toInt() } } -/** - * Represents a 16-bit signed integer. - */ +/** Represents a 16-bit signed integer. */ public final class Short private constructor() : Number(), Comparable { @CanBePrecreated companion object { @@ -386,162 +475,234 @@ public final class Short private constructor() : Number(), Comparable { * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun compareTo(other: Byte): Int = - this.compareTo(other.toShort()) + this.compareTo(other.toShort()) + /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.SIGNED_COMPARE_TO) external public override operator fun compareTo(other: Short): Int + /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun compareTo(other: Int): Int = - this.toInt().compareTo(other) + this.toInt().compareTo(other) + /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun compareTo(other: Long): Int = - this.toLong().compareTo(other) + this.toLong().compareTo(other) + /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun compareTo(other: Float): Int = - this.toFloat().compareTo(other) + this.toFloat().compareTo(other) + /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun compareTo(other: Double): Int = - this.toDouble().compareTo(other) + this.toDouble().compareTo(other) /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Byte): Int = - this.toInt() + other.toInt() + this.toInt() + other.toInt() + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Short): Int = - this.toInt() + other.toInt() + this.toInt() + other.toInt() + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Int): Int = - this.toInt() + other + this.toInt() + other + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Long): Long = - this.toLong() + other + this.toLong() + other + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Float): Float = - this.toFloat() + other + this.toFloat() + other + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Double): Double = - this.toDouble() + other + this.toDouble() + other /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Byte): Int = - this.toInt() - other.toInt() + this.toInt() - other.toInt() + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Short): Int = - this.toInt() - other.toInt() + this.toInt() - other.toInt() + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Int): Int = - this.toInt() - other + this.toInt() - other + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Long): Long = - this.toLong() - other + this.toLong() - other + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Float): Float = - this.toFloat() - other + this.toFloat() - other + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Double): Double = - this.toDouble() - other + this.toDouble() - other /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Byte): Int = - this.toInt() * other.toInt() + this.toInt() * other.toInt() + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Short): Int = - this.toInt() * other.toInt() + this.toInt() * other.toInt() + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Int): Int = - this.toInt() * other + this.toInt() * other + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Long): Long = - this.toLong() * other + this.toLong() * other + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Float): Float = - this.toFloat() * other + this.toFloat() * other + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Double): Double = - this.toDouble() * other + this.toDouble() * other /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Byte): Int = - this.toInt() / other.toInt() + this.toInt() / other.toInt() + /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Short): Int = - this.toInt() / other.toInt() + this.toInt() / other.toInt() + /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Int): Int = - this.toInt() / other + this.toInt() / other + /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Long): Long = - this.toLong() / other + this.toLong() / other + /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Float): Float = - this.toFloat() / other + this.toFloat() / other + /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Double): Double = - this.toDouble() / other + this.toDouble() / other /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Byte): Int = - this.toInt() % other.toInt() + this.toInt() % other.toInt() + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Short): Int = - this.toInt() % other.toInt() + this.toInt() % other.toInt() + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Int): Int = - this.toInt() % other + this.toInt() % other + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Long): Long = - this.toLong() % other + this.toLong() % other + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Float): Float = - this.toFloat() % other + this.toFloat() % other + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Double): Double = - this.toDouble() % other + this.toDouble() % other /** * Returns this value incremented by one. @@ -550,6 +711,7 @@ public final class Short private constructor() : Number(), Comparable { */ @TypedIntrinsic(IntrinsicType.INC) external public operator fun inc(): Short + /** * Returns this value decremented by one. * @@ -557,28 +719,35 @@ public final class Short private constructor() : Number(), Comparable { */ @TypedIntrinsic(IntrinsicType.DEC) external public operator fun dec(): Short + /** Returns this value. */ - public operator fun unaryPlus(): Int = - this.toInt() + @kotlin.internal.IntrinsicConstEvaluation + public inline operator fun unaryPlus(): Int = + this.toInt() + /** Returns the negative of this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun unaryMinus(): Int = - -this.toInt() + -this.toInt() /** Creates a range from this value to the specified [other] value. */ public operator fun rangeTo(other: Byte): IntRange { return IntRange(this.toInt(), other.toInt()) } + /** Creates a range from this value to the specified [other] value. */ public operator fun rangeTo(other: Short): IntRange { return IntRange(this.toInt(), other.toInt()) } + /** Creates a range from this value to the specified [other] value. */ public operator fun rangeTo(other: Int): IntRange { - return IntRange(this.toInt(), other.toInt()) + return IntRange(this.toInt(), other) } + /** Creates a range from this value to the specified [other] value. */ - public operator fun rangeTo(other: Long): LongRange { - return LongRange(this.toLong(), other.toLong()) + public operator fun rangeTo(other: Long): LongRange { + return LongRange(this.toLong(), other) } /** @@ -625,8 +794,10 @@ public final class Short private constructor() : Number(), Comparable { * * The resulting `Byte` value is represented by the least significant 8 bits of this `Short` value. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.INT_TRUNCATE) external public override fun toByte(): Byte + /** * Converts this [Short] value to [Char]. * @@ -635,12 +806,15 @@ public final class Short private constructor() : Number(), Comparable { */ @Deprecated("Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", ReplaceWith("this.toInt().toChar()")) @DeprecatedSinceKotlin(warningSince = "1.5", errorSince = "2.3") + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.ZERO_EXTEND) external public override fun toChar(): Char /** Returns this value. */ - public inline override fun toShort(): Short = - this + @kotlin.internal.IntrinsicConstEvaluation + public override inline fun toShort(): Short = + this + /** * Converts this [Short] value to [Int]. * @@ -649,8 +823,10 @@ public final class Short private constructor() : Number(), Comparable { * The least significant 16 bits of the resulting `Int` value are the same as the bits of this `Short` value, * whereas the most significant 16 bits are filled with the sign bit of this value. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.SIGN_EXTEND) external public override fun toInt(): Int + /** * Converts this [Short] value to [Long]. * @@ -659,40 +835,45 @@ public final class Short private constructor() : Number(), Comparable { * The least significant 16 bits of the resulting `Long` value are the same as the bits of this `Short` value, * whereas the most significant 48 bits are filled with the sign bit of this value. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.SIGN_EXTEND) external public override fun toLong(): Long + /** * Converts this [Short] value to [Float]. * * The resulting `Float` value represents the same numerical value as this `Short`. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.SIGNED_TO_FLOAT) external public override fun toFloat(): Float + /** * Converts this [Short] value to [Double]. * * The resulting `Double` value represents the same numerical value as this `Short`. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.SIGNED_TO_FLOAT) external public override fun toDouble(): Double - // Konan-specific. - public fun equals(other: Short): Boolean = kotlin.native.internal.areEqualByValue(this, other) - + @kotlin.internal.IntrinsicConstEvaluation public override fun equals(other: Any?): Boolean = - other is Short && kotlin.native.internal.areEqualByValue(this, other) + other is Short && kotlin.native.internal.areEqualByValue(this, other) + @kotlin.internal.IntrinsicConstEvaluation @GCUnsafeCall("Kotlin_Short_toString") external public override fun toString(): String + @kotlin.internal.IntrinsicConstEvaluation + public fun equals(other: Short): Boolean = kotlin.native.internal.areEqualByValue(this, other) + public override fun hashCode(): Int { return this.toInt() } } -/** - * Represents a 32-bit signed integer. - */ +/** Represents a 32-bit signed integer. */ public final class Int private constructor() : Number(), Comparable { @CanBePrecreated companion object { @@ -724,162 +905,234 @@ public final class Int private constructor() : Number(), Comparable { * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun compareTo(other: Byte): Int = - this.compareTo(other.toInt()) + this.compareTo(other.toInt()) + /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun compareTo(other: Short): Int = - this.compareTo(other.toInt()) + this.compareTo(other.toInt()) + /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.SIGNED_COMPARE_TO) external public override operator fun compareTo(other: Int): Int + /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun compareTo(other: Long): Int = - this.toLong().compareTo(other) + this.toLong().compareTo(other) + /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun compareTo(other: Float): Int = - this.toFloat().compareTo(other) + this.toFloat().compareTo(other) + /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun compareTo(other: Double): Int = - this.toDouble().compareTo(other) + this.toDouble().compareTo(other) /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Byte): Int = - this + other.toInt() + this + other.toInt() + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Short): Int = - this + other.toInt() + this + other.toInt() + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.PLUS) external public operator fun plus(other: Int): Int + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Long): Long = - this.toLong() + other + this.toLong() + other + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Float): Float = - this.toFloat() + other + this.toFloat() + other + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Double): Double = - this.toDouble() + other + this.toDouble() + other /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Byte): Int = - this - other.toInt() + this - other.toInt() + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Short): Int = - this - other.toInt() + this - other.toInt() + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.MINUS) external public operator fun minus(other: Int): Int + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Long): Long = - this.toLong() - other + this.toLong() - other + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Float): Float = - this.toFloat() - other + this.toFloat() - other + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Double): Double = - this.toDouble() - other + this.toDouble() - other /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Byte): Int = - this * other.toInt() + this * other.toInt() + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Short): Int = - this * other.toInt() + this * other.toInt() + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.TIMES) external public operator fun times(other: Int): Int + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Long): Long = - this.toLong() * other + this.toLong() * other + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Float): Float = - this.toFloat() * other + this.toFloat() * other + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Double): Double = - this.toDouble() * other + this.toDouble() * other /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Byte): Int = - this / other.toInt() + this / other.toInt() + /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Short): Int = - this / other.toInt() + this / other.toInt() + /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.SIGNED_DIV) external public operator fun div(other: Int): Int + /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Long): Long = - this.toLong() / other + this.toLong() / other + /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Float): Float = - this.toFloat() / other + this.toFloat() / other + /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Double): Double = - this.toDouble() / other + this.toDouble() / other /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Byte): Int = - this % other.toInt() + this % other.toInt() + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Short): Int = - this % other.toInt() + this % other.toInt() + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.SIGNED_REM) external public operator fun rem(other: Int): Int + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Long): Long = - this.toLong() % other + this.toLong() % other + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Float): Float = - this.toFloat() % other + this.toFloat() % other + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Double): Double = - this.toDouble() % other + this.toDouble() % other /** * Returns this value incremented by one. @@ -888,6 +1141,7 @@ public final class Int private constructor() : Number(), Comparable { */ @TypedIntrinsic(IntrinsicType.INC) external public operator fun inc(): Int + /** * Returns this value decremented by one. * @@ -895,10 +1149,14 @@ public final class Int private constructor() : Number(), Comparable { */ @TypedIntrinsic(IntrinsicType.DEC) external public operator fun dec(): Int + /** Returns this value. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.UNARY_PLUS) external public operator fun unaryPlus(): Int + /** Returns the negative of this value. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.UNARY_MINUS) external public operator fun unaryMinus(): Int @@ -914,12 +1172,12 @@ public final class Int private constructor() : Number(), Comparable { /** Creates a range from this value to the specified [other] value. */ public operator fun rangeTo(other: Int): IntRange { - return IntRange(this, other.toInt()) + return IntRange(this, other) } /** Creates a range from this value to the specified [other] value. */ public operator fun rangeTo(other: Long): LongRange { - return LongRange(this.toLong(), other.toLong()) + return LongRange(this.toLong(), other) } /** @@ -964,6 +1222,7 @@ public final class Int private constructor() : Number(), Comparable { * Note that only the five lowest-order bits of the [bitCount] are used as the shift distance. * The shift distance actually used is therefore always in the range `0..31`. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.SHL) external public infix fun shl(bitCount: Int): Int @@ -973,6 +1232,7 @@ public final class Int private constructor() : Number(), Comparable { * Note that only the five lowest-order bits of the [bitCount] are used as the shift distance. * The shift distance actually used is therefore always in the range `0..31`. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.SHR) external public infix fun shr(bitCount: Int): Int @@ -982,19 +1242,27 @@ public final class Int private constructor() : Number(), Comparable { * Note that only the five lowest-order bits of the [bitCount] are used as the shift distance. * The shift distance actually used is therefore always in the range `0..31`. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.USHR) external public infix fun ushr(bitCount: Int): Int /** Performs a bitwise AND operation between the two values. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.AND) external public infix fun and(other: Int): Int + /** Performs a bitwise OR operation between the two values. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.OR) external public infix fun or(other: Int): Int + /** Performs a bitwise XOR operation between the two values. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.XOR) external public infix fun xor(other: Int): Int + /** Inverts the bits in this value. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.INV) external public fun inv(): Int @@ -1006,8 +1274,10 @@ public final class Int private constructor() : Number(), Comparable { * * The resulting `Byte` value is represented by the least significant 8 bits of this `Int` value. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.INT_TRUNCATE) external public override fun toByte(): Byte + /** * Converts this [Int] value to [Char]. * @@ -1016,9 +1286,11 @@ public final class Int private constructor() : Number(), Comparable { * * The resulting `Char` code is represented by the least significant 16 bits of this `Int` value. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.INT_TRUNCATE) @Suppress("OVERRIDE_DEPRECATION") external public override fun toChar(): Char + /** * Converts this [Int] value to [Short]. * @@ -1027,12 +1299,15 @@ public final class Int private constructor() : Number(), Comparable { * * The resulting `Short` value is represented by the least significant 16 bits of this `Int` value. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.INT_TRUNCATE) external public override fun toShort(): Short /** Returns this value. */ - public inline override fun toInt(): Int = - this + @kotlin.internal.IntrinsicConstEvaluation + public override inline fun toInt(): Int = + this + /** * Converts this [Int] value to [Long]. * @@ -1041,8 +1316,10 @@ public final class Int private constructor() : Number(), Comparable { * The least significant 32 bits of the resulting `Long` value are the same as the bits of this `Int` value, * whereas the most significant 32 bits are filled with the sign bit of this value. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.SIGN_EXTEND) external public override fun toLong(): Long + /** * Converts this [Int] value to [Float]. * @@ -1050,33 +1327,36 @@ public final class Int private constructor() : Number(), Comparable { * In case when this `Int` value is exactly between two `Float`s, * the one with zero at least significant bit of mantissa is selected. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.SIGNED_TO_FLOAT) external public override fun toFloat(): Float + /** * Converts this [Int] value to [Double]. * * The resulting `Double` value represents the same numerical value as this `Int`. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.SIGNED_TO_FLOAT) external public override fun toDouble(): Double - // Konan-specific. - public fun equals(other: Int): Boolean = kotlin.native.internal.areEqualByValue(this, other) - + @kotlin.internal.IntrinsicConstEvaluation public override fun equals(other: Any?): Boolean = - other is Int && kotlin.native.internal.areEqualByValue(this, other) + other is Int && kotlin.native.internal.areEqualByValue(this, other) + @kotlin.internal.IntrinsicConstEvaluation @GCUnsafeCall("Kotlin_Int_toString") external public override fun toString(): String + @kotlin.internal.IntrinsicConstEvaluation + public fun equals(other: Int): Boolean = kotlin.native.internal.areEqualByValue(this, other) + public override fun hashCode(): Int { return this } } -/** - * Represents a 64-bit signed integer. - */ +/** Represents a 64-bit signed integer. */ public final class Long private constructor() : Number(), Comparable { @CanBePrecreated companion object { @@ -1108,162 +1388,234 @@ public final class Long private constructor() : Number(), Comparable { * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun compareTo(other: Byte): Int = - this.compareTo(other.toLong()) + this.compareTo(other.toLong()) + /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun compareTo(other: Short): Int = - this.compareTo(other.toLong()) + this.compareTo(other.toLong()) + /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun compareTo(other: Int): Int = - this.compareTo(other.toLong()) + this.compareTo(other.toLong()) + /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.SIGNED_COMPARE_TO) external public override operator fun compareTo(other: Long): Int + /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun compareTo(other: Float): Int = - this.toFloat().compareTo(other) + this.toFloat().compareTo(other) + /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun compareTo(other: Double): Int = - this.toDouble().compareTo(other) + this.toDouble().compareTo(other) /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Byte): Long = - this + other.toLong() + this + other.toLong() + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Short): Long = - this + other.toLong() + this + other.toLong() + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Int): Long = - this + other.toLong() + this + other.toLong() + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.PLUS) external public operator fun plus(other: Long): Long + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Float): Float = - this.toFloat() + other + this.toFloat() + other + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Double): Double = - this.toDouble() + other + this.toDouble() + other /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Byte): Long = - this - other.toLong() + this - other.toLong() + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Short): Long = - this - other.toLong() + this - other.toLong() + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Int): Long = - this - other.toLong() + this - other.toLong() + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.MINUS) external public operator fun minus(other: Long): Long + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Float): Float = - this.toFloat() - other + this.toFloat() - other + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Double): Double = - this.toDouble() - other + this.toDouble() - other /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Byte): Long = - this * other.toLong() + this * other.toLong() + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Short): Long = - this * other.toLong() + this * other.toLong() + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Int): Long = - this * other.toLong() + this * other.toLong() + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.TIMES) external public operator fun times(other: Long): Long + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Float): Float = - this.toFloat() * other + this.toFloat() * other + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Double): Double = - this.toDouble() * other + this.toDouble() * other /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Byte): Long = - this / other.toLong() + this / other.toLong() + /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Short): Long = - this / other.toLong() + this / other.toLong() + /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Int): Long = - this / other.toLong() + this / other.toLong() + /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.SIGNED_DIV) external public operator fun div(other: Long): Long + /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Float): Float = - this.toFloat() / other + this.toFloat() / other + /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Double): Double = - this.toDouble() / other + this.toDouble() / other /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Byte): Long = - this % other.toLong() + this % other.toLong() + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Short): Long = - this % other.toLong() + this % other.toLong() + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Int): Long = - this % other.toLong() + this % other.toLong() + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.SIGNED_REM) external public operator fun rem(other: Long): Long + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Float): Float = - this.toFloat() % other + this.toFloat() % other + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Double): Double = - this.toDouble() % other + this.toDouble() % other /** * Returns this value incremented by one. @@ -1272,6 +1624,7 @@ public final class Long private constructor() : Number(), Comparable { */ @TypedIntrinsic(IntrinsicType.INC) external public operator fun inc(): Long + /** * Returns this value decremented by one. * @@ -1279,10 +1632,14 @@ public final class Long private constructor() : Number(), Comparable { */ @TypedIntrinsic(IntrinsicType.DEC) external public operator fun dec(): Long + /** Returns this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun unaryPlus(): Long = - this + this + /** Returns the negative of this value. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.UNARY_MINUS) external public operator fun unaryMinus(): Long @@ -1290,17 +1647,20 @@ public final class Long private constructor() : Number(), Comparable { public operator fun rangeTo(other: Byte): LongRange { return LongRange(this, other.toLong()) } + /** Creates a range from this value to the specified [other] value. */ - public operator fun rangeTo(other: Short): LongRange { + public operator fun rangeTo(other: Short): LongRange { return LongRange(this, other.toLong()) } + /** Creates a range from this value to the specified [other] value. */ public operator fun rangeTo(other: Int): LongRange { return LongRange(this, other.toLong()) } + /** Creates a range from this value to the specified [other] value. */ - public operator fun rangeTo(other: Long): LongRange { - return LongRange(this, other.toLong()) + public operator fun rangeTo(other: Long): LongRange { + return LongRange(this, other) } /** @@ -1345,6 +1705,7 @@ public final class Long private constructor() : Number(), Comparable { * Note that only the six lowest-order bits of the [bitCount] are used as the shift distance. * The shift distance actually used is therefore always in the range `0..63`. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.SHL) external public infix fun shl(bitCount: Int): Long @@ -1354,6 +1715,7 @@ public final class Long private constructor() : Number(), Comparable { * Note that only the six lowest-order bits of the [bitCount] are used as the shift distance. * The shift distance actually used is therefore always in the range `0..63`. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.SHR) external public infix fun shr(bitCount: Int): Long @@ -1363,19 +1725,27 @@ public final class Long private constructor() : Number(), Comparable { * Note that only the six lowest-order bits of the [bitCount] are used as the shift distance. * The shift distance actually used is therefore always in the range `0..63`. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.USHR) external public infix fun ushr(bitCount: Int): Long /** Performs a bitwise AND operation between the two values. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.AND) external public infix fun and(other: Long): Long + /** Performs a bitwise OR operation between the two values. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.OR) external public infix fun or(other: Long): Long + /** Performs a bitwise XOR operation between the two values. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.XOR) external public infix fun xor(other: Long): Long + /** Inverts the bits in this value. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.INV) external public fun inv(): Long @@ -1387,8 +1757,10 @@ public final class Long private constructor() : Number(), Comparable { * * The resulting `Byte` value is represented by the least significant 8 bits of this `Long` value. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.INT_TRUNCATE) external public override fun toByte(): Byte + /** * Converts this [Long] value to [Char]. * @@ -1399,8 +1771,10 @@ public final class Long private constructor() : Number(), Comparable { */ @Deprecated("Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", ReplaceWith("this.toInt().toChar()")) @DeprecatedSinceKotlin(warningSince = "1.5", errorSince = "2.3") + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.INT_TRUNCATE) external public override fun toChar(): Char + /** * Converts this [Long] value to [Short]. * @@ -1409,8 +1783,10 @@ public final class Long private constructor() : Number(), Comparable { * * The resulting `Short` value is represented by the least significant 16 bits of this `Long` value. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.INT_TRUNCATE) external public override fun toShort(): Short + /** * Converts this [Long] value to [Int]. * @@ -1419,12 +1795,15 @@ public final class Long private constructor() : Number(), Comparable { * * The resulting `Int` value is represented by the least significant 32 bits of this `Long` value. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.INT_TRUNCATE) external public override fun toInt(): Int /** Returns this value. */ - public inline override fun toLong(): Long = - this + @kotlin.internal.IntrinsicConstEvaluation + public override inline fun toLong(): Long = + this + /** * Converts this [Long] value to [Float]. * @@ -1432,8 +1811,10 @@ public final class Long private constructor() : Number(), Comparable { * In case when this `Long` value is exactly between two `Float`s, * the one with zero at least significant bit of mantissa is selected. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.SIGNED_TO_FLOAT) external public override fun toFloat(): Float + /** * Converts this [Long] value to [Double]. * @@ -1441,55 +1822,56 @@ public final class Long private constructor() : Number(), Comparable { * In case when this `Long` value is exactly between two `Double`s, * the one with zero at least significant bit of mantissa is selected. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.SIGNED_TO_FLOAT) external public override fun toDouble(): Double - // Konan-specific. - public fun equals(other: Long): Boolean = kotlin.native.internal.areEqualByValue(this, other) - + @kotlin.internal.IntrinsicConstEvaluation public override fun equals(other: Any?): Boolean = - other is Long && kotlin.native.internal.areEqualByValue(this, other) + other is Long && kotlin.native.internal.areEqualByValue(this, other) + @kotlin.internal.IntrinsicConstEvaluation @GCUnsafeCall("Kotlin_Long_toString") external public override fun toString(): String + @kotlin.internal.IntrinsicConstEvaluation + public fun equals(other: Long): Boolean = kotlin.native.internal.areEqualByValue(this, other) + public override fun hashCode(): Int { - return ((this ushr 32) xor this).toInt() + return ((this ushr 32) xor this).toInt() } } -/** - * Represents a single-precision 32-bit IEEE 754 floating point number. - */ +/** Represents a single-precision 32-bit IEEE 754 floating point number. */ public final class Float private constructor() : Number(), Comparable { companion object { /** * A constant holding the smallest *positive* nonzero value of Float. */ - public const val MIN_VALUE: Float = 1.40129846432481707e-45f + public const val MIN_VALUE: Float = 1.40129846432481700e-45F /** * A constant holding the largest positive finite value of Float. */ - public const val MAX_VALUE: Float = 3.40282346638528860e+38f + public const val MAX_VALUE: Float = 3.40282346638528860e+38F /** * A constant holding the positive infinity value of Float. */ @Suppress("DIVISION_BY_ZERO") - public const val POSITIVE_INFINITY: Float = 1.0f / 0.0f + public const val POSITIVE_INFINITY: Float = 1.0F/0.0F /** * A constant holding the negative infinity value of Float. */ @Suppress("DIVISION_BY_ZERO") - public const val NEGATIVE_INFINITY: Float = -1.0f / 0.0f + public const val NEGATIVE_INFINITY: Float = -1.0F/0.0F /** * A constant holding the "not a number" value of Float. */ @Suppress("DIVISION_BY_ZERO") - public const val NaN: Float = -(0.0f / 0.0f) + public const val NaN: Float = -(0.0F/0.0F) /** * The number of bytes used to represent an instance of Float in a binary form. @@ -1509,30 +1891,43 @@ public final class Float private constructor() : Number(), Comparable { * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ - public operator fun compareTo(other: Byte): Int = compareTo(other.toFloat()) + @kotlin.internal.IntrinsicConstEvaluation + public operator fun compareTo(other: Byte): Int = + this.compareTo(other.toFloat()) + /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ - public operator fun compareTo(other: Short): Int = compareTo(other.toFloat()) + @kotlin.internal.IntrinsicConstEvaluation + public operator fun compareTo(other: Short): Int = + this.compareTo(other.toFloat()) + /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ - public operator fun compareTo(other: Int): Int = compareTo(other.toFloat()) + @kotlin.internal.IntrinsicConstEvaluation + public operator fun compareTo(other: Int): Int = + this.compareTo(other.toFloat()) + /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ - public operator fun compareTo(other: Long): Int = compareTo(other.toFloat()) + @kotlin.internal.IntrinsicConstEvaluation + public operator fun compareTo(other: Long): Int = + this.compareTo(other.toFloat()) + /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public override operator fun compareTo(other: Float): Int { // if any of values in NaN both comparisons return false if (this > other) return 1 @@ -1541,7 +1936,7 @@ public final class Float private constructor() : Number(), Comparable { val thisBits = this.toBits() val otherBits = other.toBits() - // Canonical NaN bits representation higher than any other bit representvalue + // Canonical NaN bits representation higher than any other bit represent value return thisBits.compareTo(otherBits) } @@ -1550,126 +1945,189 @@ public final class Float private constructor() : Number(), Comparable { * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ - public operator fun compareTo(other: Double): Int = - other.compareTo(this) + @kotlin.internal.IntrinsicConstEvaluation + public operator fun compareTo(other: Double): Int = + - other.compareTo(this) /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Byte): Float = - this + other.toFloat() + this + other.toFloat() + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Short): Float = - this + other.toFloat() + this + other.toFloat() + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Int): Float = - this + other.toFloat() + this + other.toFloat() + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Long): Float = - this + other.toFloat() + this + other.toFloat() + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.PLUS) external public operator fun plus(other: Float): Float + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Double): Double = - this.toDouble() + other + this.toDouble() + other /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Byte): Float = - this - other.toFloat() + this - other.toFloat() + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Short): Float = - this - other.toFloat() + this - other.toFloat() + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Int): Float = - this - other.toFloat() + this - other.toFloat() + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Long): Float = - this - other.toFloat() + this - other.toFloat() + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.MINUS) external public operator fun minus(other: Float): Float + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Double): Double = - this.toDouble() - other + this.toDouble() - other /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Byte): Float = - this * other.toFloat() + this * other.toFloat() + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Short): Float = - this * other.toFloat() + this * other.toFloat() + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Int): Float = - this * other.toFloat() + this * other.toFloat() + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Long): Float = - this * other.toFloat() + this * other.toFloat() + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.TIMES) external public operator fun times(other: Float): Float + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Double): Double = - this.toDouble() * other + this.toDouble() * other /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Byte): Float = - this / other.toFloat() + this / other.toFloat() + /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Short): Float = - this / other.toFloat() + this / other.toFloat() + /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Int): Float = - this / other.toFloat() + this / other.toFloat() + /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Long): Float = - this / other.toFloat() + this / other.toFloat() + /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.SIGNED_DIV) external public operator fun div(other: Float): Float + /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Double): Double = - this.toDouble() / other + this.toDouble() / other /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Byte): Float = - this % other.toFloat() + this % other.toFloat() + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Short): Float = - this % other.toFloat() + this % other.toFloat() + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Int): Float = - this % other.toFloat() + this % other.toFloat() + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Long): Float = - this % other.toFloat() + this % other.toFloat() + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.SIGNED_REM) external public operator fun rem(other: Float): Float + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Double): Double = - this.toDouble() % other + this.toDouble() % other /** * Returns this value incremented by one. @@ -1678,6 +2136,7 @@ public final class Float private constructor() : Number(), Comparable { */ @TypedIntrinsic(IntrinsicType.INC) external public operator fun inc(): Float + /** * Returns this value decremented by one. * @@ -1685,10 +2144,14 @@ public final class Float private constructor() : Number(), Comparable { */ @TypedIntrinsic(IntrinsicType.DEC) external public operator fun dec(): Float + /** Returns this value. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.UNARY_PLUS) external public operator fun unaryPlus(): Float + /** Returns the negative of this value. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.UNARY_MINUS) external public operator fun unaryMinus(): Float @@ -1699,6 +2162,7 @@ public final class Float private constructor() : Number(), Comparable { */ @Deprecated("Unclear conversion. To achieve the same result convert to Int explicitly and then to Byte.", ReplaceWith("toInt().toByte()")) @DeprecatedSinceKotlin(warningSince = "1.3", errorSince = "1.5") + @kotlin.internal.IntrinsicConstEvaluation public override fun toByte(): Byte = this.toInt().toByte() /** @@ -1708,6 +2172,7 @@ public final class Float private constructor() : Number(), Comparable { */ @Deprecated("Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", ReplaceWith("this.toInt().toChar()")) @DeprecatedSinceKotlin(warningSince = "1.5", errorSince = "2.3") + @kotlin.internal.IntrinsicConstEvaluation public override fun toChar(): Char = this.toInt().toChar() /** @@ -1717,6 +2182,7 @@ public final class Float private constructor() : Number(), Comparable { */ @Deprecated("Unclear conversion. To achieve the same result convert to Int explicitly and then to Short.", ReplaceWith("toInt().toShort()")) @DeprecatedSinceKotlin(warningSince = "1.3", errorSince = "1.5") + @kotlin.internal.IntrinsicConstEvaluation public override fun toShort(): Short = this.toInt().toShort() /** @@ -1726,8 +2192,10 @@ public final class Float private constructor() : Number(), Comparable { * Returns zero if this `Float` value is `NaN`, [Int.MIN_VALUE] if it's less than `Int.MIN_VALUE`, * [Int.MAX_VALUE] if it's bigger than `Int.MAX_VALUE`. */ + @kotlin.internal.IntrinsicConstEvaluation @GCUnsafeCall("Kotlin_Float_toInt") external public override fun toInt(): Int + /** * Converts this [Float] value to [Long]. * @@ -1735,23 +2203,27 @@ public final class Float private constructor() : Number(), Comparable { * Returns zero if this `Float` value is `NaN`, [Long.MIN_VALUE] if it's less than `Long.MIN_VALUE`, * [Long.MAX_VALUE] if it's bigger than `Long.MAX_VALUE`. */ + @kotlin.internal.IntrinsicConstEvaluation @GCUnsafeCall("Kotlin_Float_toLong") external public override fun toLong(): Long /** Returns this value. */ - public inline override fun toFloat(): Float = - this + @kotlin.internal.IntrinsicConstEvaluation + public override inline fun toFloat(): Float = + this + /** * Converts this [Float] value to [Double]. * * The resulting `Double` value represents the same numerical value as this `Float`. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.FLOAT_EXTEND) external public override fun toDouble(): Double - public fun equals(other: Float): Boolean = toBits() == other.toBits() - - public override fun equals(other: Any?): Boolean = other is Float && this.equals(other) + @kotlin.internal.IntrinsicConstEvaluation + public override fun equals(other: Any?): Boolean = + other is Float && this.equals(other) /** * Returns the string representation of this [Float] value. @@ -1761,7 +2233,11 @@ public final class Float private constructor() : Number(), Comparable { * using [String.toFloat], and will result in the same numeric value. * The exact bit pattern of a `NaN` float is not guaranteed to be preserved though. */ - public override fun toString() = NumberConverter.convert(this) + @kotlin.internal.IntrinsicConstEvaluation + public override fun toString(): String = NumberConverter.convert(this) + + @kotlin.internal.IntrinsicConstEvaluation + public fun equals(other: Float): Boolean = toBits() == other.toBits() public override fun hashCode(): Int = toBits() @@ -1770,38 +2246,36 @@ public final class Float private constructor() : Number(), Comparable { external internal fun bits(): Int } -/** - * Represents a double-precision 64-bit IEEE 754 floating point number. - */ +/** Represents a double-precision 64-bit IEEE 754 floating point number. */ public final class Double private constructor() : Number(), Comparable { companion object { /** * A constant holding the smallest *positive* nonzero value of Double. */ - public const val MIN_VALUE: Double = 4.9e-324 + public const val MIN_VALUE: Double = 4.9E-324 /** * A constant holding the largest positive finite value of Double. */ - public const val MAX_VALUE: Double = 1.7976931348623157e+308 + public const val MAX_VALUE: Double = 1.7976931348623157E308 /** * A constant holding the positive infinity value of Double. */ @Suppress("DIVISION_BY_ZERO") - public const val POSITIVE_INFINITY: Double = 1.0 / 0.0 + public const val POSITIVE_INFINITY: Double = 1.0/0.0 /** * A constant holding the negative infinity value of Double. */ @Suppress("DIVISION_BY_ZERO") - public const val NEGATIVE_INFINITY: Double = -1.0 / 0.0 + public const val NEGATIVE_INFINITY: Double = -1.0/0.0 /** * A constant holding the "not a number" value of Double. */ @Suppress("DIVISION_BY_ZERO") - public const val NaN: Double = -(0.0 / 0.0) + public const val NaN: Double = -(0.0/0.0) /** * The number of bytes used to represent an instance of Double in a binary form. @@ -1821,41 +2295,52 @@ public final class Double private constructor() : Number(), Comparable { * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ - public operator fun compareTo(other: Byte): Int = compareTo(other.toDouble()) + @kotlin.internal.IntrinsicConstEvaluation + public operator fun compareTo(other: Byte): Int = + this.compareTo(other.toDouble()) /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ - public operator fun compareTo(other: Short): Int = compareTo(other.toDouble()) + @kotlin.internal.IntrinsicConstEvaluation + public operator fun compareTo(other: Short): Int = + this.compareTo(other.toDouble()) /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ - public operator fun compareTo(other: Int): Int = compareTo(other.toDouble()) + @kotlin.internal.IntrinsicConstEvaluation + public operator fun compareTo(other: Int): Int = + this.compareTo(other.toDouble()) /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ - public operator fun compareTo(other: Long): Int = compareTo(other.toDouble()) + @kotlin.internal.IntrinsicConstEvaluation + public operator fun compareTo(other: Long): Int = + this.compareTo(other.toDouble()) /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ - public operator fun compareTo(other: Float): Int = compareTo(other.toDouble()) + @kotlin.internal.IntrinsicConstEvaluation + public operator fun compareTo(other: Float): Int = + this.compareTo(other.toDouble()) /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public override operator fun compareTo(other: Double): Int { // if any of values in NaN both comparisons return false if (this > other) return 1 @@ -1864,83 +2349,127 @@ public final class Double private constructor() : Number(), Comparable { val thisBits = this.toBits() val otherBits = other.toBits() - // Canonical NaN bits representation higher than any other bit representvalue + // Canonical NaN bits representation higher than any other bit represent value return thisBits.compareTo(otherBits) } /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Byte): Double = - this + other.toDouble() + this + other.toDouble() + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Short): Double = - this + other.toDouble() + this + other.toDouble() + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Int): Double = - this + other.toDouble() + this + other.toDouble() + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Long): Double = - this + other.toDouble() + this + other.toDouble() + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Float): Double = - this + other.toDouble() + this + other.toDouble() + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.PLUS) external public operator fun plus(other: Double): Double /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Byte): Double = - this - other.toDouble() + this - other.toDouble() + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Short): Double = - this - other.toDouble() + this - other.toDouble() + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Int): Double = - this - other.toDouble() + this - other.toDouble() + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Long): Double = - this - other.toDouble() + this - other.toDouble() + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Float): Double = - this - other.toDouble() + this - other.toDouble() + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.MINUS) external public operator fun minus(other: Double): Double /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Byte): Double = - this * other.toDouble() + this * other.toDouble() + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Short): Double = - this * other.toDouble() + this * other.toDouble() + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Int): Double = - this * other.toDouble() + this * other.toDouble() + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Long): Double = - this * other.toDouble() + this * other.toDouble() + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Float): Double = - this * other.toDouble() + this * other.toDouble() + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.TIMES) external public operator fun times(other: Double): Double /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Byte): Double = - this / other.toDouble() + this / other.toDouble() + /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Short): Double = - this / other.toDouble() + this / other.toDouble() + /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Int): Double = - this / other.toDouble() + this / other.toDouble() + /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Long): Double = - this / other.toDouble() + this / other.toDouble() + /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Float): Double = - this / other.toDouble() + this / other.toDouble() + /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.SIGNED_DIV) external public operator fun div(other: Double): Double @@ -1949,41 +2478,58 @@ public final class Double private constructor() : Number(), Comparable { * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Byte): Double = - this % other.toDouble() + this % other.toDouble() + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Short): Double = - this % other.toDouble() + this % other.toDouble() + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Int): Double = - this % other.toDouble() + this % other.toDouble() + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Long): Double = - this % other.toDouble() + this % other.toDouble() + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Float): Double = - this % other.toDouble() + this % other.toDouble() + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.SIGNED_REM) external public operator fun rem(other: Double): Double @@ -1994,6 +2540,7 @@ public final class Double private constructor() : Number(), Comparable { */ @TypedIntrinsic(IntrinsicType.INC) external public operator fun inc(): Double + /** * Returns this value decremented by one. * @@ -2001,10 +2548,14 @@ public final class Double private constructor() : Number(), Comparable { */ @TypedIntrinsic(IntrinsicType.DEC) external public operator fun dec(): Double + /** Returns this value. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.UNARY_PLUS) external public operator fun unaryPlus(): Double + /** Returns the negative of this value. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.UNARY_MINUS) external public operator fun unaryMinus(): Double @@ -2015,6 +2566,7 @@ public final class Double private constructor() : Number(), Comparable { */ @Deprecated("Unclear conversion. To achieve the same result convert to Int explicitly and then to Byte.", ReplaceWith("toInt().toByte()")) @DeprecatedSinceKotlin(warningSince = "1.3", errorSince = "1.5") + @kotlin.internal.IntrinsicConstEvaluation public override fun toByte(): Byte = this.toInt().toByte() /** @@ -2024,6 +2576,7 @@ public final class Double private constructor() : Number(), Comparable { */ @Deprecated("Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", ReplaceWith("this.toInt().toChar()")) @DeprecatedSinceKotlin(warningSince = "1.5", errorSince = "2.3") + @kotlin.internal.IntrinsicConstEvaluation public override fun toChar(): Char = this.toInt().toChar() /** @@ -2033,6 +2586,7 @@ public final class Double private constructor() : Number(), Comparable { */ @Deprecated("Unclear conversion. To achieve the same result convert to Int explicitly and then to Short.", ReplaceWith("toInt().toShort()")) @DeprecatedSinceKotlin(warningSince = "1.3", errorSince = "1.5") + @kotlin.internal.IntrinsicConstEvaluation public override fun toShort(): Short = this.toInt().toShort() /** @@ -2042,8 +2596,10 @@ public final class Double private constructor() : Number(), Comparable { * Returns zero if this `Double` value is `NaN`, [Int.MIN_VALUE] if it's less than `Int.MIN_VALUE`, * [Int.MAX_VALUE] if it's bigger than `Int.MAX_VALUE`. */ + @kotlin.internal.IntrinsicConstEvaluation @GCUnsafeCall("Kotlin_Double_toInt") external public override fun toInt(): Int + /** * Converts this [Double] value to [Long]. * @@ -2051,8 +2607,10 @@ public final class Double private constructor() : Number(), Comparable { * Returns zero if this `Double` value is `NaN`, [Long.MIN_VALUE] if it's less than `Long.MIN_VALUE`, * [Long.MAX_VALUE] if it's bigger than `Long.MAX_VALUE`. */ + @kotlin.internal.IntrinsicConstEvaluation @GCUnsafeCall("Kotlin_Double_toLong") external public override fun toLong(): Long + /** * Converts this [Double] value to [Float]. * @@ -2060,16 +2618,18 @@ public final class Double private constructor() : Number(), Comparable { * In case when this `Double` value is exactly between two `Float`s, * the one with zero at least significant bit of mantissa is selected. */ + @kotlin.internal.IntrinsicConstEvaluation @TypedIntrinsic(IntrinsicType.FLOAT_TRUNCATE) external public override fun toFloat(): Float /** Returns this value. */ - public inline override fun toDouble(): Double = - this + @kotlin.internal.IntrinsicConstEvaluation + public override inline fun toDouble(): Double = + this - public fun equals(other: Double): Boolean = toBits() == other.toBits() - - public override fun equals(other: Any?): Boolean = other is Double && this.equals(other) + @kotlin.internal.IntrinsicConstEvaluation + public override fun equals(other: Any?): Boolean = + other is Double && this.equals(other) /** * Returns the string representation of this [Double] value. @@ -2079,8 +2639,12 @@ public final class Double private constructor() : Number(), Comparable { * using [String.toDouble], and will result in the same numeric value. * The exact bit pattern of a `NaN` double is not guaranteed to be preserved though. */ + @kotlin.internal.IntrinsicConstEvaluation public override fun toString(): String = NumberConverter.convert(this) + @kotlin.internal.IntrinsicConstEvaluation + public fun equals(other: Double): Boolean = toBits() == other.toBits() + public override fun hashCode(): Int = toBits().hashCode() @TypedIntrinsic(IntrinsicType.REINTERPRET) diff --git a/libraries/stdlib/api/js-v1/kotlin.kt b/libraries/stdlib/api/js-v1/kotlin.kt index eba4dc5aa25..9d77e353f5b 100644 --- a/libraries/stdlib/api/js-v1/kotlin.kt +++ b/libraries/stdlib/api/js-v1/kotlin.kt @@ -986,83 +986,83 @@ public final annotation class BuilderInference : kotlin.Annotation { } public final class Byte : kotlin.Number, kotlin.Comparable { -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public open override operator fun compareTo(other: kotlin.Byte): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun compareTo(other: kotlin.Double): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun compareTo(other: kotlin.Float): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun compareTo(other: kotlin.Int): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun compareTo(other: kotlin.Long): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun compareTo(other: kotlin.Short): kotlin.Int public final operator fun dec(): kotlin.Byte -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Byte): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Double): kotlin.Double -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Float): kotlin.Float -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Int): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Long): kotlin.Long -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Short): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public open override operator fun equals(other: kotlin.Any?): kotlin.Boolean public final operator fun inc(): kotlin.Byte -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Byte): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Double): kotlin.Double -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Float): kotlin.Float -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Int): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Long): kotlin.Long -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Short): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Byte): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Double): kotlin.Double -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Float): kotlin.Float -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Int): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Long): kotlin.Long -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Short): kotlin.Int public final operator fun rangeTo(other: kotlin.Byte): kotlin.ranges.IntRange @@ -1090,77 +1090,77 @@ public final class Byte : kotlin.Number, kotlin.Comparable { public final operator fun rangeUntil(other: kotlin.Short): kotlin.ranges.IntRange @kotlin.SinceKotlin(version = "1.1") -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Byte): kotlin.Int @kotlin.SinceKotlin(version = "1.1") -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Double): kotlin.Double @kotlin.SinceKotlin(version = "1.1") -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Float): kotlin.Float @kotlin.SinceKotlin(version = "1.1") -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Int): kotlin.Int @kotlin.SinceKotlin(version = "1.1") -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Long): kotlin.Long @kotlin.SinceKotlin(version = "1.1") -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Short): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Byte): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Double): kotlin.Double -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Float): kotlin.Float -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Int): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Long): kotlin.Long -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Short): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public open override fun toByte(): kotlin.Byte @kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "2.3", warningSince = "1.5") -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public open override fun toChar(): kotlin.Char -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public open override fun toDouble(): kotlin.Double -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public open override fun toFloat(): kotlin.Float -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public open override fun toInt(): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public open override fun toLong(): kotlin.Long -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public open override fun toShort(): kotlin.Short -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public open override fun toString(): kotlin.String -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun unaryMinus(): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun unaryPlus(): kotlin.Int public companion object of Byte { @@ -1397,161 +1397,161 @@ public final enum class DeprecationLevel : kotlin.Enum } public final class Double : kotlin.Number, kotlin.Comparable { -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun compareTo(other: kotlin.Byte): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public open override operator fun compareTo(other: kotlin.Double): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun compareTo(other: kotlin.Float): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun compareTo(other: kotlin.Int): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun compareTo(other: kotlin.Long): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun compareTo(other: kotlin.Short): kotlin.Int public final operator fun dec(): kotlin.Double -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Byte): kotlin.Double -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Double): kotlin.Double -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Float): kotlin.Double -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Int): kotlin.Double -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Long): kotlin.Double -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Short): kotlin.Double -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public open override operator fun equals(other: kotlin.Any?): kotlin.Boolean public final operator fun inc(): kotlin.Double -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Byte): kotlin.Double -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Double): kotlin.Double -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Float): kotlin.Double -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Int): kotlin.Double -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Long): kotlin.Double -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Short): kotlin.Double -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Byte): kotlin.Double -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Double): kotlin.Double -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Float): kotlin.Double -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Int): kotlin.Double -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Long): kotlin.Double -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Short): kotlin.Double @kotlin.SinceKotlin(version = "1.1") -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Byte): kotlin.Double @kotlin.SinceKotlin(version = "1.1") -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Double): kotlin.Double @kotlin.SinceKotlin(version = "1.1") -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Float): kotlin.Double @kotlin.SinceKotlin(version = "1.1") -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Int): kotlin.Double @kotlin.SinceKotlin(version = "1.1") -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Long): kotlin.Double @kotlin.SinceKotlin(version = "1.1") -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Short): kotlin.Double -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Byte): kotlin.Double -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Double): kotlin.Double -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Float): kotlin.Double -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Int): kotlin.Double -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Long): kotlin.Double -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Short): kotlin.Double @kotlin.Deprecated(message = "Unclear conversion. To achieve the same result convert to Int explicitly and then to Byte.", replaceWith = kotlin.ReplaceWith(expression = "toInt().toByte()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "1.5", warningSince = "1.3") -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public open override fun toByte(): kotlin.Byte @kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "2.3", warningSince = "1.5") -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public open override fun toChar(): kotlin.Char -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public open override fun toDouble(): kotlin.Double -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public open override fun toFloat(): kotlin.Float -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public open override fun toInt(): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public open override fun toLong(): kotlin.Long @kotlin.Deprecated(message = "Unclear conversion. To achieve the same result convert to Int explicitly and then to Short.", replaceWith = kotlin.ReplaceWith(expression = "toInt().toShort()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "1.5", warningSince = "1.3") -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public open override fun toShort(): kotlin.Short -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public open override fun toString(): kotlin.String -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun unaryMinus(): kotlin.Double -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun unaryPlus(): kotlin.Double public companion object of Double { @@ -1692,161 +1692,161 @@ public final annotation class ExtensionFunctionType : kotlin.Annotation { } public final class Float : kotlin.Number, kotlin.Comparable { -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun compareTo(other: kotlin.Byte): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun compareTo(other: kotlin.Double): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public open override operator fun compareTo(other: kotlin.Float): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun compareTo(other: kotlin.Int): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun compareTo(other: kotlin.Long): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun compareTo(other: kotlin.Short): kotlin.Int public final operator fun dec(): kotlin.Float -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Byte): kotlin.Float -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Double): kotlin.Double -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Float): kotlin.Float -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Int): kotlin.Float -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Long): kotlin.Float -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Short): kotlin.Float -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public open override operator fun equals(other: kotlin.Any?): kotlin.Boolean public final operator fun inc(): kotlin.Float -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Byte): kotlin.Float -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Double): kotlin.Double -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Float): kotlin.Float -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Int): kotlin.Float -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Long): kotlin.Float -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Short): kotlin.Float -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Byte): kotlin.Float -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Double): kotlin.Double -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Float): kotlin.Float -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Int): kotlin.Float -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Long): kotlin.Float -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Short): kotlin.Float @kotlin.SinceKotlin(version = "1.1") -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Byte): kotlin.Float @kotlin.SinceKotlin(version = "1.1") -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Double): kotlin.Double @kotlin.SinceKotlin(version = "1.1") -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Float): kotlin.Float @kotlin.SinceKotlin(version = "1.1") -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Int): kotlin.Float @kotlin.SinceKotlin(version = "1.1") -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Long): kotlin.Float @kotlin.SinceKotlin(version = "1.1") -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Short): kotlin.Float -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Byte): kotlin.Float -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Double): kotlin.Double -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Float): kotlin.Float -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Int): kotlin.Float -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Long): kotlin.Float -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Short): kotlin.Float @kotlin.Deprecated(message = "Unclear conversion. To achieve the same result convert to Int explicitly and then to Byte.", replaceWith = kotlin.ReplaceWith(expression = "toInt().toByte()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "1.5", warningSince = "1.3") -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public open override fun toByte(): kotlin.Byte @kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "2.3", warningSince = "1.5") -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public open override fun toChar(): kotlin.Char -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public open override fun toDouble(): kotlin.Double -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public open override fun toFloat(): kotlin.Float -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public open override fun toInt(): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public open override fun toLong(): kotlin.Long @kotlin.Deprecated(message = "Unclear conversion. To achieve the same result convert to Int explicitly and then to Short.", replaceWith = kotlin.ReplaceWith(expression = "toInt().toShort()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "1.5", warningSince = "1.3") -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public open override fun toShort(): kotlin.Short -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public open override fun toString(): kotlin.String -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun unaryMinus(): kotlin.Float -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun unaryPlus(): kotlin.Float public companion object of Float { @@ -1915,92 +1915,92 @@ public open class IndexOutOfBoundsException : kotlin.RuntimeException { } public final class Int : kotlin.Number, kotlin.Comparable { -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final infix fun and(other: kotlin.Int): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun compareTo(other: kotlin.Byte): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun compareTo(other: kotlin.Double): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun compareTo(other: kotlin.Float): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public open override operator fun compareTo(other: kotlin.Int): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun compareTo(other: kotlin.Long): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun compareTo(other: kotlin.Short): kotlin.Int public final operator fun dec(): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Byte): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Double): kotlin.Double -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Float): kotlin.Float -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Int): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Long): kotlin.Long -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Short): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public open override operator fun equals(other: kotlin.Any?): kotlin.Boolean public final operator fun inc(): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final fun inv(): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Byte): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Double): kotlin.Double -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Float): kotlin.Float -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Int): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Long): kotlin.Long -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Short): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final infix fun or(other: kotlin.Int): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Byte): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Double): kotlin.Double -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Float): kotlin.Float -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Int): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Long): kotlin.Long -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Short): kotlin.Int public final operator fun rangeTo(other: kotlin.Byte): kotlin.ranges.IntRange @@ -2028,87 +2028,87 @@ public final class Int : kotlin.Number, kotlin.Comparable { public final operator fun rangeUntil(other: kotlin.Short): kotlin.ranges.IntRange @kotlin.SinceKotlin(version = "1.1") -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Byte): kotlin.Int @kotlin.SinceKotlin(version = "1.1") -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Double): kotlin.Double @kotlin.SinceKotlin(version = "1.1") -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Float): kotlin.Float @kotlin.SinceKotlin(version = "1.1") -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Int): kotlin.Int @kotlin.SinceKotlin(version = "1.1") -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Long): kotlin.Long @kotlin.SinceKotlin(version = "1.1") -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Short): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final infix fun shl(bitCount: kotlin.Int): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final infix fun shr(bitCount: kotlin.Int): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Byte): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Double): kotlin.Double -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Float): kotlin.Float -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Int): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Long): kotlin.Long -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Short): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public open override fun toByte(): kotlin.Byte -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public open override fun toChar(): kotlin.Char -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public open override fun toDouble(): kotlin.Double -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public open override fun toFloat(): kotlin.Float -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public open override fun toInt(): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public open override fun toLong(): kotlin.Long -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public open override fun toShort(): kotlin.Short -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public open override fun toString(): kotlin.String -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun unaryMinus(): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun unaryPlus(): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final infix fun ushr(bitCount: kotlin.Int): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final infix fun xor(other: kotlin.Int): kotlin.Int public companion object of Int { @@ -2621,83 +2621,83 @@ public open class RuntimeException : kotlin.Exception { } public final class Short : kotlin.Number, kotlin.Comparable { -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun compareTo(other: kotlin.Byte): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun compareTo(other: kotlin.Double): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun compareTo(other: kotlin.Float): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun compareTo(other: kotlin.Int): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun compareTo(other: kotlin.Long): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public open override operator fun compareTo(other: kotlin.Short): kotlin.Int public final operator fun dec(): kotlin.Short -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Byte): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Double): kotlin.Double -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Float): kotlin.Float -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Int): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Long): kotlin.Long -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Short): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public open override operator fun equals(other: kotlin.Any?): kotlin.Boolean public final operator fun inc(): kotlin.Short -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Byte): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Double): kotlin.Double -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Float): kotlin.Float -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Int): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Long): kotlin.Long -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Short): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Byte): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Double): kotlin.Double -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Float): kotlin.Float -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Int): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Long): kotlin.Long -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Short): kotlin.Int public final operator fun rangeTo(other: kotlin.Byte): kotlin.ranges.IntRange @@ -2725,77 +2725,77 @@ public final class Short : kotlin.Number, kotlin.Comparable { public final operator fun rangeUntil(other: kotlin.Short): kotlin.ranges.IntRange @kotlin.SinceKotlin(version = "1.1") -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Byte): kotlin.Int @kotlin.SinceKotlin(version = "1.1") -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Double): kotlin.Double @kotlin.SinceKotlin(version = "1.1") -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Float): kotlin.Float @kotlin.SinceKotlin(version = "1.1") -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Int): kotlin.Int @kotlin.SinceKotlin(version = "1.1") -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Long): kotlin.Long @kotlin.SinceKotlin(version = "1.1") -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Short): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Byte): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Double): kotlin.Double -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Float): kotlin.Float -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Int): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Long): kotlin.Long -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Short): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public open override fun toByte(): kotlin.Byte @kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "2.3", warningSince = "1.5") -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public open override fun toChar(): kotlin.Char -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public open override fun toDouble(): kotlin.Double -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public open override fun toFloat(): kotlin.Float -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public open override fun toInt(): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public open override fun toLong(): kotlin.Long -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public open override fun toShort(): kotlin.Short -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public open override fun toString(): kotlin.String -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun unaryMinus(): kotlin.Int -/*∆*/ @kotlin.internal.IntrinsicConstEvaluation + @kotlin.internal.IntrinsicConstEvaluation public final operator fun unaryPlus(): kotlin.Int public companion object of Short { @@ -3772,4 +3772,4 @@ public open class UnsupportedOperationException : kotlin.RuntimeException { public constructor UnsupportedOperationException(message: kotlin.String?, cause: kotlin.Throwable?) public constructor UnsupportedOperationException(cause: kotlin.Throwable?) -} +} \ No newline at end of file diff --git a/libraries/stdlib/api/js/kotlin.kt b/libraries/stdlib/api/js/kotlin.kt index bea10a6a29d..94987455362 100644 --- a/libraries/stdlib/api/js/kotlin.kt +++ b/libraries/stdlib/api/js/kotlin.kt @@ -938,60 +938,85 @@ public final annotation class BuilderInference : kotlin.Annotation { } public final class Byte : kotlin.Number, kotlin.Comparable { + @kotlin.internal.IntrinsicConstEvaluation public open override operator fun compareTo(other: kotlin.Byte): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun compareTo(other: kotlin.Double): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun compareTo(other: kotlin.Float): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun compareTo(other: kotlin.Int): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun compareTo(other: kotlin.Long): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun compareTo(other: kotlin.Short): kotlin.Int public final operator fun dec(): kotlin.Byte + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Byte): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Double): kotlin.Double + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Float): kotlin.Float + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Int): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Long): kotlin.Long + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Short): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public open override operator fun equals(other: kotlin.Any?): kotlin.Boolean /*∆*/ public open override fun hashCode(): kotlin.Int /*∆*/ public final operator fun inc(): kotlin.Byte + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Byte): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Double): kotlin.Double + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Float): kotlin.Float + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Int): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Long): kotlin.Long + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Short): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Byte): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Double): kotlin.Double + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Float): kotlin.Float + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Int): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Long): kotlin.Long + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Short): kotlin.Int public final operator fun rangeTo(other: kotlin.Byte): kotlin.ranges.IntRange @@ -1019,55 +1044,77 @@ public final class Byte : kotlin.Number, kotlin.Comparable { public final operator fun rangeUntil(other: kotlin.Short): kotlin.ranges.IntRange @kotlin.SinceKotlin(version = "1.1") + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Byte): kotlin.Int @kotlin.SinceKotlin(version = "1.1") + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Double): kotlin.Double @kotlin.SinceKotlin(version = "1.1") + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Float): kotlin.Float @kotlin.SinceKotlin(version = "1.1") + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Int): kotlin.Int @kotlin.SinceKotlin(version = "1.1") + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Long): kotlin.Long @kotlin.SinceKotlin(version = "1.1") + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Short): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Byte): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Double): kotlin.Double + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Float): kotlin.Float + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Int): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Long): kotlin.Long + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Short): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public open override fun toByte(): kotlin.Byte @kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "2.3", warningSince = "1.5") + @kotlin.internal.IntrinsicConstEvaluation public open override fun toChar(): kotlin.Char + @kotlin.internal.IntrinsicConstEvaluation public open override fun toDouble(): kotlin.Double + @kotlin.internal.IntrinsicConstEvaluation public open override fun toFloat(): kotlin.Float + @kotlin.internal.IntrinsicConstEvaluation public open override fun toInt(): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public open override fun toLong(): kotlin.Long + @kotlin.internal.IntrinsicConstEvaluation public open override fun toShort(): kotlin.Short + @kotlin.internal.IntrinsicConstEvaluation public open override fun toString(): kotlin.String + @kotlin.internal.IntrinsicConstEvaluation public final operator fun unaryMinus(): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun unaryPlus(): kotlin.Int public companion object of Byte { @@ -1290,116 +1337,163 @@ public final enum class DeprecationLevel : kotlin.Enum } public final class Double : kotlin.Number, kotlin.Comparable { + @kotlin.internal.IntrinsicConstEvaluation public final operator fun compareTo(other: kotlin.Byte): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public open override operator fun compareTo(other: kotlin.Double): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun compareTo(other: kotlin.Float): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun compareTo(other: kotlin.Int): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun compareTo(other: kotlin.Long): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun compareTo(other: kotlin.Short): kotlin.Int public final operator fun dec(): kotlin.Double + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Byte): kotlin.Double + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Double): kotlin.Double + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Float): kotlin.Double + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Int): kotlin.Double + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Long): kotlin.Double + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Short): kotlin.Double + @kotlin.internal.IntrinsicConstEvaluation public open override operator fun equals(other: kotlin.Any?): kotlin.Boolean /*∆*/ public open override fun hashCode(): kotlin.Int /*∆*/ public final operator fun inc(): kotlin.Double + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Byte): kotlin.Double + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Double): kotlin.Double + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Float): kotlin.Double + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Int): kotlin.Double + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Long): kotlin.Double + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Short): kotlin.Double + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Byte): kotlin.Double + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Double): kotlin.Double + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Float): kotlin.Double + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Int): kotlin.Double + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Long): kotlin.Double + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Short): kotlin.Double @kotlin.SinceKotlin(version = "1.1") + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Byte): kotlin.Double @kotlin.SinceKotlin(version = "1.1") + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Double): kotlin.Double @kotlin.SinceKotlin(version = "1.1") + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Float): kotlin.Double @kotlin.SinceKotlin(version = "1.1") + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Int): kotlin.Double @kotlin.SinceKotlin(version = "1.1") + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Long): kotlin.Double @kotlin.SinceKotlin(version = "1.1") + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Short): kotlin.Double + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Byte): kotlin.Double + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Double): kotlin.Double + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Float): kotlin.Double + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Int): kotlin.Double + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Long): kotlin.Double + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Short): kotlin.Double @kotlin.Deprecated(message = "Unclear conversion. To achieve the same result convert to Int explicitly and then to Byte.", replaceWith = kotlin.ReplaceWith(expression = "toInt().toByte()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "1.5", warningSince = "1.3") + @kotlin.internal.IntrinsicConstEvaluation public open override fun toByte(): kotlin.Byte @kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "2.3", warningSince = "1.5") + @kotlin.internal.IntrinsicConstEvaluation public open override fun toChar(): kotlin.Char + @kotlin.internal.IntrinsicConstEvaluation public open override fun toDouble(): kotlin.Double + @kotlin.internal.IntrinsicConstEvaluation public open override fun toFloat(): kotlin.Float + @kotlin.internal.IntrinsicConstEvaluation public open override fun toInt(): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public open override fun toLong(): kotlin.Long @kotlin.Deprecated(message = "Unclear conversion. To achieve the same result convert to Int explicitly and then to Short.", replaceWith = kotlin.ReplaceWith(expression = "toInt().toShort()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "1.5", warningSince = "1.3") + @kotlin.internal.IntrinsicConstEvaluation public open override fun toShort(): kotlin.Short + @kotlin.internal.IntrinsicConstEvaluation public open override fun toString(): kotlin.String + @kotlin.internal.IntrinsicConstEvaluation public final operator fun unaryMinus(): kotlin.Double + @kotlin.internal.IntrinsicConstEvaluation public final operator fun unaryPlus(): kotlin.Double public companion object of Double { @@ -1521,116 +1615,163 @@ public final annotation class ExtensionFunctionType : kotlin.Annotation { } public final class Float : kotlin.Number, kotlin.Comparable { + @kotlin.internal.IntrinsicConstEvaluation public final operator fun compareTo(other: kotlin.Byte): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun compareTo(other: kotlin.Double): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public open override operator fun compareTo(other: kotlin.Float): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun compareTo(other: kotlin.Int): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun compareTo(other: kotlin.Long): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun compareTo(other: kotlin.Short): kotlin.Int public final operator fun dec(): kotlin.Float + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Byte): kotlin.Float + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Double): kotlin.Double + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Float): kotlin.Float + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Int): kotlin.Float + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Long): kotlin.Float + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Short): kotlin.Float + @kotlin.internal.IntrinsicConstEvaluation public open override operator fun equals(other: kotlin.Any?): kotlin.Boolean /*∆*/ public open override fun hashCode(): kotlin.Int /*∆*/ public final operator fun inc(): kotlin.Float + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Byte): kotlin.Float + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Double): kotlin.Double + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Float): kotlin.Float + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Int): kotlin.Float + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Long): kotlin.Float + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Short): kotlin.Float + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Byte): kotlin.Float + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Double): kotlin.Double + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Float): kotlin.Float + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Int): kotlin.Float + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Long): kotlin.Float + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Short): kotlin.Float @kotlin.SinceKotlin(version = "1.1") + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Byte): kotlin.Float @kotlin.SinceKotlin(version = "1.1") + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Double): kotlin.Double @kotlin.SinceKotlin(version = "1.1") + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Float): kotlin.Float @kotlin.SinceKotlin(version = "1.1") + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Int): kotlin.Float @kotlin.SinceKotlin(version = "1.1") + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Long): kotlin.Float @kotlin.SinceKotlin(version = "1.1") + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Short): kotlin.Float + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Byte): kotlin.Float + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Double): kotlin.Double + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Float): kotlin.Float + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Int): kotlin.Float + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Long): kotlin.Float + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Short): kotlin.Float @kotlin.Deprecated(message = "Unclear conversion. To achieve the same result convert to Int explicitly and then to Byte.", replaceWith = kotlin.ReplaceWith(expression = "toInt().toByte()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "1.5", warningSince = "1.3") + @kotlin.internal.IntrinsicConstEvaluation public open override fun toByte(): kotlin.Byte @kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "2.3", warningSince = "1.5") + @kotlin.internal.IntrinsicConstEvaluation public open override fun toChar(): kotlin.Char + @kotlin.internal.IntrinsicConstEvaluation public open override fun toDouble(): kotlin.Double + @kotlin.internal.IntrinsicConstEvaluation public open override fun toFloat(): kotlin.Float + @kotlin.internal.IntrinsicConstEvaluation public open override fun toInt(): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public open override fun toLong(): kotlin.Long @kotlin.Deprecated(message = "Unclear conversion. To achieve the same result convert to Int explicitly and then to Short.", replaceWith = kotlin.ReplaceWith(expression = "toInt().toShort()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "1.5", warningSince = "1.3") + @kotlin.internal.IntrinsicConstEvaluation public open override fun toShort(): kotlin.Short + @kotlin.internal.IntrinsicConstEvaluation public open override fun toString(): kotlin.String + @kotlin.internal.IntrinsicConstEvaluation public final operator fun unaryMinus(): kotlin.Float + @kotlin.internal.IntrinsicConstEvaluation public final operator fun unaryPlus(): kotlin.Float public companion object of Float { @@ -1696,66 +1837,94 @@ public open class IndexOutOfBoundsException : kotlin.RuntimeException { } public final class Int : kotlin.Number, kotlin.Comparable { + @kotlin.internal.IntrinsicConstEvaluation public final infix fun and(other: kotlin.Int): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun compareTo(other: kotlin.Byte): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun compareTo(other: kotlin.Double): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun compareTo(other: kotlin.Float): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public open override operator fun compareTo(other: kotlin.Int): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun compareTo(other: kotlin.Long): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun compareTo(other: kotlin.Short): kotlin.Int public final operator fun dec(): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Byte): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Double): kotlin.Double + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Float): kotlin.Float + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Int): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Long): kotlin.Long + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Short): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public open override operator fun equals(other: kotlin.Any?): kotlin.Boolean /*∆*/ public open override fun hashCode(): kotlin.Int /*∆*/ public final operator fun inc(): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final fun inv(): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Byte): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Double): kotlin.Double + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Float): kotlin.Float + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Int): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Long): kotlin.Long + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Short): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final infix fun or(other: kotlin.Int): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Byte): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Double): kotlin.Double + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Float): kotlin.Float + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Int): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Long): kotlin.Long + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Short): kotlin.Int public final operator fun rangeTo(other: kotlin.Byte): kotlin.ranges.IntRange @@ -1783,61 +1952,87 @@ public final class Int : kotlin.Number, kotlin.Comparable { public final operator fun rangeUntil(other: kotlin.Short): kotlin.ranges.IntRange @kotlin.SinceKotlin(version = "1.1") + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Byte): kotlin.Int @kotlin.SinceKotlin(version = "1.1") + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Double): kotlin.Double @kotlin.SinceKotlin(version = "1.1") + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Float): kotlin.Float @kotlin.SinceKotlin(version = "1.1") + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Int): kotlin.Int @kotlin.SinceKotlin(version = "1.1") + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Long): kotlin.Long @kotlin.SinceKotlin(version = "1.1") + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Short): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final infix fun shl(bitCount: kotlin.Int): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final infix fun shr(bitCount: kotlin.Int): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Byte): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Double): kotlin.Double + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Float): kotlin.Float + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Int): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Long): kotlin.Long + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Short): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public open override fun toByte(): kotlin.Byte + @kotlin.internal.IntrinsicConstEvaluation public open override fun toChar(): kotlin.Char + @kotlin.internal.IntrinsicConstEvaluation public open override fun toDouble(): kotlin.Double + @kotlin.internal.IntrinsicConstEvaluation public open override fun toFloat(): kotlin.Float + @kotlin.internal.IntrinsicConstEvaluation public open override fun toInt(): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public open override fun toLong(): kotlin.Long + @kotlin.internal.IntrinsicConstEvaluation public open override fun toShort(): kotlin.Short + @kotlin.internal.IntrinsicConstEvaluation public open override fun toString(): kotlin.String + @kotlin.internal.IntrinsicConstEvaluation public final operator fun unaryMinus(): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun unaryPlus(): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final infix fun ushr(bitCount: kotlin.Int): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final infix fun xor(other: kotlin.Int): kotlin.Int public companion object of Int { @@ -2273,60 +2468,85 @@ public open class RuntimeException : kotlin.Exception { } public final class Short : kotlin.Number, kotlin.Comparable { + @kotlin.internal.IntrinsicConstEvaluation public final operator fun compareTo(other: kotlin.Byte): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun compareTo(other: kotlin.Double): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun compareTo(other: kotlin.Float): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun compareTo(other: kotlin.Int): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun compareTo(other: kotlin.Long): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public open override operator fun compareTo(other: kotlin.Short): kotlin.Int public final operator fun dec(): kotlin.Short + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Byte): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Double): kotlin.Double + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Float): kotlin.Float + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Int): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Long): kotlin.Long + @kotlin.internal.IntrinsicConstEvaluation public final operator fun div(other: kotlin.Short): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public open override operator fun equals(other: kotlin.Any?): kotlin.Boolean /*∆*/ public open override fun hashCode(): kotlin.Int /*∆*/ public final operator fun inc(): kotlin.Short + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Byte): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Double): kotlin.Double + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Float): kotlin.Float + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Int): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Long): kotlin.Long + @kotlin.internal.IntrinsicConstEvaluation public final operator fun minus(other: kotlin.Short): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Byte): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Double): kotlin.Double + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Float): kotlin.Float + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Int): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Long): kotlin.Long + @kotlin.internal.IntrinsicConstEvaluation public final operator fun plus(other: kotlin.Short): kotlin.Int public final operator fun rangeTo(other: kotlin.Byte): kotlin.ranges.IntRange @@ -2354,55 +2574,77 @@ public final class Short : kotlin.Number, kotlin.Comparable { public final operator fun rangeUntil(other: kotlin.Short): kotlin.ranges.IntRange @kotlin.SinceKotlin(version = "1.1") + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Byte): kotlin.Int @kotlin.SinceKotlin(version = "1.1") + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Double): kotlin.Double @kotlin.SinceKotlin(version = "1.1") + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Float): kotlin.Float @kotlin.SinceKotlin(version = "1.1") + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Int): kotlin.Int @kotlin.SinceKotlin(version = "1.1") + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Long): kotlin.Long @kotlin.SinceKotlin(version = "1.1") + @kotlin.internal.IntrinsicConstEvaluation public final operator fun rem(other: kotlin.Short): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Byte): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Double): kotlin.Double + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Float): kotlin.Float + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Int): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Long): kotlin.Long + @kotlin.internal.IntrinsicConstEvaluation public final operator fun times(other: kotlin.Short): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public open override fun toByte(): kotlin.Byte @kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "2.3", warningSince = "1.5") + @kotlin.internal.IntrinsicConstEvaluation public open override fun toChar(): kotlin.Char + @kotlin.internal.IntrinsicConstEvaluation public open override fun toDouble(): kotlin.Double + @kotlin.internal.IntrinsicConstEvaluation public open override fun toFloat(): kotlin.Float + @kotlin.internal.IntrinsicConstEvaluation public open override fun toInt(): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public open override fun toLong(): kotlin.Long + @kotlin.internal.IntrinsicConstEvaluation public open override fun toShort(): kotlin.Short + @kotlin.internal.IntrinsicConstEvaluation public open override fun toString(): kotlin.String + @kotlin.internal.IntrinsicConstEvaluation public final operator fun unaryMinus(): kotlin.Int + @kotlin.internal.IntrinsicConstEvaluation public final operator fun unaryPlus(): kotlin.Int public companion object of Short { @@ -3364,4 +3606,4 @@ public open class UnsupportedOperationException : kotlin.RuntimeException { public constructor UnsupportedOperationException(message: kotlin.String?, cause: kotlin.Throwable?) public constructor UnsupportedOperationException(cause: kotlin.Throwable?) -} +} \ No newline at end of file diff --git a/libraries/stdlib/js-ir/builtins/Primitives.kt b/libraries/stdlib/js-ir/builtins/Primitives.kt index 23ee9a9bb69..e039c4b3485 100644 --- a/libraries/stdlib/js-ir/builtins/Primitives.kt +++ b/libraries/stdlib/js-ir/builtins/Primitives.kt @@ -1,17 +1,15 @@ /* - * Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ // Auto-generated file. DO NOT EDIT! + @file:Suppress("NON_ABSTRACT_FUNCTION_WITH_NO_BODY", "UNUSED_PARAMETER") package kotlin -/** - * Represents a 8-bit signed integer. - * On the JVM, non-nullable values of this type are represented as values of the primitive type `byte`. - */ +/** Represents a 8-bit signed integer. */ public class Byte private constructor() : Number(), Comparable { companion object { /** @@ -42,6 +40,7 @@ public class Byte private constructor() : Number(), Comparable { * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public override operator fun compareTo(other: Byte): Int /** @@ -49,6 +48,7 @@ public class Byte private constructor() : Number(), Comparable { * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun compareTo(other: Short): Int /** @@ -56,6 +56,7 @@ public class Byte private constructor() : Number(), Comparable { * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun compareTo(other: Int): Int /** @@ -63,6 +64,7 @@ public class Byte private constructor() : Number(), Comparable { * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun compareTo(other: Long): Int /** @@ -70,6 +72,7 @@ public class Byte private constructor() : Number(), Comparable { * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun compareTo(other: Float): Int /** @@ -77,58 +80,103 @@ public class Byte private constructor() : Number(), Comparable { * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun compareTo(other: Double): Int /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Byte): Int + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Short): Int + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Int): Int + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Long): Long + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Float): Float + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Double): Double /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Byte): Int + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Short): Int + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Int): Int + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Long): Long + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Float): Float + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Double): Double /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Byte): Int + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Short): Int + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Int): Int + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Long): Long + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Float): Float + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Double): Double /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Byte): Int + /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Short): Int + /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Int): Int + /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Long): Long + /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Float): Float + /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Double): Double /** @@ -137,41 +185,52 @@ public class Byte private constructor() : Number(), Comparable { * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Byte): Int + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Short): Int + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Int): Int + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Long): Long + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Float): Float + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Double): Double /** @@ -189,17 +248,23 @@ public class Byte private constructor() : Number(), Comparable { public operator fun dec(): Byte /** Returns this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun unaryPlus(): Int + /** Returns the negative of this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun unaryMinus(): Int - /** Creates a range from this value to the specified [other] value. */ + /** Creates a range from this value to the specified [other] value. */ public operator fun rangeTo(other: Byte): IntRange - /** Creates a range from this value to the specified [other] value. */ + + /** Creates a range from this value to the specified [other] value. */ public operator fun rangeTo(other: Short): IntRange - /** Creates a range from this value to the specified [other] value. */ + + /** Creates a range from this value to the specified [other] value. */ public operator fun rangeTo(other: Int): IntRange - /** Creates a range from this value to the specified [other] value. */ + + /** Creates a range from this value to the specified [other] value. */ public operator fun rangeTo(other: Long): LongRange /** @@ -239,7 +304,9 @@ public class Byte private constructor() : Number(), Comparable { public operator fun rangeUntil(other: Long): LongRange /** Returns this value. */ + @kotlin.internal.IntrinsicConstEvaluation public override fun toByte(): Byte + /** * Converts this [Byte] value to [Char]. * @@ -250,7 +317,9 @@ public class Byte private constructor() : Number(), Comparable { */ @Deprecated("Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", ReplaceWith("this.toInt().toChar()")) @DeprecatedSinceKotlin(warningSince = "1.5", errorSince = "2.3") + @kotlin.internal.IntrinsicConstEvaluation public override fun toChar(): Char + /** * Converts this [Byte] value to [Short]. * @@ -259,7 +328,9 @@ public class Byte private constructor() : Number(), Comparable { * The least significant 8 bits of the resulting `Short` value are the same as the bits of this `Byte` value, * whereas the most significant 8 bits are filled with the sign bit of this value. */ + @kotlin.internal.IntrinsicConstEvaluation public override fun toShort(): Short + /** * Converts this [Byte] value to [Int]. * @@ -268,7 +339,9 @@ public class Byte private constructor() : Number(), Comparable { * The least significant 8 bits of the resulting `Int` value are the same as the bits of this `Byte` value, * whereas the most significant 24 bits are filled with the sign bit of this value. */ + @kotlin.internal.IntrinsicConstEvaluation public override fun toInt(): Int + /** * Converts this [Byte] value to [Long]. * @@ -277,29 +350,35 @@ public class Byte private constructor() : Number(), Comparable { * The least significant 8 bits of the resulting `Long` value are the same as the bits of this `Byte` value, * whereas the most significant 56 bits are filled with the sign bit of this value. */ + @kotlin.internal.IntrinsicConstEvaluation public override fun toLong(): Long + /** * Converts this [Byte] value to [Float]. * * The resulting `Float` value represents the same numerical value as this `Byte`. */ + @kotlin.internal.IntrinsicConstEvaluation public override fun toFloat(): Float + /** * Converts this [Byte] value to [Double]. * * The resulting `Double` value represents the same numerical value as this `Byte`. */ + @kotlin.internal.IntrinsicConstEvaluation public override fun toDouble(): Double + @kotlin.internal.IntrinsicConstEvaluation public override fun equals(other: Any?): Boolean - public override fun hashCode(): Int + + @kotlin.internal.IntrinsicConstEvaluation public override fun toString(): String + + public override fun hashCode(): Int } -/** - * Represents a 16-bit signed integer. - * On the JVM, non-nullable values of this type are represented as values of the primitive type `short`. - */ +/** Represents a 16-bit signed integer. */ public class Short private constructor() : Number(), Comparable { companion object { /** @@ -330,6 +409,7 @@ public class Short private constructor() : Number(), Comparable { * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun compareTo(other: Byte): Int /** @@ -337,6 +417,7 @@ public class Short private constructor() : Number(), Comparable { * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public override operator fun compareTo(other: Short): Int /** @@ -344,6 +425,7 @@ public class Short private constructor() : Number(), Comparable { * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun compareTo(other: Int): Int /** @@ -351,6 +433,7 @@ public class Short private constructor() : Number(), Comparable { * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun compareTo(other: Long): Int /** @@ -358,6 +441,7 @@ public class Short private constructor() : Number(), Comparable { * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun compareTo(other: Float): Int /** @@ -365,58 +449,103 @@ public class Short private constructor() : Number(), Comparable { * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun compareTo(other: Double): Int /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Byte): Int + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Short): Int + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Int): Int + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Long): Long + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Float): Float + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Double): Double /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Byte): Int + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Short): Int + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Int): Int + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Long): Long + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Float): Float + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Double): Double /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Byte): Int + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Short): Int + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Int): Int + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Long): Long + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Float): Float + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Double): Double /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Byte): Int + /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Short): Int + /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Int): Int + /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Long): Long + /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Float): Float + /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Double): Double /** @@ -425,41 +554,52 @@ public class Short private constructor() : Number(), Comparable { * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Byte): Int + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Short): Int + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Int): Int + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Long): Long + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Float): Float + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Double): Double /** @@ -477,17 +617,23 @@ public class Short private constructor() : Number(), Comparable { public operator fun dec(): Short /** Returns this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun unaryPlus(): Int + /** Returns the negative of this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun unaryMinus(): Int - /** Creates a range from this value to the specified [other] value. */ + /** Creates a range from this value to the specified [other] value. */ public operator fun rangeTo(other: Byte): IntRange - /** Creates a range from this value to the specified [other] value. */ + + /** Creates a range from this value to the specified [other] value. */ public operator fun rangeTo(other: Short): IntRange - /** Creates a range from this value to the specified [other] value. */ + + /** Creates a range from this value to the specified [other] value. */ public operator fun rangeTo(other: Int): IntRange - /** Creates a range from this value to the specified [other] value. */ + + /** Creates a range from this value to the specified [other] value. */ public operator fun rangeTo(other: Long): LongRange /** @@ -534,7 +680,9 @@ public class Short private constructor() : Number(), Comparable { * * The resulting `Byte` value is represented by the least significant 8 bits of this `Short` value. */ + @kotlin.internal.IntrinsicConstEvaluation public override fun toByte(): Byte + /** * Converts this [Short] value to [Char]. * @@ -543,9 +691,13 @@ public class Short private constructor() : Number(), Comparable { */ @Deprecated("Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", ReplaceWith("this.toInt().toChar()")) @DeprecatedSinceKotlin(warningSince = "1.5", errorSince = "2.3") + @kotlin.internal.IntrinsicConstEvaluation public override fun toChar(): Char + /** Returns this value. */ + @kotlin.internal.IntrinsicConstEvaluation public override fun toShort(): Short + /** * Converts this [Short] value to [Int]. * @@ -554,7 +706,9 @@ public class Short private constructor() : Number(), Comparable { * The least significant 16 bits of the resulting `Int` value are the same as the bits of this `Short` value, * whereas the most significant 16 bits are filled with the sign bit of this value. */ + @kotlin.internal.IntrinsicConstEvaluation public override fun toInt(): Int + /** * Converts this [Short] value to [Long]. * @@ -563,29 +717,35 @@ public class Short private constructor() : Number(), Comparable { * The least significant 16 bits of the resulting `Long` value are the same as the bits of this `Short` value, * whereas the most significant 48 bits are filled with the sign bit of this value. */ + @kotlin.internal.IntrinsicConstEvaluation public override fun toLong(): Long + /** * Converts this [Short] value to [Float]. * * The resulting `Float` value represents the same numerical value as this `Short`. */ + @kotlin.internal.IntrinsicConstEvaluation public override fun toFloat(): Float + /** * Converts this [Short] value to [Double]. * * The resulting `Double` value represents the same numerical value as this `Short`. */ + @kotlin.internal.IntrinsicConstEvaluation public override fun toDouble(): Double + @kotlin.internal.IntrinsicConstEvaluation public override fun equals(other: Any?): Boolean - public override fun hashCode(): Int + + @kotlin.internal.IntrinsicConstEvaluation public override fun toString(): String + + public override fun hashCode(): Int } -/** - * Represents a 32-bit signed integer. - * On the JVM, non-nullable values of this type are represented as values of the primitive type `int`. - */ +/** Represents a 32-bit signed integer. */ public class Int private constructor() : Number(), Comparable { companion object { /** @@ -616,6 +776,7 @@ public class Int private constructor() : Number(), Comparable { * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun compareTo(other: Byte): Int /** @@ -623,6 +784,7 @@ public class Int private constructor() : Number(), Comparable { * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun compareTo(other: Short): Int /** @@ -630,6 +792,7 @@ public class Int private constructor() : Number(), Comparable { * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public override operator fun compareTo(other: Int): Int /** @@ -637,6 +800,7 @@ public class Int private constructor() : Number(), Comparable { * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun compareTo(other: Long): Int /** @@ -644,6 +808,7 @@ public class Int private constructor() : Number(), Comparable { * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun compareTo(other: Float): Int /** @@ -651,58 +816,103 @@ public class Int private constructor() : Number(), Comparable { * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun compareTo(other: Double): Int /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Byte): Int + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Short): Int + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Int): Int + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Long): Long + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Float): Float + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Double): Double /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Byte): Int + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Short): Int + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Int): Int + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Long): Long + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Float): Float + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Double): Double /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Byte): Int + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Short): Int + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Int): Int + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Long): Long + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Float): Float + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Double): Double /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Byte): Int + /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Short): Int + /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Int): Int + /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Long): Long + /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Float): Float + /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Double): Double /** @@ -711,41 +921,52 @@ public class Int private constructor() : Number(), Comparable { * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Byte): Int + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Short): Int + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Int): Int + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Long): Long + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Float): Float + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Double): Double /** @@ -763,17 +984,23 @@ public class Int private constructor() : Number(), Comparable { public operator fun dec(): Int /** Returns this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun unaryPlus(): Int + /** Returns the negative of this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun unaryMinus(): Int - /** Creates a range from this value to the specified [other] value. */ + /** Creates a range from this value to the specified [other] value. */ public operator fun rangeTo(other: Byte): IntRange - /** Creates a range from this value to the specified [other] value. */ + + /** Creates a range from this value to the specified [other] value. */ public operator fun rangeTo(other: Short): IntRange - /** Creates a range from this value to the specified [other] value. */ + + /** Creates a range from this value to the specified [other] value. */ public operator fun rangeTo(other: Int): IntRange - /** Creates a range from this value to the specified [other] value. */ + + /** Creates a range from this value to the specified [other] value. */ public operator fun rangeTo(other: Long): LongRange /** @@ -783,7 +1010,7 @@ public class Int private constructor() : Number(), Comparable { */ @SinceKotlin("1.7") @ExperimentalStdlibApi - public operator fun rangeUntil(other: Byte): IntRange = this until other + public operator fun rangeUntil(other: Byte): IntRange /** * Creates a range from this value up to but excluding the specified [other] value. @@ -792,7 +1019,7 @@ public class Int private constructor() : Number(), Comparable { */ @SinceKotlin("1.7") @ExperimentalStdlibApi - public operator fun rangeUntil(other: Short): IntRange = this until other + public operator fun rangeUntil(other: Short): IntRange /** * Creates a range from this value up to but excluding the specified [other] value. @@ -801,7 +1028,7 @@ public class Int private constructor() : Number(), Comparable { */ @SinceKotlin("1.7") @ExperimentalStdlibApi - public operator fun rangeUntil(other: Int): IntRange = this until other + public operator fun rangeUntil(other: Int): IntRange /** * Creates a range from this value up to but excluding the specified [other] value. @@ -810,7 +1037,7 @@ public class Int private constructor() : Number(), Comparable { */ @SinceKotlin("1.7") @ExperimentalStdlibApi - public operator fun rangeUntil(other: Long): LongRange = this until other + public operator fun rangeUntil(other: Long): LongRange /** * Shifts this value left by the [bitCount] number of bits. @@ -818,6 +1045,7 @@ public class Int private constructor() : Number(), Comparable { * Note that only the five lowest-order bits of the [bitCount] are used as the shift distance. * The shift distance actually used is therefore always in the range `0..31`. */ + @kotlin.internal.IntrinsicConstEvaluation public infix fun shl(bitCount: Int): Int /** @@ -826,6 +1054,7 @@ public class Int private constructor() : Number(), Comparable { * Note that only the five lowest-order bits of the [bitCount] are used as the shift distance. * The shift distance actually used is therefore always in the range `0..31`. */ + @kotlin.internal.IntrinsicConstEvaluation public infix fun shr(bitCount: Int): Int /** @@ -834,15 +1063,23 @@ public class Int private constructor() : Number(), Comparable { * Note that only the five lowest-order bits of the [bitCount] are used as the shift distance. * The shift distance actually used is therefore always in the range `0..31`. */ + @kotlin.internal.IntrinsicConstEvaluation public infix fun ushr(bitCount: Int): Int /** Performs a bitwise AND operation between the two values. */ + @kotlin.internal.IntrinsicConstEvaluation public infix fun and(other: Int): Int + /** Performs a bitwise OR operation between the two values. */ + @kotlin.internal.IntrinsicConstEvaluation public infix fun or(other: Int): Int + /** Performs a bitwise XOR operation between the two values. */ + @kotlin.internal.IntrinsicConstEvaluation public infix fun xor(other: Int): Int + /** Inverts the bits in this value. */ + @kotlin.internal.IntrinsicConstEvaluation public fun inv(): Int /** @@ -853,7 +1090,9 @@ public class Int private constructor() : Number(), Comparable { * * The resulting `Byte` value is represented by the least significant 8 bits of this `Int` value. */ + @kotlin.internal.IntrinsicConstEvaluation public override fun toByte(): Byte + /** * Converts this [Int] value to [Char]. * @@ -863,7 +1102,9 @@ public class Int private constructor() : Number(), Comparable { * The resulting `Char` code is represented by the least significant 16 bits of this `Int` value. */ @Suppress("OVERRIDE_DEPRECATION") + @kotlin.internal.IntrinsicConstEvaluation public override fun toChar(): Char + /** * Converts this [Int] value to [Short]. * @@ -872,9 +1113,13 @@ public class Int private constructor() : Number(), Comparable { * * The resulting `Short` value is represented by the least significant 16 bits of this `Int` value. */ + @kotlin.internal.IntrinsicConstEvaluation public override fun toShort(): Short + /** Returns this value. */ + @kotlin.internal.IntrinsicConstEvaluation public override fun toInt(): Int + /** * Converts this [Int] value to [Long]. * @@ -883,7 +1128,9 @@ public class Int private constructor() : Number(), Comparable { * The least significant 32 bits of the resulting `Long` value are the same as the bits of this `Int` value, * whereas the most significant 32 bits are filled with the sign bit of this value. */ + @kotlin.internal.IntrinsicConstEvaluation public override fun toLong(): Long + /** * Converts this [Int] value to [Float]. * @@ -891,25 +1138,28 @@ public class Int private constructor() : Number(), Comparable { * In case when this `Int` value is exactly between two `Float`s, * the one with zero at least significant bit of mantissa is selected. */ + @kotlin.internal.IntrinsicConstEvaluation public override fun toFloat(): Float + /** * Converts this [Int] value to [Double]. * * The resulting `Double` value represents the same numerical value as this `Int`. */ + @kotlin.internal.IntrinsicConstEvaluation public override fun toDouble(): Double + @kotlin.internal.IntrinsicConstEvaluation public override fun equals(other: Any?): Boolean - public override fun hashCode(): Int + + @kotlin.internal.IntrinsicConstEvaluation public override fun toString(): String + + public override fun hashCode(): Int } -/** - * Represents a single-precision 32-bit IEEE 754 floating point number. - * On the JVM, non-nullable values of this type are represented as values of the primitive type `float`. - */ +/** Represents a single-precision 32-bit IEEE 754 floating point number. */ public class Float private constructor() : Number(), Comparable { - @Suppress("DIVISION_BY_ZERO") companion object { /** * A constant holding the smallest *positive* nonzero value of Float. @@ -924,16 +1174,19 @@ public class Float private constructor() : Number(), Comparable { /** * A constant holding the positive infinity value of Float. */ + @Suppress("DIVISION_BY_ZERO") public const val POSITIVE_INFINITY: Float = 1.0F/0.0F /** * A constant holding the negative infinity value of Float. */ + @Suppress("DIVISION_BY_ZERO") public const val NEGATIVE_INFINITY: Float = -1.0F/0.0F /** * A constant holding the "not a number" value of Float. */ + @Suppress("DIVISION_BY_ZERO") public const val NaN: Float = -(0.0F/0.0F) /** @@ -954,6 +1207,7 @@ public class Float private constructor() : Number(), Comparable { * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun compareTo(other: Byte): Int /** @@ -961,6 +1215,7 @@ public class Float private constructor() : Number(), Comparable { * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun compareTo(other: Short): Int /** @@ -968,6 +1223,7 @@ public class Float private constructor() : Number(), Comparable { * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun compareTo(other: Int): Int /** @@ -975,6 +1231,7 @@ public class Float private constructor() : Number(), Comparable { * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun compareTo(other: Long): Int /** @@ -982,6 +1239,7 @@ public class Float private constructor() : Number(), Comparable { * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public override operator fun compareTo(other: Float): Int /** @@ -989,58 +1247,103 @@ public class Float private constructor() : Number(), Comparable { * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun compareTo(other: Double): Int /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Byte): Float + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Short): Float + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Int): Float + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Long): Float + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Float): Float + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Double): Double /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Byte): Float + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Short): Float + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Int): Float + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Long): Float + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Float): Float + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Double): Double /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Byte): Float + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Short): Float + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Int): Float + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Long): Float + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Float): Float + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Double): Double /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Byte): Float + /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Short): Float + /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Int): Float + /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Long): Float + /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Float): Float + /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Double): Double /** @@ -1049,41 +1352,52 @@ public class Float private constructor() : Number(), Comparable { * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Byte): Float + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Short): Float + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Int): Float + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Long): Float + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Float): Float + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Double): Double /** @@ -1101,10 +1415,12 @@ public class Float private constructor() : Number(), Comparable { public operator fun dec(): Float /** Returns this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun unaryPlus(): Float - /** Returns the negative of this value. */ - public operator fun unaryMinus(): Float + /** Returns the negative of this value. */ + @kotlin.internal.IntrinsicConstEvaluation + public operator fun unaryMinus(): Float /** * Converts this [Float] value to [Byte]. @@ -1113,7 +1429,9 @@ public class Float private constructor() : Number(), Comparable { */ @Deprecated("Unclear conversion. To achieve the same result convert to Int explicitly and then to Byte.", ReplaceWith("toInt().toByte()")) @DeprecatedSinceKotlin(warningSince = "1.3", errorSince = "1.5") + @kotlin.internal.IntrinsicConstEvaluation public override fun toByte(): Byte + /** * Converts this [Float] value to [Char]. * @@ -1121,7 +1439,9 @@ public class Float private constructor() : Number(), Comparable { */ @Deprecated("Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", ReplaceWith("this.toInt().toChar()")) @DeprecatedSinceKotlin(warningSince = "1.5", errorSince = "2.3") + @kotlin.internal.IntrinsicConstEvaluation public override fun toChar(): Char + /** * Converts this [Float] value to [Short]. * @@ -1129,7 +1449,9 @@ public class Float private constructor() : Number(), Comparable { */ @Deprecated("Unclear conversion. To achieve the same result convert to Int explicitly and then to Short.", ReplaceWith("toInt().toShort()")) @DeprecatedSinceKotlin(warningSince = "1.3", errorSince = "1.5") + @kotlin.internal.IntrinsicConstEvaluation public override fun toShort(): Short + /** * Converts this [Float] value to [Int]. * @@ -1137,7 +1459,9 @@ public class Float private constructor() : Number(), Comparable { * Returns zero if this `Float` value is `NaN`, [Int.MIN_VALUE] if it's less than `Int.MIN_VALUE`, * [Int.MAX_VALUE] if it's bigger than `Int.MAX_VALUE`. */ + @kotlin.internal.IntrinsicConstEvaluation public override fun toInt(): Int + /** * Converts this [Float] value to [Long]. * @@ -1145,27 +1469,32 @@ public class Float private constructor() : Number(), Comparable { * Returns zero if this `Float` value is `NaN`, [Long.MIN_VALUE] if it's less than `Long.MIN_VALUE`, * [Long.MAX_VALUE] if it's bigger than `Long.MAX_VALUE`. */ + @kotlin.internal.IntrinsicConstEvaluation public override fun toLong(): Long + /** Returns this value. */ + @kotlin.internal.IntrinsicConstEvaluation public override fun toFloat(): Float + /** * Converts this [Float] value to [Double]. * * The resulting `Double` value represents the same numerical value as this `Float`. */ + @kotlin.internal.IntrinsicConstEvaluation public override fun toDouble(): Double + @kotlin.internal.IntrinsicConstEvaluation public override fun equals(other: Any?): Boolean - public override fun hashCode(): Int + + @kotlin.internal.IntrinsicConstEvaluation public override fun toString(): String + + public override fun hashCode(): Int } -/** - * Represents a double-precision 64-bit IEEE 754 floating point number. - * On the JVM, non-nullable values of this type are represented as values of the primitive type `double`. - */ +/** Represents a double-precision 64-bit IEEE 754 floating point number. */ public class Double private constructor() : Number(), Comparable { - @Suppress("DIVISION_BY_ZERO") companion object { /** * A constant holding the smallest *positive* nonzero value of Double. @@ -1180,16 +1509,19 @@ public class Double private constructor() : Number(), Comparable { /** * A constant holding the positive infinity value of Double. */ + @Suppress("DIVISION_BY_ZERO") public const val POSITIVE_INFINITY: Double = 1.0/0.0 /** * A constant holding the negative infinity value of Double. */ + @Suppress("DIVISION_BY_ZERO") public const val NEGATIVE_INFINITY: Double = -1.0/0.0 /** * A constant holding the "not a number" value of Double. */ + @Suppress("DIVISION_BY_ZERO") public const val NaN: Double = -(0.0/0.0) /** @@ -1210,6 +1542,7 @@ public class Double private constructor() : Number(), Comparable { * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun compareTo(other: Byte): Int /** @@ -1217,6 +1550,7 @@ public class Double private constructor() : Number(), Comparable { * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun compareTo(other: Short): Int /** @@ -1224,6 +1558,7 @@ public class Double private constructor() : Number(), Comparable { * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun compareTo(other: Int): Int /** @@ -1231,6 +1566,7 @@ public class Double private constructor() : Number(), Comparable { * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun compareTo(other: Long): Int /** @@ -1238,6 +1574,7 @@ public class Double private constructor() : Number(), Comparable { * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun compareTo(other: Float): Int /** @@ -1245,58 +1582,103 @@ public class Double private constructor() : Number(), Comparable { * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public override operator fun compareTo(other: Double): Int /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Byte): Double + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Short): Double + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Int): Double + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Long): Double + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Float): Double + /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun plus(other: Double): Double /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Byte): Double + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Short): Double + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Int): Double + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Long): Double + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Float): Double + /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun minus(other: Double): Double /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Byte): Double + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Short): Double + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Int): Double + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Long): Double + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Float): Double + /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun times(other: Double): Double /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Byte): Double + /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Short): Double + /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Int): Double + /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Long): Double + /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Float): Double + /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Double): Double /** @@ -1305,41 +1687,52 @@ public class Double private constructor() : Number(), Comparable { * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Byte): Double + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Short): Double + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Int): Double + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Long): Double + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Float): Double + /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Double): Double /** @@ -1357,10 +1750,12 @@ public class Double private constructor() : Number(), Comparable { public operator fun dec(): Double /** Returns this value. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun unaryPlus(): Double - /** Returns the negative of this value. */ - public operator fun unaryMinus(): Double + /** Returns the negative of this value. */ + @kotlin.internal.IntrinsicConstEvaluation + public operator fun unaryMinus(): Double /** * Converts this [Double] value to [Byte]. @@ -1369,7 +1764,9 @@ public class Double private constructor() : Number(), Comparable { */ @Deprecated("Unclear conversion. To achieve the same result convert to Int explicitly and then to Byte.", ReplaceWith("toInt().toByte()")) @DeprecatedSinceKotlin(warningSince = "1.3", errorSince = "1.5") + @kotlin.internal.IntrinsicConstEvaluation public override fun toByte(): Byte + /** * Converts this [Double] value to [Char]. * @@ -1377,7 +1774,9 @@ public class Double private constructor() : Number(), Comparable { */ @Deprecated("Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", ReplaceWith("this.toInt().toChar()")) @DeprecatedSinceKotlin(warningSince = "1.5", errorSince = "2.3") + @kotlin.internal.IntrinsicConstEvaluation public override fun toChar(): Char + /** * Converts this [Double] value to [Short]. * @@ -1385,7 +1784,9 @@ public class Double private constructor() : Number(), Comparable { */ @Deprecated("Unclear conversion. To achieve the same result convert to Int explicitly and then to Short.", ReplaceWith("toInt().toShort()")) @DeprecatedSinceKotlin(warningSince = "1.3", errorSince = "1.5") + @kotlin.internal.IntrinsicConstEvaluation public override fun toShort(): Short + /** * Converts this [Double] value to [Int]. * @@ -1393,7 +1794,9 @@ public class Double private constructor() : Number(), Comparable { * Returns zero if this `Double` value is `NaN`, [Int.MIN_VALUE] if it's less than `Int.MIN_VALUE`, * [Int.MAX_VALUE] if it's bigger than `Int.MAX_VALUE`. */ + @kotlin.internal.IntrinsicConstEvaluation public override fun toInt(): Int + /** * Converts this [Double] value to [Long]. * @@ -1401,7 +1804,9 @@ public class Double private constructor() : Number(), Comparable { * Returns zero if this `Double` value is `NaN`, [Long.MIN_VALUE] if it's less than `Long.MIN_VALUE`, * [Long.MAX_VALUE] if it's bigger than `Long.MAX_VALUE`. */ + @kotlin.internal.IntrinsicConstEvaluation public override fun toLong(): Long + /** * Converts this [Double] value to [Float]. * @@ -1409,12 +1814,18 @@ public class Double private constructor() : Number(), Comparable { * In case when this `Double` value is exactly between two `Float`s, * the one with zero at least significant bit of mantissa is selected. */ + @kotlin.internal.IntrinsicConstEvaluation public override fun toFloat(): Float + /** Returns this value. */ + @kotlin.internal.IntrinsicConstEvaluation public override fun toDouble(): Double + @kotlin.internal.IntrinsicConstEvaluation public override fun equals(other: Any?): Boolean - public override fun hashCode(): Int - public override fun toString(): String -} + @kotlin.internal.IntrinsicConstEvaluation + public override fun toString(): String + + public override fun hashCode(): Int +} diff --git a/libraries/stdlib/wasm/builtins/kotlin/Primitives.kt b/libraries/stdlib/wasm/builtins/kotlin/Primitives.kt index 3ded24cea3b..c294a9d31bb 100644 --- a/libraries/stdlib/wasm/builtins/kotlin/Primitives.kt +++ b/libraries/stdlib/wasm/builtins/kotlin/Primitives.kt @@ -1,20 +1,17 @@ /* - * Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ -@file:Suppress( - "OVERRIDE_BY_INLINE", - "NOTHING_TO_INLINE", - "unused", "UNUSED_PARAMETER" -) + +// Auto-generated file. DO NOT EDIT! + +@file:Suppress("OVERRIDE_BY_INLINE", "NOTHING_TO_INLINE", "unused", "UNUSED_PARAMETER") package kotlin import kotlin.wasm.internal.* -/** - * Represents a 8-bit signed integer. - */ +/** Represents a 8-bit signed integer. */ @WasmAutoboxed public class Byte private constructor(private val value: Byte) : Number(), Comparable { public companion object { @@ -46,180 +43,234 @@ public class Byte private constructor(private val value: Byte) : Number(), Compa * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public override inline operator fun compareTo(other: Byte): Int = - wasm_i32_compareTo(this.toInt(), other.toInt()) + wasm_i32_compareTo(this.toInt(), other.toInt()) /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun compareTo(other: Short): Int = - this.toShort().compareTo(other) + this.toShort().compareTo(other) /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun compareTo(other: Int): Int = - this.toInt().compareTo(other) + this.toInt().compareTo(other) /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun compareTo(other: Long): Int = - this.toLong().compareTo(other) + this.toLong().compareTo(other) /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun compareTo(other: Float): Int = - this.toFloat().compareTo(other) + this.toFloat().compareTo(other) /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun compareTo(other: Double): Int = - this.toDouble().compareTo(other) + this.toDouble().compareTo(other) /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Byte): Int = - this.toInt() + other.toInt() + this.toInt() + other.toInt() /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Short): Int = - this.toInt() + other.toInt() + this.toInt() + other.toInt() /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Int): Int = - this.toInt() + other + this.toInt() + other /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Long): Long = - this.toLong() + other + this.toLong() + other /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Float): Float = - this.toFloat() + other + this.toFloat() + other /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Double): Double = - this.toDouble() + other + this.toDouble() + other /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Byte): Int = - this.toInt() - other.toInt() + this.toInt() - other.toInt() /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Short): Int = - this.toInt() - other.toInt() + this.toInt() - other.toInt() /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Int): Int = - this.toInt() - other + this.toInt() - other /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Long): Long = - this.toLong() - other + this.toLong() - other /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Float): Float = - this.toFloat() - other + this.toFloat() - other /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Double): Double = - this.toDouble() - other + this.toDouble() - other /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Byte): Int = - this.toInt() * other.toInt() + this.toInt() * other.toInt() /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Short): Int = - this.toInt() * other.toInt() + this.toInt() * other.toInt() /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Int): Int = - this.toInt() * other + this.toInt() * other /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Long): Long = - this.toLong() * other + this.toLong() * other /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Float): Float = - this.toFloat() * other + this.toFloat() * other /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Double): Double = - this.toDouble() * other + this.toDouble() * other /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Byte): Int = - this.toInt() / other.toInt() + this.toInt() / other.toInt() /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Short): Int = - this.toInt() / other.toInt() + this.toInt() / other.toInt() /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Int): Int = - this.toInt() / other + this.toInt() / other - /** Divides this value by the other value. */ + /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Long): Long = - this.toLong() / other + this.toLong() / other /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Float): Float = - this.toFloat() / other + this.toFloat() / other /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Double): Double = - this.toDouble() / other + this.toDouble() / other - /** Calculates the remainder of dividing this value by the other value. */ + /** + * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). + * + * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. + */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Byte): Int = - this.toInt() % other.toInt() + this.toInt() % other.toInt() - /** Calculates the remainder of dividing this value by the other value. */ + /** + * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). + * + * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. + */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Short): Int = - this.toInt() % other.toInt() + this.toInt() % other.toInt() - /** Calculates the remainder of dividing this value by the other value. */ + /** + * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). + * + * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. + */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Int): Int = - this.toInt() % other + this.toInt() % other /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Long): Long = - this.toLong() % other + this.toLong() % other /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Float): Float = - this.toFloat() % other + this.toFloat() % other /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Double): Double = - this.toDouble() % other + this.toDouble() % other /** * Returns this value incremented by one. @@ -227,7 +278,7 @@ public class Byte private constructor(private val value: Byte) : Number(), Compa * @sample samples.misc.Builtins.inc */ public inline operator fun inc(): Byte = - (this + 1).toByte() + (this + 1).toByte() /** * Returns this value decremented by one. @@ -235,15 +286,17 @@ public class Byte private constructor(private val value: Byte) : Number(), Compa * @sample samples.misc.Builtins.dec */ public inline operator fun dec(): Byte = - (this - 1).toByte() + (this - 1).toByte() /** Returns this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun unaryPlus(): Int = - this.toInt() + this.toInt() /** Returns the negative of this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun unaryMinus(): Int = - -this.toInt() + -this.toInt() /** Creates a range from this value to the specified [other] value. */ public operator fun rangeTo(other: Byte): IntRange { @@ -257,12 +310,12 @@ public class Byte private constructor(private val value: Byte) : Number(), Compa /** Creates a range from this value to the specified [other] value. */ public operator fun rangeTo(other: Int): IntRange { - return IntRange(this.toInt(), other.toInt()) + return IntRange(this.toInt(), other) } /** Creates a range from this value to the specified [other] value. */ public operator fun rangeTo(other: Long): LongRange { - return LongRange(this.toLong(), other.toLong()) + return LongRange(this.toLong(), other) } /** @@ -302,8 +355,9 @@ public class Byte private constructor(private val value: Byte) : Number(), Compa public operator fun rangeUntil(other: Long): LongRange = this until other /** Returns this value. */ + @kotlin.internal.IntrinsicConstEvaluation public override inline fun toByte(): Byte = - this + this /** * Converts this [Byte] value to [Char]. @@ -315,6 +369,7 @@ public class Byte private constructor(private val value: Byte) : Number(), Compa */ @Deprecated("Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", ReplaceWith("this.toInt().toChar()")) @DeprecatedSinceKotlin(warningSince = "1.5", errorSince = "2.3") + @kotlin.internal.IntrinsicConstEvaluation public override fun toChar(): Char = reinterpretAsInt().reinterpretAsChar() /** @@ -325,6 +380,7 @@ public class Byte private constructor(private val value: Byte) : Number(), Compa * The least significant 8 bits of the resulting `Short` value are the same as the bits of this `Byte` value, * whereas the most significant 8 bits are filled with the sign bit of this value. */ + @kotlin.internal.IntrinsicConstEvaluation public override fun toShort(): Short = reinterpretAsInt().reinterpretAsShort() /** @@ -335,6 +391,7 @@ public class Byte private constructor(private val value: Byte) : Number(), Compa * The least significant 8 bits of the resulting `Int` value are the same as the bits of this `Byte` value, * whereas the most significant 24 bits are filled with the sign bit of this value. */ + @kotlin.internal.IntrinsicConstEvaluation public override fun toInt(): Int = reinterpretAsInt() /** @@ -345,6 +402,7 @@ public class Byte private constructor(private val value: Byte) : Number(), Compa * The least significant 8 bits of the resulting `Long` value are the same as the bits of this `Byte` value, * whereas the most significant 56 bits are filled with the sign bit of this value. */ + @kotlin.internal.IntrinsicConstEvaluation public override fun toLong(): Long = wasm_i64_extend_i32_s(this.toInt()) /** @@ -352,6 +410,7 @@ public class Byte private constructor(private val value: Byte) : Number(), Compa * * The resulting `Float` value represents the same numerical value as this `Byte`. */ + @kotlin.internal.IntrinsicConstEvaluation public override fun toFloat(): Float = wasm_f32_convert_i32_s(this.toInt()) /** @@ -359,30 +418,33 @@ public class Byte private constructor(private val value: Byte) : Number(), Compa * * The resulting `Double` value represents the same numerical value as this `Byte`. */ + @kotlin.internal.IntrinsicConstEvaluation public override fun toDouble(): Double = wasm_f64_convert_i32_s(this.toInt()) + @kotlin.internal.IntrinsicConstEvaluation public override fun equals(other: Any?): Boolean = - other is Byte && wasm_i32_eq(this.toInt(), other.toInt()) + other is Byte && wasm_i32_eq(this.toInt(), other.toInt()) + @kotlin.internal.IntrinsicConstEvaluation + public override fun toString(): String = + this.toInt().toString() + + @kotlin.internal.IntrinsicConstEvaluation @WasmOp(WasmOp.I32_EQ) public fun equals(other: Byte): Boolean = - implementedAsIntrinsic + implementedAsIntrinsic - public override fun toString(): String = - this.toInt().toString() - - public override inline fun hashCode(): Int = - this.toInt() + public override inline fun hashCode(): Int { + return this.toInt() + } @WasmNoOpCast @PublishedApi internal fun reinterpretAsInt(): Int = - implementedAsIntrinsic + implementedAsIntrinsic } -/** - * Represents a 16-bit signed integer. - */ +/** Represents a 16-bit signed integer. */ @WasmAutoboxed public class Short private constructor(private val value: Short) : Number(), Comparable { public companion object { @@ -414,192 +476,234 @@ public class Short private constructor(private val value: Short) : Number(), Com * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun compareTo(other: Byte): Int = - this.compareTo(other.toShort()) + this.compareTo(other.toShort()) /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public override inline operator fun compareTo(other: Short): Int = - this.toInt().compareTo(other.toInt()) + this.toInt().compareTo(other.toInt()) /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun compareTo(other: Int): Int = - this.toInt().compareTo(other) + this.toInt().compareTo(other) /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun compareTo(other: Long): Int = - this.toLong().compareTo(other) + this.toLong().compareTo(other) /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun compareTo(other: Float): Int = - this.toFloat().compareTo(other) + this.toFloat().compareTo(other) /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun compareTo(other: Double): Int = - this.toDouble().compareTo(other) + this.toDouble().compareTo(other) /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Byte): Int = - this.toInt() + other.toInt() + this.toInt() + other.toInt() /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Short): Int = - this.toInt() + other.toInt() + this.toInt() + other.toInt() /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Int): Int = - this.toInt() + other + this.toInt() + other /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Long): Long = - this.toLong() + other + this.toLong() + other /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Float): Float = - this.toFloat() + other + this.toFloat() + other /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Double): Double = - this.toDouble() + other + this.toDouble() + other /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Byte): Int = - this.toInt() - other.toInt() + this.toInt() - other.toInt() /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Short): Int = - this.toInt() - other.toInt() + this.toInt() - other.toInt() /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Int): Int = - this.toInt() - other + this.toInt() - other /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Long): Long = - this.toLong() - other + this.toLong() - other /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Float): Float = - this.toFloat() - other + this.toFloat() - other /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Double): Double = - this.toDouble() - other + this.toDouble() - other /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Byte): Int = - this.toInt() * other.toInt() + this.toInt() * other.toInt() /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Short): Int = - this.toInt() * other.toInt() + this.toInt() * other.toInt() /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Int): Int = - this.toInt() * other + this.toInt() * other /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Long): Long = - this.toLong() * other + this.toLong() * other /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Float): Float = - this.toFloat() * other + this.toFloat() * other /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Double): Double = - this.toDouble() * other + this.toDouble() * other /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Byte): Int = - this.toInt() / other.toInt() + this.toInt() / other.toInt() /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Short): Int = - this.toInt() / other.toInt() + this.toInt() / other.toInt() /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Int): Int = - this.toInt() / other + this.toInt() / other /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Long): Long = - this.toLong() / other + this.toLong() / other /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Float): Float = - this.toFloat() / other + this.toFloat() / other /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Double): Double = - this.toDouble() / other + this.toDouble() / other /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Byte): Int = - this.toInt() % other.toInt() + this.toInt() % other.toInt() /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Short): Int = - this.toInt() % other.toInt() + this.toInt() % other.toInt() /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Int): Int = - this.toInt() % other + this.toInt() % other /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Long): Long = - this.toLong() % other + this.toLong() % other /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Float): Float = - this.toFloat() % other + this.toFloat() % other /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Double): Double = - this.toDouble() % other + this.toDouble() % other /** * Returns this value incremented by one. @@ -607,7 +711,7 @@ public class Short private constructor(private val value: Short) : Number(), Com * @sample samples.misc.Builtins.inc */ public inline operator fun inc(): Short = - (this + 1).toShort() + (this + 1).toShort() /** * Returns this value decremented by one. @@ -615,15 +719,17 @@ public class Short private constructor(private val value: Short) : Number(), Com * @sample samples.misc.Builtins.dec */ public inline operator fun dec(): Short = - (this - 1).toShort() + (this - 1).toShort() /** Returns this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun unaryPlus(): Int = - this.toInt() + this.toInt() /** Returns the negative of this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun unaryMinus(): Int = - -this.toInt() + -this.toInt() /** Creates a range from this value to the specified [other] value. */ public operator fun rangeTo(other: Byte): IntRange { @@ -689,8 +795,8 @@ public class Short private constructor(private val value: Short) : Number(), Com * * The resulting `Byte` value is represented by the least significant 8 bits of this `Short` value. */ - public override inline fun toByte(): Byte = - this.toInt().toByte() + @kotlin.internal.IntrinsicConstEvaluation + public override inline fun toByte(): Byte = this.toInt().toByte() /** * Converts this [Short] value to [Char]. @@ -700,11 +806,13 @@ public class Short private constructor(private val value: Short) : Number(), Com */ @Deprecated("Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", ReplaceWith("this.toInt().toChar()")) @DeprecatedSinceKotlin(warningSince = "1.5", errorSince = "2.3") + @kotlin.internal.IntrinsicConstEvaluation public override fun toChar(): Char = reinterpretAsInt().reinterpretAsChar() /** Returns this value. */ + @kotlin.internal.IntrinsicConstEvaluation public override inline fun toShort(): Short = - this + this /** * Converts this [Short] value to [Int]. @@ -714,6 +822,7 @@ public class Short private constructor(private val value: Short) : Number(), Com * The least significant 16 bits of the resulting `Int` value are the same as the bits of this `Short` value, * whereas the most significant 16 bits are filled with the sign bit of this value. */ + @kotlin.internal.IntrinsicConstEvaluation public override fun toInt(): Int = reinterpretAsInt() /** @@ -724,6 +833,7 @@ public class Short private constructor(private val value: Short) : Number(), Com * The least significant 16 bits of the resulting `Long` value are the same as the bits of this `Short` value, * whereas the most significant 48 bits are filled with the sign bit of this value. */ + @kotlin.internal.IntrinsicConstEvaluation public override fun toLong(): Long = wasm_i64_extend_i32_s(this.toInt()) /** @@ -731,6 +841,7 @@ public class Short private constructor(private val value: Short) : Number(), Com * * The resulting `Float` value represents the same numerical value as this `Short`. */ + @kotlin.internal.IntrinsicConstEvaluation public override fun toFloat(): Float = wasm_f32_convert_i32_s(this.toInt()) /** @@ -738,34 +849,35 @@ public class Short private constructor(private val value: Short) : Number(), Com * * The resulting `Double` value represents the same numerical value as this `Short`. */ - public override fun toDouble(): Double = - wasm_f64_convert_i32_s(this.toInt()) + @kotlin.internal.IntrinsicConstEvaluation + public override fun toDouble(): Double = wasm_f64_convert_i32_s(this.toInt()) + @kotlin.internal.IntrinsicConstEvaluation + public override fun equals(other: Any?): Boolean = + other is Short && wasm_i32_eq(this.toInt(), other.toInt()) + + @kotlin.internal.IntrinsicConstEvaluation + public override fun toString(): String = + this.toInt().toString() + + @kotlin.internal.IntrinsicConstEvaluation @WasmOp(WasmOp.I32_EQ) public fun equals(other: Short): Boolean = - implementedAsIntrinsic + implementedAsIntrinsic - public override fun equals(other: Any?): Boolean = - other is Short && wasm_i32_eq(this.toInt(), other.toInt()) - - public override fun toString(): String = - this.toInt().toString() - - public override inline fun hashCode(): Int = - this.toInt() + public override inline fun hashCode(): Int { + return this.toInt() + } @WasmNoOpCast @PublishedApi internal fun reinterpretAsInt(): Int = - implementedAsIntrinsic + implementedAsIntrinsic } -/** - * Represents a 32-bit signed integer. - */ +/** Represents a 32-bit signed integer. */ @WasmAutoboxed public class Int private constructor(private val value: Int) : Number(), Comparable { - public companion object { /** * A constant holding the minimum value an instance of Int can have. @@ -795,192 +907,238 @@ public class Int private constructor(private val value: Int) : Number(), Compara * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun compareTo(other: Byte): Int = - this.compareTo(other.toInt()) + this.compareTo(other.toInt()) /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun compareTo(other: Short): Int = - this.compareTo(other.toInt()) + this.compareTo(other.toInt()) /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public override inline operator fun compareTo(other: Int): Int = - wasm_i32_compareTo(this, other) + wasm_i32_compareTo(this, other) /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun compareTo(other: Long): Int = - this.toLong().compareTo(other) + this.toLong().compareTo(other) /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun compareTo(other: Float): Int = - this.toFloat().compareTo(other) + this.toFloat().compareTo(other) /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun compareTo(other: Double): Int = - this.toDouble().compareTo(other) + this.toDouble().compareTo(other) /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Byte): Int = - this + other.toInt() + this + other.toInt() /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Short): Int = - this + other.toInt() + this + other.toInt() /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation @WasmOp(WasmOp.I32_ADD) public operator fun plus(other: Int): Int = - implementedAsIntrinsic + implementedAsIntrinsic /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Long): Long = - this.toLong() + other + this.toLong() + other /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Float): Float = - this.toFloat() + other + this.toFloat() + other /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Double): Double = - this.toDouble() + other + this.toDouble() + other /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Byte): Int = - this - other.toInt() + this - other.toInt() /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Short): Int = - this - other.toInt() + this - other.toInt() /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation @WasmOp(WasmOp.I32_SUB) public operator fun minus(other: Int): Int = - implementedAsIntrinsic + implementedAsIntrinsic /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Long): Long = - this.toLong() - other + this.toLong() - other /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Float): Float = - this.toFloat() - other + this.toFloat() - other /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Double): Double = - this.toDouble() - other + this.toDouble() - other /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Byte): Int = - this * other.toInt() + this * other.toInt() /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Short): Int = - this * other.toInt() + this * other.toInt() /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation @WasmOp(WasmOp.I32_MUL) public operator fun times(other: Int): Int = - implementedAsIntrinsic + implementedAsIntrinsic /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Long): Long = - this.toLong() * other + this.toLong() * other /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Float): Float = - this.toFloat() * other + this.toFloat() * other /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Double): Double = - this.toDouble() * other + this.toDouble() * other /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Byte): Int = - this / other.toInt() + this / other.toInt() /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Short): Int = - this / other.toInt() + this / other.toInt() /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Int): Int = - if (this == Int.MIN_VALUE && other == -1) Int.MIN_VALUE else wasm_i32_div_s(this, other) + if (this == Int.MIN_VALUE && other == -1) Int.MIN_VALUE else wasm_i32_div_s(this, other) /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Long): Long = - this.toLong() / other + this.toLong() / other /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Float): Float = - this.toFloat() / other + this.toFloat() / other /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Double): Double = - this.toDouble() / other + this.toDouble() / other - /** Calculates the remainder of dividing this value by the other value. */ + /** + * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). + * + * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. + */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Byte): Int = - this % other.toInt() + this % other.toInt() /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Short): Int = - this % other.toInt() + this % other.toInt() /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation @WasmOp(WasmOp.I32_REM_S) public operator fun rem(other: Int): Int = - implementedAsIntrinsic + implementedAsIntrinsic /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Long): Long = - this.toLong() % other + this.toLong() % other /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Float): Float = - this.toFloat() % other + this.toFloat() % other /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Double): Double = - this.toDouble() % other + this.toDouble() % other /** * Returns this value incremented by one. @@ -988,7 +1146,7 @@ public class Int private constructor(private val value: Int) : Number(), Compara * @sample samples.misc.Builtins.inc */ public inline operator fun inc(): Int = - this + 1 + this + 1 /** * Returns this value decremented by one. @@ -997,13 +1155,17 @@ public class Int private constructor(private val value: Int) : Number(), Compara */ // TODO: Fix test compiler/testData/codegen/box/functions/invoke/invoke.kt with inline dec public operator fun dec(): Int = - this - 1 + this - 1 /** Returns this value. */ - public inline operator fun unaryPlus(): Int = this + @kotlin.internal.IntrinsicConstEvaluation + public inline operator fun unaryPlus(): Int = + this /** Returns the negative of this value. */ - public inline operator fun unaryMinus(): Int = 0 - this + @kotlin.internal.IntrinsicConstEvaluation + public inline operator fun unaryMinus(): Int = + 0 - this /** Creates a range from this value to the specified [other] value. */ public operator fun rangeTo(other: Byte): IntRange { @@ -1017,12 +1179,12 @@ public class Int private constructor(private val value: Int) : Number(), Compara /** Creates a range from this value to the specified [other] value. */ public operator fun rangeTo(other: Int): IntRange { - return IntRange(this, other.toInt()) + return IntRange(this, other) } /** Creates a range from this value to the specified [other] value. */ public operator fun rangeTo(other: Long): LongRange { - return LongRange(this.toLong(), other.toLong()) + return LongRange(this.toLong(), other) } /** @@ -1067,9 +1229,10 @@ public class Int private constructor(private val value: Int) : Number(), Compara * Note that only the five lowest-order bits of the [bitCount] are used as the shift distance. * The shift distance actually used is therefore always in the range `0..31`. */ + @kotlin.internal.IntrinsicConstEvaluation @WasmOp(WasmOp.I32_SHL) public infix fun shl(bitCount: Int): Int = - implementedAsIntrinsic + implementedAsIntrinsic /** * Shifts this value right by the [bitCount] number of bits, filling the leftmost bits with copies of the sign bit. @@ -1077,9 +1240,10 @@ public class Int private constructor(private val value: Int) : Number(), Compara * Note that only the five lowest-order bits of the [bitCount] are used as the shift distance. * The shift distance actually used is therefore always in the range `0..31`. */ + @kotlin.internal.IntrinsicConstEvaluation @WasmOp(WasmOp.I32_SHR_S) public infix fun shr(bitCount: Int): Int = - implementedAsIntrinsic + implementedAsIntrinsic /** * Shifts this value right by the [bitCount] number of bits, filling the leftmost bits with zeros. @@ -1087,28 +1251,33 @@ public class Int private constructor(private val value: Int) : Number(), Compara * Note that only the five lowest-order bits of the [bitCount] are used as the shift distance. * The shift distance actually used is therefore always in the range `0..31`. */ + @kotlin.internal.IntrinsicConstEvaluation @WasmOp(WasmOp.I32_SHR_U) public infix fun ushr(bitCount: Int): Int = - implementedAsIntrinsic + implementedAsIntrinsic /** Performs a bitwise AND operation between the two values. */ + @kotlin.internal.IntrinsicConstEvaluation @WasmOp(WasmOp.I32_AND) public infix fun and(other: Int): Int = - implementedAsIntrinsic + implementedAsIntrinsic /** Performs a bitwise OR operation between the two values. */ + @kotlin.internal.IntrinsicConstEvaluation @WasmOp(WasmOp.I32_OR) public infix fun or(other: Int): Int = - implementedAsIntrinsic + implementedAsIntrinsic /** Performs a bitwise XOR operation between the two values. */ + @kotlin.internal.IntrinsicConstEvaluation @WasmOp(WasmOp.I32_XOR) public infix fun xor(other: Int): Int = - implementedAsIntrinsic + implementedAsIntrinsic /** Inverts the bits in this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline fun inv(): Int = - this.xor(-1) + this.xor(-1) /** * Converts this [Int] value to [Byte]. @@ -1118,8 +1287,8 @@ public class Int private constructor(private val value: Int) : Number(), Compara * * The resulting `Byte` value is represented by the least significant 8 bits of this `Int` value. */ - public override fun toByte(): Byte = - ((this shl 24) shr 24).reinterpretAsByte() + @kotlin.internal.IntrinsicConstEvaluation + public override fun toByte(): Byte = ((this shl 24) shr 24).reinterpretAsByte() /** * Converts this [Int] value to [Char]. @@ -1130,6 +1299,7 @@ public class Int private constructor(private val value: Int) : Number(), Compara * The resulting `Char` code is represented by the least significant 16 bits of this `Int` value. */ @Suppress("OVERRIDE_DEPRECATION") + @kotlin.internal.IntrinsicConstEvaluation public override fun toChar(): Char = (this and 0xFFFF).reinterpretAsChar() @@ -1141,12 +1311,13 @@ public class Int private constructor(private val value: Int) : Number(), Compara * * The resulting `Short` value is represented by the least significant 16 bits of this `Int` value. */ - public override fun toShort(): Short = - ((this shl 16) shr 16).reinterpretAsShort() + @kotlin.internal.IntrinsicConstEvaluation + public override fun toShort(): Short = ((this shl 16) shr 16).reinterpretAsShort() /** Returns this value. */ + @kotlin.internal.IntrinsicConstEvaluation public override inline fun toInt(): Int = - this + this /** * Converts this [Int] value to [Long]. @@ -1156,8 +1327,8 @@ public class Int private constructor(private val value: Int) : Number(), Compara * The least significant 32 bits of the resulting `Long` value are the same as the bits of this `Int` value, * whereas the most significant 32 bits are filled with the sign bit of this value. */ - public override fun toLong(): Long = - wasm_i64_extend_i32_s(this) + @kotlin.internal.IntrinsicConstEvaluation + public override fun toLong(): Long = wasm_i64_extend_i32_s(this) /** * Converts this [Int] value to [Float]. @@ -1166,57 +1337,58 @@ public class Int private constructor(private val value: Int) : Number(), Compara * In case when this `Int` value is exactly between two `Float`s, * the one with zero at least significant bit of mantissa is selected. */ - public override fun toFloat(): Float = - wasm_f32_convert_i32_s(this) + @kotlin.internal.IntrinsicConstEvaluation + public override fun toFloat(): Float = wasm_f32_convert_i32_s(this) /** * Converts this [Int] value to [Double]. * * The resulting `Double` value represents the same numerical value as this `Int`. */ - public override fun toDouble(): Double = - wasm_f64_convert_i32_s(this) + @kotlin.internal.IntrinsicConstEvaluation + public override fun toDouble(): Double = wasm_f64_convert_i32_s(this) + @kotlin.internal.IntrinsicConstEvaluation + public override fun equals(other: Any?): Boolean = + other is Int && wasm_i32_eq(this, other) + + @kotlin.internal.IntrinsicConstEvaluation + public override fun toString(): String = + itoa32(this, 10) + + @kotlin.internal.IntrinsicConstEvaluation @WasmOp(WasmOp.I32_EQ) public fun equals(other: Int): Boolean = - implementedAsIntrinsic + implementedAsIntrinsic - public override fun equals(other: Any?): Boolean = - other is Int && wasm_i32_eq(this, other) - - public override fun toString(): String = - itoa32(this, 10) - - public override inline fun hashCode(): Int = - this + public override inline fun hashCode(): Int { + return this + } @WasmNoOpCast @PublishedApi internal fun reinterpretAsBoolean(): Boolean = - implementedAsIntrinsic + implementedAsIntrinsic - @PublishedApi @WasmNoOpCast + @PublishedApi internal fun reinterpretAsByte(): Byte = - implementedAsIntrinsic + implementedAsIntrinsic - @PublishedApi @WasmNoOpCast + @PublishedApi internal fun reinterpretAsShort(): Short = - implementedAsIntrinsic + implementedAsIntrinsic - @PublishedApi @WasmNoOpCast + @PublishedApi internal fun reinterpretAsChar(): Char = - implementedAsIntrinsic + implementedAsIntrinsic } -/** - * Represents a 64-bit signed integer. - */ +/** Represents a 64-bit signed integer. */ @WasmAutoboxed public class Long private constructor(private val value: Long) : Number(), Comparable { - public companion object { /** * A constant holding the minimum value an instance of Long can have. @@ -1246,196 +1418,238 @@ public class Long private constructor(private val value: Long) : Number(), Compa * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun compareTo(other: Byte): Int = - this.compareTo(other.toLong()) + this.compareTo(other.toLong()) /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun compareTo(other: Short): Int = - this.compareTo(other.toLong()) + this.compareTo(other.toLong()) /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun compareTo(other: Int): Int = - this.compareTo(other.toLong()) + this.compareTo(other.toLong()) /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public override inline operator fun compareTo(other: Long): Int = - wasm_i64_compareTo(this, other) + wasm_i64_compareTo(this, other) /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun compareTo(other: Float): Int = - this.toFloat().compareTo(other) + this.toFloat().compareTo(other) /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun compareTo(other: Double): Int = - this.toDouble().compareTo(other) + this.toDouble().compareTo(other) /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Byte): Long = - this + other.toLong() + this + other.toLong() /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Short): Long = - this + other.toLong() + this + other.toLong() /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Int): Long = - this + other.toLong() + this + other.toLong() /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation @WasmOp(WasmOp.I64_ADD) public operator fun plus(other: Long): Long = - implementedAsIntrinsic + implementedAsIntrinsic /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Float): Float = - this.toFloat() + other + this.toFloat() + other /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Double): Double = - this.toDouble() + other + this.toDouble() + other /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Byte): Long = - this - other.toLong() + this - other.toLong() /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Short): Long = - this - other.toLong() + this - other.toLong() /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Int): Long = - this - other.toLong() + this - other.toLong() /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation @WasmOp(WasmOp.I64_SUB) public operator fun minus(other: Long): Long = - implementedAsIntrinsic + implementedAsIntrinsic /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Float): Float = - this.toFloat() - other + this.toFloat() - other /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Double): Double = - this.toDouble() - other + this.toDouble() - other /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Byte): Long = - this * other.toLong() + this * other.toLong() /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Short): Long = - this * other.toLong() + this * other.toLong() /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Int): Long = - this * other.toLong() + this * other.toLong() /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation @WasmOp(WasmOp.I64_MUL) public operator fun times(other: Long): Long = - implementedAsIntrinsic + implementedAsIntrinsic /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Float): Float = - this.toFloat() * other + this.toFloat() * other /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Double): Double = - this.toDouble() * other + this.toDouble() * other /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Byte): Long = - this / other.toLong() + this / other.toLong() /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Short): Long = - this / other.toLong() + this / other.toLong() /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Int): Long = - this / other.toLong() + this / other.toLong() /** Divides this value by the other value, truncating the result to an integer that is closer to zero. */ + @kotlin.internal.IntrinsicConstEvaluation public operator fun div(other: Long): Long = - if (this == Long.MIN_VALUE && other == -1L) Long.MIN_VALUE else wasm_i64_div_s(this, other) + if (this == Long.MIN_VALUE && other == -1L) Long.MIN_VALUE else wasm_i64_div_s(this, other) /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Float): Float = - this.toFloat() / other + this.toFloat() / other /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Double): Double = - this.toDouble() / other + this.toDouble() / other /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Byte): Long = - this % other.toLong() + this % other.toLong() /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Short): Long = - this % other.toLong() + this % other.toLong() /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Int): Long = - this % other.toLong() + this % other.toLong() /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation @WasmOp(WasmOp.I64_REM_S) public operator fun rem(other: Long): Long = - implementedAsIntrinsic + implementedAsIntrinsic /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Float): Float = - this.toFloat() % other + this.toFloat() % other /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Double): Double = - this.toDouble() % other + this.toDouble() % other /** * Returns this value incremented by one. @@ -1443,7 +1657,7 @@ public class Long private constructor(private val value: Long) : Number(), Compa * @sample samples.misc.Builtins.inc */ public inline operator fun inc(): Long = - this + 1L + this + 1L /** * Returns this value decremented by one. @@ -1451,14 +1665,17 @@ public class Long private constructor(private val value: Long) : Number(), Compa * @sample samples.misc.Builtins.dec */ public inline operator fun dec(): Long = - this - 1L + this - 1L /** Returns this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun unaryPlus(): Long = - this + this /** Returns the negative of this value. */ - public inline operator fun unaryMinus(): Long = 0L - this + @kotlin.internal.IntrinsicConstEvaluation + public inline operator fun unaryMinus(): Long = + 0L - this /** Creates a range from this value to the specified [other] value. */ public operator fun rangeTo(other: Byte): LongRange { @@ -1477,7 +1694,7 @@ public class Long private constructor(private val value: Long) : Number(), Compa /** Creates a range from this value to the specified [other] value. */ public operator fun rangeTo(other: Long): LongRange { - return LongRange(this, other.toLong()) + return LongRange(this, other) } /** @@ -1522,8 +1739,9 @@ public class Long private constructor(private val value: Long) : Number(), Compa * Note that only the six lowest-order bits of the [bitCount] are used as the shift distance. * The shift distance actually used is therefore always in the range `0..63`. */ + @kotlin.internal.IntrinsicConstEvaluation public inline infix fun shl(bitCount: Int): Long = - wasm_i64_shl(this, bitCount.toLong()) + wasm_i64_shl(this, bitCount.toLong()) /** * Shifts this value right by the [bitCount] number of bits, filling the leftmost bits with copies of the sign bit. @@ -1531,8 +1749,9 @@ public class Long private constructor(private val value: Long) : Number(), Compa * Note that only the six lowest-order bits of the [bitCount] are used as the shift distance. * The shift distance actually used is therefore always in the range `0..63`. */ + @kotlin.internal.IntrinsicConstEvaluation public inline infix fun shr(bitCount: Int): Long = - wasm_i64_shr_s(this, bitCount.toLong()) + wasm_i64_shr_s(this, bitCount.toLong()) /** * Shifts this value right by the [bitCount] number of bits, filling the leftmost bits with zeros. @@ -1540,27 +1759,32 @@ public class Long private constructor(private val value: Long) : Number(), Compa * Note that only the six lowest-order bits of the [bitCount] are used as the shift distance. * The shift distance actually used is therefore always in the range `0..63`. */ + @kotlin.internal.IntrinsicConstEvaluation public inline infix fun ushr(bitCount: Int): Long = - wasm_i64_shr_u(this, bitCount.toLong()) + wasm_i64_shr_u(this, bitCount.toLong()) /** Performs a bitwise AND operation between the two values. */ + @kotlin.internal.IntrinsicConstEvaluation @WasmOp(WasmOp.I64_AND) public infix fun and(other: Long): Long = - implementedAsIntrinsic + implementedAsIntrinsic /** Performs a bitwise OR operation between the two values. */ + @kotlin.internal.IntrinsicConstEvaluation @WasmOp(WasmOp.I64_OR) public infix fun or(other: Long): Long = - implementedAsIntrinsic + implementedAsIntrinsic /** Performs a bitwise XOR operation between the two values. */ + @kotlin.internal.IntrinsicConstEvaluation @WasmOp(WasmOp.I64_XOR) public infix fun xor(other: Long): Long = - implementedAsIntrinsic + implementedAsIntrinsic /** Inverts the bits in this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline fun inv(): Long = - this.xor(-1L) + this.xor(-1L) /** * Converts this [Long] value to [Byte]. @@ -1570,8 +1794,8 @@ public class Long private constructor(private val value: Long) : Number(), Compa * * The resulting `Byte` value is represented by the least significant 8 bits of this `Long` value. */ - public override inline fun toByte(): Byte = - this.toInt().toByte() + @kotlin.internal.IntrinsicConstEvaluation + public override inline fun toByte(): Byte = this.toInt().toByte() /** * Converts this [Long] value to [Char]. @@ -1583,6 +1807,7 @@ public class Long private constructor(private val value: Long) : Number(), Compa */ @Deprecated("Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", ReplaceWith("this.toInt().toChar()")) @DeprecatedSinceKotlin(warningSince = "1.5", errorSince = "2.3") + @kotlin.internal.IntrinsicConstEvaluation public override inline fun toChar(): Char = this.toInt().toChar() @@ -1594,8 +1819,8 @@ public class Long private constructor(private val value: Long) : Number(), Compa * * The resulting `Short` value is represented by the least significant 16 bits of this `Long` value. */ - public override inline fun toShort(): Short = - this.toInt().toShort() + @kotlin.internal.IntrinsicConstEvaluation + public override inline fun toShort(): Short = this.toInt().toShort() /** * Converts this [Long] value to [Int]. @@ -1605,12 +1830,13 @@ public class Long private constructor(private val value: Long) : Number(), Compa * * The resulting `Int` value is represented by the least significant 32 bits of this `Long` value. */ - public override fun toInt(): Int = - wasm_i32_wrap_i64(this) + @kotlin.internal.IntrinsicConstEvaluation + public override fun toInt(): Int = wasm_i32_wrap_i64(this) /** Returns this value. */ + @kotlin.internal.IntrinsicConstEvaluation public override inline fun toLong(): Long = - this + this /** * Converts this [Long] value to [Float]. @@ -1619,8 +1845,8 @@ public class Long private constructor(private val value: Long) : Number(), Compa * In case when this `Long` value is exactly between two `Float`s, * the one with zero at least significant bit of mantissa is selected. */ - public override fun toFloat(): Float = - wasm_f32_convert_i64_s(this) + @kotlin.internal.IntrinsicConstEvaluation + public override fun toFloat(): Float = wasm_f32_convert_i64_s(this) /** * Converts this [Long] value to [Double]. @@ -1629,57 +1855,58 @@ public class Long private constructor(private val value: Long) : Number(), Compa * In case when this `Long` value is exactly between two `Double`s, * the one with zero at least significant bit of mantissa is selected. */ - public override fun toDouble(): Double = - wasm_f64_convert_i64_s(this) + @kotlin.internal.IntrinsicConstEvaluation + public override fun toDouble(): Double = wasm_f64_convert_i64_s(this) + @kotlin.internal.IntrinsicConstEvaluation + public override fun equals(other: Any?): Boolean = + other is Long && wasm_i64_eq(this, other) + + @kotlin.internal.IntrinsicConstEvaluation + public override fun toString(): String = + itoa64(this, 10) + + @kotlin.internal.IntrinsicConstEvaluation @WasmOp(WasmOp.I64_EQ) public fun equals(other: Long): Boolean = - implementedAsIntrinsic + implementedAsIntrinsic - public override fun equals(other: Any?): Boolean = - other is Long && wasm_i64_eq(this, other) - - public override fun toString(): String = - itoa64(this, 10) - - public override fun hashCode(): Int = - ((this ushr 32) xor this).toInt() + public override inline fun hashCode(): Int { + return ((this ushr 32) xor this).toInt() + } } -/** - * Represents a single-precision 32-bit IEEE 754 floating point number. - */ +/** Represents a single-precision 32-bit IEEE 754 floating point number. */ @WasmAutoboxed public class Float private constructor(private val value: Float) : Number(), Comparable { - public companion object { /** * A constant holding the smallest *positive* nonzero value of Float. */ - public const val MIN_VALUE: Float = 1.40129846432481707e-45f + public const val MIN_VALUE: Float = 1.40129846432481700e-45F /** * A constant holding the largest positive finite value of Float. */ - public const val MAX_VALUE: Float = 3.40282346638528860e+38f + public const val MAX_VALUE: Float = 3.40282346638528860e+38F /** * A constant holding the positive infinity value of Float. */ @Suppress("DIVISION_BY_ZERO") - public const val POSITIVE_INFINITY: Float = 1.0f / 0.0f + public const val POSITIVE_INFINITY: Float = 1.0F/0.0F /** * A constant holding the negative infinity value of Float. */ @Suppress("DIVISION_BY_ZERO") - public const val NEGATIVE_INFINITY: Float = -1.0f / 0.0f + public const val NEGATIVE_INFINITY: Float = -1.0F/0.0F /** * A constant holding the "not a number" value of Float. */ @Suppress("DIVISION_BY_ZERO") - public const val NaN: Float = 0.0f / 0.0f + public const val NaN: Float = -(0.0F/0.0F) /** * The number of bytes used to represent an instance of Float in a binary form. @@ -1699,34 +1926,43 @@ public class Float private constructor(private val value: Float) : Number(), Com * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ - public inline operator fun compareTo(other: Byte): Int = compareTo(other.toFloat()) + @kotlin.internal.IntrinsicConstEvaluation + public inline operator fun compareTo(other: Byte): Int = + this.compareTo(other.toFloat()) /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ - public inline operator fun compareTo(other: Short): Int = compareTo(other.toFloat()) + @kotlin.internal.IntrinsicConstEvaluation + public inline operator fun compareTo(other: Short): Int = + this.compareTo(other.toFloat()) /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ - public inline operator fun compareTo(other: Int): Int = compareTo(other.toFloat()) + @kotlin.internal.IntrinsicConstEvaluation + public inline operator fun compareTo(other: Int): Int = + this.compareTo(other.toFloat()) /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ - public inline operator fun compareTo(other: Long): Int = compareTo(other.toFloat()) + @kotlin.internal.IntrinsicConstEvaluation + public inline operator fun compareTo(other: Long): Int = + this.compareTo(other.toFloat()) /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public override operator fun compareTo(other: Float): Int { // if any of values in NaN both comparisons return false if (this > other) return 1 @@ -1735,7 +1971,7 @@ public class Float private constructor(private val value: Float) : Number(), Com val thisBits = this.toBits() val otherBits = other.toBits() - // Canonical NaN bits representation higher than any other value + // Canonical NaN bits representation higher than any other bit represent value return thisBits.compareTo(otherBits) } @@ -1744,155 +1980,193 @@ public class Float private constructor(private val value: Float) : Number(), Com * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ - public inline operator fun compareTo(other: Double): Int = -other.compareTo(this) + @kotlin.internal.IntrinsicConstEvaluation + public inline operator fun compareTo(other: Double): Int = + - other.compareTo(this) /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Byte): Float = - this + other.toFloat() + this + other.toFloat() /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Short): Float = - this + other.toFloat() + this + other.toFloat() /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Int): Float = - this + other.toFloat() + this + other.toFloat() /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Long): Float = - this + other.toFloat() + this + other.toFloat() /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation @WasmOp(WasmOp.F32_ADD) public operator fun plus(other: Float): Float = - implementedAsIntrinsic + implementedAsIntrinsic /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Double): Double = - this.toDouble() + other + this.toDouble() + other /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Byte): Float = - this - other.toFloat() + this - other.toFloat() /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Short): Float = - this - other.toFloat() + this - other.toFloat() /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Int): Float = - this - other.toFloat() + this - other.toFloat() /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Long): Float = - this - other.toFloat() + this - other.toFloat() /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation @WasmOp(WasmOp.F32_SUB) public operator fun minus(other: Float): Float = - implementedAsIntrinsic + implementedAsIntrinsic /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Double): Double = - this.toDouble() - other + this.toDouble() - other /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Byte): Float = - this * other.toFloat() + this * other.toFloat() /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Short): Float = - this * other.toFloat() + this * other.toFloat() /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Int): Float = - this * other.toFloat() + this * other.toFloat() /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Long): Float = - this * other.toFloat() + this * other.toFloat() /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation @WasmOp(WasmOp.F32_MUL) public operator fun times(other: Float): Float = - implementedAsIntrinsic + implementedAsIntrinsic /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Double): Double = - this.toDouble() * other + this.toDouble() * other /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Byte): Float = - this / other.toFloat() + this / other.toFloat() /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Short): Float = - this / other.toFloat() + this / other.toFloat() /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Int): Float = - this / other.toFloat() + this / other.toFloat() /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Long): Float = - this / other.toFloat() + this / other.toFloat() /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation @WasmOp(WasmOp.F32_DIV) public operator fun div(other: Float): Float = - implementedAsIntrinsic + implementedAsIntrinsic /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Double): Double = - this.toDouble() / other + this.toDouble() / other /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Byte): Float = - this % other.toFloat() + this % other.toFloat() /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Short): Float = - this % other.toFloat() + this % other.toFloat() /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Int): Float = - this % other.toFloat() + this % other.toFloat() /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Long): Float = - this % other.toFloat() + this % other.toFloat() /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Float): Float = - this - (wasm_f32_nearest(this / other) * other) + this - (wasm_f32_nearest(this / other) * other) /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Double): Double = - this.toDouble() % other + this.toDouble() % other /** * Returns this value incremented by one. @@ -1900,7 +2174,7 @@ public class Float private constructor(private val value: Float) : Number(), Com * @sample samples.misc.Builtins.inc */ public inline operator fun inc(): Float = - this + 1.0f + this + 1.0f /** * Returns this value decremented by one. @@ -1908,21 +2182,27 @@ public class Float private constructor(private val value: Float) : Number(), Com * @sample samples.misc.Builtins.dec */ public inline operator fun dec(): Float = - this - 1.0f + this - 1.0f /** Returns this value. */ - public inline operator fun unaryPlus(): Float = this + @kotlin.internal.IntrinsicConstEvaluation + public inline operator fun unaryPlus(): Float = + this /** Returns the negative of this value. */ + @kotlin.internal.IntrinsicConstEvaluation @WasmOp(WasmOp.F32_NEG) public operator fun unaryMinus(): Float = - implementedAsIntrinsic + implementedAsIntrinsic /** * Converts this [Float] value to [Byte]. * * The resulting `Byte` value is equal to `this.toInt().toByte()`. */ + @Deprecated("Unclear conversion. To achieve the same result convert to Int explicitly and then to Byte.", ReplaceWith("toInt().toByte()")) + @DeprecatedSinceKotlin(warningSince = "1.3", errorSince = "1.5") + @kotlin.internal.IntrinsicConstEvaluation public override inline fun toByte(): Byte = this.toInt().toByte() /** @@ -1932,6 +2212,7 @@ public class Float private constructor(private val value: Float) : Number(), Com */ @Deprecated("Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", ReplaceWith("this.toInt().toChar()")) @DeprecatedSinceKotlin(warningSince = "1.5", errorSince = "2.3") + @kotlin.internal.IntrinsicConstEvaluation public override inline fun toChar(): Char = this.toInt().toChar() /** @@ -1939,6 +2220,9 @@ public class Float private constructor(private val value: Float) : Number(), Com * * The resulting `Short` value is equal to `this.toInt().toShort()`. */ + @Deprecated("Unclear conversion. To achieve the same result convert to Int explicitly and then to Short.", ReplaceWith("toInt().toShort()")) + @DeprecatedSinceKotlin(warningSince = "1.3", errorSince = "1.5") + @kotlin.internal.IntrinsicConstEvaluation public override inline fun toShort(): Short = this.toInt().toShort() /** @@ -1948,9 +2232,8 @@ public class Float private constructor(private val value: Float) : Number(), Com * Returns zero if this `Float` value is `NaN`, [Int.MIN_VALUE] if it's less than `Int.MIN_VALUE`, * [Int.MAX_VALUE] if it's bigger than `Int.MAX_VALUE`. */ - public override fun toInt(): Int { - return wasm_i32_trunc_sat_f32_s(this) - } + @kotlin.internal.IntrinsicConstEvaluation + public override fun toInt(): Int = wasm_i32_trunc_sat_f32_s(this) /** * Converts this [Float] value to [Long]. @@ -1959,69 +2242,67 @@ public class Float private constructor(private val value: Float) : Number(), Com * Returns zero if this `Float` value is `NaN`, [Long.MIN_VALUE] if it's less than `Long.MIN_VALUE`, * [Long.MAX_VALUE] if it's bigger than `Long.MAX_VALUE`. */ - public override fun toLong(): Long { - return wasm_i64_trunc_sat_f32_s(this) - } + @kotlin.internal.IntrinsicConstEvaluation + public override fun toLong(): Long = wasm_i64_trunc_sat_f32_s(this) /** Returns this value. */ + @kotlin.internal.IntrinsicConstEvaluation public override inline fun toFloat(): Float = - this + this /** * Converts this [Float] value to [Double]. * * The resulting `Double` value represents the same numerical value as this `Float`. */ - public override fun toDouble(): Double = - wasm_f64_promote_f32(this) - - public inline fun equals(other: Float): Boolean = - toBits() == other.toBits() + @kotlin.internal.IntrinsicConstEvaluation + public override fun toDouble(): Double = wasm_f64_promote_f32(this) + @kotlin.internal.IntrinsicConstEvaluation public override fun equals(other: Any?): Boolean = - other is Float && this.equals(other) + other is Float && this.equals(other) + @kotlin.internal.IntrinsicConstEvaluation public override fun toString(): String = - dtoa(this.toDouble()) + dtoa(this.toDouble()) - public override inline fun hashCode(): Int = - toBits() + @kotlin.internal.IntrinsicConstEvaluation + public inline fun equals(other: Float): Boolean = toBits() == other.toBits() + + public override inline fun hashCode(): Int = toBits() } -/** - * Represents a double-precision 64-bit IEEE 754 floating point number. - */ +/** Represents a double-precision 64-bit IEEE 754 floating point number. */ @WasmAutoboxed public class Double private constructor(private val value: Double) : Number(), Comparable { - public companion object { /** * A constant holding the smallest *positive* nonzero value of Double. */ - public const val MIN_VALUE: Double = 4.9e-324 + public const val MIN_VALUE: Double = 4.9E-324 /** * A constant holding the largest positive finite value of Double. */ - public const val MAX_VALUE: Double = 1.7976931348623157e+308 + public const val MAX_VALUE: Double = 1.7976931348623157E308 /** * A constant holding the positive infinity value of Double. */ @Suppress("DIVISION_BY_ZERO") - public const val POSITIVE_INFINITY: Double = 1.0 / 0.0 + public const val POSITIVE_INFINITY: Double = 1.0/0.0 /** * A constant holding the negative infinity value of Double. */ @Suppress("DIVISION_BY_ZERO") - public const val NEGATIVE_INFINITY: Double = -1.0 / 0.0 + public const val NEGATIVE_INFINITY: Double = -1.0/0.0 /** * A constant holding the "not a number" value of Double. */ @Suppress("DIVISION_BY_ZERO") - public const val NaN: Double = 0.0 / 0.0 + public const val NaN: Double = -(0.0/0.0) /** * The number of bytes used to represent an instance of Double in a binary form. @@ -2041,41 +2322,52 @@ public class Double private constructor(private val value: Double) : Number(), C * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ - public inline operator fun compareTo(other: Byte): Int = compareTo(other.toDouble()) + @kotlin.internal.IntrinsicConstEvaluation + public inline operator fun compareTo(other: Byte): Int = + this.compareTo(other.toDouble()) /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ - public inline operator fun compareTo(other: Short): Int = compareTo(other.toDouble()) + @kotlin.internal.IntrinsicConstEvaluation + public inline operator fun compareTo(other: Short): Int = + this.compareTo(other.toDouble()) /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ - public inline operator fun compareTo(other: Int): Int = compareTo(other.toDouble()) + @kotlin.internal.IntrinsicConstEvaluation + public inline operator fun compareTo(other: Int): Int = + this.compareTo(other.toDouble()) /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ - public inline operator fun compareTo(other: Long): Int = compareTo(other.toDouble()) + @kotlin.internal.IntrinsicConstEvaluation + public inline operator fun compareTo(other: Long): Int = + this.compareTo(other.toDouble()) /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ - public inline operator fun compareTo(other: Float): Int = compareTo(other.toDouble()) + @kotlin.internal.IntrinsicConstEvaluation + public inline operator fun compareTo(other: Float): Int = + this.compareTo(other.toDouble()) /** * Compares this value with the specified value for order. * Returns zero if this value is equal to the specified other value, a negative number if it's less than other, * or a positive number if it's greater than other. */ + @kotlin.internal.IntrinsicConstEvaluation public override operator fun compareTo(other: Double): Int { // if any of values in NaN both comparisons return false if (this > other) return 1 @@ -2084,157 +2376,193 @@ public class Double private constructor(private val value: Double) : Number(), C val thisBits = this.toBits() val otherBits = other.toBits() - // Canonical NaN bits representation higher than any other value + // Canonical NaN bits representation higher than any other bit represent value return thisBits.compareTo(otherBits) } /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Byte): Double = - this + other.toDouble() + this + other.toDouble() /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Short): Double = - this + other.toDouble() + this + other.toDouble() /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Int): Double = - this + other.toDouble() + this + other.toDouble() /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Long): Double = - this + other.toDouble() + this + other.toDouble() /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun plus(other: Float): Double = - this + other.toDouble() + this + other.toDouble() /** Adds the other value to this value. */ + @kotlin.internal.IntrinsicConstEvaluation @WasmOp(WasmOp.F64_ADD) public operator fun plus(other: Double): Double = - implementedAsIntrinsic + implementedAsIntrinsic /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Byte): Double = - this - other.toDouble() + this - other.toDouble() /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Short): Double = - this - other.toDouble() + this - other.toDouble() /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Int): Double = - this - other.toDouble() + this - other.toDouble() /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Long): Double = - this - other.toDouble() + this - other.toDouble() /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun minus(other: Float): Double = - this - other.toDouble() + this - other.toDouble() /** Subtracts the other value from this value. */ + @kotlin.internal.IntrinsicConstEvaluation @WasmOp(WasmOp.F64_SUB) public operator fun minus(other: Double): Double = - implementedAsIntrinsic + implementedAsIntrinsic /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Byte): Double = - this * other.toDouble() + this * other.toDouble() /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Short): Double = - this * other.toDouble() + this * other.toDouble() /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Int): Double = - this * other.toDouble() + this * other.toDouble() /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Long): Double = - this * other.toDouble() + this * other.toDouble() /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun times(other: Float): Double = - this * other.toDouble() + this * other.toDouble() /** Multiplies this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation @WasmOp(WasmOp.F64_MUL) public operator fun times(other: Double): Double = - implementedAsIntrinsic + implementedAsIntrinsic /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Byte): Double = - this / other.toDouble() + this / other.toDouble() /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Short): Double = - this / other.toDouble() + this / other.toDouble() /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Int): Double = - this / other.toDouble() + this / other.toDouble() /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Long): Double = - this / other.toDouble() + this / other.toDouble() /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun div(other: Float): Double = - this / other.toDouble() + this / other.toDouble() /** Divides this value by the other value. */ + @kotlin.internal.IntrinsicConstEvaluation @WasmOp(WasmOp.F64_DIV) public operator fun div(other: Double): Double = - implementedAsIntrinsic + implementedAsIntrinsic /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Byte): Double = - this % other.toDouble() + this % other.toDouble() /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Short): Double = - this % other.toDouble() + this % other.toDouble() /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Int): Double = - this % other.toDouble() + this % other.toDouble() /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Long): Double = - this % other.toDouble() + this % other.toDouble() /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun rem(other: Float): Double = - this % other.toDouble() + this % other.toDouble() /** * Calculates the remainder of truncating division of this value (dividend) by the other value (divisor). * * The result is either zero or has the same sign as the _dividend_ and has the absolute value less than the absolute value of the divisor. */ + @SinceKotlin("1.1") + @kotlin.internal.IntrinsicConstEvaluation public operator fun rem(other: Double): Double = - this - (wasm_f64_nearest(this / other) * other) + this - (wasm_f64_nearest(this / other) * other) /** * Returns this value incremented by one. @@ -2242,7 +2570,7 @@ public class Double private constructor(private val value: Double) : Number(), C * @sample samples.misc.Builtins.inc */ public inline operator fun inc(): Double = - this + 1.0 + this + 1.0 /** * Returns this value decremented by one. @@ -2250,22 +2578,27 @@ public class Double private constructor(private val value: Double) : Number(), C * @sample samples.misc.Builtins.dec */ public inline operator fun dec(): Double = - this - 1.0 + this - 1.0 /** Returns this value. */ + @kotlin.internal.IntrinsicConstEvaluation public inline operator fun unaryPlus(): Double = - this + this /** Returns the negative of this value. */ + @kotlin.internal.IntrinsicConstEvaluation @WasmOp(WasmOp.F64_NEG) public operator fun unaryMinus(): Double = - implementedAsIntrinsic + implementedAsIntrinsic /** * Converts this [Double] value to [Byte]. * * The resulting `Byte` value is equal to `this.toInt().toByte()`. */ + @Deprecated("Unclear conversion. To achieve the same result convert to Int explicitly and then to Byte.", ReplaceWith("toInt().toByte()")) + @DeprecatedSinceKotlin(warningSince = "1.3", errorSince = "1.5") + @kotlin.internal.IntrinsicConstEvaluation public override inline fun toByte(): Byte = this.toInt().toByte() /** @@ -2275,6 +2608,7 @@ public class Double private constructor(private val value: Double) : Number(), C */ @Deprecated("Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", ReplaceWith("this.toInt().toChar()")) @DeprecatedSinceKotlin(warningSince = "1.5", errorSince = "2.3") + @kotlin.internal.IntrinsicConstEvaluation public override inline fun toChar(): Char = this.toInt().toChar() /** @@ -2282,6 +2616,9 @@ public class Double private constructor(private val value: Double) : Number(), C * * The resulting `Short` value is equal to `this.toInt().toShort()`. */ + @Deprecated("Unclear conversion. To achieve the same result convert to Int explicitly and then to Short.", ReplaceWith("toInt().toShort()")) + @DeprecatedSinceKotlin(warningSince = "1.3", errorSince = "1.5") + @kotlin.internal.IntrinsicConstEvaluation public override inline fun toShort(): Short = this.toInt().toShort() /** @@ -2291,9 +2628,8 @@ public class Double private constructor(private val value: Double) : Number(), C * Returns zero if this `Double` value is `NaN`, [Int.MIN_VALUE] if it's less than `Int.MIN_VALUE`, * [Int.MAX_VALUE] if it's bigger than `Int.MAX_VALUE`. */ - public override fun toInt(): Int { - return wasm_i32_trunc_sat_f64_s(this) - } + @kotlin.internal.IntrinsicConstEvaluation + public override fun toInt(): Int = wasm_i32_trunc_sat_f64_s(this) /** * Converts this [Double] value to [Long]. @@ -2302,9 +2638,8 @@ public class Double private constructor(private val value: Double) : Number(), C * Returns zero if this `Double` value is `NaN`, [Long.MIN_VALUE] if it's less than `Long.MIN_VALUE`, * [Long.MAX_VALUE] if it's bigger than `Long.MAX_VALUE`. */ - public override fun toLong(): Long { - return wasm_i64_trunc_sat_f64_s(this) - } + @kotlin.internal.IntrinsicConstEvaluation + public override fun toLong(): Long = wasm_i64_trunc_sat_f64_s(this) /** * Converts this [Double] value to [Float]. @@ -2313,21 +2648,24 @@ public class Double private constructor(private val value: Double) : Number(), C * In case when this `Double` value is exactly between two `Float`s, * the one with zero at least significant bit of mantissa is selected. */ - public override fun toFloat(): Float = - wasm_f32_demote_f64(this) + @kotlin.internal.IntrinsicConstEvaluation + public override fun toFloat(): Float = wasm_f32_demote_f64(this) /** Returns this value. */ + @kotlin.internal.IntrinsicConstEvaluation public override inline fun toDouble(): Double = - this - - public inline fun equals(other: Double): Boolean = - this.toBits() == other.toBits() + this + @kotlin.internal.IntrinsicConstEvaluation public override fun equals(other: Any?): Boolean = - other is Double && this.toBits() == other.toBits() + other is Double && this.toBits() == other.toBits() + @kotlin.internal.IntrinsicConstEvaluation public override fun toString(): String = - dtoa(this) + dtoa(this) + + @kotlin.internal.IntrinsicConstEvaluation + public inline fun equals(other: Double): Boolean = toBits() == other.toBits() public override inline fun hashCode(): Int = toBits().hashCode() }