diff options
author | Henrik Nord <[email protected]> | 2011-09-08 16:33:33 +0200 |
---|---|---|
committer | Henrik Nord <[email protected]> | 2011-09-08 16:33:36 +0200 |
commit | 262a9af33d3ceb4cb032c434b100cea7d4b0d60e (patch) | |
tree | d89ffaced24cff1ec895a101f999a3ae1cfd79c6 /erts/emulator/beam/erl_nif.c | |
parent | 2ee4aed839aa63243e2c12694822cfdef7c4ea60 (diff) | |
parent | 03d8c2877342d5ed57596330a61ec0374092f136 (diff) | |
download | otp-262a9af33d3ceb4cb032c434b100cea7d4b0d60e.tar.gz otp-262a9af33d3ceb4cb032c434b100cea7d4b0d60e.tar.bz2 otp-262a9af33d3ceb4cb032c434b100cea7d4b0d60e.zip |
Merge branch 'fm/enif_compare-64-to-32bits-cast' into dev
* fm/enif_compare-64-to-32bits-cast:
Fix enif_compare on 64bits machines
OTP-9533
Diffstat (limited to 'erts/emulator/beam/erl_nif.c')
-rw-r--r-- | erts/emulator/beam/erl_nif.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/erts/emulator/beam/erl_nif.c b/erts/emulator/beam/erl_nif.c index d9b1a8e89d..6e7ac43676 100644 --- a/erts/emulator/beam/erl_nif.c +++ b/erts/emulator/beam/erl_nif.c @@ -578,7 +578,15 @@ int enif_is_identical(Eterm lhs, Eterm rhs) int enif_compare(Eterm lhs, Eterm rhs) { - return CMP(lhs,rhs); + Sint result = CMP(lhs,rhs); + + if (result < 0) { + return -1; + } else if (result > 0) { + return 1; + } + + return result; } int enif_get_tuple(ErlNifEnv* env, Eterm tpl, int* arity, const Eterm** array) |