Skip to content

Commit e1ae48e

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 1092ec3 commit e1ae48e

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
@@ -33,21 +33,3 @@ CALL_JS_1_TRIPLE(sqrt)
3333

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

0 commit comments

Comments
 (0)