summaryrefslogtreecommitdiff
path: root/marshal.c
diff options
context:
space:
mode:
Diffstat (limited to 'marshal.c')
-rw-r--r--marshal.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/marshal.c b/marshal.c
index 284d4e0fe8..ec6cc35fd1 100644
--- a/marshal.c
+++ b/marshal.c
@@ -824,7 +824,11 @@ r_object(arg)
OBJSETUP(big, rb_cBignum, T_BIGNUM);
big->sign = (r_byte(arg) == '+');
len = r_long(arg);
+#if SIZEOF_BDIGITS == SIZEOF_SHORT
+ big->len = len;
+#else
big->len = (len + 1) * sizeof(short) / sizeof(BDIGIT);
+#endif
big->digits = digits = ALLOC_N(BDIGIT, big->len);
while (len > 0) {
#if SIZEOF_BDIGITS > SIZEOF_SHORT