summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--marshal.c4
2 files changed, 7 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 8df04e77cb..15f74fa6db 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Wed Jun 5 00:09:32 2013 Tanaka Akira <akr@fsij.org>
+
+ * marshal.c (r_object0): Generalize a round up expression.
+ Use BDIGIT instead of int.
+
Tue Jun 4 23:44:02 2013 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
* object.c (rb_Hash): fix docs. patched by Stefan Schüßler.
diff --git a/marshal.c b/marshal.c
index e9ae3e3a98..e5ded68f05 100644
--- a/marshal.c
+++ b/marshal.c
@@ -1620,7 +1620,7 @@ r_object0(struct load_arg *arg, int *ivp, VALUE extmod)
#if SIZEOF_BDIGITS == SIZEOF_SHORT
rb_big_resize((VALUE)big, len);
#else
- rb_big_resize((VALUE)big, (len + 1) * 2 / sizeof(BDIGIT));
+ rb_big_resize((VALUE)big, (len * 2 + sizeof(BDIGIT) - 1) / sizeof(BDIGIT));
#endif
digits = RBIGNUM_DIGITS(big);
MEMCPY(digits, RSTRING_PTR(data), char, len * 2);
@@ -1638,7 +1638,7 @@ r_object0(struct load_arg *arg, int *ivp, VALUE extmod)
int i;
for (i=0; i<SIZEOF_BDIGITS; i++) {
- num |= (int)p[i] << shift;
+ num |= (BDIGIT)p[i] << shift;
shift += 8;
}
#else