зеркало из https://github.com/github/ruby.git
* 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42291 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
5f8cba0705
Коммит
9e84b33564
|
@ -1,3 +1,10 @@
|
|||
Wed Jul 31 23:19:06 2013 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* 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@cozmixng.org>
|
||||
|
||||
* test/rexml/parse/test_notation_declaration.rb: Change class
|
||||
|
|
18
bignum.c
18
bignum.c
|
@ -4145,12 +4145,12 @@ power_cache_get_power0(int base, int i)
|
|||
}
|
||||
|
||||
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 {
|
|||
};
|
||||
|
||||
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, VALUE x, char* ptr, long len, int trim)
|
|||
|
||||
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)
|
|||
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);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче