From: Christian Heller Date: Tue, 30 Jul 2013 01:16:29 +0000 (+0200) Subject: Use bit shifting instead of magic number in rrand(). X-Git-Tag: tce~1115 X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/static/%7B%7Byoutube_prefix%7D%7D%7B%7Bvideo_data.id_%7D%7D?a=commitdiff_plain;h=9074c7d3e4c1345f50f86275f99dc4c27534a7e3;p=plomrogue Use bit shifting instead of magic number in rrand(). --- diff --git a/src/misc.c b/src/misc.c index 8998d0a..6ac01c7 100644 --- a/src/misc.c +++ b/src/misc.c @@ -85,9 +85,8 @@ extern uint16_t rrand(char use_seed, uint32_t new_seed) /* Constants as recommended by POSIX.1-2001 (see man page rand(3)). */ seed = ((seed * 1103515245) + 12345) % 2147483648; - return (seed / 65536); /* TODO: Use bit-shifting for ignoring the less */ -} /* random least significant 16 bits. */ - + return (seed >> 16); /* Ignore less random least significant 16 bits. */ +} extern void update_log(struct World * world, char * text)