[前][次][番号順一覧][スレッド一覧]

ruby-changes:30335

From: akr <ko1@a...>
Date: Mon, 5 Aug 2013 23:50:19 +0900 (JST)
Subject: [ruby-changes:30335] akr:r42387 (trunk): * bignum.c: Rename local variables.

akr	2013-08-05 23:50:07 +0900 (Mon, 05 Aug 2013)

  New Revision: 42387

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=42387

  Log:
    * bignum.c: Rename local variables.

  Modified files:
    trunk/ChangeLog
    trunk/bignum.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 42386)
+++ ChangeLog	(revision 42387)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon Aug  5 23:47:59 2013  Tanaka Akira  <akr@f...>
+
+	* bignum.c: Rename local variables.
+
 Mon Aug  5 22:23:59 2013  Zachary Scott  <e@z...>
 
 	* vm_trace.c: [DOC] Fix TracePoint return values in examples
Index: bignum.c
===================================================================
--- bignum.c	(revision 42386)
+++ bignum.c	(revision 42387)
@@ -132,12 +132,12 @@ STATIC_ASSERT(sizeof_long_and_sizeof_bdi https://github.com/ruby/ruby/blob/trunk/bignum.c#L132
 #define KARATSUBA_MUL_DIGITS 70
 #define TOOM3_MUL_DIGITS 150
 
-typedef void (mulfunc_t)(BDIGIT *zds, size_t zl, const BDIGIT *xds, size_t xl, const BDIGIT *yds, size_t yl, BDIGIT *wds, size_t wl);
+typedef void (mulfunc_t)(BDIGIT *zds, size_t zn, const BDIGIT *xds, size_t xn, const BDIGIT *yds, size_t yn, BDIGIT *wds, size_t wn);
 
 static mulfunc_t bary_mul_toom3_start;
 static mulfunc_t bary_mul_karatsuba_start;
-static BDIGIT bigdivrem_single(BDIGIT *qds, const BDIGIT *xds, long nx, BDIGIT y);
-static void bary_divmod(BDIGIT *qds, size_t nq, BDIGIT *rds, size_t nr, const BDIGIT *xds, size_t nx, const BDIGIT *yds, size_t ny);
+static BDIGIT bigdivrem_single(BDIGIT *qds, const BDIGIT *xds, long xn, BDIGIT y);
+static void bary_divmod(BDIGIT *qds, size_t qn, BDIGIT *rds, size_t rn, const BDIGIT *xds, size_t xn, const BDIGIT *yds, size_t yn);
 
 static VALUE bigmul0(VALUE x, VALUE y);
 static void bary_mul_toom3(BDIGIT *zds, size_t zn, const BDIGIT *xds, size_t xn, const BDIGIT *yds, size_t yn, BDIGIT *wds, size_t wn);
@@ -561,13 +561,13 @@ bary_small_rshift(BDIGIT *zds, const BDI https://github.com/ruby/ruby/blob/trunk/bignum.c#L561
 }
 
 static int
-bary_zero_p(BDIGIT *xds, size_t nx)
+bary_zero_p(BDIGIT *xds, size_t xn)
 {
-    if (nx == 0)
+    if (xn == 0)
         return 1;
     do {
-	if (xds[--nx]) return 0;
-    } while (nx);
+	if (xds[--xn]) return 0;
+    } while (xn);
     return 1;
 }
 
@@ -1568,31 +1568,31 @@ bary_add_one(BDIGIT *ds, size_t n) https://github.com/ruby/ruby/blob/trunk/bignum.c#L1568
 }
 
 static void
-bary_mul_single(BDIGIT *zds, size_t zl, BDIGIT x, BDIGIT y)
+bary_mul_single(BDIGIT *zds, size_t zn, BDIGIT x, BDIGIT y)
 {
     BDIGIT_DBL n;
 
-    assert(2 <= zl);
+    assert(2 <= zn);
 
     n = (BDIGIT_DBL)x * y;
     bdigitdbl2bary(zds, 2, n);
-    BDIGITS_ZERO(zds + 2, zl - 2);
+    BDIGITS_ZERO(zds + 2, zn - 2);
 }
 
 static int
-bary_muladd_1xN(BDIGIT *zds, size_t zl, BDIGIT x, const BDIGIT *yds, size_t yl)
+bary_muladd_1xN(BDIGIT *zds, size_t zn, BDIGIT x, const BDIGIT *yds, size_t yn)
 {
     BDIGIT_DBL n;
     BDIGIT_DBL dd;
     size_t j;
 
-    assert(zl > yl);
+    assert(zn > yn);
 
     if (x == 0)
         return 0;
     dd = x;
     n = 0;
-    for (j = 0; j < yl; j++) {
+    for (j = 0; j < yn; j++) {
         BDIGIT_DBL ee = n + dd * yds[j];
         if (ee) {
             n = zds[j] + ee;
@@ -1604,7 +1604,7 @@ bary_muladd_1xN(BDIGIT *zds, size_t zl, https://github.com/ruby/ruby/blob/trunk/bignum.c#L1604
         }
 
     }
-    for (; j < zl; j++) {
+    for (; j < zn; j++) {
         if (n == 0)
             break;
         n += zds[j];
@@ -1655,15 +1655,15 @@ bary_mulsub_1xN(BDIGIT *zds, size_t zn, https://github.com/ruby/ruby/blob/trunk/bignum.c#L1655
 }
 
 static void
-bary_mul_normal(BDIGIT *zds, size_t zl, const BDIGIT *xds, size_t xl, const BDIGIT *yds, size_t yl)
+bary_mul_normal(BDIGIT *zds, size_t zn, const BDIGIT *xds, size_t xn, const BDIGIT *yds, size_t yn)
 {
     size_t i;
 
-    assert(xl + yl <= zl);
+    assert(xn + yn <= zn);
 
-    BDIGITS_ZERO(zds, zl);
-    for (i = 0; i < xl; i++) {
-        bary_muladd_1xN(zds+i, zl-i, xds[i], yds, yl);
+    BDIGITS_ZERO(zds, zn);
+    for (i = 0; i < xn; i++) {
+        bary_muladd_1xN(zds+i, zn-i, xds[i], yds, yn);
     }
 }
 
@@ -1748,48 +1748,48 @@ rb_big_sq_fast(VALUE x) https://github.com/ruby/ruby/blob/trunk/bignum.c#L1748
 
 /* balancing multiplication by slicing larger argument */
 static void
-bary_mul_balance_with_mulfunc(BDIGIT *zds, size_t zl, const BDIGIT *xds, size_t xl, const BDIGIT *yds, size_t yl, BDIGIT *wds, size_t wl, mulfunc_t *mulfunc)
+bary_mul_balance_with_mulfunc(BDIGIT *zds, size_t zn, const BDIGIT *xds, size_t xn, const BDIGIT *yds, size_t yn, BDIGIT *wds, size_t wn, mulfunc_t *mulfunc)
 {
     VALUE work = 0;
-    size_t yl0 = yl;
+    size_t yn0 = yn;
     size_t r, n;
 
-    assert(xl + yl <= zl);
-    assert(xl <= yl);
-    assert(!KARATSUBA_BALANCED(xl, yl) || !TOOM3_BALANCED(xl, yl));
+    assert(xn + yn <= zn);
+    assert(xn <= yn);
+    assert(!KARATSUBA_BALANCED(xn, yn) || !TOOM3_BALANCED(xn, yn));
 
-    BDIGITS_ZERO(zds, xl);
+    BDIGITS_ZERO(zds, xn);
 
     n = 0;
-    while (yl > 0) {
+    while (yn > 0) {
         BDIGIT *tds;
-        size_t tl;
-	r = xl > yl ? yl : xl;
-        tl = xl + r;
-        if (2 * (xl + r) <= zl - n) {
-            tds = zds + n + xl + r;
-            mulfunc(tds, tl, xds, xl, yds + n, r, wds, wl);
-            BDIGITS_ZERO(zds + n + xl, r);
-            bary_add(zds + n, tl,
-                     zds + n, tl,
-                     tds, tl);
+        size_t tn;
+	r = xn > yn ? yn : xn;
+        tn = xn + r;
+        if (2 * (xn + r) <= zn - n) {
+            tds = zds + n + xn + r;
+            mulfunc(tds, tn, xds, xn, yds + n, r, wds, wn);
+            BDIGITS_ZERO(zds + n + xn, r);
+            bary_add(zds + n, tn,
+                     zds + n, tn,
+                     tds, tn);
         }
         else {
-            if (wl < xl) {
-                wl = xl;
-                wds = ALLOCV_N(BDIGIT, work, wl);
+            if (wn < xn) {
+                wn = xn;
+                wds = ALLOCV_N(BDIGIT, work, wn);
             }
             tds = zds + n;
-            MEMCPY(wds, zds + n, BDIGIT, xl);
-            mulfunc(tds, tl, xds, xl, yds + n, r, wds-xl, wl-xl);
-            bary_add(zds + n, tl,
-                     zds + n, tl,
-                     wds, xl);
+            MEMCPY(wds, zds + n, BDIGIT, xn);
+            mulfunc(tds, tn, xds, xn, yds + n, r, wds-xn, wn-xn);
+            bary_add(zds + n, tn,
+                     zds + n, tn,
+                     wds, xn);
         }
-	yl -= r;
+	yn -= r;
 	n += r;
     }
-    BDIGITS_ZERO(zds+xl+yl0, zl - (xl+yl0));
+    BDIGITS_ZERO(zds+xn+yn0, zn - (xn+yn0));
 
     if (work)
         ALLOCV_END(work);
@@ -1808,7 +1808,7 @@ rb_big_mul_balance(VALUE x, VALUE y) https://github.com/ruby/ruby/blob/trunk/bignum.c#L1808
 
 /* multiplication by karatsuba method */
 static void
-bary_mul_karatsuba(BDIGIT *zds, size_t zl, const BDIGIT *xds, size_t xl, const BDIGIT *yds, size_t yl, BDIGIT *wds, size_t wl)
+bary_mul_karatsuba(BDIGIT *zds, size_t zn, const BDIGIT *xds, size_t xn, const BDIGIT *yds, size_t yn, BDIGIT *wds, size_t wn)
 {
     VALUE work = 0;
 
@@ -1822,34 +1822,34 @@ bary_mul_karatsuba(BDIGIT *zds, size_t z https://github.com/ruby/ruby/blob/trunk/bignum.c#L1822
     const BDIGIT *xds0, *xds1, *yds0, *yds1;
     BDIGIT *zds0, *zds1, *zds2, *zds3;
 
-    assert(xl + yl <= zl);
-    assert(xl <= yl);
-    assert(yl < 2 * xl);
+    assert(xn + yn <= zn);
+    assert(xn <= yn);
+    assert(yn < 2 * xn);
 
-    sq = xds == yds && xl == yl;
+    sq = xds == yds && xn == yn;
 
-    if (yl & 1) {
+    if (yn & 1) {
         odd_y = 1;
-        yl--;
-        if (yl < xl) {
+        yn--;
+        if (yn < xn) {
             odd_xy = 1;
-            xl--;
+            xn--;
         }
     }
 
-    n = yl / 2;
+    n = yn / 2;
 
-    assert(n < xl);
+    assert(n < xn);
 
-    if (wl < n) {
+    if (wn < n) {
         /* This function itself needs only n BDIGITs for work area.
          * However this function calls bary_mul_karatsuba and
          * bary_mul_balance recursively.
          * 2n BDIGITs are enough to avoid allocations in
          * the recursively called functions.
          */
-        wl = 2*n;
-        wds = ALLOCV_N(BDIGIT, work, wl);
+        wn = 2*n;
+        wds = ALLOCV_N(BDIGIT, work, wn);
     }
 
     /* Karatsuba algorithm:
@@ -1876,7 +1876,7 @@ bary_mul_karatsuba(BDIGIT *zds, size_t z https://github.com/ruby/ruby/blob/trunk/bignum.c#L1876
 
     /* zds0:? zds1:? zds2:? zds3:? wds:? */
 
-    if (bary_sub(zds0, n, xds, n, xds+n, xl-n)) {
+    if (bary_sub(zds0, n, xds, n, xds+n, xn-n)) {
         bary_2comp(zds0, n);
         sub_p = !sub_p;
     }
@@ -1885,7 +1885,7 @@ bary_mul_karatsuba(BDIGIT *zds, size_t z https://github.com/ruby/ruby/blob/trunk/bignum.c#L1885
 
     if (sq) {
         sub_p = 1;
-        bary_mul_karatsuba_start(zds1, 2*n, zds0, n, zds0, n, wds, wl);
+        bary_mul_karatsuba_start(zds1, 2*n, zds0, n, zds0, n, wds, wn);
     }
     else {
         if (bary_sub(wds, n, yds, n, yds+n, n)) {
@@ -1895,7 +1895,7 @@ bary_mul_karatsuba(BDIGIT *zds, size_t z https://github.com/ruby/ruby/blob/trunk/bignum.c#L1895
 
         /* zds0:|x1-x0| zds1:? zds2:? zds3:? wds:|y1-y0| */
 
-        bary_mul_karatsuba_start(zds1, 2*n, zds0, n, wds, n, wds+n, wl-n);
+        bary_mul_karatsuba_start(zds1, 2*n, zds0, n, wds, n, wds+n, wn-n);
     }
 
     /* zds0:|x1-x0| zds1,zds2:|x1-x0|*|y1-y0| zds3:? wds:|y1-y0| */
@@ -1910,7 +1910,7 @@ bary_mul_karatsuba(BDIGIT *zds, size_t z https://github.com/ruby/ruby/blob/trunk/bignum.c#L1910
 
     /* zds0:|x1-x0| zds1,zds2:-?|x1-x0|*|y1-y0| zds3:? wds:lo(-?|x1-x0|*|y1-y0|) */
 
-    bary_mul_karatsuba_start(zds0, 2*n, xds0, n, yds0, n, wds+n, wl-n);
+    bary_mul_karatsuba_start(zds0, 2*n, xds0, n, yds0, n, wds+n, wn-n);
 
     /* zds0,zds1:x0*y0 zds2:hi(-?|x1-x0|*|y1-y0|) zds3:? wds:lo(-?|x1-x0|*|y1-y0|) */
 
@@ -1927,7 +1927,7 @@ bary_mul_karatsuba(BDIGIT *zds, size_t z https://github.com/ruby/ruby/blob/trunk/bignum.c#L1927
 
     /* zds0:lo(x0*y0) zds1:hi(x0*y0)+lo(x0*y0-?|x1-x0|*|y1-y0|) zds2:_ zds3:? wds:hi(x0*y0-?|x1-x0|*|y1-y0|) */
 
-    bary_mul_karatsuba_start(zds2, zl-2*n, xds1, xl-n, yds1, n, wds+n, wl-n);
+    bary_mul_karatsuba_start(zds2, zn-2*n, xds1, xn-n, yds1, n, wds+n, wn-n);
 
     /* zds0:lo(x0*y0) zds1:hi(x0*y0)+lo(x0*y0-?|x1-x0|*|y1-y0|) zds2,zds3:x1*y1 wds:hi(x0*y0-?|x1-x0|*|y1-y0|) */
 
@@ -1935,41 +1935,41 @@ bary_mul_karatsuba(BDIGIT *zds, size_t z https://github.com/ruby/ruby/blob/trunk/bignum.c#L1935
 
     /* zds0:lo(x0*y0) zds1:hi(x0*y0)+lo(x0*y0-?|x1-x0|*|y1-y0|)+lo(x1*y1) zds2,zds3:x1*y1 wds:hi(x0*y0-?|x1-x0|*|y1-y0|) */
 
-    carry3 = bary_addc(zds2, n, zds2, n, zds3, (4*n < zl ? n : zl-3*n), carry3);
+    carry3 = bary_addc(zds2, n, zds2, n, zds3, (4*n < zn ? n : zn-3*n), carry3);
 
     /* zds0:lo(x0*y0) zds1:hi(x0*y0)+lo(x0*y0-?|x1-x0|*|y1-y0|)+lo(x1*y1) zds2,zds3:x1*y1+hi(x1*y1) wds:hi(x0*y0-?|x1-x0|*|y1-y0|) */
 
-    bary_add(zds2, zl-2*n, zds2, zl-2*n, wds, n);
+    bary_add(zds2, zn-2*n, zds2, zn-2*n, wds, n);
 
     /* zds0:lo(x0*y0) zds1:hi(x0*y0)+lo(x0*y0-?|x1-x0|*|y1-y0|)+lo(x1*y1) zds2,zds3:x1*y1+hi(x1*y1)+hi(x0*y0-?|x1-x0|*|y1-y0|) wds:_ */
 
     if (carry2)
-        bary_add_one(zds2, zl-2*n);
+        bary_add_one(zds2, zn-2*n);
 
     if (carry1 + carry3 - borrow < 0)
-        bary_sub_one(zds3, zl-3*n);
+        bary_sub_one(zds3, zn-3*n);
     else if (carry1 + carry3 - borrow > 0) {
         BDIGIT c = carry1 + carry3 - borrow;
-        bary_add(zds3, zl-3*n, zds3, zl-3*n, &c, 1);
+        bary_add(zds3, zn-3*n, zds3, zn-3*n, &c, 1);
     }
 
     /*
-    if (SIZEOF_BDIGITS * zl <= 16) {
+    if (SIZEOF_BDIGITS * zn <= 16) {
         uint128_t z, x, y;
         ssize_t i;
-        for (x = 0, i = xl-1; 0 <= i; i--) { x <<= SIZEOF_BDIGITS*CHAR_BIT; x |= xds[i]; }
-        for (y = 0, i = yl-1; 0 <= i; i--) { y <<= SIZEOF_BDIGITS*CHAR_BIT; y |= yds[i]; }
-        for (z = 0, i = zl-1; 0 <= i; i--) { z <<= SIZEOF_BDIGITS*CHAR_BIT; z |= zds[i]; }
+        for (x = 0, i = xn-1; 0 <= i; i--) { x <<= SIZEOF_BDIGITS*CHAR_BIT; x |= xds[i]; }
+        for (y = 0, i = yn-1; 0 <= i; i--) { y <<= SIZEOF_BDIGITS*CHAR_BIT; y |= yds[i]; }
+        for (z = 0, i = zn-1; 0 <= i; i--) { z <<= SIZEOF_BDIGITS*CHAR_BIT; z |= zds[i]; }
         assert(z == x * y);
     }
     */
 
     if (odd_xy) {
-        bary_muladd_1xN(zds+yl, zl-yl, yds[yl], xds, xl);
-        bary_muladd_1xN(zds+xl, zl-xl, xds[xl], yds, yl+1);
+        bary_muladd_1xN(zds+yn, zn-yn, yds[yn], xds, xn);
+        bary_muladd_1xN(zds+xn, zn-xn, xds[xn], yds, yn+1);
     }
     else if (odd_y) {
-        bary_muladd_1xN(zds+yl, zl-yl, yds[yl], xds, xl);
+        bary_muladd_1xN(zds+yn, zn-yn, yds[yn], xds, xn);
     }
 
     if (work)
@@ -2389,15 +2389,15 @@ rb_big_mul_toom3(VALUE x, VALUE y) https://github.com/ruby/ruby/blob/trunk/bignum.c#L2389
 }
 
 static void
-bary_mul1(BDIGIT *zds, size_t zl, const BDIGIT *xds, size_t xl, const BDIGIT *yds, size_t yl)
+bary_mul1(BDIGIT *zds, size_t zn, const BDIGIT *xds, size_t xn, const BDIGIT *yds, size_t yn)
 {
-    assert(xl + yl <= zl);
+    assert(xn + yn <= zn);
 
-    if (xl == 1 && yl == 1) {
-        bary_mul_single(zds, zl, xds[0], yds[0]);
+    if (xn == 1 && yn == 1) {
+        bary_mul_single(zds, zn, xds[0], yds[0]);
     }
     else {
-        bary_mul_normal(zds, zl, xds, xl, yds, yl);
+        bary_mul_normal(zds, zn, xds, xn, yds, yn);
         rb_thread_check_ints();
     }
 }
@@ -2416,49 +2416,49 @@ bary_sparse_p(const BDIGIT *ds, size_t n https://github.com/ruby/ruby/blob/trunk/bignum.c#L2416
 }
 
 static int
-bary_mul_precheck(BDIGIT **zdsp, size_t *zlp, const BDIGIT **xdsp, size_t *xlp, const BDIGIT **ydsp, size_t *ylp)
+bary_mul_precheck(BDIGIT **zdsp, size_t *znp, const BDIGIT **xdsp, size_t *xnp, const BDIGIT **ydsp, size_t *ynp)
 {
     size_t nlsz; /* number of least significant zero BDIGITs */
 
     BDIGIT *zds = *zdsp;
-    size_t zl = *zlp;
+    size_t zn = *znp;
     const BDIGIT *xds = *xdsp;
-    size_t xl = *xlp;
+    size_t xn = *xnp;
     const BDIGIT *yds = *ydsp;
-    size_t yl = *ylp;
+    size_t yn = *ynp;
 
-    assert(xl + yl <= zl);
+    assert(xn + yn <= zn);
 
     nlsz = 0;
 
-    while (0 < xl) {
-        if (xds[xl-1] == 0) {
-            xl--;
+    while (0 < xn) {
+        if (xds[xn-1] == 0) {
+            xn--;
         }
         else {
             do {
                 if (xds[0] != 0)
                     break;
                 xds++;
-                xl--;
+                xn--;
                 nlsz++;
-            } while (0 < xl);
+            } while (0 < xn);
             break;
         }
     }
 
-    while (0 < yl) {
-        if (yds[yl-1] == 0) {
-            yl--;
+    while (0 < yn) {
+        if (yds[yn-1] == 0) {
+            yn--;
         }
         else {
             do {
                 if (xds[0] != 0)
                     break;
                 yds++;
-                yl--;
+                yn--;
                 nlsz++;
-            } while (0 < yl);
+            } while (0 < yn);
             break;
         }
     }
@@ -2466,141 +2466,141 @@ bary_mul_precheck(BDIGIT **zdsp, size_t https://github.com/ruby/ruby/blob/trunk/bignum.c#L2466
     if (nlsz) {
         BDIGITS_ZERO(zds, nlsz);
         zds += nlsz;
-        zl -= nlsz;
+        zn -= nlsz;
     }
 
     /* make sure that y is longer than x */
-    if (xl > yl) {
+    if (xn > yn) {
         const BDIGIT *tds;
-        size_t tl;
+        size_t tn;
 	tds = xds; xds = yds; yds = tds;
-	tl = xl; xl = yl; yl = tl;
+	tn = xn; xn = yn; yn = tn;
     }
-    assert(xl <= yl);
+    assert(xn <= yn);
 
-    if (xl <= 1) {
-        if (xl == 0) {
-            BDIGITS_ZERO(zds, zl);
+    if (xn <= 1) {
+        if (xn == 0) {
+            BDIGITS_ZERO(zds, zn);
             return 1;
         }
 
         if (xds[0] == 1) {
-            MEMCPY(zds, yds, BDIGIT, yl);
-            BDIGITS_ZERO(zds+yl, zl-yl);
+            MEMCPY(zds, yds, BDIGIT, yn);
+            BDIGITS_ZERO(zds+yn, zn-yn);
             return 1;
         }
         if (POW2_P(xds[0])) {
-            zds[yl] = bary_small_lshift(zds, yds, yl, bitsize(xds[0])-1);
-            BDIGITS_ZERO(zds+yl+1, zl-yl-1);
+            zds[yn] = bary_small_lshift(zds, yds, yn, bitsize(xds[0])-1);
+            BDIGITS_ZERO(zds+yn+1, zn-yn-1);
             return 1;
         }
-        if (yl == 1 && yds[0] == 1) {
+        if (yn == 1 && yds[0] == 1) {
             zds[0] = xds[0];
-            BDIGITS_ZERO(zds+1, zl-1);
+            BDIGITS_ZERO(zds+1, zn-1);
             return 1;
         }
-        bary_mul_normal(zds, zl, xds, xl, yds, yl);
+        bary_mul_normal(zds, zn, xds, xn, yds, yn);
         return 1;
     }
 
     *zdsp = zds;
-    *zlp = zl;
+    *znp = zn;
     *xdsp = xds;
-    *xlp = xl;
+    *xnp = xn;
     *ydsp = yds;
-    *ylp = yl;
+    *ynp = yn;
 
     return 0;
 }
 
 static void
-bary_mul_karatsuba_branch(BDIGIT *zds, size_t zl, const BDIGIT *xds, size_t xl, const BDIGIT *yds, size_t yl, BDIGIT *wds, size_t wl)
+bary_mul_karatsuba_branch(BDIGIT *zds, size_t zn, const BDIGIT *xds, size_t xn, const BDIGIT *yds, size_t yn, BDIGIT *wds, size_t wn)
 {
     /* normal multiplication when x is small */
-    if (xl < KARATSUBA_MUL_DIGITS) {
+    if (xn < KARATSUBA_MUL_DIGITS) {
       normal:
-        if (xds == yds && xl == yl)
-            bary_sq_fast(zds, zl, xds, xl);
+        if (xds == yds && xn == yn)
+            bary_sq_fast(zds, zn, xds, xn);
         else
-            bary_mul1(zds, zl, xds, xl, yds, yl);
+            bary_mul1(zds, zn, xds, xn, yds, yn);
         return;
     }
 
     /* normal multiplication when x or y is a sparse bignum */
-    if (bary_sparse_p(xds, xl)) goto normal;
-    if (bary_sparse_p(yds, yl)) {
-        bary_mul1(zds, zl, yds, yl, xds, xl);
+    if (bary_sparse_p(xds, xn)) goto normal;
+    if (bary_sparse_p(yds, yn)) {
+        bary_mul1(zds, zn, yds, yn, xds, xn);
         return;
     }
 
     /* balance multiplication by slicing y when x is much smaller than y */
-    if (!KARATSUBA_BALANCED(xl, yl)) {
-        bary_mul_balance_with_mulfunc(zds, zl, xds, xl, yds, yl, wds, wl, bary_mul_karatsuba_start);
+    if (!KARATSUBA_BALANCED(xn, yn)) {
+        bary_mul_balance_with_mulfunc(zds, zn, xds, xn, yds, yn, wds, wn, bary_mul_karatsuba_start);
         return;
     }
 
     /* multiplication by karatsuba method */
-    bary_mul_karatsuba(zds, zl, xds, xl, yds, yl, wds, wl);
+    bary_mul_karatsuba(zds, zn, xds, xn, yds, yn, wds, wn);
 }
 
 static void
-bary_mul_karatsuba_start(BDIGIT *zds, size_t zl, const BDIGIT *xds, size_t xl, const BDIGIT *yds, size_t yl, BDIGIT *wds, size_t wl)
+bary_mul_karatsuba_start(BDIGIT *zds, size_t zn, const BDIGIT *xds, size_t xn, const BDIGIT *yds, size_t yn, BDIGIT *wds, size_t wn)
 {
-    if (bary_mul_precheck(&zds, &zl, &xds, &xl, &yds, &yl))
+    if (bary_mul_precheck(&zds, &zn, &xds, &xn, &yds, &yn))
         return;
 
-    bary_mul_karatsuba_branch(zds, zl, xds, xl, yds, yl, wds, wl);
+    bary_mul_karatsuba_branch(zds, zn, xds, xn, yds, yn, wds, wn);
 }
 
 static void
-bary_mul_toom3_branch(BDIGIT *zds, size_t zl, const BDIGIT *xds, size_t xl, const BDIGIT *yds, size_t yl, BDIGIT *wds, size_t wl)
+bary_mul_toom3_branch(BDIGIT *zds, size_t zn, const BDIGIT *xds, size_t xn, const BDIGIT *yds, size_t yn, BDIGIT *wds, size_t wn)
 {
-    if (xl < TOOM3_MUL_DIGITS) {
-        bary_mul_karatsuba_branch(zds, zl, xds, xl, yds, yl, wds, wl);
+    if (xn < TOOM3_MUL_DIGITS) {
+        bary_mul_karatsuba_branch(zds, zn, xds, xn, yds, yn, wds, wn);
         return;
     }
 
-    if (!TOOM3_BALANCED(xl, yl)) {
-        bary_mul_balance_with_mulfunc(zds, zl, xds, xl, yds, yl, wds, wl, bary_mul_toom3_start);
+    if (!TOOM3_BALANCED(xn, yn)) {
+        bary_mul_balance_with_mulfunc(zds, zn, xds, xn, yds, yn, wds, wn, bary_mul_toom3_start);
         return;
     }
 
-    bary_mul_toom3(zds, zl, xds, xl, yds, yl, wds, wl);
+    bary_mul_toom3(zds, zn, xds, xn, yds, yn, wds, wn);
 }
 
 static void
-bary_mul_toom3_start(BDIG (... truncated)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]