aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_nif.c
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2011-07-13 12:24:47 +0200
committerSverker Eriksson <[email protected]>2011-07-13 12:24:47 +0200
commit59c43904b029c5ccde511fcb83a809ed8370d887 (patch)
tree2b8045f5ed8a1f2b78968a12b19847dfa7b51412 /erts/emulator/beam/erl_nif.c
parent089b8c357f5e7c96605c8f8cab4b3c856081dc39 (diff)
parent1c0966044b66d20f3f6607e91076e0a61918f1a4 (diff)
downloadotp-59c43904b029c5ccde511fcb83a809ed8370d887.tar.gz
otp-59c43904b029c5ccde511fcb83a809ed8370d887.tar.bz2
otp-59c43904b029c5ccde511fcb83a809ed8370d887.zip
Merge branch 'sverker/enif_make_int64-halfword/OTP-9394' into dev
* sverker/enif_make_int64-halfword/OTP-9394: Fix halfword bug in enif_make_int64
Diffstat (limited to 'erts/emulator/beam/erl_nif.c')
-rw-r--r--erts/emulator/beam/erl_nif.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/erts/emulator/beam/erl_nif.c b/erts/emulator/beam/erl_nif.c
index 68421b4387..d9b1a8e89d 100644
--- a/erts/emulator/beam/erl_nif.c
+++ b/erts/emulator/beam/erl_nif.c
@@ -833,8 +833,11 @@ ERL_NIF_TERM enif_make_uint(ErlNifEnv* env, unsigned i)
ERL_NIF_TERM enif_make_long(ErlNifEnv* env, long i)
{
+ if (IS_SSMALL(i)) {
+ return make_small(i);
+ }
#if SIZEOF_LONG == ERTS_SIZEOF_ETERM
- return IS_SSMALL(i) ? make_small(i) : small_to_big(i, alloc_heap(env,2));
+ return small_to_big(i, alloc_heap(env,2));
#elif SIZEOF_LONG == 8
ensure_heap(env,3);
return erts_sint64_to_big(i, &env->hp);
@@ -843,8 +846,11 @@ ERL_NIF_TERM enif_make_long(ErlNifEnv* env, long i)
ERL_NIF_TERM enif_make_ulong(ErlNifEnv* env, unsigned long i)
{
+ if (IS_USMALL(0,i)) {
+ return make_small(i);
+ }
#if SIZEOF_LONG == ERTS_SIZEOF_ETERM
- return IS_USMALL(0,i) ? make_small(i) : uint_to_big(i,alloc_heap(env,2));
+ return uint_to_big(i,alloc_heap(env,2));
#elif SIZEOF_LONG == 8
ensure_heap(env,3);
return erts_uint64_to_big(i, &env->hp);