зеркало из https://github.com/github/ruby.git
* bignum.c (rb_ull2big): Refactored.
(rb_uint2big): Useless code removed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41505 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
d1c518d416
Коммит
de8ca8a138
|
@ -1,3 +1,8 @@
|
|||
Fri Jun 21 06:43:59 2013 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* bignum.c (rb_ull2big): Refactored.
|
||||
(rb_uint2big): Useless code removed.
|
||||
|
||||
Fri Jun 21 05:37:39 2013 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* gc.c (gc_prof_sweep_timer_stop): accumulate sweep time only when
|
||||
|
|
22
bignum.c
22
bignum.c
|
@ -345,7 +345,6 @@ rb_uint2big(VALUE n)
|
|||
#if SIZEOF_BDIGITS >= SIZEOF_VALUE
|
||||
digits[0] = n;
|
||||
#else
|
||||
i = 0;
|
||||
for (i = 0; i < bdigit_roomof(SIZEOF_VALUE); i++) {
|
||||
digits[i] = BIGLO(n);
|
||||
n = BIGDN(n);
|
||||
|
@ -1830,19 +1829,20 @@ rb_str_to_inum(VALUE str, int base, int badcheck)
|
|||
static VALUE
|
||||
rb_ull2big(unsigned LONG_LONG n)
|
||||
{
|
||||
BDIGIT_DBL num = n;
|
||||
long i = 0;
|
||||
BDIGIT *digits;
|
||||
VALUE big;
|
||||
long i;
|
||||
VALUE big = bignew(DIGSPERLL, bdigit_roomof(SIZEOF_LONG_LONG));
|
||||
BDIGIT *digits = BDIGITS(big);
|
||||
|
||||
big = bignew(DIGSPERLL, 1);
|
||||
digits = BDIGITS(big);
|
||||
while (i < DIGSPERLL) {
|
||||
digits[i++] = BIGLO(num);
|
||||
num = BIGDN(num);
|
||||
#if SIZEOF_BDIGITS >= SIZEOF_LONG_LONG
|
||||
digits[0] = n;
|
||||
#else
|
||||
for (i = 0; i < bdigit_roomof(SIZEOF_LONG_LONG); i++) {
|
||||
digits[i] = BIGLO(n);
|
||||
n = BIGDN(n);
|
||||
}
|
||||
#endif
|
||||
|
||||
i = DIGSPERLL;
|
||||
i = bdigit_roomof(SIZEOF_LONG_LONG);
|
||||
while (i-- && !digits[i]) ;
|
||||
RBIGNUM_SET_LEN(big, i+1);
|
||||
return big;
|
||||
|
|
Загрузка…
Ссылка в новой задаче