home
·
contact
·
privacy
projects
/
plomrogue
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
dd29efe
)
Use bit shifting instead of magic number in rrand().
author
Christian Heller
<c.heller@plomlompom.de>
Tue, 30 Jul 2013 01:16:29 +0000
(
03:16
+0200)
committer
Christian Heller
<c.heller@plomlompom.de>
Tue, 30 Jul 2013 01:16:29 +0000
(
03:16
+0200)
src/misc.c
patch
|
blob
|
history
diff --git
a/src/misc.c
b/src/misc.c
index 8998d0a462f807f6485fae2ff752e1940033682b..6ac01c7a5b499b977a6f20e604ac2b5adb28aeea 100644
(file)
--- 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)