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

ruby-changes:29560

From: nobu <ko1@a...>
Date: Tue, 25 Jun 2013 11:40:21 +0900 (JST)
Subject: [ruby-changes:29560] nobu:r41612 (trunk): bignum.c: suppress warning

nobu	2013-06-25 11:40:11 +0900 (Tue, 25 Jun 2013)

  New Revision: 41612

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

  Log:
    bignum.c: suppress warning
    
    * bignum.c (big2ulong): suppress shorten-64-to-32 warning.  BDIGIT can
      be bigger than long now.

  Modified files:
    trunk/ChangeLog
    trunk/bignum.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 41611)
+++ ChangeLog	(revision 41612)
@@ -1,4 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
-Tue Jun 25 11:39:34 2013  Nobuyoshi Nakada  <nobu@r...>
+Tue Jun 25 11:40:08 2013  Nobuyoshi Nakada  <nobu@r...>
+
+	* bignum.c (big2ulong): suppress shorten-64-to-32 warning.  BDIGIT can
+	  be bigger than long now.
 
 	* bignum.c (LSHIFTX): remove redundant never-true expression.
 
Index: bignum.c
===================================================================
--- bignum.c	(revision 41611)
+++ bignum.c	(revision 41612)
@@ -2422,8 +2422,8 @@ big2ulong(VALUE x, const char *type, int https://github.com/ruby/ruby/blob/trunk/bignum.c#L2422
     ds = BDIGITS(x);
     num = 0;
     while (len--) {
-	num = BIGUP(num);
-	num += ds[len];
+	num <<= BITSPERDIG;
+	num += (unsigned long)ds[len]; /* overflow is already checked */
     }
     return num;
 }

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

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