Skip to content

Commit d04f14a

Browse files
authored
Remove unnecessary functions from jsmath.c. NFC (#23143)
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 3b8d3fa commit d04f14a

File tree

2 files changed

+1
-7
lines changed

2 files changed

+1
-7
lines changed

system/include/emscripten/em_math.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ extern "C" {
2929
// Math.ceil -> f32.ceil and f64.ceil (ceil() and ceilf() in math.h)
3030
// Math.clz32(x) -> i32.clz and i64.clz (call __builtin_clz() and __builtin_clzll())
3131
// Math.floor -> f32.floor and f64.floor (floor() and floorf() in math.h)
32-
// Math.fround -> f64.promote_f32(f32.demote_f64()) (call double d = (double)(float)someDouble;)
32+
// Math.fround -> f64.promote_f32(f32.demote_f64()) (double d = (double)(float)someDouble;)
3333
// Math.imul(x, y) -> i32.mul and i64.mul (directly multiply two signed integers)
3434
// Math.min -> f32.min and f64.min (fminf() and fmin() in math.h)
3535
// Math.max -> f32.max and f64.max (fmaxf() and fmax() in math.h)

system/lib/jsmath.c

Lines changed: 0 additions & 6 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) \
3128
EM_JS(type, JS_##cname, (type x, type y), { return jsname(x, y) }); \
@@ -55,6 +52,3 @@ CALL_JS_1_IMPL_TRIPLE(rint, {
5552
}
5653
return (x - Math.floor(x) != .5) ? round(x) : round(x / 2) * 2;
5754
})
58-
59-
double nearbyint(double x) { return rint(x); }
60-
float nearbyintf(float x) { return rintf(x); }

0 commit comments

Comments
 (0)