Skip to content

Commit b16b3be

Browse files
committed
improve portable code
1 parent 5913f9a commit b16b3be

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

std/portable/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ var globalScope = typeof window !== "undefined" && window || typeof global !== "
44

55
globalScope.ASC_TARGET = 0;
66

7+
var F64 = new Float64Array(1);
8+
var U64 = new Uint32Array(F64.buffer);
9+
710
Object.defineProperties(
811
globalScope["i8"] = function i8(value) { return value << 24 >> 24; }
912
, {
@@ -224,7 +227,7 @@ globalScope["fmodf"] = function fmodf(x, y) {
224227

225228
globalScope["JSMath"] = Math;
226229
globalScope["JSMath"].signbit = function signbit(x) {
227-
return (x = +x) != x ? x : x == 0 ? 1 / x == Infinity : x > 0;
230+
F64[0] = x; return Boolean(U64[1] >>> 31);
228231
}
229232

230233
globalScope["memory"] = (() => {

0 commit comments

Comments
 (0)