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

ruby-changes:29502

From: akr <ko1@a...>
Date: Sat, 22 Jun 2013 09:58:41 +0900 (JST)
Subject: [ruby-changes:29502] akr:r41554 (trunk): * bignum.c (LSHIFTX): Defined to suppress a warning.

akr	2013-06-22 09:56:53 +0900 (Sat, 22 Jun 2013)

  New Revision: 41554

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

  Log:
    * bignum.c (LSHIFTX): Defined to suppress a warning.
      (RSHIFTX): Ditto.
      (CLEAR_LOWBITS): Use LSHIFTX and RSHIFTX.
      (FILL_LOWBITS): Use LSHIFTX.
      Reported by ko1 via IRC.

  Modified files:
    trunk/ChangeLog
    trunk/bignum.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 41553)
+++ ChangeLog	(revision 41554)
@@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat Jun 22 09:55:13 2013  Tanaka Akira  <akr@f...>
+
+	* bignum.c (LSHIFTX): Defined to suppress a warning.
+	  (RSHIFTX): Ditto.
+	  (CLEAR_LOWBITS): Use LSHIFTX and RSHIFTX.
+	  (FILL_LOWBITS): Use LSHIFTX.
+	  Reported by ko1 via IRC.
+
 Sat Jun 22 09:11:33 2013  Ryan Davis  <ryand-ruby@z...>
 
 	* lib/minitest/*: Imported minitest 4.7.5 (r8724)
Index: bignum.c
===================================================================
--- bignum.c	(revision 41553)
+++ bignum.c	(revision 41554)
@@ -39,8 +39,10 @@ static VALUE big_three = Qnil; https://github.com/ruby/ruby/blob/trunk/bignum.c#L39
 #   define HOST_BIGENDIAN_P 0
 #endif
 #define ALIGNOF(type) ((int)offsetof(struct { char f1; type f2; }, f2))
-#define CLEAR_LOWBITS(d, numbits) (sizeof(d) * CHAR_BIT <= (numbits) ? 0 : ((d) >> (numbits)) << (numbits))
-#define FILL_LOWBITS(d, numbits) (sizeof(d) * CHAR_BIT <= (numbits) ? ~((d)*0) : (d) | ((((d)*0+1) << (numbits))-1))
+#define LSHIFTX(d, n) (sizeof(d) * CHAR_BIT <= (n) ? 0 : ((d) << (sizeof(d) * CHAR_BIT <= (n) ? 0 : (n))))
+#define RSHIFTX(d, n) (sizeof(d) * CHAR_BIT <= (n) ? ~((d)*0) : RSHIFT((d), (sizeof(d) * CHAR_BIT <= (n) ? 0 : (n))))
+#define CLEAR_LOWBITS(d, numbits) LSHIFTX(RSHIFTX((d), (numbits)), (numbits))
+#define FILL_LOWBITS(d, numbits) ((d) | (LSHIFTX(((d)*0+1), (numbits))-1))
 
 #define BDIGITS(x) (RBIGNUM_DIGITS(x))
 #define BITSPERDIG (SIZEOF_BDIGITS*CHAR_BIT)

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

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