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

ruby-changes:29218

From: akr <ko1@a...>
Date: Thu, 13 Jun 2013 12:20:39 +0900 (JST)
Subject: [ruby-changes:29218] akr:r41270 (trunk): Refine debug code.

akr	2013-06-13 12:20:28 +0900 (Thu, 13 Jun 2013)

  New Revision: 41270

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

  Log:
    Refine debug code.

  Modified files:
    trunk/bignum.c

Index: bignum.c
===================================================================
--- bignum.c	(revision 41269)
+++ bignum.c	(revision 41270)
@@ -652,20 +652,24 @@ rb_absint_numwords(VALUE val, size_t wor https://github.com/ruby/ruby/blob/trunk/bignum.c#L652
 
     if (numbytes <= SIZE_MAX / CHAR_BIT) {
         numwords = absint_numwords_small(numbytes, nlz_bits_in_msbyte, word_numbits, &nlz_bits);
-#if 0
-        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);
+#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);
-#if 0
-        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);
+#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 {
@@ -1226,7 +1230,7 @@ rb_integer_unpack_internal(const void *w https://github.com/ruby/ruby/blob/trunk/bignum.c#L1230
 
     if (numwords <= (SIZE_MAX - (BITSPERDIG-1)) / CHAR_BIT / wordsize) {
         num_bdigits = integer_unpack_num_bdigits_small(numwords, wordsize, nails, nlp_bits_ret);
-#if 0
+#ifdef DEBUG_INTEGER_PACK
         {
             int nlp_bits1;
             size_t num_bdigits1 = integer_unpack_num_bdigits_generic(numwords, wordsize, nails, &nlp_bits1);

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

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