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

ruby-changes:29589

From: nobu <ko1@a...>
Date: Wed, 26 Jun 2013 15:27:40 +0900 (JST)
Subject: [ruby-changes:29589] nobu:r41641 (trunk): * bignum.c (LSHIFTABLE): extract from LSHIFTX().

nobu	2013-06-26 15:27:29 +0900 (Wed, 26 Jun 2013)

  New Revision: 41641

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

  Log:
    * bignum.c (LSHIFTABLE): extract from LSHIFTX().

  Modified files:
    trunk/bignum.c

Index: bignum.c
===================================================================
--- bignum.c	(revision 41640)
+++ bignum.c	(revision 41641)
@@ -40,7 +40,8 @@ static VALUE big_three = Qnil; https://github.com/ruby/ruby/blob/trunk/bignum.c#L40
 #endif
 #define ALIGNOF(type) ((int)offsetof(struct { char f1; type f2; }, f2))
 /* (sizeof(d) * CHAR_BIT <= (n) ? 0 : (n)) is same as n but suppress a warning, C4293, by Visual Studio.  */
-#define LSHIFTX(d, n) (sizeof(d) * CHAR_BIT <= (n) ? 0 : ((d) << (sizeof(d) * CHAR_BIT <= (n) ? 0 : (n))))
+#define LSHIFTABLE(d, n) ((n) < sizeof(d) * CHAR_BIT)
+#define LSHIFTX(d, n) (!LSHIFTABLE(d, n) ? 0 : ((d) << (!LSHIFTABLE(d, n) ? 0 : (n))))
 #define CLEAR_LOWBITS(d, numbits) ((d) & LSHIFTX(~((d)*0), (numbits)))
 #define FILL_LOWBITS(d, numbits) ((d) | (LSHIFTX(((d)*0+1), (numbits))-1))
 #define POW2_P(x) (((x)&((x)-1))==0)

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

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