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

ruby-changes:29287

From: akr <ko1@a...>
Date: Mon, 17 Jun 2013 07:39:58 +0900 (JST)
Subject: [ruby-changes:29287] akr:r41339 (trunk): * bignum.c (absint_numwords_bytes): Removed.

akr	2013-06-17 07:39:46 +0900 (Mon, 17 Jun 2013)

  New Revision: 41339

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

  Log:
    * bignum.c (absint_numwords_bytes): Removed.
      (rb_absint_numwords): Don't call absint_numwords_bytes.

  Modified files:
    trunk/ChangeLog
    trunk/bignum.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 41338)
+++ ChangeLog	(revision 41339)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon Jun 17 07:38:48 2013  Tanaka Akira  <akr@f...>
+
+	* bignum.c (absint_numwords_bytes): Removed.
+	  (rb_absint_numwords): Don't call absint_numwords_bytes.
+
 Sun Jun 16 23:14:58 2013  Tanaka Akira  <akr@f...>
 
 	* bignum.c (BARY_ADD): New macro.
Index: bignum.c
===================================================================
--- bignum.c	(revision 41338)
+++ bignum.c	(revision 41339)
@@ -558,55 +558,6 @@ rb_absint_size(VALUE val, int *nlz_bits_ https://github.com/ruby/ruby/blob/trunk/bignum.c#L558
 }
 
 static size_t
-absint_numwords_bytes(size_t numbytes, int nlz_bits_in_msbyte, size_t word_numbits, size_t *nlz_bits_ret)
-{
-    /*
-     * word_numbytes = word_numbits / CHAR_BIT
-     * div, mod = val_numbits.divmod(word_numbits)
-     *
-     * q, r = numbytes.divmod(word_numbytes)
-     * s = q        if r * CHAR_BIT >= nlz_bits_in_msbyte
-     *   = q - 1    if otherwise
-     * t = r * CHAR_BIT - nlz_bits_in_msbyte                if r * CHAR_BIT >= nlz_bits_in_msbyte
-     *   = word_numbits + r * CHAR_BIT - nlz_bits_in_msbyte if otherwise
-     *
-     * div = (numbytes * CHAR_BIT - nlz_bits_in_msbyte) / word_numbits
-     *     = ((q * word_numbytes + r) * CHAR_BIT - nlz_bits_in_msbyte) / word_numbits
-     *     = (q * word_numbytes * CHAR_BIT + r * CHAR_BIT - nlz_bits_in_msbyte) / word_numbits
-     *     = q + (r * CHAR_BIT - nlz_bits_in_msbyte) / word_numbits if r * CHAR_BIT >= nlz_bits_in_msbyte
-     *       q - 1 + (word_numbits + r * CHAR_BIT - nlz_bits_in_msbyte) / word_numbits if r * CHAR_BIT < nlz_bits_in_msbyte
-     *     = s + t / word_numbits
-     * mod = (r * CHAR_BIT - nlz_bits_in_msbyte) % word_numbits if r * CHAR_BIT >= nlz_bits_in_msbyte
-     *       (word_numbits + r * CHAR_BIT - nlz_bits_in_msbyte) % word_numbits if r * CHAR_BIT < nlz_bits_in_msbyte
-     *     = t % word_numbits
-     *
-     * numwords = mod == 0 ? div : div + 1
-     * nlz_bits = mod == 0 ? 0 : word_numbits - mod
-     */
-    size_t word_numbytes = word_numbits / CHAR_BIT;
-    size_t q = numbytes / word_numbytes;
-    size_t r = numbytes % word_numbytes;
-    size_t s, t;
-    size_t div, mod;
-    size_t numwords;
-    size_t nlz_bits;
-    if (r * CHAR_BIT >= (size_t)nlz_bits_in_msbyte) {
-        s = q;
-        t = r * CHAR_BIT - nlz_bits_in_msbyte;
-    }
-    else {
-        s = q - 1;
-        t = word_numbits - nlz_bits_in_msbyte + r * CHAR_BIT;
-    }
-    div = s + t / word_numbits;
-    mod = t % word_numbits;
-    numwords = mod == 0 ? div : div + 1;
-    nlz_bits = mod == 0 ? 0 : word_numbits - mod;
-    *nlz_bits_ret = nlz_bits;
-    return numwords;
-}
-
-static size_t
 absint_numwords_small(size_t numbytes, int nlz_bits_in_msbyte, size_t word_numbits, size_t *nlz_bits_ret)
 {
     size_t val_numbits = numbytes * CHAR_BIT - nlz_bits_in_msbyte;
@@ -706,17 +657,6 @@ rb_absint_numwords(VALUE val, size_t wor https://github.com/ruby/ruby/blob/trunk/bignum.c#L657
 #ifdef DEBUG_INTEGER_PACK
         {
             size_t numwords0, nlz_bits0;
-            numwords0 = absint_numwords_generic(numbytes, nlz_bits_in_msbyte, word_numbits, &nlz_bits0);
-            assert(numwords0 == numwords);
-            assert(nlz_bits0 == nlz_bits);
-        }
-#endif
-    }
-    else if (word_numbits % CHAR_BIT == 0) {
-        numwords = absint_numwords_bytes(numbytes, nlz_bits_in_msbyte, word_numbits, &nlz_bits);
-#ifdef DEBUG_INTEGER_PACK
-        {
-            size_t numwords0, nlz_bits0;
             numwords0 = absint_numwords_generic(numbytes, nlz_bits_in_msbyte, word_numbits, &nlz_bits0);
             assert(numwords0 == numwords);
             assert(nlz_bits0 == nlz_bits);

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

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