Skip to content

Commit e724526

Browse files
committed
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
1 parent 1171ada commit e724526

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

system/lib/jsmath.c

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ CALL_JS_1_TRIPLE(atan, Math.atan)
2323
CALL_JS_1_TRIPLE(exp, Math.exp)
2424
CALL_JS_1_TRIPLE(log, Math.log)
2525
CALL_JS_1_TRIPLE(sqrt, Math.sqrt)
26-
CALL_JS_1_TRIPLE(fabs, Math.abs)
27-
CALL_JS_1_TRIPLE(ceil, Math.ceil)
28-
CALL_JS_1_TRIPLE(floor, Math.floor)
2926

3027
#define CALL_JS_2(cname, jsname, type, casttype) \
3128
EM_JS(type, JS_##cname, (type x, type y), { return jsname(x, y) }); \
@@ -46,15 +43,7 @@ CALL_JS_2_TRIPLE(pow, Math.pow)
4643
CALL_JS_1_IMPL(cname, double, double, impl) \
4744
CALL_JS_1_IMPL(cname##f, float, float, impl)
4845

49-
CALL_JS_1_IMPL_TRIPLE(round, {
50-
return x >= 0 ? Math.floor(x + 0.5) : Math.ceil(x - 0.5);
51-
})
5246
CALL_JS_1_IMPL_TRIPLE(rint, {
53-
function round(x) {
54-
return x >= 0 ? Math.floor(x + 0.5) : Math.ceil(x - 0.5);
55-
}
47+
var round(x) => x >= 0 ? Math.floor(x + 0.5) : Math.ceil(x - 0.5);
5648
return (x - Math.floor(x) != .5) ? round(x) : round(x / 2) * 2;
5749
})
58-
59-
double nearbyint(double x) { return rint(x); }
60-
float nearbyintf(float x) { return rintf(x); }

0 commit comments

Comments
 (0)