JS: fix long emulation in JS engines that don't support BigInt

This commit is contained in:
Alexey Andreev 2021-03-18 10:14:18 +03:00
parent 0b36010a19
commit 2c7b5be62e

View File

@ -744,6 +744,12 @@ function Long(lo, hi) {
Long.prototype.__teavm_class__ = function() { Long.prototype.__teavm_class__ = function() {
return "long"; return "long";
}; };
function Long_isPositive(a) {
return (a.hi & 0x80000000) === 0;
}
function Long_isNegative(a) {
return (a.hi & 0x80000000) !== 0;
}
var Long_MAX_NORMAL = 1 << 18; var Long_MAX_NORMAL = 1 << 18;
var Long_ZERO; var Long_ZERO;
@ -754,14 +760,6 @@ var Long_toNumber;
var Long_hi; var Long_hi;
var Long_lo; var Long_lo;
if (typeof BigInt !== "function") { if (typeof BigInt !== "function") {
function Long_isPositive(a) {
return (a.hi & 0x80000000) === 0;
}
function Long_isNegative(a) {
return (a.hi & 0x80000000) !== 0;
}
Long.prototype.toString = function() { Long.prototype.toString = function() {
var result = []; var result = [];
var n = this; var n = this;