Skip to content

Commit a08cb90

Browse files
committed
Remove round and rint from jsmath library. NFC
These native versions of these function should be just as efficient since both of them are based on only `floor` and `ceil` which themslelves have good native versions. See js_math.h:
1 parent d04f14a commit a08cb90

File tree

1 file changed

+0
-18
lines changed

1 file changed

+0
-18
lines changed

system/lib/jsmath.c

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,3 @@ CALL_JS_1_TRIPLE(sqrt, Math.sqrt)
3434

3535
CALL_JS_2_TRIPLE(atan2, Math.atan2)
3636
CALL_JS_2_TRIPLE(pow, Math.pow)
37-
38-
#define CALL_JS_1_IMPL(cname, type, impl) \
39-
EM_JS(type, JS_##cname, (type x), impl); \
40-
type cname(type x) { return JS_##cname(x); }
41-
42-
#define CALL_JS_1_IMPL_TRIPLE(cname, impl) \
43-
CALL_JS_1_IMPL(cname, double, impl) \
44-
CALL_JS_1_IMPL(cname##f, float, impl)
45-
46-
CALL_JS_1_IMPL_TRIPLE(round, {
47-
return x >= 0 ? Math.floor(x + 0.5) : Math.ceil(x - 0.5);
48-
})
49-
CALL_JS_1_IMPL_TRIPLE(rint, {
50-
function round(x) {
51-
return x >= 0 ? Math.floor(x + 0.5) : Math.ceil(x - 0.5);
52-
}
53-
return (x - Math.floor(x) != .5) ? round(x) : round(x / 2) * 2;
54-
})

0 commit comments

Comments
 (0)