diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | marshal.c | 4 |
2 files changed, 7 insertions, 2 deletions
@@ -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. @@ -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 |