summaryrefslogtreecommitdiff
path: root/apps/plugins/puzzles/src/random.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/puzzles/src/random.c')
-rw-r--r--apps/plugins/puzzles/src/random.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/apps/plugins/puzzles/src/random.c b/apps/plugins/puzzles/src/random.c
index fb54560c95..bd11f16601 100644
--- a/apps/plugins/puzzles/src/random.c
+++ b/apps/plugins/puzzles/src/random.c
@@ -109,7 +109,7 @@ void SHA_Init(SHA_State * s)
109 109
110void SHA_Bytes(SHA_State * s, const void *p, int len) 110void SHA_Bytes(SHA_State * s, const void *p, int len)
111{ 111{
112 unsigned char *q = (unsigned char *) p; 112 const unsigned char *q = (const unsigned char *) p;
113 uint32 wordblock[16]; 113 uint32 wordblock[16];
114 uint32 lenw = len; 114 uint32 lenw = len;
115 int i; 115 int i;
@@ -254,12 +254,12 @@ unsigned long random_bits(random_state *state, int bits)
254 } 254 }
255 255
256 /* 256 /*
257 * `(1 << bits) - 1' is not good enough, since if bits==32 on a 257 * `(1UL << bits) - 1' is not good enough, since if bits==32 on a
258 * 32-bit machine, behaviour is undefined and Intel has a nasty 258 * 32-bit machine, behaviour is undefined and Intel has a nasty
259 * habit of shifting left by zero instead. We'll shift by 259 * habit of shifting left by zero instead. We'll shift by
260 * bits-1 and then separately shift by one. 260 * bits-1 and then separately shift by one.
261 */ 261 */
262 ret &= (1 << (bits-1)) * 2 - 1; 262 ret &= (1UL << (bits-1)) * 2 - 1;
263 return ret; 263 return ret;
264} 264}
265 265