ruby-changes:29887
From: akr <ko1@a...>
Date: Sat, 13 Jul 2013 15:36:50 +0900 (JST)
Subject: [ruby-changes:29887] akr:r41939 (trunk): * bignum.c (bary_small_lshift): Functions moved to remove
akr 2013-07-13 15:36:40 +0900 (Sat, 13 Jul 2013) New Revision: 41939 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=41939 Log: * bignum.c (bary_small_lshift): Functions moved to remove declaration. (bary_small_rshift): Ditto. Modified files: trunk/ChangeLog trunk/bignum.c Index: ChangeLog =================================================================== --- ChangeLog (revision 41938) +++ ChangeLog (revision 41939) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sat Jul 13 15:33:33 2013 Tanaka Akira <akr@f...> + + * bignum.c (bary_small_lshift): Functions moved to remove + declaration. + (bary_small_rshift): Ditto. + Sat Jul 13 12:27:34 2013 Nobuyoshi Nakada <nobu@r...> * encoding.c (rb_enc_associate_index): fill new terminator length, not Index: bignum.c =================================================================== --- bignum.c (revision 41938) +++ bignum.c (revision 41939) @@ -114,8 +114,6 @@ STATIC_ASSERT(rbignum_embed_len_max, RBI https://github.com/ruby/ruby/blob/trunk/bignum.c#L114 typedef void (mulfunc_t)(BDIGIT *zds, size_t zl, BDIGIT *xds, size_t xl, BDIGIT *yds, size_t yl, BDIGIT *wds, size_t wl); -static BDIGIT bary_small_lshift(BDIGIT *zds, BDIGIT *xds, long n, int shift); -static void bary_small_rshift(BDIGIT *zds, BDIGIT *xds, long n, int shift, int sign_bit); static mulfunc_t bary_mul_toom3_start; static mulfunc_t bary_mul_karatsuba_start; static void bary_divmod(BDIGIT *qds, size_t nq, BDIGIT *rds, size_t nr, BDIGIT *xds, size_t nx, BDIGIT *yds, size_t ny); @@ -442,6 +440,35 @@ maxpow_in_bdigit(int base, int *exp_ret) https://github.com/ruby/ruby/blob/trunk/bignum.c#L440 return maxpow; } +static BDIGIT +bary_small_lshift(BDIGIT *zds, BDIGIT *xds, long n, int shift) +{ + long i; + BDIGIT_DBL num = 0; + + for (i=0; i<n; i++) { + num = num | (BDIGIT_DBL)*xds++ << shift; + *zds++ = BIGLO(num); + num = BIGDN(num); + } + return BIGLO(num); +} + +static void +bary_small_rshift(BDIGIT *zds, BDIGIT *xds, long n, int shift, int sign_bit) +{ + BDIGIT_DBL num = 0; + BDIGIT x; + if (sign_bit) { + num = (~(BDIGIT_DBL)0) << BITSPERDIG; + } + while (n--) { + num = (num | xds[n]) >> shift; + x = xds[n]; + zds[n] = BIGLO(num); + num = BIGUP(x); + } +} static int bary_zero_p(BDIGIT *xds, size_t nx) @@ -5706,20 +5733,6 @@ rb_big_lshift(VALUE x, VALUE y) https://github.com/ruby/ruby/blob/trunk/bignum.c#L5733 return bignorm(x); } -static BDIGIT -bary_small_lshift(BDIGIT *zds, BDIGIT *xds, long n, int shift) -{ - long i; - BDIGIT_DBL num = 0; - - for (i=0; i<n; i++) { - num = num | (BDIGIT_DBL)*xds++ << shift; - *zds++ = BIGLO(num); - num = BIGDN(num); - } - return BIGLO(num); -} - static VALUE big_lshift(VALUE x, unsigned long shift) { @@ -5783,22 +5796,6 @@ rb_big_rshift(VALUE x, VALUE y) https://github.com/ruby/ruby/blob/trunk/bignum.c#L5796 return bignorm(x); } -static void -bary_small_rshift(BDIGIT *zds, BDIGIT *xds, long n, int shift, int sign_bit) -{ - BDIGIT_DBL num = 0; - BDIGIT x; - if (sign_bit) { - num = (~(BDIGIT_DBL)0) << BITSPERDIG; - } - while (n--) { - num = (num | xds[n]) >> shift; - x = xds[n]; - zds[n] = BIGLO(num); - num = BIGUP(x); - } -} - static VALUE big_rshift(VALUE x, unsigned long shift) { -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/