aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/bif.c
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2013-12-12 10:58:59 +0100
committerBjörn-Egil Dahlberg <[email protected]>2014-01-29 11:08:41 +0100
commit76b8ea8ab1eb4ce099f88ccb8d1721c438d0ada4 (patch)
treeeb511b92e2259dd6239617d22c0540bad2e7b0c1 /erts/emulator/beam/bif.c
parentd5c238473b9cec819d93faaef4ccc00ddb60465f (diff)
downloadotp-76b8ea8ab1eb4ce099f88ccb8d1721c438d0ada4.tar.gz
otp-76b8ea8ab1eb4ce099f88ccb8d1721c438d0ada4.tar.bz2
otp-76b8ea8ab1eb4ce099f88ccb8d1721c438d0ada4.zip
erts: Add BIF erts_internal:cmp_term/2
Compares terms where integer() < float().
Diffstat (limited to 'erts/emulator/beam/bif.c')
-rw-r--r--erts/emulator/beam/bif.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/erts/emulator/beam/bif.c b/erts/emulator/beam/bif.c
index 61c1abedb5..9c4801041f 100644
--- a/erts/emulator/beam/bif.c
+++ b/erts/emulator/beam/bif.c
@@ -4615,6 +4615,17 @@ BIF_RETTYPE bump_reductions_1(BIF_ALIST_1)
BIF_RET2(am_true, reds);
}
+BIF_RETTYPE erts_internal_cmp_term_2(BIF_ALIST_2) {
+ int res = CMP_TERM(BIF_ARG_1,BIF_ARG_2);
+
+ /* ensure -1, 0, 1 result */
+ if (res < 0) {
+ BIF_RET(make_small(-1));
+ } else if (res > 0) {
+ BIF_RET(make_small(1));
+ }
+ BIF_RET(make_small(0));
+}
/*
* Processes doing yield on return in a bif ends up in bif_return_trap().
*/