Suppress code warnings in kotlin-stdlib

This commit is contained in:
Alexander Udalov
2020-08-13 19:13:31 +02:00
parent 5ef4f7df5a
commit da6d904c6e
32 changed files with 62 additions and 18 deletions
@@ -7,15 +7,15 @@ package kotlin.js
internal fun numberToByte(a: dynamic): Byte = toByte(numberToInt(a))
internal fun numberToDouble(a: dynamic): Double = js("+a").unsafeCast<Double>()
internal fun numberToDouble(@Suppress("UNUSED_PARAMETER") a: dynamic): Double = js("+a").unsafeCast<Double>()
internal fun numberToInt(a: dynamic): Int = if (a is Long) a.toInt() else doubleToInt(a)
internal fun numberToShort(a: dynamic): Short = toShort(numberToInt(a))
// << and >> shifts are used to preserve sign of the number
internal fun toByte(a: dynamic): Byte = js("a << 24 >> 24").unsafeCast<Byte>()
internal fun toShort(a: dynamic): Short = js("a << 16 >> 16").unsafeCast<Short>()
internal fun toByte(@Suppress("UNUSED_PARAMETER") a: dynamic): Byte = js("a << 24 >> 24").unsafeCast<Byte>()
internal fun toShort(@Suppress("UNUSED_PARAMETER") a: dynamic): Short = js("a << 16 >> 16").unsafeCast<Short>()
internal fun numberToLong(a: dynamic): Long = if (a is Long) a else fromNumber(a)