From bf517943387f364ad7b11854d803a84612f8cf60 Mon Sep 17 00:00:00 2001 From: MadCamel Date: Wed, 30 Sep 2009 13:42:54 -0400 Subject: Added -fno-strict-aliasing to CFLAGS This will likely fix a few minor weirdnesses, and compiler warnings. --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 08e54f4..40abc74 100644 --- a/Makefile +++ b/Makefile @@ -18,10 +18,10 @@ OPT = -g -O2 ${M32} ifeq ($(findstring CYGWIN,$(PLATFORM)), CYGWIN) OS_TYPE = -DCYGWIN -CFLAGS = $(OPT) -Wall -DFD_SETSIZE=4096 -I../common $(PACKETDEF) $(OS_TYPE) +CFLAGS = $(OPT) -Wall -fno-strict-aliasing -DFD_SETSIZE=4096 -I../common $(PACKETDEF) $(OS_TYPE) else OS_TYPE = -CFLAGS = $(OPT) -Wall -Wno-pointer-sign -I../common $(PACKETDEF) $(OS_TYPE) +CFLAGS = $(OPT) -Wall -fno-strict-aliasing -Wno-pointer-sign -I../common $(PACKETDEF) $(OS_TYPE) endif MKDEF = CC="$(CC)" CFLAGS="$(CFLAGS)" -- cgit v1.2.3-70-g09d2 From 765c84f370747e35902757b6771368009ae2a8f6 Mon Sep 17 00:00:00 2001 From: MadCamel Date: Wed, 30 Sep 2009 13:42:54 -0400 Subject: Added -fno-strict-aliasing to CFLAGS This will likely fix a few minor weirdnesses, and compiler warnings. --- Makefile | 4 ++-- src/common/mt_rand.c | 9 +++++++++ src/common/mt_rand.h | 1 + src/common/utils.h | 2 +- 4 files changed, 13 insertions(+), 3 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 08e54f4..40abc74 100644 --- a/Makefile +++ b/Makefile @@ -18,10 +18,10 @@ OPT = -g -O2 ${M32} ifeq ($(findstring CYGWIN,$(PLATFORM)), CYGWIN) OS_TYPE = -DCYGWIN -CFLAGS = $(OPT) -Wall -DFD_SETSIZE=4096 -I../common $(PACKETDEF) $(OS_TYPE) +CFLAGS = $(OPT) -Wall -fno-strict-aliasing -DFD_SETSIZE=4096 -I../common $(PACKETDEF) $(OS_TYPE) else OS_TYPE = -CFLAGS = $(OPT) -Wall -Wno-pointer-sign -I../common $(PACKETDEF) $(OS_TYPE) +CFLAGS = $(OPT) -Wall -fno-strict-aliasing -Wno-pointer-sign -I../common $(PACKETDEF) $(OS_TYPE) endif MKDEF = CC="$(CC)" CFLAGS="$(CFLAGS)" diff --git a/src/common/mt_rand.c b/src/common/mt_rand.c index ab733ae..fc9a9ec 100644 --- a/src/common/mt_rand.c +++ b/src/common/mt_rand.c @@ -108,3 +108,12 @@ unsigned long mt_random(void) y ^= (y << 15) & 0xEFC60000U; return(y ^ (y >> 18)); } + +int mt_rand(void) { + unsigned long r = mt_random(); + while (r >> 16) + r = (r & 0xFFFF) + (r >> 16); + + return(r); +} + diff --git a/src/common/mt_rand.h b/src/common/mt_rand.h index 07f6ef0..bda5861 100644 --- a/src/common/mt_rand.h +++ b/src/common/mt_rand.h @@ -4,5 +4,6 @@ void mt_seed(unsigned long seed); unsigned long mt_reload(void); unsigned long mt_random(void); +int mt_rand(void); #endif /* __mt_rand_h */ diff --git a/src/common/utils.h b/src/common/utils.h index 0b006c3..3493808 100644 --- a/src/common/utils.h +++ b/src/common/utils.h @@ -38,5 +38,5 @@ * MRAND(10), returns 0-9. * MPRAND(5,10) returns 5-14. */ -#define MRAND(mod) (int) (mt_random() % mod) +#define MRAND(mod) (mt_rand() % mod) #define MPRAND(add, mod) add + MRAND(mod) -- cgit v1.2.3-70-g09d2 From cf1920e296365c8323fd52b6d927766d296b59c6 Mon Sep 17 00:00:00 2001 From: MadCamel Date: Wed, 30 Sep 2009 13:50:50 -0400 Subject: Revert "Added -fno-strict-aliasing to CFLAGS This will likely fix a few minor weirdnesses, and compiler warnings." This reverts commit 765c84f370747e35902757b6771368009ae2a8f6. --- Makefile | 4 ++-- src/common/mt_rand.c | 9 --------- src/common/mt_rand.h | 1 - src/common/utils.h | 2 +- 4 files changed, 3 insertions(+), 13 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 40abc74..08e54f4 100644 --- a/Makefile +++ b/Makefile @@ -18,10 +18,10 @@ OPT = -g -O2 ${M32} ifeq ($(findstring CYGWIN,$(PLATFORM)), CYGWIN) OS_TYPE = -DCYGWIN -CFLAGS = $(OPT) -Wall -fno-strict-aliasing -DFD_SETSIZE=4096 -I../common $(PACKETDEF) $(OS_TYPE) +CFLAGS = $(OPT) -Wall -DFD_SETSIZE=4096 -I../common $(PACKETDEF) $(OS_TYPE) else OS_TYPE = -CFLAGS = $(OPT) -Wall -fno-strict-aliasing -Wno-pointer-sign -I../common $(PACKETDEF) $(OS_TYPE) +CFLAGS = $(OPT) -Wall -Wno-pointer-sign -I../common $(PACKETDEF) $(OS_TYPE) endif MKDEF = CC="$(CC)" CFLAGS="$(CFLAGS)" diff --git a/src/common/mt_rand.c b/src/common/mt_rand.c index fc9a9ec..ab733ae 100644 --- a/src/common/mt_rand.c +++ b/src/common/mt_rand.c @@ -108,12 +108,3 @@ unsigned long mt_random(void) y ^= (y << 15) & 0xEFC60000U; return(y ^ (y >> 18)); } - -int mt_rand(void) { - unsigned long r = mt_random(); - while (r >> 16) - r = (r & 0xFFFF) + (r >> 16); - - return(r); -} - diff --git a/src/common/mt_rand.h b/src/common/mt_rand.h index bda5861..07f6ef0 100644 --- a/src/common/mt_rand.h +++ b/src/common/mt_rand.h @@ -4,6 +4,5 @@ void mt_seed(unsigned long seed); unsigned long mt_reload(void); unsigned long mt_random(void); -int mt_rand(void); #endif /* __mt_rand_h */ diff --git a/src/common/utils.h b/src/common/utils.h index 3493808..0b006c3 100644 --- a/src/common/utils.h +++ b/src/common/utils.h @@ -38,5 +38,5 @@ * MRAND(10), returns 0-9. * MPRAND(5,10) returns 5-14. */ -#define MRAND(mod) (mt_rand() % mod) +#define MRAND(mod) (int) (mt_random() % mod) #define MPRAND(add, mod) add + MRAND(mod) -- cgit v1.2.3-70-g09d2 From 5967577d8bf92a9912cd153b20597f0d13a19456 Mon Sep 17 00:00:00 2001 From: MadCamel Date: Wed, 30 Sep 2009 13:52:13 -0400 Subject: Added -fno-strict-aliasing to CFLAGS This will likely fix a few minor weirdnesses and compiler warnings. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 08e54f4..6d378dc 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ else MAKE = make endif -OPT = -g -O2 ${M32} +OPT = -g -fno-strict-aliasing -O2 ${M32} ifeq ($(findstring CYGWIN,$(PLATFORM)), CYGWIN) OS_TYPE = -DCYGWIN -- cgit v1.2.3-70-g09d2