From ebb0f16458273af5ee69e2c81e8733d3968a51c0 Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Thu, 12 Dec 2024 12:00:11 -0800 Subject: [PATCH] Remove unnecessary functions from JSMATH. NFC See the comments at the top of `emscripten/js_math.h` for why JS versions of these functions are not needed. As a followup I plan to map `jsmath.c` functions to `em_math.h` functions instead of using EM_JS here. See #19284 --- system/lib/jsmath.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/system/lib/jsmath.c b/system/lib/jsmath.c index b6a7ff3a80b82..a4f65b396cdc4 100644 --- a/system/lib/jsmath.c +++ b/system/lib/jsmath.c @@ -23,9 +23,6 @@ CALL_JS_1_TRIPLE(atan, Math.atan) CALL_JS_1_TRIPLE(exp, Math.exp) CALL_JS_1_TRIPLE(log, Math.log) CALL_JS_1_TRIPLE(sqrt, Math.sqrt) -CALL_JS_1_TRIPLE(fabs, Math.abs) -CALL_JS_1_TRIPLE(ceil, Math.ceil) -CALL_JS_1_TRIPLE(floor, Math.floor) #define CALL_JS_2(cname, jsname, type, casttype) \ EM_JS(type, JS_##cname, (type x, type y), { return jsname(x, y) }); \ @@ -46,15 +43,9 @@ CALL_JS_2_TRIPLE(pow, Math.pow) CALL_JS_1_IMPL(cname, double, double, impl) \ CALL_JS_1_IMPL(cname##f, float, float, impl) -CALL_JS_1_IMPL_TRIPLE(round, { - return x >= 0 ? Math.floor(x + 0.5) : Math.ceil(x - 0.5); -}) CALL_JS_1_IMPL_TRIPLE(rint, { function round(x) { return x >= 0 ? Math.floor(x + 0.5) : Math.ceil(x - 0.5); } return (x - Math.floor(x) != .5) ? round(x) : round(x / 2) * 2; }) - -double nearbyint(double x) { return rint(x); } -float nearbyintf(float x) { return rintf(x); }