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

ruby-changes:29087

From: charliesome <ko1@a...>
Date: Fri, 7 Jun 2013 17:41:59 +0900 (JST)
Subject: [ruby-changes:29087] charliesome:r41139 (trunk): * bignum.c (rb_absint_size): explicit cast to BDIGIT to avoid implicit

charliesome	2013-06-07 17:41:48 +0900 (Fri, 07 Jun 2013)

  New Revision: 41139

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

  Log:
    * bignum.c (rb_absint_size): explicit cast to BDIGIT to avoid implicit
      64 bit to 32 bit shortening warning
    * bignum.c (rb_int_export): ditto
    * bignum.c (int_import_push_bits): ditto

  Modified files:
    trunk/ChangeLog
    trunk/bignum.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 41138)
+++ ChangeLog	(revision 41139)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Jun  7 17:41:00 2013  Charlie Somerville  <charliesome@r...>
+
+	* bignum.c (rb_absint_size): explicit cast to BDIGIT to avoid implicit
+	  64 bit to 32 bit shortening warning
+	* bignum.c (rb_int_export): ditto
+	* bignum.c (int_import_push_bits): ditto
+
 Fri Jun  7 17:31:00 2013  Charlie Somerville  <charliesome@r...>
 
 	* internal.h (RCLASS_SUPER): use descriptive variable name
Index: bignum.c
===================================================================
--- bignum.c	(revision 41138)
+++ bignum.c	(revision 41139)
@@ -472,7 +472,7 @@ rb_absint_size(VALUE val, int *number_of https://github.com/ruby/ruby/blob/trunk/bignum.c#L472
         fixbuf[0] = v;
 #else
         for (i = 0; i < (int)(sizeof(fixbuf)/sizeof(*fixbuf)); i++) {
-            fixbuf[i] = v & ((1L << (SIZEOF_BDIGITS * CHAR_BIT)) - 1);
+            fixbuf[i] = (BDIGIT)(v & ((1L << (SIZEOF_BDIGITS * CHAR_BIT)) - 1));
             v >>= SIZEOF_BDIGITS * CHAR_BIT;
         }
 #endif
@@ -623,7 +623,7 @@ rb_int_export(VALUE val, int *signp, siz https://github.com/ruby/ruby/blob/trunk/bignum.c#L623
         fixbuf[0] = v;
 #else
         for (i = 0; i < (int)(sizeof(fixbuf)/sizeof(*fixbuf)); i++) {
-            fixbuf[i] = v & ((1L << (SIZEOF_BDIGITS * CHAR_BIT)) - 1);
+            fixbuf[i] = (BDIGIT)(v & ((1L << (SIZEOF_BDIGITS * CHAR_BIT)) - 1));
             v >>= SIZEOF_BDIGITS * CHAR_BIT;
         }
 #endif
@@ -775,7 +775,7 @@ int_import_push_bits(int data, int numbi https://github.com/ruby/ruby/blob/trunk/bignum.c#L775
     (*ddp) |= ((BDIGIT_DBL)data) << (*numbits_in_dd_p);
     *numbits_in_dd_p += numbits;
     while (SIZEOF_BDIGITS*CHAR_BIT <= *numbits_in_dd_p) {
-        *(*dpp)++ = (*ddp) & (((BDIGIT_DBL)1 << (SIZEOF_BDIGITS*CHAR_BIT))-1);
+        *(*dpp)++ = (BDIGIT)((*ddp) & (((BDIGIT_DBL)1 << (SIZEOF_BDIGITS*CHAR_BIT))-1));
         *ddp >>= SIZEOF_BDIGITS*CHAR_BIT;
         *numbits_in_dd_p -= SIZEOF_BDIGITS*CHAR_BIT;
     }

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

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