More efficient Char(Int) in common, JS, and JS-IR
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
@@ -27,4 +27,4 @@ internal fun doubleToInt(a: Double): Int = when {
|
||||
else -> jsBitwiseOr(a, 0)
|
||||
}
|
||||
|
||||
internal fun numberToChar(a: dynamic) = Char(numberToInt(a) and 0xFFFF)
|
||||
internal fun numberToChar(a: dynamic) = Char(numberToInt(a).toUShort())
|
||||
@@ -22,7 +22,7 @@ public inline fun Char(code: Int): Char {
|
||||
if (code < Char.MIN_VALUE.code || code > Char.MAX_VALUE.code) {
|
||||
throw IllegalArgumentException("Invalid Char code: $code")
|
||||
}
|
||||
return Char(code.toUShort())
|
||||
return code.toChar()
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user