From 633e4949bda73c7e6fdbc330dd48b46884e5f548 Mon Sep 17 00:00:00 2001 From: akr Date: Sat, 8 Jun 2013 14:57:28 +0000 Subject: [PATCH] * 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 --- ChangeLog | 5 +++++ numeric.c | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 492291dc19..d7569960e2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sat Jun 8 23:56:00 2013 Tanaka Akira + + * numeric.c (rb_num_to_uint): Use rb_absint_size instead of + RBIGNUM_LEN. + Sat Jun 8 22:53:45 2013 Tanaka Akira * marshal.c (r_object0): Use rb_integer_unpack. diff --git a/numeric.c b/numeric.c index f675034e6c..5a15e5b82e 100644 --- a/numeric.c +++ b/numeric.c @@ -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