1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* numeric.c (rb_num_to_uint): Use rb_absint_size instead of

RBIGNUM_LEN.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41183 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2013-06-08 14:57:28 +00:00
parent ceb6d94265
commit 633e4949bd
2 changed files with 6 additions and 2 deletions

View file

@ -1,3 +1,8 @@
Sat Jun 8 23:56:00 2013 Tanaka Akira <akr@fsij.org>
* numeric.c (rb_num_to_uint): Use rb_absint_size instead of
RBIGNUM_LEN.
Sat Jun 8 22:53:45 2013 Tanaka Akira <akr@fsij.org>
* marshal.c (r_object0): Use rb_integer_unpack.

View file

@ -142,8 +142,7 @@ rb_num_to_uint(VALUE val, unsigned int *ret)
return NUMERR_TOOLARGE;
#else
/* long is 32bit */
#define DIGSPERLONG (SIZEOF_LONG/SIZEOF_BDIGITS)
if (RBIGNUM_LEN(val) > DIGSPERLONG) return NUMERR_TOOLARGE;
if (rb_absint_size(val, NULL) > sizeof(int)) return NUMERR_TOOLARGE;
*ret = (unsigned int)rb_big2ulong((VALUE)val);
return 0;
#endif