diff options
author | MadCamel <madcamel@gmail.com> | 2009-09-30 13:58:34 -0400 |
---|---|---|
committer | MadCamel <madcamel@gmail.com> | 2009-09-30 13:58:34 -0400 |
commit | 592170e732fd5b75cf1447ed33e8999541048db8 (patch) | |
tree | d3ba7169a077ea7975c41c3ab68027be747df017 | |
parent | 3fc3d83aa0be31e6d51afac54ff76b447f99f711 (diff) | |
parent | bf517943387f364ad7b11854d803a84612f8cf60 (diff) | |
download | tmwa-592170e732fd5b75cf1447ed33e8999541048db8.tar.gz tmwa-592170e732fd5b75cf1447ed33e8999541048db8.tar.bz2 tmwa-592170e732fd5b75cf1447ed33e8999541048db8.tar.xz tmwa-592170e732fd5b75cf1447ed33e8999541048db8.zip |
Merge branch 'master' of git@gitorious.org:~madcamel/tmw-eathena/thealternateworld
Conflicts:
src/common/utils.h
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | src/common/mt_rand.c | 9 | ||||
-rw-r--r-- | src/common/mt_rand.h | 1 |
3 files changed, 12 insertions, 2 deletions
@@ -18,10 +18,10 @@ OPT = -g -fno-strict-aliasing -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 */ |