salomonbrys
09/20/2021, 11:55 AMLong
to JS with the IR compiler ???
@JsExport
fun long(): Long = 0x12_34_56_78_9A_BC_DE_F0
Calling this long
function with typescript returns the following object: Long { _low: -1698898192, _high: 305419896 }
Casting to int does NOT do the trick as the compiler overflows :
@JsExport
fun int(): Int = 0x12_34_56_78_9A_BC_DE_F0.toInt()
Calling this int
function with typescript returns a negative number: -1698898192
How can I export a Long
?hfhbd
09/20/2021, 11:57 AMLong
implementation.spand
09/20/2021, 11:59 AMsalomonbrys
09/20/2021, 11:59 AM9223372036854775
, which is way over Int.MAX_VALUE
.
Running in node:
let n = 9223372036854775
n = n + 1
Gives the correct valuespand
09/20/2021, 12:02 PMsalomonbrys
09/20/2021, 12:03 PM