зеркало из https://github.com/github/ruby.git
* bignum.c (rb_cstr_to_inum): Merge two temporary buffers.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41748 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
2ade221827
Коммит
4658478ae1
|
@ -1,3 +1,7 @@
|
||||||
|
Tue Jul 2 21:17:37 2013 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
|
* bignum.c (rb_cstr_to_inum): Merge two temporary buffers.
|
||||||
|
|
||||||
Tue Jul 2 20:25:04 2013 Tanaka Akira <akr@fsij.org>
|
Tue Jul 2 20:25:04 2013 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* bignum.c (rb_cstr_to_inum): Use BDIGIT_DBL to collect adjacent digits.
|
* bignum.c (rb_cstr_to_inum): Use BDIGIT_DBL to collect adjacent digits.
|
||||||
|
|
12
bignum.c
12
bignum.c
|
@ -2095,7 +2095,7 @@ rb_cstr_to_inum(const char *str, int base, int badcheck)
|
||||||
int j;
|
int j;
|
||||||
size_t num_bdigits;
|
size_t num_bdigits;
|
||||||
size_t unit;
|
size_t unit;
|
||||||
VALUE tmpu = 0, tmpv = 0;
|
VALUE tmpuv = 0;
|
||||||
BDIGIT *uds, *vds, *tds;
|
BDIGIT *uds, *vds, *tds;
|
||||||
|
|
||||||
power = maxpow_in_bdigit_dbl(base, &digits_per_bdigits_dbl);
|
power = maxpow_in_bdigit_dbl(base, &digits_per_bdigits_dbl);
|
||||||
|
@ -2103,8 +2103,8 @@ rb_cstr_to_inum(const char *str, int base, int badcheck)
|
||||||
size = p - buf;
|
size = p - buf;
|
||||||
num_bdigits = roomof(size, digits_per_bdigits_dbl)*2;
|
num_bdigits = roomof(size, digits_per_bdigits_dbl)*2;
|
||||||
|
|
||||||
uds = ALLOCV_N(BDIGIT, tmpu, num_bdigits);
|
uds = ALLOCV_N(BDIGIT, tmpuv, 2*num_bdigits);
|
||||||
vds = ALLOCV_N(BDIGIT, tmpv, num_bdigits);
|
vds = uds + num_bdigits;
|
||||||
|
|
||||||
powerv = bignew(2, 1);
|
powerv = bignew(2, 1);
|
||||||
BDIGITS(powerv)[0] = BIGLO(power);
|
BDIGITS(powerv)[0] = BIGLO(power);
|
||||||
|
@ -2151,10 +2151,8 @@ rb_cstr_to_inum(const char *str, int base, int badcheck)
|
||||||
z = bignew(num_bdigits, sign);
|
z = bignew(num_bdigits, sign);
|
||||||
MEMCPY(BDIGITS(z), uds, BDIGIT, num_bdigits);
|
MEMCPY(BDIGITS(z), uds, BDIGIT, num_bdigits);
|
||||||
|
|
||||||
if (tmpv)
|
if (tmpuv)
|
||||||
ALLOCV_END(tmpv);
|
ALLOCV_END(tmpuv);
|
||||||
if (tmpu)
|
|
||||||
ALLOCV_END(tmpu);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче