ruby-changes:30239
From: akr <ko1@a...>
Date: Wed, 31 Jul 2013 23:22:06 +0900 (JST)
Subject: [ruby-changes:30239] akr:r42291 (trunk): * bignum.c (power_cache_get_power): Change numdigits_ret to size_t *.
akr 2013-07-31 23:21:54 +0900 (Wed, 31 Jul 2013) New Revision: 42291 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=42291 Log: * bignum.c (power_cache_get_power): Change numdigits_ret to size_t *. (big2str_orig): Change len argument to size_t. (big2str_karatsuba): Ditto. (rb_big2str1): Follow the above changes. Modified files: trunk/ChangeLog trunk/bignum.c Index: ChangeLog =================================================================== --- ChangeLog (revision 42290) +++ ChangeLog (revision 42291) @@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Wed Jul 31 23:19:06 2013 Tanaka Akira <akr@f...> + + * bignum.c (power_cache_get_power): Change numdigits_ret to size_t *. + (big2str_orig): Change len argument to size_t. + (big2str_karatsuba): Ditto. + (rb_big2str1): Follow the above changes. + Wed Jul 31 22:59:47 2013 Kouhei Sutou <kou@c...> * test/rexml/parse/test_notation_declaration.rb: Change class Index: bignum.c =================================================================== --- bignum.c (revision 42290) +++ bignum.c (revision 42291) @@ -4145,12 +4145,12 @@ power_cache_get_power0(int base, int i) https://github.com/ruby/ruby/blob/trunk/bignum.c#L4145 } static VALUE -power_cache_get_power(int base, int power_level, long *numdigits_ret) +power_cache_get_power(int base, int power_level, size_t *numdigits_ret) { VALUE power; power = power_cache_get_power0(base, power_level); if (numdigits_ret) - *numdigits_ret = KARATSUBA_BIG2STR_DIGITS * (1 << power_level); + *numdigits_ret = KARATSUBA_BIG2STR_DIGITS * ((size_t)1 << power_level); return power; } @@ -4213,9 +4213,10 @@ struct big2str_struct { https://github.com/ruby/ruby/blob/trunk/bignum.c#L4213 }; static long -big2str_orig(struct big2str_struct *b2s, VALUE x, char* ptr, long len, int trim) +big2str_orig(struct big2str_struct *b2s, VALUE x, char* ptr, size_t len, int trim) { - long i = RBIGNUM_LEN(x), j = len; + long i = RBIGNUM_LEN(x); + size_t j = len; BDIGIT* ds = BDIGITS(x); while (i && j > 0) { @@ -4246,9 +4247,10 @@ big2str_orig(struct big2str_struct *b2s, https://github.com/ruby/ruby/blob/trunk/bignum.c#L4247 static long big2str_karatsuba(struct big2str_struct *b2s, VALUE x, char* ptr, - int power_level, long len, int trim) + int power_level, size_t len, int trim) { - long lh, ll, m1; + long lh, ll; + size_t m1; VALUE b, q, r; if (BIGZEROP(x)) { @@ -4364,11 +4366,11 @@ rb_big2str1(VALUE x, int base, int trim) https://github.com/ruby/ruby/blob/trunk/bignum.c#L4366 xx = rb_big_clone(x); RBIGNUM_SET_SIGN(xx, 1); if (power_level < 0) { - len = off + big2str_orig(&b2s_data, xx, ptr + off, n2, trim); + len = off + big2str_orig(&b2s_data, xx, ptr + off, (size_t)n2, trim); } else { len = off + big2str_karatsuba(&b2s_data, xx, ptr + off, power_level, - n2, trim); + (size_t)n2, trim); } rb_big_resize(xx, 0); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/