aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2011-07-27 16:41:13 +0200
committerLukas Larsson <[email protected]>2011-10-11 17:11:16 +0200
commitb47a8245774ee1d57872d99015081e6307e037f1 (patch)
tree1eb6e28a8746a25dcc40f0baeea4dfb84dd07744 /erts/emulator
parent5d4e1831fafb5c2cb119d4b2cc5a704f3b9c1c55 (diff)
downloadotp-b47a8245774ee1d57872d99015081e6307e037f1.tar.gz
otp-b47a8245774ee1d57872d99015081e6307e037f1.tar.bz2
otp-b47a8245774ee1d57872d99015081e6307e037f1.zip
Optimise bugnum and small comparison
As it is possible to assume that bignums are bigger than smalls, we can just check the sign of the bignum.
Diffstat (limited to 'erts/emulator')
-rw-r--r--erts/emulator/beam/utils.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/erts/emulator/beam/utils.c b/erts/emulator/beam/utils.c
index e67a793b9a..5e22aa42c8 100644
--- a/erts/emulator/beam/utils.c
+++ b/erts/emulator/beam/utils.c
@@ -2657,8 +2657,10 @@ tailrecur_ne:
switch(_NUMBER_CODE(a_tag, b_tag)) {
case SMALL_BIG:
- big = small_to_big(signed_val(a), big_buf);
- j = big_comp(big, bw);
+ j = big_sign(bw) ? 1 : -1;
+ break;
+ case BIG_SMALL:
+ j = big_sign(aw) ? -1 : 1;
break;
case SMALL_FLOAT:
GET_DOUBLE(bw, f2);
@@ -2674,10 +2676,6 @@ tailrecur_ne:
j = signed_val(a) - (Sint) f2.fd;
}
break;
- case BIG_SMALL:
- big = small_to_big(signed_val(b), big_buf);
- j = big_comp(aw, big);
- break;
case BIG_FLOAT:
GET_DOUBLE(bw, f2);
if ((f2.fd < 9007199254740990.0 && f2.fd > -9007199254740990.0)) {