aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2014-08-14 09:43:13 +0200
committerLukas Larsson <[email protected]>2014-08-14 09:43:13 +0200
commit63c9133c74649c77b885c083985dfd1aaa982e42 (patch)
tree305154bec3050e5173cf785dff37baaeb496fa2f /erts/emulator
parentf019d0967498bf3550c8a0e35554f5a467edfa1f (diff)
parent8fe6c462ec8e20ab2ad14b0c1addf1030ada0e54 (diff)
downloadotp-63c9133c74649c77b885c083985dfd1aaa982e42.tar.gz
otp-63c9133c74649c77b885c083985dfd1aaa982e42.tar.bz2
otp-63c9133c74649c77b885c083985dfd1aaa982e42.zip
Merge branch 'maint'
* maint: Properly handle SINT_MIN in small_to_big() Use offsetof() in io.c
Diffstat (limited to 'erts/emulator')
-rw-r--r--erts/emulator/beam/big.c6
-rw-r--r--erts/emulator/beam/io.c2
2 files changed, 5 insertions, 3 deletions
diff --git a/erts/emulator/beam/big.c b/erts/emulator/beam/big.c
index 41a041eba6..4d087bf967 100644
--- a/erts/emulator/beam/big.c
+++ b/erts/emulator/beam/big.c
@@ -1506,13 +1506,15 @@ Eterm uword_to_big(UWord x, Eterm *y)
*/
Eterm small_to_big(Sint x, Eterm *y)
{
+ Uint xu;
if (x >= 0) {
+ xu = x;
*y = make_pos_bignum_header(1);
} else {
- x = -x;
+ xu = -(Uint)x;
*y = make_neg_bignum_header(1);
}
- BIG_DIGIT(y, 0) = x;
+ BIG_DIGIT(y, 0) = xu;
return make_big(y);
}
diff --git a/erts/emulator/beam/io.c b/erts/emulator/beam/io.c
index d028737664..0f86d8e41d 100644
--- a/erts/emulator/beam/io.c
+++ b/erts/emulator/beam/io.c
@@ -7166,7 +7166,7 @@ char *driver_dl_error(void)
#define ERL_DRV_SYS_INFO_SIZE(LAST_FIELD) \
- (((size_t) &((ErlDrvSysInfo *) 0)->LAST_FIELD) \
+ (offsetof(ErlDrvSysInfo, LAST_FIELD) \
+ sizeof(((ErlDrvSysInfo *) 0)->LAST_FIELD))
void