From 84d8e582494ef6d0a8581a4d42d41c68ba07bf0b Mon Sep 17 00:00:00 2001 From: akr Date: Fri, 7 Jun 2013 10:24:07 +0000 Subject: [PATCH] * bignum.c (rb_absint_size): Use numberof. (rb_int_export): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41143 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ bignum.c | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3b0960105a..2501a270b4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Fri Jun 7 19:23:15 2013 Tanaka Akira + + * bignum.c (rb_absint_size): Use numberof. + (rb_int_export): Ditto. + Fri Jun 7 18:58:56 2013 Tanaka Akira * internal.h (numberof): Gathered from various files. diff --git a/bignum.c b/bignum.c index e33dbfb5bb..9ae0106b22 100644 --- a/bignum.c +++ b/bignum.c @@ -473,14 +473,14 @@ rb_absint_size(VALUE val, int *number_of_leading_zero_bits) #else { int i; - for (i = 0; i < (int)(sizeof(fixbuf)/sizeof(*fixbuf)); i++) { + for (i = 0; i < numberof(fixbuf); i++) { fixbuf[i] = (BDIGIT)(v & ((1L << (SIZEOF_BDIGITS * CHAR_BIT)) - 1)); v >>= SIZEOF_BDIGITS * CHAR_BIT; } } #endif dp = fixbuf; - de = fixbuf + sizeof(fixbuf)/sizeof(*fixbuf); + de = fixbuf + numberof(fixbuf); } else { dp = BDIGITS(val); @@ -626,14 +626,14 @@ rb_int_export(VALUE val, int *signp, size_t *wordcount_allocated, void *words, s #else { int i; - for (i = 0; i < (int)(sizeof(fixbuf)/sizeof(*fixbuf)); i++) { + for (i = 0; i < numberof(fixbuf); i++) { fixbuf[i] = (BDIGIT)(v & ((1L << (SIZEOF_BDIGITS * CHAR_BIT)) - 1)); v >>= SIZEOF_BDIGITS * CHAR_BIT; } } #endif dp = fixbuf; - de = fixbuf + sizeof(fixbuf)/sizeof(*fixbuf); + de = fixbuf + numberof(fixbuf); } else { sign = RBIGNUM_POSITIVE_P(val) ? 1 : -1;