[Generator] Always put expression body on a new line
This commit is contained in:
committed by
Space Team
parent
68a9b9c312
commit
1c149925b7
@@ -451,7 +451,7 @@ abstract class BasePrimitivesGenerator(private val writer: PrintWriter) : BuiltI
|
||||
}
|
||||
val thisCasted = "this${thisKind.castToIfNecessary(opReturnType)}"
|
||||
val otherCasted = "other${otherKind.castToIfNecessary(opReturnType)}"
|
||||
"${returnType}($thisCasted, $otherCasted)".addAsSingleLineBody(bodyOnNewLine = true)
|
||||
"${returnType}($thisCasted, $otherCasted)".setAsExpressionBody()
|
||||
}.modifyGeneratedRangeTo(thisKind, otherKind, opReturnType)
|
||||
}
|
||||
}
|
||||
@@ -482,7 +482,7 @@ abstract class BasePrimitivesGenerator(private val writer: PrintWriter) : BuiltI
|
||||
}
|
||||
returnType = "${opReturnType.capitalized}Range"
|
||||
}
|
||||
"this until $parameterName".addAsSingleLineBody(bodyOnNewLine = false)
|
||||
"this until $parameterName".setAsExpressionBody()
|
||||
}.modifyGeneratedRangeUntil(thisKind, otherKind, opReturnType)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,12 +211,12 @@ class WasmBooleanGenerator(writer: PrintWriter) : BooleanGenerator(writer) {
|
||||
}
|
||||
|
||||
override fun MethodBuilder.modifyGeneratedCompareTo() {
|
||||
"wasm_i32_compareTo(this.toInt(), other.toInt())".addAsSingleLineBody(bodyOnNewLine = true)
|
||||
"wasm_i32_compareTo(this.toInt(), other.toInt())".setAsExpressionBody()
|
||||
}
|
||||
|
||||
override fun MethodBuilder.modifyGeneratedToString() {
|
||||
modifySignature { visibility = null }
|
||||
"if (this) \"true\" else \"false\"".addAsSingleLineBody(bodyOnNewLine = true)
|
||||
"if (this) \"true\" else \"false\"".setAsExpressionBody()
|
||||
}
|
||||
|
||||
override fun MethodBuilder.modifyGeneratedEquals() {
|
||||
@@ -227,12 +227,12 @@ class WasmBooleanGenerator(writer: PrintWriter) : BooleanGenerator(writer) {
|
||||
} else {
|
||||
wasm_i32_eq(this.toInt(), other.toInt())
|
||||
}
|
||||
""".trimIndent().addAsMultiLineBody()
|
||||
""".trimIndent().setAsBlockBody()
|
||||
}
|
||||
|
||||
override fun MethodBuilder.modifyGeneratedHashCode() {
|
||||
modifySignature { visibility = null }
|
||||
"if (this) 1231 else 1237".addAsSingleLineBody(bodyOnNewLine = true)
|
||||
"if (this) 1231 else 1237".setAsExpressionBody()
|
||||
}
|
||||
|
||||
override fun ClassBuilder.generateAdditionalMethods() {
|
||||
@@ -243,7 +243,7 @@ class WasmBooleanGenerator(writer: PrintWriter) : BooleanGenerator(writer) {
|
||||
methodName = "toInt"
|
||||
returnType = PrimitiveType.INT.capitalized
|
||||
}
|
||||
implementedAsIntrinsic.addAsSingleLineBody(bodyOnNewLine = true)
|
||||
implementedAsIntrinsic.setAsExpressionBody()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -275,11 +275,11 @@ class NativeBooleanGenerator(writer: PrintWriter) : BooleanGenerator(writer) {
|
||||
}
|
||||
|
||||
override fun MethodBuilder.modifyGeneratedToString() {
|
||||
"if (this) \"true\" else \"false\"".addAsSingleLineBody()
|
||||
"if (this) \"true\" else \"false\"".setAsExpressionBody()
|
||||
}
|
||||
|
||||
override fun MethodBuilder.modifyGeneratedEquals() {
|
||||
"other is Boolean && kotlin.native.internal.areEqualByValue(this, other)".addAsSingleLineBody(bodyOnNewLine = true)
|
||||
"other is Boolean && kotlin.native.internal.areEqualByValue(this, other)".setAsExpressionBody()
|
||||
}
|
||||
|
||||
private fun ClassBuilder.generateCustomEquals() {
|
||||
@@ -295,13 +295,13 @@ class NativeBooleanGenerator(writer: PrintWriter) : BooleanGenerator(writer) {
|
||||
returnType = PrimitiveType.BOOLEAN.capitalized
|
||||
}
|
||||
|
||||
"kotlin.native.internal.areEqualByValue(this, other)".addAsSingleLineBody(bodyOnNewLine = false)
|
||||
"kotlin.native.internal.areEqualByValue(this, other)".setAsExpressionBody()
|
||||
}
|
||||
}
|
||||
|
||||
override fun MethodBuilder.modifyGeneratedHashCode() {
|
||||
modifySignature { visibility = MethodVisibility.PUBLIC }
|
||||
"if (this) 1231 else 1237".addAsSingleLineBody(bodyOnNewLine = true)
|
||||
"if (this) 1231 else 1237".setAsExpressionBody()
|
||||
}
|
||||
|
||||
override fun ClassBuilder.generateAdditionalMethods() {
|
||||
|
||||
@@ -370,35 +370,35 @@ class JsCharGenerator(writer: PrintWriter) : CharGenerator(writer) {
|
||||
}
|
||||
|
||||
override fun MethodBuilder.modifyGeneratedCompareTo() {
|
||||
"value - other.value".addAsSingleLineBody(bodyOnNewLine = false)
|
||||
"value - other.value".setAsExpressionBody()
|
||||
}
|
||||
|
||||
override fun MethodBuilder.modifyGeneratedPlus() {
|
||||
"(value + other).toChar()".addAsSingleLineBody(bodyOnNewLine = false)
|
||||
"(value + other).toChar()".setAsExpressionBody()
|
||||
}
|
||||
|
||||
override fun MethodBuilder.modifyGeneratedMinusChar() {
|
||||
"value - other.value".addAsSingleLineBody(bodyOnNewLine = false)
|
||||
"value - other.value".setAsExpressionBody()
|
||||
}
|
||||
|
||||
override fun MethodBuilder.modifyGeneratedMinusInt() {
|
||||
"(value - other).toChar()".addAsSingleLineBody(bodyOnNewLine = false)
|
||||
"(value - other).toChar()".setAsExpressionBody()
|
||||
}
|
||||
|
||||
override fun MethodBuilder.modifyGeneratedInc() {
|
||||
"(value + 1).toChar()".addAsSingleLineBody(bodyOnNewLine = false)
|
||||
"(value + 1).toChar()".setAsExpressionBody()
|
||||
}
|
||||
|
||||
override fun MethodBuilder.modifyGeneratedDec() {
|
||||
"(value - 1).toChar()".addAsSingleLineBody(bodyOnNewLine = false)
|
||||
"(value - 1).toChar()".setAsExpressionBody()
|
||||
}
|
||||
|
||||
override fun MethodBuilder.modifyGeneratedRangeTo() {
|
||||
"CharRange(this, other)".addAsSingleLineBody(bodyOnNewLine = false)
|
||||
"CharRange(this, other)".setAsExpressionBody()
|
||||
}
|
||||
|
||||
override fun MethodBuilder.modifyGeneratedRangeUntil() {
|
||||
"this until other".addAsSingleLineBody(bodyOnNewLine = false)
|
||||
"this until other".setAsExpressionBody()
|
||||
}
|
||||
|
||||
override fun MethodBuilder.modifyGeneratedConversions(otherKind: PrimitiveType) {
|
||||
@@ -407,25 +407,25 @@ class JsCharGenerator(writer: PrintWriter) : CharGenerator(writer) {
|
||||
PrimitiveType.INT -> "value"
|
||||
else -> "value.$methodName()"
|
||||
}
|
||||
body.addAsSingleLineBody(bodyOnNewLine = false)
|
||||
body.setAsExpressionBody()
|
||||
}
|
||||
|
||||
override fun MethodBuilder.modifyGeneratedEquals() {
|
||||
"""
|
||||
if (other !is Char) return false
|
||||
return this.value == other.value
|
||||
""".trimIndent().addAsMultiLineBody()
|
||||
""".trimIndent().setAsBlockBody()
|
||||
}
|
||||
|
||||
override fun MethodBuilder.modifyGeneratedToString() {
|
||||
additionalComments = "TODO implicit usages of toString and valueOf must be covered in DCE"
|
||||
annotations += "Suppress(\"JS_NAME_PROHIBITED_FOR_OVERRIDE\")"
|
||||
annotations += "JsName(\"toString\")"
|
||||
"return js(\"String\").fromCharCode(value).unsafeCast<String>()".addAsMultiLineBody()
|
||||
"return js(\"String\").fromCharCode(value).unsafeCast<String>()".setAsBlockBody()
|
||||
}
|
||||
|
||||
override fun MethodBuilder.modifyGeneratedHashCode() {
|
||||
"value".addAsSingleLineBody(bodyOnNewLine = false)
|
||||
"value".setAsExpressionBody()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -489,40 +489,40 @@ class WasmCharGenerator(writer: PrintWriter) : CharGenerator(writer) {
|
||||
}
|
||||
|
||||
override fun MethodBuilder.modifyGeneratedCompareTo() {
|
||||
"wasm_i32_compareTo(this.code, other.code)".addAsSingleLineBody(bodyOnNewLine = true)
|
||||
"wasm_i32_compareTo(this.code, other.code)".setAsExpressionBody()
|
||||
}
|
||||
|
||||
override fun MethodBuilder.modifyGeneratedPlus() {
|
||||
modifySignature { isInline = true }
|
||||
"(this.code + other).toChar()".addAsSingleLineBody(bodyOnNewLine = true)
|
||||
"(this.code + other).toChar()".setAsExpressionBody()
|
||||
}
|
||||
|
||||
override fun MethodBuilder.modifyGeneratedMinusChar() {
|
||||
modifySignature { isInline = true }
|
||||
"(this.code - other.code)".addAsSingleLineBody(bodyOnNewLine = true)
|
||||
"(this.code - other.code)".setAsExpressionBody()
|
||||
}
|
||||
|
||||
override fun MethodBuilder.modifyGeneratedMinusInt() {
|
||||
modifySignature { isInline = true }
|
||||
"(this.code - other).toChar()".addAsSingleLineBody(bodyOnNewLine = true)
|
||||
"(this.code - other).toChar()".setAsExpressionBody()
|
||||
}
|
||||
|
||||
override fun MethodBuilder.modifyGeneratedInc() {
|
||||
modifySignature { isInline = true }
|
||||
"(this.code + 1).toChar()".addAsSingleLineBody(bodyOnNewLine = true)
|
||||
"(this.code + 1).toChar()".setAsExpressionBody()
|
||||
}
|
||||
|
||||
override fun MethodBuilder.modifyGeneratedDec() {
|
||||
modifySignature { isInline = true }
|
||||
"(this.code - 1).toChar()".addAsSingleLineBody(bodyOnNewLine = true)
|
||||
"(this.code - 1).toChar()".setAsExpressionBody()
|
||||
}
|
||||
|
||||
override fun MethodBuilder.modifyGeneratedRangeTo() {
|
||||
"CharRange(this, other)".addAsSingleLineBody(bodyOnNewLine = true)
|
||||
"CharRange(this, other)".setAsExpressionBody()
|
||||
}
|
||||
|
||||
override fun MethodBuilder.modifyGeneratedRangeUntil() {
|
||||
"this until other".addAsSingleLineBody(bodyOnNewLine = true)
|
||||
"this until other".setAsExpressionBody()
|
||||
}
|
||||
|
||||
override fun MethodBuilder.modifyGeneratedConversions(otherKind: PrimitiveType) {
|
||||
@@ -535,7 +535,7 @@ class WasmCharGenerator(writer: PrintWriter) : CharGenerator(writer) {
|
||||
}
|
||||
else -> "this.code.$methodName()"
|
||||
}
|
||||
body.addAsSingleLineBody(bodyOnNewLine = true)
|
||||
body.setAsExpressionBody()
|
||||
}
|
||||
|
||||
override fun MethodBuilder.modifyGeneratedEquals() {
|
||||
@@ -543,7 +543,7 @@ class WasmCharGenerator(writer: PrintWriter) : CharGenerator(writer) {
|
||||
if (other is Char)
|
||||
return wasm_i32_eq(this.code, other.code)
|
||||
return false
|
||||
""".trimIndent().addAsMultiLineBody()
|
||||
""".trimIndent().setAsBlockBody()
|
||||
}
|
||||
|
||||
override fun MethodBuilder.modifyGeneratedToString() {
|
||||
@@ -552,12 +552,12 @@ class WasmCharGenerator(writer: PrintWriter) : CharGenerator(writer) {
|
||||
val array = WasmCharArray(1)
|
||||
array.set(0, this)
|
||||
return array.createString()
|
||||
""".trimIndent().addAsMultiLineBody()
|
||||
""".trimIndent().setAsBlockBody()
|
||||
}
|
||||
|
||||
override fun MethodBuilder.modifyGeneratedHashCode() {
|
||||
modifySignature { visibility = null }
|
||||
"this.code.hashCode()".addAsSingleLineBody(bodyOnNewLine = true)
|
||||
"this.code.hashCode()".setAsExpressionBody()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -642,17 +642,17 @@ class NativeCharGenerator(writer: PrintWriter) : CharGenerator(writer) {
|
||||
|
||||
override fun MethodBuilder.modifyGeneratedPlus() {
|
||||
modifySignature { isInline = true }
|
||||
"(this.code + other).toChar()".addAsSingleLineBody(bodyOnNewLine = true)
|
||||
"(this.code + other).toChar()".setAsExpressionBody()
|
||||
}
|
||||
|
||||
override fun MethodBuilder.modifyGeneratedMinusChar() {
|
||||
modifySignature { isInline = true }
|
||||
"this.code - other.code".addAsSingleLineBody(bodyOnNewLine = true)
|
||||
"this.code - other.code".setAsExpressionBody()
|
||||
}
|
||||
|
||||
override fun MethodBuilder.modifyGeneratedMinusInt() {
|
||||
modifySignature { isInline = true }
|
||||
"(this.code - other).toChar()".addAsSingleLineBody(bodyOnNewLine = true)
|
||||
"(this.code - other).toChar()".setAsExpressionBody()
|
||||
}
|
||||
|
||||
override fun MethodBuilder.modifyGeneratedInc() {
|
||||
@@ -664,11 +664,11 @@ class NativeCharGenerator(writer: PrintWriter) : CharGenerator(writer) {
|
||||
}
|
||||
|
||||
override fun MethodBuilder.modifyGeneratedRangeTo() {
|
||||
"CharRange(this, other)".addAsSingleLineBody(bodyOnNewLine = true)
|
||||
"CharRange(this, other)".setAsExpressionBody()
|
||||
}
|
||||
|
||||
override fun MethodBuilder.modifyGeneratedRangeUntil() {
|
||||
"this until other".addAsSingleLineBody(bodyOnNewLine = true)
|
||||
"this until other".setAsExpressionBody()
|
||||
}
|
||||
|
||||
override fun MethodBuilder.modifyGeneratedConversions(otherKind: PrimitiveType) {
|
||||
@@ -677,7 +677,7 @@ class NativeCharGenerator(writer: PrintWriter) : CharGenerator(writer) {
|
||||
PrimitiveType.BYTE -> annotations += "TypedIntrinsic(IntrinsicType.INT_TRUNCATE)"
|
||||
PrimitiveType.CHAR -> {
|
||||
modifySignature { isInline = true }
|
||||
"this".addAsSingleLineBody(bodyOnNewLine = true)
|
||||
"this".setAsExpressionBody()
|
||||
}
|
||||
PrimitiveType.SHORT, PrimitiveType.INT, PrimitiveType.LONG -> annotations += "TypedIntrinsic(IntrinsicType.ZERO_EXTEND)"
|
||||
PrimitiveType.FLOAT, PrimitiveType.DOUBLE -> annotations += "TypedIntrinsic(IntrinsicType.UNSIGNED_TO_FLOAT)"
|
||||
@@ -686,7 +686,7 @@ class NativeCharGenerator(writer: PrintWriter) : CharGenerator(writer) {
|
||||
}
|
||||
|
||||
override fun MethodBuilder.modifyGeneratedEquals() {
|
||||
"other is Char && this.code == other.code".addAsSingleLineBody(bodyOnNewLine = true)
|
||||
"other is Char && this.code == other.code".setAsExpressionBody()
|
||||
}
|
||||
|
||||
override fun MethodBuilder.modifyGeneratedToString() {
|
||||
@@ -707,12 +707,12 @@ class NativeCharGenerator(writer: PrintWriter) : CharGenerator(writer) {
|
||||
returnType = PrimitiveType.BOOLEAN.capitalized
|
||||
}
|
||||
|
||||
"this == other".addAsSingleLineBody(bodyOnNewLine = false)
|
||||
"this == other".setAsExpressionBody()
|
||||
}
|
||||
}
|
||||
|
||||
override fun MethodBuilder.modifyGeneratedHashCode() {
|
||||
"return this.code".addAsMultiLineBody()
|
||||
"return this.code".setAsBlockBody()
|
||||
}
|
||||
|
||||
override fun ClassBuilder.generateAdditionalMethods() {
|
||||
|
||||
@@ -54,10 +54,10 @@ class JsPrimitivesGenerator(writer: PrintWriter) : BasePrimitivesGenerator(write
|
||||
"rem" -> "modulo"
|
||||
else -> error("Unsupported binary operation: $methodName")
|
||||
}
|
||||
"this.$implMethod(other)".addAsSingleLineBody(false)
|
||||
"this.$implMethod(other)".setAsExpressionBody()
|
||||
} else {
|
||||
modifySignature { isInline = true }
|
||||
"this${thisKind.castToIfNecessary(otherKind)}.${methodName}(other${otherKind.castToIfNecessary(thisKind)})".addAsSingleLineBody(false)
|
||||
"this${thisKind.castToIfNecessary(otherKind)}.${methodName}(other${otherKind.castToIfNecessary(thisKind)})".setAsExpressionBody()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -73,7 +73,7 @@ class JsPrimitivesGenerator(writer: PrintWriter) : BasePrimitivesGenerator(write
|
||||
"this"
|
||||
}
|
||||
else -> error(methodName)
|
||||
}.addAsSingleLineBody(false)
|
||||
}.setAsExpressionBody()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,16 +91,16 @@ class JsPrimitivesGenerator(writer: PrintWriter) : BasePrimitivesGenerator(write
|
||||
"ushr" -> "shiftRightUnsigned"
|
||||
else -> error(methodName)
|
||||
}
|
||||
"$implMethod(bitCount)".addAsSingleLineBody(bodyOnNewLine = false)
|
||||
"$implMethod(bitCount)".setAsExpressionBody()
|
||||
}
|
||||
}
|
||||
|
||||
override fun MethodBuilder.modifyGeneratedBitwiseOperators(thisKind: PrimitiveType) {
|
||||
if (thisKind == PrimitiveType.LONG) {
|
||||
if (methodName == "inv") {
|
||||
"Long(low.inv(), high.inv())".addAsSingleLineBody(bodyOnNewLine = false)
|
||||
"Long(low.inv(), high.inv())".setAsExpressionBody()
|
||||
} else {
|
||||
"Long(this.low $methodName other.low, this.high $methodName other.high)".addAsSingleLineBody(bodyOnNewLine = false)
|
||||
"Long(this.low $methodName other.low, this.high $methodName other.high)".setAsExpressionBody()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -116,19 +116,19 @@ class JsPrimitivesGenerator(writer: PrintWriter) : BasePrimitivesGenerator(write
|
||||
PrimitiveType.FLOAT -> "toDouble().toFloat()"
|
||||
PrimitiveType.DOUBLE -> "toNumber()"
|
||||
else -> error("Unsupported type $otherKind for Long conversion")
|
||||
}.addAsSingleLineBody(bodyOnNewLine = false)
|
||||
}.setAsExpressionBody()
|
||||
}
|
||||
}
|
||||
|
||||
override fun MethodBuilder.modifyGeneratedEquals(thisKind: PrimitiveType) {
|
||||
if (thisKind == PrimitiveType.LONG) {
|
||||
"other is Long && equalsLong(other)".addAsSingleLineBody(false)
|
||||
"other is Long && equalsLong(other)".setAsExpressionBody()
|
||||
}
|
||||
}
|
||||
|
||||
override fun MethodBuilder.modifyGeneratedToString(thisKind: PrimitiveType) {
|
||||
if (thisKind == PrimitiveType.LONG) {
|
||||
"this.toStringImpl(radix = 10)".addAsSingleLineBody(false)
|
||||
"this.toStringImpl(radix = 10)".setAsExpressionBody()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ class JsPrimitivesGenerator(writer: PrintWriter) : BasePrimitivesGenerator(write
|
||||
returnType = PrimitiveType.INT.capitalized
|
||||
}
|
||||
if (thisKind == PrimitiveType.LONG) {
|
||||
"hashCode(this)".addAsSingleLineBody(bodyOnNewLine = false)
|
||||
"hashCode(this)".setAsExpressionBody()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ class JsPrimitivesGenerator(writer: PrintWriter) : BasePrimitivesGenerator(write
|
||||
methodName = "valueOf"
|
||||
returnType = PrimitiveType.DOUBLE.capitalized
|
||||
}
|
||||
"toDouble()".addAsSingleLineBody(bodyOnNewLine = false)
|
||||
"toDouble()".setAsExpressionBody()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ class NativePrimitivesGenerator(writer: PrintWriter) : BasePrimitivesGenerator(w
|
||||
|
||||
// Canonical NaN bit representation is higher than any other value's bit representation
|
||||
return thisBits.compareTo(otherBits)
|
||||
""".trimIndent().addAsMultiLineBody()
|
||||
""".trimIndent().setAsBlockBody()
|
||||
} else {
|
||||
setAsExternal(thisKind)
|
||||
}
|
||||
@@ -70,7 +70,7 @@ class NativePrimitivesGenerator(writer: PrintWriter) : BasePrimitivesGenerator(w
|
||||
"-${otherCasted}.compareTo(this)"
|
||||
} else {
|
||||
"$thisCasted.compareTo($otherCasted)"
|
||||
}.addAsSingleLineBody(bodyOnNewLine = true)
|
||||
}.setAsExpressionBody()
|
||||
}
|
||||
|
||||
override fun MethodBuilder.modifyGeneratedBinaryOperation(thisKind: PrimitiveType, otherKind: PrimitiveType) {
|
||||
@@ -84,7 +84,7 @@ class NativePrimitivesGenerator(writer: PrintWriter) : BasePrimitivesGenerator(w
|
||||
val returnTypeAsPrimitive = PrimitiveType.valueOf(returnType.uppercase())
|
||||
val thisCasted = "this" + thisKind.castToIfNecessary(returnTypeAsPrimitive)
|
||||
val otherCasted = parameterName + parameterType.toPrimitiveType().castToIfNecessary(returnTypeAsPrimitive)
|
||||
"$thisCasted $sign $otherCasted".addAsSingleLineBody(bodyOnNewLine = true)
|
||||
"$thisCasted $sign $otherCasted".setAsExpressionBody()
|
||||
}
|
||||
|
||||
override fun MethodBuilder.modifyGeneratedUnaryOperation(thisKind: PrimitiveType) {
|
||||
@@ -98,7 +98,7 @@ class NativePrimitivesGenerator(writer: PrintWriter) : BasePrimitivesGenerator(w
|
||||
val returnTypeAsPrimitive = PrimitiveType.valueOf(returnType.uppercase())
|
||||
val thisCasted = "this" + thisKind.castToIfNecessary(returnTypeAsPrimitive)
|
||||
val sign = if (methodName == "unaryMinus") "-" else ""
|
||||
"$sign$thisCasted".addAsSingleLineBody(bodyOnNewLine = true)
|
||||
"$sign$thisCasted".setAsExpressionBody()
|
||||
}
|
||||
|
||||
override fun MethodBuilder.modifyGeneratedBitShiftOperators(thisKind: PrimitiveType) {
|
||||
@@ -113,7 +113,7 @@ class NativePrimitivesGenerator(writer: PrintWriter) : BasePrimitivesGenerator(w
|
||||
when {
|
||||
otherKind == thisKind -> {
|
||||
modifySignature { isInline = true }
|
||||
"this".addAsSingleLineBody(bodyOnNewLine = true)
|
||||
"this".setAsExpressionBody()
|
||||
}
|
||||
thisKind !in PrimitiveType.floatingPoint -> {
|
||||
modifySignature { isExternal = true }
|
||||
@@ -127,7 +127,7 @@ class NativePrimitivesGenerator(writer: PrintWriter) : BasePrimitivesGenerator(w
|
||||
}
|
||||
else -> {
|
||||
if (otherKind in setOf(PrimitiveType.BYTE, PrimitiveType.SHORT, PrimitiveType.CHAR)) {
|
||||
"this.toInt().to${returnType}()".addAsSingleLineBody(bodyOnNewLine = false)
|
||||
"this.toInt().to${returnType}()".setAsExpressionBody()
|
||||
return
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ class NativePrimitivesGenerator(writer: PrintWriter) : BasePrimitivesGenerator(w
|
||||
} else {
|
||||
"kotlin.native.internal.areEqualByValue(this, $parameterName)"
|
||||
}
|
||||
"$parameterName is ${thisKind.capitalized} && $additionalCheck".addAsSingleLineBody(bodyOnNewLine = true)
|
||||
"$parameterName is ${thisKind.capitalized} && $additionalCheck".setAsExpressionBody()
|
||||
}
|
||||
|
||||
override fun MethodBuilder.modifyGeneratedToString(thisKind: PrimitiveType) {
|
||||
@@ -166,7 +166,7 @@ class NativePrimitivesGenerator(writer: PrintWriter) : BasePrimitivesGenerator(w
|
||||
The exact bit pattern of a `NaN` ${thisKind.name.lowercase()} is not guaranteed to be preserved though.
|
||||
""".trimIndent().let { appendDoc(it) }
|
||||
|
||||
"NumberConverter.convert(this)".addAsSingleLineBody(bodyOnNewLine = false)
|
||||
"NumberConverter.convert(this)".setAsExpressionBody()
|
||||
} else {
|
||||
modifySignature { isExternal = true }
|
||||
annotations += "GCUnsafeCall(\"Kotlin_${thisKind.capitalized}_toString\")"
|
||||
@@ -194,7 +194,7 @@ class NativePrimitivesGenerator(writer: PrintWriter) : BasePrimitivesGenerator(w
|
||||
PrimitiveType.FLOAT -> "toBits()"
|
||||
PrimitiveType.DOUBLE -> "toBits().hashCode()"
|
||||
else -> "this${thisKind.castToIfNecessary(PrimitiveType.INT)}"
|
||||
}.addAsSingleLineBody()
|
||||
}.setAsExpressionBody()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,8 +212,8 @@ class NativePrimitivesGenerator(writer: PrintWriter) : BasePrimitivesGenerator(w
|
||||
}
|
||||
|
||||
when (thisKind) {
|
||||
in PrimitiveType.floatingPoint -> "toBits() == other.toBits()".addAsSingleLineBody(bodyOnNewLine = false)
|
||||
else -> "kotlin.native.internal.areEqualByValue(this, other)".addAsSingleLineBody(bodyOnNewLine = false)
|
||||
in PrimitiveType.floatingPoint -> "toBits() == other.toBits()".setAsExpressionBody()
|
||||
else -> "kotlin.native.internal.areEqualByValue(this, other)".setAsExpressionBody()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ class WasmPrimitivesGenerator(writer: PrintWriter) : BasePrimitivesGenerator(wri
|
||||
|
||||
// Canonical NaN bit representation is higher than any other value's bit representation
|
||||
return thisBits.compareTo(otherBits)
|
||||
""".trimIndent().addAsMultiLineBody()
|
||||
""".trimIndent().setAsBlockBody()
|
||||
} else {
|
||||
val body = when (thisKind) {
|
||||
PrimitiveType.BYTE -> "wasm_i32_compareTo(this.toInt(), $parameterName.toInt())"
|
||||
@@ -75,7 +75,7 @@ class WasmPrimitivesGenerator(writer: PrintWriter) : BasePrimitivesGenerator(wri
|
||||
PrimitiveType.INT, PrimitiveType.LONG -> "wasm_${thisKind.prefixLowercase}_compareTo(this, $parameterName)"
|
||||
else -> throw IllegalArgumentException("Unsupported type $thisKind for generation `compareTo` method")
|
||||
}
|
||||
body.addAsSingleLineBody(bodyOnNewLine = true)
|
||||
body.setAsExpressionBody()
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -85,7 +85,7 @@ class WasmPrimitivesGenerator(writer: PrintWriter) : BasePrimitivesGenerator(wri
|
||||
when {
|
||||
thisKind == PrimitiveType.FLOAT && otherKind == PrimitiveType.DOUBLE -> "-${otherCasted}.compareTo(this)"
|
||||
else -> "$thisCasted.compareTo($otherCasted)"
|
||||
}.addAsSingleLineBody(bodyOnNewLine = true)
|
||||
}.setAsExpressionBody()
|
||||
}
|
||||
|
||||
override fun MethodBuilder.modifyGeneratedBinaryOperation(thisKind: PrimitiveType, otherKind: PrimitiveType) {
|
||||
@@ -107,7 +107,7 @@ class WasmPrimitivesGenerator(writer: PrintWriter) : BasePrimitivesGenerator(wri
|
||||
else -> return implementAsIntrinsic(thisKind, methodName)
|
||||
}
|
||||
else -> return implementAsIntrinsic(thisKind, methodName)
|
||||
}.addAsSingleLineBody(bodyOnNewLine = true)
|
||||
}.setAsExpressionBody()
|
||||
return
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ class WasmPrimitivesGenerator(writer: PrintWriter) : BasePrimitivesGenerator(wri
|
||||
val returnTypeAsPrimitive = PrimitiveType.valueOf(returnType.uppercase())
|
||||
val thisCasted = "this" + thisKind.castToIfNecessary(returnTypeAsPrimitive)
|
||||
val otherCasted = parameterName + parameterType.toPrimitiveType().castToIfNecessary(returnTypeAsPrimitive)
|
||||
"$thisCasted $sign $otherCasted".addAsSingleLineBody(bodyOnNewLine = true)
|
||||
"$thisCasted $sign $otherCasted".setAsExpressionBody()
|
||||
}
|
||||
|
||||
override fun MethodBuilder.modifyGeneratedUnaryOperation(thisKind: PrimitiveType) {
|
||||
@@ -128,11 +128,11 @@ class WasmPrimitivesGenerator(writer: PrintWriter) : BasePrimitivesGenerator(wri
|
||||
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)
|
||||
PrimitiveType.BYTE, PrimitiveType.SHORT -> "(this $sign 1).to${thisKind.capitalized}()".setAsExpressionBody()
|
||||
PrimitiveType.INT -> "this $sign 1".setAsExpressionBody()
|
||||
PrimitiveType.LONG -> "this $sign 1L".setAsExpressionBody()
|
||||
PrimitiveType.FLOAT -> "this $sign 1.0f".setAsExpressionBody()
|
||||
PrimitiveType.DOUBLE -> "this $sign 1.0".setAsExpressionBody()
|
||||
else -> Unit
|
||||
}
|
||||
}
|
||||
@@ -151,7 +151,7 @@ class WasmPrimitivesGenerator(writer: PrintWriter) : BasePrimitivesGenerator(wri
|
||||
else -> "-"
|
||||
}
|
||||
} else ""
|
||||
"$sign$thisCasted".addAsSingleLineBody(bodyOnNewLine = true)
|
||||
"$sign$thisCasted".setAsExpressionBody()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ class WasmPrimitivesGenerator(writer: PrintWriter) : BasePrimitivesGenerator(wri
|
||||
implementAsIntrinsic(thisKind, methodName)
|
||||
} else if (thisKind == PrimitiveType.LONG) {
|
||||
modifySignature { isInline = true }
|
||||
"wasm_i64_${methodName.toWasmOperator().lowercase()}(this, ${parameterName}.toLong())".addAsSingleLineBody(bodyOnNewLine = true)
|
||||
"wasm_i64_${methodName.toWasmOperator().lowercase()}(this, ${parameterName}.toLong())".setAsExpressionBody()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@ class WasmPrimitivesGenerator(writer: PrintWriter) : BasePrimitivesGenerator(wri
|
||||
if (methodName == "inv") {
|
||||
modifySignature { isInline = true }
|
||||
val oneConst = if (thisKind == PrimitiveType.LONG) "-1L" else "-1"
|
||||
"this.xor($oneConst)".addAsSingleLineBody(bodyOnNewLine = true)
|
||||
"this.xor($oneConst)".setAsExpressionBody()
|
||||
return
|
||||
}
|
||||
|
||||
@@ -178,7 +178,7 @@ class WasmPrimitivesGenerator(writer: PrintWriter) : BasePrimitivesGenerator(wri
|
||||
override fun MethodBuilder.modifyGeneratedConversions(thisKind: PrimitiveType, otherKind: PrimitiveType) {
|
||||
if (otherKind == thisKind) {
|
||||
modifySignature { isInline = true }
|
||||
"this".addAsSingleLineBody(bodyOnNewLine = true)
|
||||
"this".setAsExpressionBody()
|
||||
return
|
||||
}
|
||||
|
||||
@@ -221,7 +221,7 @@ class WasmPrimitivesGenerator(writer: PrintWriter) : BasePrimitivesGenerator(wri
|
||||
else -> throw IllegalArgumentException("Unsupported type $otherKind for generation conversion method from type $thisKind")
|
||||
}
|
||||
else -> throw IllegalArgumentException("Unsupported type $thisKind to generate conversion methods")
|
||||
}.addAsSingleLineBody(bodyOnNewLine = false)
|
||||
}.setAsExpressionBody()
|
||||
}
|
||||
|
||||
override fun MethodBuilder.modifyGeneratedEquals(thisKind: PrimitiveType) {
|
||||
@@ -232,7 +232,7 @@ class WasmPrimitivesGenerator(writer: PrintWriter) : BasePrimitivesGenerator(wri
|
||||
"wasm_i32_eq(this${thisKind.castToIfNecessary(PrimitiveType.INT)}, $parameterName${thisKind.castToIfNecessary(PrimitiveType.INT)})"
|
||||
}
|
||||
}
|
||||
"$parameterName is ${thisKind.capitalized} && $additionalCheck".addAsSingleLineBody(bodyOnNewLine = true)
|
||||
"$parameterName is ${thisKind.capitalized} && $additionalCheck".setAsExpressionBody()
|
||||
}
|
||||
|
||||
override fun MethodBuilder.modifyGeneratedToString(thisKind: PrimitiveType) {
|
||||
@@ -240,7 +240,7 @@ class WasmPrimitivesGenerator(writer: PrintWriter) : BasePrimitivesGenerator(wri
|
||||
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)
|
||||
}.setAsExpressionBody()
|
||||
}
|
||||
|
||||
override fun ClassBuilder.generateAdditionalMethods(thisKind: PrimitiveType) {
|
||||
@@ -267,7 +267,7 @@ class WasmPrimitivesGenerator(writer: PrintWriter) : BasePrimitivesGenerator(wri
|
||||
PrimitiveType.FLOAT -> "toBits()"
|
||||
PrimitiveType.DOUBLE -> "toBits().hashCode()"
|
||||
else -> "this${thisKind.castToIfNecessary(PrimitiveType.INT)}"
|
||||
}.addAsSingleLineBody()
|
||||
}.setAsExpressionBody()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -280,7 +280,7 @@ class WasmPrimitivesGenerator(writer: PrintWriter) : BasePrimitivesGenerator(wri
|
||||
methodName = "reinterpretAs${otherKind.capitalized}"
|
||||
returnType = otherKind.capitalized
|
||||
}
|
||||
implementedAsIntrinsic.addAsSingleLineBody(bodyOnNewLine = true)
|
||||
implementedAsIntrinsic.setAsExpressionBody()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -305,7 +305,7 @@ class WasmPrimitivesGenerator(writer: PrintWriter) : BasePrimitivesGenerator(wri
|
||||
internal fun MethodBuilder.implementAsIntrinsic(thisKind: PrimitiveType, methodName: String) {
|
||||
modifySignature { isInline = false }
|
||||
annotations += "WasmOp(WasmOp.${thisKind.prefixUppercase}_${methodName.toWasmOperator()})"
|
||||
implementedAsIntrinsic.addAsSingleLineBody(bodyOnNewLine = true)
|
||||
implementedAsIntrinsic.setAsExpressionBody()
|
||||
}
|
||||
|
||||
private val PrimitiveType.prefixUppercase: String
|
||||
|
||||
@@ -359,12 +359,11 @@ internal class MethodBuilder : AnnotatedAndDocumented(), PrimitiveBuilder {
|
||||
|
||||
fun noBody() { body = null }
|
||||
|
||||
fun String.addAsSingleLineBody(bodyOnNewLine: Boolean = false) {
|
||||
val skip = if (bodyOnNewLine) "$END_LINE " else " "
|
||||
body = " =$skip$this"
|
||||
fun String.setAsExpressionBody() {
|
||||
body = " =$END_LINE $this"
|
||||
}
|
||||
|
||||
fun String.addAsMultiLineBody() {
|
||||
fun String.setAsBlockBody() {
|
||||
body = " {$END_LINE${this.shift()}$END_LINE}"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,8 @@ public class Boolean private constructor() : Comparable<Boolean> {
|
||||
public external override fun compareTo(other: Boolean): Int
|
||||
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public override fun toString(): String = if (this) "true" else "false"
|
||||
public override fun toString(): String =
|
||||
if (this) "true" else "false"
|
||||
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public override fun equals(other: Any?): Boolean =
|
||||
@@ -58,5 +59,6 @@ public class Boolean private constructor() : Comparable<Boolean> {
|
||||
|
||||
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public fun equals(other: Boolean): Boolean = kotlin.native.internal.areEqualByValue(this, other)
|
||||
public fun equals(other: Boolean): Boolean =
|
||||
kotlin.native.internal.areEqualByValue(this, other)
|
||||
}
|
||||
|
||||
@@ -133,7 +133,8 @@ public class Char private constructor() : Comparable<Char> {
|
||||
|
||||
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public fun equals(other: Char): Boolean = this == other
|
||||
public fun equals(other: Char): Boolean =
|
||||
this == other
|
||||
|
||||
@kotlin.native.internal.CanBePrecreated
|
||||
companion object {
|
||||
|
||||
@@ -322,7 +322,8 @@ public final class Byte private constructor() : Number(), Comparable<Byte> {
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public operator fun rangeUntil(other: Byte): IntRange = this until other
|
||||
public operator fun rangeUntil(other: Byte): IntRange =
|
||||
this until other
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
@@ -331,7 +332,8 @@ public final class Byte private constructor() : Number(), Comparable<Byte> {
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public operator fun rangeUntil(other: Short): IntRange = this until other
|
||||
public operator fun rangeUntil(other: Short): IntRange =
|
||||
this until other
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
@@ -340,7 +342,8 @@ public final class Byte private constructor() : Number(), Comparable<Byte> {
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public operator fun rangeUntil(other: Int): IntRange = this until other
|
||||
public operator fun rangeUntil(other: Int): IntRange =
|
||||
this until other
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
@@ -349,7 +352,8 @@ public final class Byte private constructor() : Number(), Comparable<Byte> {
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public operator fun rangeUntil(other: Long): LongRange = this until other
|
||||
public operator fun rangeUntil(other: Long): LongRange =
|
||||
this until other
|
||||
|
||||
/** Returns this value. */
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
@@ -434,9 +438,11 @@ public final class Byte private constructor() : Number(), Comparable<Byte> {
|
||||
|
||||
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public fun equals(other: Byte): Boolean = kotlin.native.internal.areEqualByValue(this, other)
|
||||
public fun equals(other: Byte): Boolean =
|
||||
kotlin.native.internal.areEqualByValue(this, other)
|
||||
|
||||
public override fun hashCode(): Int = this.toInt()
|
||||
public override fun hashCode(): Int =
|
||||
this.toInt()
|
||||
}
|
||||
|
||||
/** Represents a 16-bit signed integer. */
|
||||
@@ -749,7 +755,8 @@ public final class Short private constructor() : Number(), Comparable<Short> {
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public operator fun rangeUntil(other: Byte): IntRange = this until other
|
||||
public operator fun rangeUntil(other: Byte): IntRange =
|
||||
this until other
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
@@ -758,7 +765,8 @@ public final class Short private constructor() : Number(), Comparable<Short> {
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public operator fun rangeUntil(other: Short): IntRange = this until other
|
||||
public operator fun rangeUntil(other: Short): IntRange =
|
||||
this until other
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
@@ -767,7 +775,8 @@ public final class Short private constructor() : Number(), Comparable<Short> {
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public operator fun rangeUntil(other: Int): IntRange = this until other
|
||||
public operator fun rangeUntil(other: Int): IntRange =
|
||||
this until other
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
@@ -776,7 +785,8 @@ public final class Short private constructor() : Number(), Comparable<Short> {
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public operator fun rangeUntil(other: Long): LongRange = this until other
|
||||
public operator fun rangeUntil(other: Long): LongRange =
|
||||
this until other
|
||||
|
||||
/**
|
||||
* Converts this [Short] value to [Byte].
|
||||
@@ -859,9 +869,11 @@ public final class Short private constructor() : Number(), Comparable<Short> {
|
||||
|
||||
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public fun equals(other: Short): Boolean = kotlin.native.internal.areEqualByValue(this, other)
|
||||
public fun equals(other: Short): Boolean =
|
||||
kotlin.native.internal.areEqualByValue(this, other)
|
||||
|
||||
public override fun hashCode(): Int = this.toInt()
|
||||
public override fun hashCode(): Int =
|
||||
this.toInt()
|
||||
}
|
||||
|
||||
/** Represents a 32-bit signed integer. */
|
||||
@@ -1174,7 +1186,8 @@ public final class Int private constructor() : Number(), Comparable<Int> {
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public operator fun rangeUntil(other: Byte): IntRange = this until other
|
||||
public operator fun rangeUntil(other: Byte): IntRange =
|
||||
this until other
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
@@ -1183,7 +1196,8 @@ public final class Int private constructor() : Number(), Comparable<Int> {
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public operator fun rangeUntil(other: Short): IntRange = this until other
|
||||
public operator fun rangeUntil(other: Short): IntRange =
|
||||
this until other
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
@@ -1192,7 +1206,8 @@ public final class Int private constructor() : Number(), Comparable<Int> {
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public operator fun rangeUntil(other: Int): IntRange = this until other
|
||||
public operator fun rangeUntil(other: Int): IntRange =
|
||||
this until other
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
@@ -1201,7 +1216,8 @@ public final class Int private constructor() : Number(), Comparable<Int> {
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public operator fun rangeUntil(other: Long): LongRange = this until other
|
||||
public operator fun rangeUntil(other: Long): LongRange =
|
||||
this until other
|
||||
|
||||
/**
|
||||
* Shifts this value left by the [bitCount] number of bits.
|
||||
@@ -1337,9 +1353,11 @@ public final class Int private constructor() : Number(), Comparable<Int> {
|
||||
|
||||
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public fun equals(other: Int): Boolean = kotlin.native.internal.areEqualByValue(this, other)
|
||||
public fun equals(other: Int): Boolean =
|
||||
kotlin.native.internal.areEqualByValue(this, other)
|
||||
|
||||
public override fun hashCode(): Int = this
|
||||
public override fun hashCode(): Int =
|
||||
this
|
||||
}
|
||||
|
||||
/** Represents a 64-bit signed integer. */
|
||||
@@ -1652,7 +1670,8 @@ public final class Long private constructor() : Number(), Comparable<Long> {
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public operator fun rangeUntil(other: Byte): LongRange = this until other
|
||||
public operator fun rangeUntil(other: Byte): LongRange =
|
||||
this until other
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
@@ -1661,7 +1680,8 @@ public final class Long private constructor() : Number(), Comparable<Long> {
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public operator fun rangeUntil(other: Short): LongRange = this until other
|
||||
public operator fun rangeUntil(other: Short): LongRange =
|
||||
this until other
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
@@ -1670,7 +1690,8 @@ public final class Long private constructor() : Number(), Comparable<Long> {
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public operator fun rangeUntil(other: Int): LongRange = this until other
|
||||
public operator fun rangeUntil(other: Int): LongRange =
|
||||
this until other
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
@@ -1679,7 +1700,8 @@ public final class Long private constructor() : Number(), Comparable<Long> {
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public operator fun rangeUntil(other: Long): LongRange = this until other
|
||||
public operator fun rangeUntil(other: Long): LongRange =
|
||||
this until other
|
||||
|
||||
/**
|
||||
* Shifts this value left by the [bitCount] number of bits.
|
||||
@@ -1818,9 +1840,11 @@ public final class Long private constructor() : Number(), Comparable<Long> {
|
||||
|
||||
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public fun equals(other: Long): Boolean = kotlin.native.internal.areEqualByValue(this, other)
|
||||
public fun equals(other: Long): Boolean =
|
||||
kotlin.native.internal.areEqualByValue(this, other)
|
||||
|
||||
public override fun hashCode(): Int = ((this ushr 32) xor this).toInt()
|
||||
public override fun hashCode(): Int =
|
||||
((this ushr 32) xor this).toInt()
|
||||
}
|
||||
|
||||
/** Represents a single-precision 32-bit IEEE 754 floating point number. */
|
||||
@@ -2144,7 +2168,8 @@ public final class Float private constructor() : Number(), Comparable<Float> {
|
||||
@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()
|
||||
public override fun toByte(): Byte =
|
||||
this.toInt().toByte()
|
||||
|
||||
/**
|
||||
* Converts this [Float] value to [Char].
|
||||
@@ -2154,7 +2179,8 @@ public final class Float private constructor() : Number(), Comparable<Float> {
|
||||
@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()
|
||||
public override fun toChar(): Char =
|
||||
this.toInt().toChar()
|
||||
|
||||
/**
|
||||
* Converts this [Float] value to [Short].
|
||||
@@ -2164,7 +2190,8 @@ public final class Float private constructor() : Number(), Comparable<Float> {
|
||||
@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()
|
||||
public override fun toShort(): Short =
|
||||
this.toInt().toShort()
|
||||
|
||||
/**
|
||||
* Converts this [Float] value to [Int].
|
||||
@@ -2211,7 +2238,8 @@ public final class Float private constructor() : Number(), Comparable<Float> {
|
||||
* The exact bit pattern of a `NaN` float is not guaranteed to be preserved though.
|
||||
*/
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public override fun toString(): String = NumberConverter.convert(this)
|
||||
public override fun toString(): String =
|
||||
NumberConverter.convert(this)
|
||||
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public override fun equals(other: Any?): Boolean =
|
||||
@@ -2219,9 +2247,11 @@ public final class Float private constructor() : Number(), Comparable<Float> {
|
||||
|
||||
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public fun equals(other: Float): Boolean = toBits() == other.toBits()
|
||||
public fun equals(other: Float): Boolean =
|
||||
toBits() == other.toBits()
|
||||
|
||||
public override fun hashCode(): Int = toBits()
|
||||
public override fun hashCode(): Int =
|
||||
toBits()
|
||||
|
||||
@TypedIntrinsic(IntrinsicType.REINTERPRET)
|
||||
@PublishedApi
|
||||
@@ -2549,7 +2579,8 @@ public final class Double private constructor() : Number(), Comparable<Double> {
|
||||
@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()
|
||||
public override fun toByte(): Byte =
|
||||
this.toInt().toByte()
|
||||
|
||||
/**
|
||||
* Converts this [Double] value to [Char].
|
||||
@@ -2559,7 +2590,8 @@ public final class Double private constructor() : Number(), Comparable<Double> {
|
||||
@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()
|
||||
public override fun toChar(): Char =
|
||||
this.toInt().toChar()
|
||||
|
||||
/**
|
||||
* Converts this [Double] value to [Short].
|
||||
@@ -2569,7 +2601,8 @@ public final class Double private constructor() : Number(), Comparable<Double> {
|
||||
@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()
|
||||
public override fun toShort(): Short =
|
||||
this.toInt().toShort()
|
||||
|
||||
/**
|
||||
* Converts this [Double] value to [Int].
|
||||
@@ -2618,7 +2651,8 @@ public final class Double private constructor() : Number(), Comparable<Double> {
|
||||
* 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)
|
||||
public override fun toString(): String =
|
||||
NumberConverter.convert(this)
|
||||
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public override fun equals(other: Any?): Boolean =
|
||||
@@ -2626,9 +2660,11 @@ public final class Double private constructor() : Number(), Comparable<Double> {
|
||||
|
||||
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public fun equals(other: Double): Boolean = toBits() == other.toBits()
|
||||
public fun equals(other: Double): Boolean =
|
||||
toBits() == other.toBits()
|
||||
|
||||
public override fun hashCode(): Int = toBits().hashCode()
|
||||
public override fun hashCode(): Int =
|
||||
toBits().hashCode()
|
||||
|
||||
@TypedIntrinsic(IntrinsicType.REINTERPRET)
|
||||
@PublishedApi
|
||||
|
||||
@@ -27,36 +27,43 @@ internal constructor(private val value: Int) : Comparable<Char> {
|
||||
* or a positive number if it's greater than other.
|
||||
*/
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public override fun compareTo(other: Char): Int = value - other.value
|
||||
public override fun compareTo(other: Char): Int =
|
||||
value - other.value
|
||||
|
||||
/** Adds the other Int value to this value resulting a Char. */
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public operator fun plus(other: Int): Char = (value + other).toChar()
|
||||
public operator fun plus(other: Int): Char =
|
||||
(value + other).toChar()
|
||||
|
||||
/** Subtracts the other Char value from this value resulting an Int. */
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public operator fun minus(other: Char): Int = value - other.value
|
||||
public operator fun minus(other: Char): Int =
|
||||
value - other.value
|
||||
|
||||
/** Subtracts the other Int value from this value resulting a Char. */
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public operator fun minus(other: Int): Char = (value - other).toChar()
|
||||
public operator fun minus(other: Int): Char =
|
||||
(value - other).toChar()
|
||||
|
||||
/**
|
||||
* Returns this value incremented by one.
|
||||
*
|
||||
* @sample samples.misc.Builtins.inc
|
||||
*/
|
||||
public operator fun inc(): Char = (value + 1).toChar()
|
||||
public operator fun inc(): Char =
|
||||
(value + 1).toChar()
|
||||
|
||||
/**
|
||||
* Returns this value decremented by one.
|
||||
*
|
||||
* @sample samples.misc.Builtins.dec
|
||||
*/
|
||||
public operator fun dec(): Char = (value - 1).toChar()
|
||||
public operator fun dec(): Char =
|
||||
(value - 1).toChar()
|
||||
|
||||
/** Creates a range from this value to the specified [other] value. */
|
||||
public operator fun rangeTo(other: Char): CharRange = CharRange(this, other)
|
||||
public operator fun rangeTo(other: Char): CharRange =
|
||||
CharRange(this, other)
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
@@ -65,47 +72,55 @@ internal constructor(private val value: Int) : Comparable<Char> {
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public operator fun rangeUntil(other: Char): CharRange = this until other
|
||||
public operator fun rangeUntil(other: Char): CharRange =
|
||||
this until other
|
||||
|
||||
/** Returns the value of this character as a `Byte`. */
|
||||
@Deprecated("Conversion of Char to Number is deprecated. Use Char.code property instead.", ReplaceWith("this.code.toByte()"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public fun toByte(): Byte = value.toByte()
|
||||
public fun toByte(): Byte =
|
||||
value.toByte()
|
||||
|
||||
/** Returns the value of this character as a `Char`. */
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public fun toChar(): Char = this
|
||||
public fun toChar(): Char =
|
||||
this
|
||||
|
||||
/** Returns the value of this character as a `Short`. */
|
||||
@Deprecated("Conversion of Char to Number is deprecated. Use Char.code property instead.", ReplaceWith("this.code.toShort()"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public fun toShort(): Short = value.toShort()
|
||||
public fun toShort(): Short =
|
||||
value.toShort()
|
||||
|
||||
/** Returns the value of this character as a `Int`. */
|
||||
@Deprecated("Conversion of Char to Number is deprecated. Use Char.code property instead.", ReplaceWith("this.code"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public fun toInt(): Int = value
|
||||
public fun toInt(): Int =
|
||||
value
|
||||
|
||||
/** Returns the value of this character as a `Long`. */
|
||||
@Deprecated("Conversion of Char to Number is deprecated. Use Char.code property instead.", ReplaceWith("this.code.toLong()"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public fun toLong(): Long = value.toLong()
|
||||
public fun toLong(): Long =
|
||||
value.toLong()
|
||||
|
||||
/** Returns the value of this character as a `Float`. */
|
||||
@Deprecated("Conversion of Char to Number is deprecated. Use Char.code property instead.", ReplaceWith("this.code.toFloat()"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public fun toFloat(): Float = value.toFloat()
|
||||
public fun toFloat(): Float =
|
||||
value.toFloat()
|
||||
|
||||
/** Returns the value of this character as a `Double`. */
|
||||
@Deprecated("Conversion of Char to Number is deprecated. Use Char.code property instead.", ReplaceWith("this.code.toDouble()"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public fun toDouble(): Double = value.toDouble()
|
||||
public fun toDouble(): Double =
|
||||
value.toDouble()
|
||||
|
||||
// TODO implicit usages of toString and valueOf must be covered in DCE
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
@@ -121,7 +136,8 @@ internal constructor(private val value: Int) : Comparable<Char> {
|
||||
return this.value == other.value
|
||||
}
|
||||
|
||||
public override fun hashCode(): Int = value
|
||||
public override fun hashCode(): Int =
|
||||
value
|
||||
|
||||
companion object {
|
||||
/**
|
||||
|
||||
@@ -275,7 +275,8 @@ public class Byte private constructor() : Number(), Comparable<Byte> {
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public operator fun rangeUntil(other: Byte): IntRange = this until other
|
||||
public operator fun rangeUntil(other: Byte): IntRange =
|
||||
this until other
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
@@ -284,7 +285,8 @@ public class Byte private constructor() : Number(), Comparable<Byte> {
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public operator fun rangeUntil(other: Short): IntRange = this until other
|
||||
public operator fun rangeUntil(other: Short): IntRange =
|
||||
this until other
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
@@ -293,7 +295,8 @@ public class Byte private constructor() : Number(), Comparable<Byte> {
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public operator fun rangeUntil(other: Int): IntRange = this until other
|
||||
public operator fun rangeUntil(other: Int): IntRange =
|
||||
this until other
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
@@ -302,7 +305,8 @@ public class Byte private constructor() : Number(), Comparable<Byte> {
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public operator fun rangeUntil(other: Long): LongRange = this until other
|
||||
public operator fun rangeUntil(other: Long): LongRange =
|
||||
this until other
|
||||
|
||||
/** Returns this value. */
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
@@ -644,7 +648,8 @@ public class Short private constructor() : Number(), Comparable<Short> {
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public operator fun rangeUntil(other: Byte): IntRange = this until other
|
||||
public operator fun rangeUntil(other: Byte): IntRange =
|
||||
this until other
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
@@ -653,7 +658,8 @@ public class Short private constructor() : Number(), Comparable<Short> {
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public operator fun rangeUntil(other: Short): IntRange = this until other
|
||||
public operator fun rangeUntil(other: Short): IntRange =
|
||||
this until other
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
@@ -662,7 +668,8 @@ public class Short private constructor() : Number(), Comparable<Short> {
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public operator fun rangeUntil(other: Int): IntRange = this until other
|
||||
public operator fun rangeUntil(other: Int): IntRange =
|
||||
this until other
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
@@ -671,7 +678,8 @@ public class Short private constructor() : Number(), Comparable<Short> {
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public operator fun rangeUntil(other: Long): LongRange = this until other
|
||||
public operator fun rangeUntil(other: Long): LongRange =
|
||||
this until other
|
||||
|
||||
/**
|
||||
* Converts this [Short] value to [Byte].
|
||||
@@ -1011,7 +1019,8 @@ public class Int private constructor() : Number(), Comparable<Int> {
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public operator fun rangeUntil(other: Byte): IntRange = this until other
|
||||
public operator fun rangeUntil(other: Byte): IntRange =
|
||||
this until other
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
@@ -1020,7 +1029,8 @@ public class Int private constructor() : Number(), Comparable<Int> {
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public operator fun rangeUntil(other: Short): IntRange = this until other
|
||||
public operator fun rangeUntil(other: Short): IntRange =
|
||||
this until other
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
@@ -1029,7 +1039,8 @@ public class Int private constructor() : Number(), Comparable<Int> {
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public operator fun rangeUntil(other: Int): IntRange = this until other
|
||||
public operator fun rangeUntil(other: Int): IntRange =
|
||||
this until other
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
@@ -1038,7 +1049,8 @@ public class Int private constructor() : Number(), Comparable<Int> {
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public operator fun rangeUntil(other: Long): LongRange = this until other
|
||||
public operator fun rangeUntil(other: Long): LongRange =
|
||||
this until other
|
||||
|
||||
/**
|
||||
* Shifts this value left by the [bitCount] number of bits.
|
||||
@@ -1192,7 +1204,8 @@ public class Long internal constructor(internal val low: Int, internal val high:
|
||||
* 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())
|
||||
public inline operator fun compareTo(other: Byte): Int =
|
||||
this.compareTo(other.toLong())
|
||||
|
||||
/**
|
||||
* Compares this value with the specified value for order.
|
||||
@@ -1200,7 +1213,8 @@ public class Long internal constructor(internal val low: Int, internal val high:
|
||||
* 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())
|
||||
public inline operator fun compareTo(other: Short): Int =
|
||||
this.compareTo(other.toLong())
|
||||
|
||||
/**
|
||||
* Compares this value with the specified value for order.
|
||||
@@ -1208,7 +1222,8 @@ public class Long internal constructor(internal val low: Int, internal val high:
|
||||
* 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())
|
||||
public inline operator fun compareTo(other: Int): Int =
|
||||
this.compareTo(other.toLong())
|
||||
|
||||
/**
|
||||
* Compares this value with the specified value for order.
|
||||
@@ -1216,7 +1231,8 @@ public class Long internal constructor(internal val low: Int, internal val high:
|
||||
* or a positive number if it's greater than other.
|
||||
*/
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public override operator fun compareTo(other: Long): Int = this.compare(other)
|
||||
public override operator fun compareTo(other: Long): Int =
|
||||
this.compare(other)
|
||||
|
||||
/**
|
||||
* Compares this value with the specified value for order.
|
||||
@@ -1224,7 +1240,8 @@ public class Long internal constructor(internal val low: Int, internal val high:
|
||||
* 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)
|
||||
public inline operator fun compareTo(other: Float): Int =
|
||||
this.toFloat().compareTo(other)
|
||||
|
||||
/**
|
||||
* Compares this value with the specified value for order.
|
||||
@@ -1232,103 +1249,128 @@ public class Long internal constructor(internal val low: Int, internal val high:
|
||||
* 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)
|
||||
public inline operator fun compareTo(other: Double): Int =
|
||||
this.toDouble().compareTo(other)
|
||||
|
||||
/** Adds the other value to this value. */
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public inline operator fun plus(other: Byte): Long = this.plus(other.toLong())
|
||||
public inline operator fun plus(other: Byte): Long =
|
||||
this.plus(other.toLong())
|
||||
|
||||
/** Adds the other value to this value. */
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public inline operator fun plus(other: Short): Long = this.plus(other.toLong())
|
||||
public inline operator fun plus(other: Short): Long =
|
||||
this.plus(other.toLong())
|
||||
|
||||
/** Adds the other value to this value. */
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public inline operator fun plus(other: Int): Long = this.plus(other.toLong())
|
||||
public inline operator fun plus(other: Int): Long =
|
||||
this.plus(other.toLong())
|
||||
|
||||
/** Adds the other value to this value. */
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public operator fun plus(other: Long): Long = this.add(other)
|
||||
public operator fun plus(other: Long): Long =
|
||||
this.add(other)
|
||||
|
||||
/** Adds the other value to this value. */
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public inline operator fun plus(other: Float): Float = this.toFloat().plus(other)
|
||||
public inline operator fun plus(other: Float): Float =
|
||||
this.toFloat().plus(other)
|
||||
|
||||
/** Adds the other value to this value. */
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public inline operator fun plus(other: Double): Double = this.toDouble().plus(other)
|
||||
public inline operator fun plus(other: Double): Double =
|
||||
this.toDouble().plus(other)
|
||||
|
||||
/** Subtracts the other value from this value. */
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public inline operator fun minus(other: Byte): Long = this.minus(other.toLong())
|
||||
public inline operator fun minus(other: Byte): Long =
|
||||
this.minus(other.toLong())
|
||||
|
||||
/** Subtracts the other value from this value. */
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public inline operator fun minus(other: Short): Long = this.minus(other.toLong())
|
||||
public inline operator fun minus(other: Short): Long =
|
||||
this.minus(other.toLong())
|
||||
|
||||
/** Subtracts the other value from this value. */
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public inline operator fun minus(other: Int): Long = this.minus(other.toLong())
|
||||
public inline operator fun minus(other: Int): Long =
|
||||
this.minus(other.toLong())
|
||||
|
||||
/** Subtracts the other value from this value. */
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public operator fun minus(other: Long): Long = this.subtract(other)
|
||||
public operator fun minus(other: Long): Long =
|
||||
this.subtract(other)
|
||||
|
||||
/** Subtracts the other value from this value. */
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public inline operator fun minus(other: Float): Float = this.toFloat().minus(other)
|
||||
public inline operator fun minus(other: Float): Float =
|
||||
this.toFloat().minus(other)
|
||||
|
||||
/** Subtracts the other value from this value. */
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public inline operator fun minus(other: Double): Double = this.toDouble().minus(other)
|
||||
public inline operator fun minus(other: Double): Double =
|
||||
this.toDouble().minus(other)
|
||||
|
||||
/** Multiplies this value by the other value. */
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public inline operator fun times(other: Byte): Long = this.times(other.toLong())
|
||||
public inline operator fun times(other: Byte): Long =
|
||||
this.times(other.toLong())
|
||||
|
||||
/** Multiplies this value by the other value. */
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public inline operator fun times(other: Short): Long = this.times(other.toLong())
|
||||
public inline operator fun times(other: Short): Long =
|
||||
this.times(other.toLong())
|
||||
|
||||
/** Multiplies this value by the other value. */
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public inline operator fun times(other: Int): Long = this.times(other.toLong())
|
||||
public inline operator fun times(other: Int): Long =
|
||||
this.times(other.toLong())
|
||||
|
||||
/** Multiplies this value by the other value. */
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public operator fun times(other: Long): Long = this.multiply(other)
|
||||
public operator fun times(other: Long): Long =
|
||||
this.multiply(other)
|
||||
|
||||
/** Multiplies this value by the other value. */
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public inline operator fun times(other: Float): Float = this.toFloat().times(other)
|
||||
public inline operator fun times(other: Float): Float =
|
||||
this.toFloat().times(other)
|
||||
|
||||
/** Multiplies this value by the other value. */
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public inline operator fun times(other: Double): Double = this.toDouble().times(other)
|
||||
public inline operator fun times(other: Double): Double =
|
||||
this.toDouble().times(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.div(other.toLong())
|
||||
public inline operator fun div(other: Byte): Long =
|
||||
this.div(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.div(other.toLong())
|
||||
public inline operator fun div(other: Short): Long =
|
||||
this.div(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.div(other.toLong())
|
||||
public inline operator fun div(other: Int): Long =
|
||||
this.div(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 = this.divide(other)
|
||||
public operator fun div(other: Long): Long =
|
||||
this.divide(other)
|
||||
|
||||
/** Divides this value by the other value. */
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public inline operator fun div(other: Float): Float = this.toFloat().div(other)
|
||||
public inline operator fun div(other: Float): Float =
|
||||
this.toFloat().div(other)
|
||||
|
||||
/** Divides this value by the other value. */
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public inline operator fun div(other: Double): Double = this.toDouble().div(other)
|
||||
public inline operator fun div(other: Double): Double =
|
||||
this.toDouble().div(other)
|
||||
|
||||
/**
|
||||
* Calculates the remainder of truncating division of this value (dividend) by the other value (divisor).
|
||||
@@ -1337,7 +1379,8 @@ public class Long internal constructor(internal val low: Int, internal val high:
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public inline operator fun rem(other: Byte): Long = this.rem(other.toLong())
|
||||
public inline operator fun rem(other: Byte): Long =
|
||||
this.rem(other.toLong())
|
||||
|
||||
/**
|
||||
* Calculates the remainder of truncating division of this value (dividend) by the other value (divisor).
|
||||
@@ -1346,7 +1389,8 @@ public class Long internal constructor(internal val low: Int, internal val high:
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public inline operator fun rem(other: Short): Long = this.rem(other.toLong())
|
||||
public inline operator fun rem(other: Short): Long =
|
||||
this.rem(other.toLong())
|
||||
|
||||
/**
|
||||
* Calculates the remainder of truncating division of this value (dividend) by the other value (divisor).
|
||||
@@ -1355,7 +1399,8 @@ public class Long internal constructor(internal val low: Int, internal val high:
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public inline operator fun rem(other: Int): Long = this.rem(other.toLong())
|
||||
public inline operator fun rem(other: Int): Long =
|
||||
this.rem(other.toLong())
|
||||
|
||||
/**
|
||||
* Calculates the remainder of truncating division of this value (dividend) by the other value (divisor).
|
||||
@@ -1364,7 +1409,8 @@ public class Long internal constructor(internal val low: Int, internal val high:
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public operator fun rem(other: Long): Long = this.modulo(other)
|
||||
public operator fun rem(other: Long): Long =
|
||||
this.modulo(other)
|
||||
|
||||
/**
|
||||
* Calculates the remainder of truncating division of this value (dividend) by the other value (divisor).
|
||||
@@ -1373,7 +1419,8 @@ public class Long internal constructor(internal val low: Int, internal val high:
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public inline operator fun rem(other: Float): Float = this.toFloat().rem(other)
|
||||
public inline operator fun rem(other: Float): Float =
|
||||
this.toFloat().rem(other)
|
||||
|
||||
/**
|
||||
* Calculates the remainder of truncating division of this value (dividend) by the other value (divisor).
|
||||
@@ -1382,29 +1429,34 @@ public class Long internal constructor(internal val low: Int, internal val high:
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public inline operator fun rem(other: Double): Double = this.toDouble().rem(other)
|
||||
public inline operator fun rem(other: Double): Double =
|
||||
this.toDouble().rem(other)
|
||||
|
||||
/**
|
||||
* Returns this value incremented by one.
|
||||
*
|
||||
* @sample samples.misc.Builtins.inc
|
||||
*/
|
||||
public operator fun inc(): Long = this + 1L
|
||||
public operator fun inc(): Long =
|
||||
this + 1L
|
||||
|
||||
/**
|
||||
* Returns this value decremented by one.
|
||||
*
|
||||
* @sample samples.misc.Builtins.dec
|
||||
*/
|
||||
public operator fun dec(): Long = this - 1L
|
||||
public operator fun dec(): Long =
|
||||
this - 1L
|
||||
|
||||
/** Returns this value. */
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public inline operator fun unaryPlus(): Long = this
|
||||
public inline operator fun unaryPlus(): Long =
|
||||
this
|
||||
|
||||
/** Returns the negative of this value. */
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public operator fun unaryMinus(): Long = this.inv() + 1L
|
||||
public operator fun unaryMinus(): Long =
|
||||
this.inv() + 1L
|
||||
|
||||
/** Creates a range from this value to the specified [other] value. */
|
||||
public operator fun rangeTo(other: Byte): LongRange =
|
||||
@@ -1429,7 +1481,8 @@ public class Long internal constructor(internal val low: Int, internal val high:
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public operator fun rangeUntil(other: Byte): LongRange = this until other
|
||||
public operator fun rangeUntil(other: Byte): LongRange =
|
||||
this until other
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
@@ -1438,7 +1491,8 @@ public class Long internal constructor(internal val low: Int, internal val high:
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public operator fun rangeUntil(other: Short): LongRange = this until other
|
||||
public operator fun rangeUntil(other: Short): LongRange =
|
||||
this until other
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
@@ -1447,7 +1501,8 @@ public class Long internal constructor(internal val low: Int, internal val high:
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public operator fun rangeUntil(other: Int): LongRange = this until other
|
||||
public operator fun rangeUntil(other: Int): LongRange =
|
||||
this until other
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
@@ -1456,7 +1511,8 @@ public class Long internal constructor(internal val low: Int, internal val high:
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public operator fun rangeUntil(other: Long): LongRange = this until other
|
||||
public operator fun rangeUntil(other: Long): LongRange =
|
||||
this until other
|
||||
|
||||
/**
|
||||
* Shifts this value left by the [bitCount] number of bits.
|
||||
@@ -1465,7 +1521,8 @@ public class Long internal constructor(internal val low: Int, internal val high:
|
||||
* The shift distance actually used is therefore always in the range `0..63`.
|
||||
*/
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public infix fun shl(bitCount: Int): Long = shiftLeft(bitCount)
|
||||
public infix fun shl(bitCount: Int): Long =
|
||||
shiftLeft(bitCount)
|
||||
|
||||
/**
|
||||
* Shifts this value right by the [bitCount] number of bits, filling the leftmost bits with copies of the sign bit.
|
||||
@@ -1474,7 +1531,8 @@ public class Long internal constructor(internal val low: Int, internal val high:
|
||||
* The shift distance actually used is therefore always in the range `0..63`.
|
||||
*/
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public infix fun shr(bitCount: Int): Long = shiftRight(bitCount)
|
||||
public infix fun shr(bitCount: Int): Long =
|
||||
shiftRight(bitCount)
|
||||
|
||||
/**
|
||||
* Shifts this value right by the [bitCount] number of bits, filling the leftmost bits with zeros.
|
||||
@@ -1483,23 +1541,28 @@ public class Long internal constructor(internal val low: Int, internal val high:
|
||||
* The shift distance actually used is therefore always in the range `0..63`.
|
||||
*/
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public infix fun ushr(bitCount: Int): Long = shiftRightUnsigned(bitCount)
|
||||
public infix fun ushr(bitCount: Int): Long =
|
||||
shiftRightUnsigned(bitCount)
|
||||
|
||||
/** Performs a bitwise AND operation between the two values. */
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public infix fun and(other: Long): Long = Long(this.low and other.low, this.high and other.high)
|
||||
public infix fun and(other: Long): Long =
|
||||
Long(this.low and other.low, this.high and other.high)
|
||||
|
||||
/** Performs a bitwise OR operation between the two values. */
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public infix fun or(other: Long): Long = Long(this.low or other.low, this.high or other.high)
|
||||
public infix fun or(other: Long): Long =
|
||||
Long(this.low or other.low, this.high or other.high)
|
||||
|
||||
/** Performs a bitwise XOR operation between the two values. */
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public infix fun xor(other: Long): Long = Long(this.low xor other.low, this.high xor other.high)
|
||||
public infix fun xor(other: Long): Long =
|
||||
Long(this.low xor other.low, this.high xor other.high)
|
||||
|
||||
/** Inverts the bits in this value. */
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public fun inv(): Long = Long(low.inv(), high.inv())
|
||||
public fun inv(): Long =
|
||||
Long(low.inv(), high.inv())
|
||||
|
||||
/**
|
||||
* Converts this [Long] value to [Byte].
|
||||
@@ -1510,7 +1573,8 @@ public class Long internal constructor(internal val low: Int, internal val high:
|
||||
* The resulting `Byte` value is represented by the least significant 8 bits of this `Long` value.
|
||||
*/
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public override fun toByte(): Byte = low.toByte()
|
||||
public override fun toByte(): Byte =
|
||||
low.toByte()
|
||||
|
||||
/**
|
||||
* Converts this [Long] value to [Char].
|
||||
@@ -1523,7 +1587,8 @@ public class Long internal constructor(internal val low: Int, internal val high:
|
||||
@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 = low.toChar()
|
||||
public override fun toChar(): Char =
|
||||
low.toChar()
|
||||
|
||||
/**
|
||||
* Converts this [Long] value to [Short].
|
||||
@@ -1534,7 +1599,8 @@ public class Long internal constructor(internal val low: Int, internal val high:
|
||||
* The resulting `Short` value is represented by the least significant 16 bits of this `Long` value.
|
||||
*/
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public override fun toShort(): Short = low.toShort()
|
||||
public override fun toShort(): Short =
|
||||
low.toShort()
|
||||
|
||||
/**
|
||||
* Converts this [Long] value to [Int].
|
||||
@@ -1545,11 +1611,13 @@ public class Long internal constructor(internal val low: Int, internal val high:
|
||||
* The resulting `Int` value is represented by the least significant 32 bits of this `Long` value.
|
||||
*/
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public override fun toInt(): Int = low
|
||||
public override fun toInt(): Int =
|
||||
low
|
||||
|
||||
/** Returns this value. */
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public override fun toLong(): Long = this
|
||||
public override fun toLong(): Long =
|
||||
this
|
||||
|
||||
/**
|
||||
* Converts this [Long] value to [Float].
|
||||
@@ -1559,7 +1627,8 @@ public class Long internal constructor(internal val low: Int, internal val high:
|
||||
* the one with zero at least significant bit of mantissa is selected.
|
||||
*/
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public override fun toFloat(): Float = toDouble().toFloat()
|
||||
public override fun toFloat(): Float =
|
||||
toDouble().toFloat()
|
||||
|
||||
/**
|
||||
* Converts this [Long] value to [Double].
|
||||
@@ -1569,15 +1638,19 @@ public class Long internal constructor(internal val low: Int, internal val high:
|
||||
* the one with zero at least significant bit of mantissa is selected.
|
||||
*/
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public override fun toDouble(): Double = toNumber()
|
||||
public override fun toDouble(): Double =
|
||||
toNumber()
|
||||
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public override fun toString(): String = this.toStringImpl(radix = 10)
|
||||
public override fun toString(): String =
|
||||
this.toStringImpl(radix = 10)
|
||||
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public override fun equals(other: Any?): Boolean = other is Long && equalsLong(other)
|
||||
public override fun equals(other: Any?): Boolean =
|
||||
other is Long && equalsLong(other)
|
||||
|
||||
public override fun hashCode(): Int = hashCode(this)
|
||||
public override fun hashCode(): Int =
|
||||
hashCode(this)
|
||||
|
||||
// This method is used by JavaScript to convert objects of type Long to primitives.
|
||||
// This is essential for the JavaScript interop.
|
||||
@@ -1586,7 +1659,8 @@ public class Long internal constructor(internal val low: Int, internal val high:
|
||||
// Because `kotlin.Number` is a supertype of `Long` too, there has to be a way for JS to know how to handle Longs.
|
||||
// See KT-50202
|
||||
@JsName("valueOf")
|
||||
internal fun valueOf(): Double = toDouble()
|
||||
internal fun valueOf(): Double =
|
||||
toDouble()
|
||||
}
|
||||
|
||||
/** Represents a single-precision 32-bit IEEE 754 floating point number. */
|
||||
|
||||
@@ -322,7 +322,8 @@ public class Byte private constructor(private val value: Byte) : Number(), Compa
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public operator fun rangeUntil(other: Byte): IntRange = this until other
|
||||
public operator fun rangeUntil(other: Byte): IntRange =
|
||||
this until other
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
@@ -331,7 +332,8 @@ public class Byte private constructor(private val value: Byte) : Number(), Compa
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public operator fun rangeUntil(other: Short): IntRange = this until other
|
||||
public operator fun rangeUntil(other: Short): IntRange =
|
||||
this until other
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
@@ -340,7 +342,8 @@ public class Byte private constructor(private val value: Byte) : Number(), Compa
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public operator fun rangeUntil(other: Int): IntRange = this until other
|
||||
public operator fun rangeUntil(other: Int): IntRange =
|
||||
this until other
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
@@ -349,7 +352,8 @@ public class Byte private constructor(private val value: Byte) : Number(), Compa
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public operator fun rangeUntil(other: Long): LongRange = this until other
|
||||
public operator fun rangeUntil(other: Long): LongRange =
|
||||
this until other
|
||||
|
||||
/** Returns this value. */
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
@@ -367,7 +371,8 @@ 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()
|
||||
public override fun toChar(): Char =
|
||||
reinterpretAsInt().reinterpretAsChar()
|
||||
|
||||
/**
|
||||
* Converts this [Byte] value to [Short].
|
||||
@@ -378,7 +383,8 @@ public class Byte private constructor(private val value: Byte) : Number(), Compa
|
||||
* 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()
|
||||
public override fun toShort(): Short =
|
||||
reinterpretAsInt().reinterpretAsShort()
|
||||
|
||||
/**
|
||||
* Converts this [Byte] value to [Int].
|
||||
@@ -389,7 +395,8 @@ public class Byte private constructor(private val value: Byte) : Number(), Compa
|
||||
* whereas the most significant 24 bits are filled with the sign bit of this value.
|
||||
*/
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public override fun toInt(): Int = reinterpretAsInt()
|
||||
public override fun toInt(): Int =
|
||||
reinterpretAsInt()
|
||||
|
||||
/**
|
||||
* Converts this [Byte] value to [Long].
|
||||
@@ -400,7 +407,8 @@ public class Byte private constructor(private val value: Byte) : Number(), Compa
|
||||
* 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())
|
||||
public override fun toLong(): Long =
|
||||
wasm_i64_extend_i32_s(this.toInt())
|
||||
|
||||
/**
|
||||
* Converts this [Byte] value to [Float].
|
||||
@@ -408,7 +416,8 @@ 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())
|
||||
public override fun toFloat(): Float =
|
||||
wasm_f32_convert_i32_s(this.toInt())
|
||||
|
||||
/**
|
||||
* Converts this [Byte] value to [Double].
|
||||
@@ -416,7 +425,8 @@ 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())
|
||||
public override fun toDouble(): Double =
|
||||
wasm_f64_convert_i32_s(this.toInt())
|
||||
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public override fun toString(): String =
|
||||
@@ -426,7 +436,8 @@ public class Byte private constructor(private val value: Byte) : Number(), Compa
|
||||
public override fun equals(other: Any?): Boolean =
|
||||
other is Byte && wasm_i32_eq(this.toInt(), other.toInt())
|
||||
|
||||
public override fun hashCode(): Int = this.toInt()
|
||||
public override fun hashCode(): Int =
|
||||
this.toInt()
|
||||
|
||||
@WasmNoOpCast
|
||||
@PublishedApi
|
||||
@@ -744,7 +755,8 @@ public class Short private constructor(private val value: Short) : Number(), Com
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public operator fun rangeUntil(other: Byte): IntRange = this until other
|
||||
public operator fun rangeUntil(other: Byte): IntRange =
|
||||
this until other
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
@@ -753,7 +765,8 @@ public class Short private constructor(private val value: Short) : Number(), Com
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public operator fun rangeUntil(other: Short): IntRange = this until other
|
||||
public operator fun rangeUntil(other: Short): IntRange =
|
||||
this until other
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
@@ -762,7 +775,8 @@ public class Short private constructor(private val value: Short) : Number(), Com
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public operator fun rangeUntil(other: Int): IntRange = this until other
|
||||
public operator fun rangeUntil(other: Int): IntRange =
|
||||
this until other
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
@@ -771,7 +785,8 @@ public class Short private constructor(private val value: Short) : Number(), Com
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public operator fun rangeUntil(other: Long): LongRange = this until other
|
||||
public operator fun rangeUntil(other: Long): LongRange =
|
||||
this until other
|
||||
|
||||
/**
|
||||
* Converts this [Short] value to [Byte].
|
||||
@@ -782,7 +797,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.
|
||||
*/
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public override inline fun toByte(): Byte = this.toInt().toByte()
|
||||
public override inline fun toByte(): Byte =
|
||||
this.toInt().toByte()
|
||||
|
||||
/**
|
||||
* Converts this [Short] value to [Char].
|
||||
@@ -793,7 +809,8 @@ 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()
|
||||
public override fun toChar(): Char =
|
||||
reinterpretAsInt().reinterpretAsChar()
|
||||
|
||||
/** Returns this value. */
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
@@ -809,7 +826,8 @@ public class Short private constructor(private val value: Short) : Number(), Com
|
||||
* whereas the most significant 16 bits are filled with the sign bit of this value.
|
||||
*/
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public override fun toInt(): Int = reinterpretAsInt()
|
||||
public override fun toInt(): Int =
|
||||
reinterpretAsInt()
|
||||
|
||||
/**
|
||||
* Converts this [Short] value to [Long].
|
||||
@@ -820,7 +838,8 @@ public class Short private constructor(private val value: Short) : Number(), Com
|
||||
* 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())
|
||||
public override fun toLong(): Long =
|
||||
wasm_i64_extend_i32_s(this.toInt())
|
||||
|
||||
/**
|
||||
* Converts this [Short] value to [Float].
|
||||
@@ -828,7 +847,8 @@ 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())
|
||||
public override fun toFloat(): Float =
|
||||
wasm_f32_convert_i32_s(this.toInt())
|
||||
|
||||
/**
|
||||
* Converts this [Short] value to [Double].
|
||||
@@ -836,7 +856,8 @@ public class Short private constructor(private val value: Short) : Number(), Com
|
||||
* The resulting `Double` value represents the same numerical value as this `Short`.
|
||||
*/
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public override fun toDouble(): Double = wasm_f64_convert_i32_s(this.toInt())
|
||||
public override fun toDouble(): Double =
|
||||
wasm_f64_convert_i32_s(this.toInt())
|
||||
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public override fun toString(): String =
|
||||
@@ -846,7 +867,8 @@ public class Short private constructor(private val value: Short) : Number(), Com
|
||||
public override fun equals(other: Any?): Boolean =
|
||||
other is Short && wasm_i32_eq(this.toInt(), other.toInt())
|
||||
|
||||
public override fun hashCode(): Int = this.toInt()
|
||||
public override fun hashCode(): Int =
|
||||
this.toInt()
|
||||
|
||||
@WasmNoOpCast
|
||||
@PublishedApi
|
||||
@@ -1169,7 +1191,8 @@ public class Int private constructor(private val value: Int) : Number(), Compara
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public operator fun rangeUntil(other: Byte): IntRange = this until other
|
||||
public operator fun rangeUntil(other: Byte): IntRange =
|
||||
this until other
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
@@ -1178,7 +1201,8 @@ public class Int private constructor(private val value: Int) : Number(), Compara
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public operator fun rangeUntil(other: Short): IntRange = this until other
|
||||
public operator fun rangeUntil(other: Short): IntRange =
|
||||
this until other
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
@@ -1187,7 +1211,8 @@ public class Int private constructor(private val value: Int) : Number(), Compara
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public operator fun rangeUntil(other: Int): IntRange = this until other
|
||||
public operator fun rangeUntil(other: Int): IntRange =
|
||||
this until other
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
@@ -1196,7 +1221,8 @@ public class Int private constructor(private val value: Int) : Number(), Compara
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public operator fun rangeUntil(other: Long): LongRange = this until other
|
||||
public operator fun rangeUntil(other: Long): LongRange =
|
||||
this until other
|
||||
|
||||
/**
|
||||
* Shifts this value left by the [bitCount] number of bits.
|
||||
@@ -1263,7 +1289,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.
|
||||
*/
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public override fun toByte(): Byte = ((this shl 24) shr 24).reinterpretAsByte()
|
||||
public override fun toByte(): Byte =
|
||||
((this shl 24) shr 24).reinterpretAsByte()
|
||||
|
||||
/**
|
||||
* Converts this [Int] value to [Char].
|
||||
@@ -1275,7 +1302,8 @@ public class Int private constructor(private val value: Int) : Number(), Compara
|
||||
*/
|
||||
@Suppress("OVERRIDE_DEPRECATION")
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public override fun toChar(): Char = (this and 0xFFFF).reinterpretAsChar()
|
||||
public override fun toChar(): Char =
|
||||
(this and 0xFFFF).reinterpretAsChar()
|
||||
|
||||
/**
|
||||
* Converts this [Int] value to [Short].
|
||||
@@ -1286,7 +1314,8 @@ 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.
|
||||
*/
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public override fun toShort(): Short = ((this shl 16) shr 16).reinterpretAsShort()
|
||||
public override fun toShort(): Short =
|
||||
((this shl 16) shr 16).reinterpretAsShort()
|
||||
|
||||
/** Returns this value. */
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
@@ -1302,7 +1331,8 @@ public class Int private constructor(private val value: Int) : Number(), Compara
|
||||
* whereas the most significant 32 bits are filled with the sign bit of this value.
|
||||
*/
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public override fun toLong(): Long = wasm_i64_extend_i32_s(this)
|
||||
public override fun toLong(): Long =
|
||||
wasm_i64_extend_i32_s(this)
|
||||
|
||||
/**
|
||||
* Converts this [Int] value to [Float].
|
||||
@@ -1312,7 +1342,8 @@ public class Int private constructor(private val value: Int) : Number(), Compara
|
||||
* the one with zero at least significant bit of mantissa is selected.
|
||||
*/
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public override fun toFloat(): Float = wasm_f32_convert_i32_s(this)
|
||||
public override fun toFloat(): Float =
|
||||
wasm_f32_convert_i32_s(this)
|
||||
|
||||
/**
|
||||
* Converts this [Int] value to [Double].
|
||||
@@ -1320,7 +1351,8 @@ public class Int private constructor(private val value: Int) : Number(), Compara
|
||||
* The resulting `Double` value represents the same numerical value as this `Int`.
|
||||
*/
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public override fun toDouble(): Double = wasm_f64_convert_i32_s(this)
|
||||
public override fun toDouble(): Double =
|
||||
wasm_f64_convert_i32_s(this)
|
||||
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public override fun toString(): String =
|
||||
@@ -1330,7 +1362,8 @@ public class Int private constructor(private val value: Int) : Number(), Compara
|
||||
public override fun equals(other: Any?): Boolean =
|
||||
other is Int && wasm_i32_eq(this, other)
|
||||
|
||||
public override fun hashCode(): Int = this
|
||||
public override fun hashCode(): Int =
|
||||
this
|
||||
|
||||
@WasmNoOpCast
|
||||
@PublishedApi
|
||||
@@ -1667,7 +1700,8 @@ public class Long private constructor(private val value: Long) : Number(), Compa
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public operator fun rangeUntil(other: Byte): LongRange = this until other
|
||||
public operator fun rangeUntil(other: Byte): LongRange =
|
||||
this until other
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
@@ -1676,7 +1710,8 @@ public class Long private constructor(private val value: Long) : Number(), Compa
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public operator fun rangeUntil(other: Short): LongRange = this until other
|
||||
public operator fun rangeUntil(other: Short): LongRange =
|
||||
this until other
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
@@ -1685,7 +1720,8 @@ public class Long private constructor(private val value: Long) : Number(), Compa
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public operator fun rangeUntil(other: Int): LongRange = this until other
|
||||
public operator fun rangeUntil(other: Int): LongRange =
|
||||
this until other
|
||||
|
||||
/**
|
||||
* Creates a range from this value up to but excluding the specified [other] value.
|
||||
@@ -1694,7 +1730,8 @@ public class Long private constructor(private val value: Long) : Number(), Compa
|
||||
*/
|
||||
@SinceKotlin("1.9")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public operator fun rangeUntil(other: Long): LongRange = this until other
|
||||
public operator fun rangeUntil(other: Long): LongRange =
|
||||
this until other
|
||||
|
||||
/**
|
||||
* Shifts this value left by the [bitCount] number of bits.
|
||||
@@ -1758,7 +1795,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.
|
||||
*/
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public override inline fun toByte(): Byte = this.toInt().toByte()
|
||||
public override inline fun toByte(): Byte =
|
||||
this.toInt().toByte()
|
||||
|
||||
/**
|
||||
* Converts this [Long] value to [Char].
|
||||
@@ -1771,7 +1809,8 @@ 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()
|
||||
public override inline fun toChar(): Char =
|
||||
this.toInt().toChar()
|
||||
|
||||
/**
|
||||
* Converts this [Long] value to [Short].
|
||||
@@ -1782,7 +1821,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.
|
||||
*/
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public override inline fun toShort(): Short = this.toInt().toShort()
|
||||
public override inline fun toShort(): Short =
|
||||
this.toInt().toShort()
|
||||
|
||||
/**
|
||||
* Converts this [Long] value to [Int].
|
||||
@@ -1793,7 +1833,8 @@ 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.
|
||||
*/
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public override fun toInt(): Int = wasm_i32_wrap_i64(this)
|
||||
public override fun toInt(): Int =
|
||||
wasm_i32_wrap_i64(this)
|
||||
|
||||
/** Returns this value. */
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
@@ -1808,7 +1849,8 @@ public class Long private constructor(private val value: Long) : Number(), Compa
|
||||
* the one with zero at least significant bit of mantissa is selected.
|
||||
*/
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public override fun toFloat(): Float = wasm_f32_convert_i64_s(this)
|
||||
public override fun toFloat(): Float =
|
||||
wasm_f32_convert_i64_s(this)
|
||||
|
||||
/**
|
||||
* Converts this [Long] value to [Double].
|
||||
@@ -1818,7 +1860,8 @@ public class Long private constructor(private val value: Long) : Number(), Compa
|
||||
* the one with zero at least significant bit of mantissa is selected.
|
||||
*/
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public override fun toDouble(): Double = wasm_f64_convert_i64_s(this)
|
||||
public override fun toDouble(): Double =
|
||||
wasm_f64_convert_i64_s(this)
|
||||
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public override fun toString(): String =
|
||||
@@ -1828,7 +1871,8 @@ public class Long private constructor(private val value: Long) : Number(), Compa
|
||||
public override fun equals(other: Any?): Boolean =
|
||||
other is Long && wasm_i64_eq(this, other)
|
||||
|
||||
public override fun hashCode(): Int = ((this ushr 32) xor this).toInt()
|
||||
public override fun hashCode(): Int =
|
||||
((this ushr 32) xor this).toInt()
|
||||
}
|
||||
|
||||
/** Represents a single-precision 32-bit IEEE 754 floating point number. */
|
||||
@@ -2158,7 +2202,8 @@ public class Float private constructor(private val value: Float) : Number(), Com
|
||||
@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()
|
||||
public override inline fun toByte(): Byte =
|
||||
this.toInt().toByte()
|
||||
|
||||
/**
|
||||
* Converts this [Float] value to [Char].
|
||||
@@ -2168,7 +2213,8 @@ 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()
|
||||
public override inline fun toChar(): Char =
|
||||
this.toInt().toChar()
|
||||
|
||||
/**
|
||||
* Converts this [Float] value to [Short].
|
||||
@@ -2178,7 +2224,8 @@ public class Float private constructor(private val value: Float) : Number(), Com
|
||||
@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()
|
||||
public override inline fun toShort(): Short =
|
||||
this.toInt().toShort()
|
||||
|
||||
/**
|
||||
* Converts this [Float] value to [Int].
|
||||
@@ -2188,7 +2235,8 @@ public class Float private constructor(private val value: Float) : Number(), Com
|
||||
* [Int.MAX_VALUE] if it's bigger than `Int.MAX_VALUE`.
|
||||
*/
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public override fun toInt(): Int = wasm_i32_trunc_sat_f32_s(this)
|
||||
public override fun toInt(): Int =
|
||||
wasm_i32_trunc_sat_f32_s(this)
|
||||
|
||||
/**
|
||||
* Converts this [Float] value to [Long].
|
||||
@@ -2198,7 +2246,8 @@ public class Float private constructor(private val value: Float) : Number(), Com
|
||||
* [Long.MAX_VALUE] if it's bigger than `Long.MAX_VALUE`.
|
||||
*/
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public override fun toLong(): Long = wasm_i64_trunc_sat_f32_s(this)
|
||||
public override fun toLong(): Long =
|
||||
wasm_i64_trunc_sat_f32_s(this)
|
||||
|
||||
/** Returns this value. */
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
@@ -2211,7 +2260,8 @@ public class Float private constructor(private val value: Float) : Number(), Com
|
||||
* The resulting `Double` value represents the same numerical value as this `Float`.
|
||||
*/
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public override fun toDouble(): Double = wasm_f64_promote_f32(this)
|
||||
public override fun toDouble(): Double =
|
||||
wasm_f64_promote_f32(this)
|
||||
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public override fun toString(): String =
|
||||
@@ -2221,7 +2271,8 @@ public class Float private constructor(private val value: Float) : Number(), Com
|
||||
public override fun equals(other: Any?): Boolean =
|
||||
other is Float && this.toBits() == other.toBits()
|
||||
|
||||
public override fun hashCode(): Int = toBits()
|
||||
public override fun hashCode(): Int =
|
||||
toBits()
|
||||
}
|
||||
|
||||
/** Represents a double-precision 64-bit IEEE 754 floating point number. */
|
||||
@@ -2551,7 +2602,8 @@ public class Double private constructor(private val value: Double) : Number(), C
|
||||
@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()
|
||||
public override inline fun toByte(): Byte =
|
||||
this.toInt().toByte()
|
||||
|
||||
/**
|
||||
* Converts this [Double] value to [Char].
|
||||
@@ -2561,7 +2613,8 @@ 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()
|
||||
public override inline fun toChar(): Char =
|
||||
this.toInt().toChar()
|
||||
|
||||
/**
|
||||
* Converts this [Double] value to [Short].
|
||||
@@ -2571,7 +2624,8 @@ public class Double private constructor(private val value: Double) : Number(), C
|
||||
@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()
|
||||
public override inline fun toShort(): Short =
|
||||
this.toInt().toShort()
|
||||
|
||||
/**
|
||||
* Converts this [Double] value to [Int].
|
||||
@@ -2581,7 +2635,8 @@ public class Double private constructor(private val value: Double) : Number(), C
|
||||
* [Int.MAX_VALUE] if it's bigger than `Int.MAX_VALUE`.
|
||||
*/
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public override fun toInt(): Int = wasm_i32_trunc_sat_f64_s(this)
|
||||
public override fun toInt(): Int =
|
||||
wasm_i32_trunc_sat_f64_s(this)
|
||||
|
||||
/**
|
||||
* Converts this [Double] value to [Long].
|
||||
@@ -2591,7 +2646,8 @@ public class Double private constructor(private val value: Double) : Number(), C
|
||||
* [Long.MAX_VALUE] if it's bigger than `Long.MAX_VALUE`.
|
||||
*/
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public override fun toLong(): Long = wasm_i64_trunc_sat_f64_s(this)
|
||||
public override fun toLong(): Long =
|
||||
wasm_i64_trunc_sat_f64_s(this)
|
||||
|
||||
/**
|
||||
* Converts this [Double] value to [Float].
|
||||
@@ -2601,7 +2657,8 @@ public class Double private constructor(private val value: Double) : Number(), C
|
||||
* the one with zero at least significant bit of mantissa is selected.
|
||||
*/
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public override fun toFloat(): Float = wasm_f32_demote_f64(this)
|
||||
public override fun toFloat(): Float =
|
||||
wasm_f32_demote_f64(this)
|
||||
|
||||
/** Returns this value. */
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
@@ -2616,5 +2673,6 @@ public class Double private constructor(private val value: Double) : Number(), C
|
||||
public override fun equals(other: Any?): Boolean =
|
||||
other is Double && this.toBits() == other.toBits()
|
||||
|
||||
public override fun hashCode(): Int = toBits().hashCode()
|
||||
public override fun hashCode(): Int =
|
||||
toBits().hashCode()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user