From 0c232beb9c109e3f35c5c9604312e959b5ddb7a4 Mon Sep 17 00:00:00 2001 From: akr Date: Sat, 25 Dec 2010 04:08:22 +0000 Subject: [PATCH] * random.c: parenthesize macro arguments. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30344 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 4 ++++ random.c | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index d19dd60be5..32aef992b8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Sat Dec 25 13:05:59 2010 Tanaka Akira + + * random.c: parenthesize macro arguments. + Sat Dec 25 12:48:50 2010 Nobuyoshi Nakada * load.c (rb_f_require_relative): don't omit return type. diff --git a/random.c b/random.c index 5701ba7f8d..f35f24bb68 100644 --- a/random.c +++ b/random.c @@ -92,7 +92,7 @@ typedef int int_must_be_32bit_at_least[sizeof(int) * CHAR_BIT < 32 ? -1 : 1]; #define UMASK 0x80000000U /* most significant w-r bits */ #define LMASK 0x7fffffffU /* least significant r bits */ #define MIXBITS(u,v) ( ((u) & UMASK) | ((v) & LMASK) ) -#define TWIST(u,v) ((MIXBITS(u,v) >> 1) ^ ((v)&1U ? MATRIX_A : 0U)) +#define TWIST(u,v) ((MIXBITS((u),(v)) >> 1) ^ ((v)&1U ? MATRIX_A : 0U)) enum {MT_MAX_STATE = N}; @@ -264,7 +264,7 @@ rb_genrand_real(void) #define BIGRAD ((BDIGIT_DBL)1 << BITSPERDIG) #define DIGSPERINT (SIZEOF_INT/SIZEOF_BDIGITS) #define BIGUP(x) ((BDIGIT_DBL)(x) << BITSPERDIG) -#define BIGDN(x) RSHIFT(x,BITSPERDIG) +#define BIGDN(x) RSHIFT((x),BITSPERDIG) #define BIGLO(x) ((BDIGIT)((x) & (BIGRAD-1))) #define BDIGMAX ((BDIGIT)-1) @@ -849,8 +849,8 @@ limited_big_rand(struct MT *mt, struct RBignum *limit) 0)) #else /* SIZEOF_BDIGITS == 4 */ -# define BIG_GET32(big,i) (RBIGNUM_DIGITS(big)[i]) -# define BIG_SET32(big,i,d) (RBIGNUM_DIGITS(big)[i] = (d)) +# define BIG_GET32(big,i) (RBIGNUM_DIGITS(big)[(i)]) +# define BIG_SET32(big,i,d) (RBIGNUM_DIGITS(big)[(i)] = (d)) #endif retry: mask = 0;