aboutsummaryrefslogtreecommitdiffstats
path: root/bignum.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-26 06:27:29 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-26 06:27:29 +0000
commit86b65861cd7a7e60674478820e3ff7c15fa0e9c0 (patch)
tree34ba6c50f1538f0ddf5280aec8f1f9d7a147f131 /bignum.c
parent1457ee2ce4582456a7226fe81b817abb9548813e (diff)
downloadruby-86b65861cd7a7e60674478820e3ff7c15fa0e9c0.tar.gz
* bignum.c (LSHIFTABLE): extract from LSHIFTX().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41641 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bignum.c')
-rw-r--r--bignum.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/bignum.c b/bignum.c
index 4b926160f5..fb95412164 100644
--- a/bignum.c
+++ b/bignum.c
@@ -40,7 +40,8 @@ static VALUE big_three = Qnil;
#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)