summaryrefslogtreecommitdiff
path: root/apps/plugins/puzzles/src/random.c
diff options
context:
space:
mode:
authorFranklin Wei <franklin@rockbox.org>2024-07-22 21:43:25 -0400
committerFranklin Wei <franklin@rockbox.org>2024-07-22 21:44:08 -0400
commit09aa8de52cb962f1ceebfb1fd44f2c54a924fc5c (patch)
tree182bd4efb2dc8ca4fcb369d8cccab0c0f290d054 /apps/plugins/puzzles/src/random.c
parentc72030f98c953a82ed6f5c7132ad000c3d5f4a16 (diff)
downloadrockbox-09aa8de52cb962f1ceebfb1fd44f2c54a924fc5c.tar.gz
rockbox-09aa8de52cb962f1ceebfb1fd44f2c54a924fc5c.zip
puzzles: resync with upstream
This brings the puzzles source in sync with Simon's branch, commit fd304c5 (from March 2024), with some added Rockbox-specific compatibility changes: https://www.franklinwei.com/git/puzzles/commit/?h=rockbox-devel&id=516830d9d76bdfe64fe5ccf2a9b59c33f5c7c078 There are quite a lot of backend changes, including a new "Mosaic" puzzle. In addition, some new frontend changes were necessary: - New "Preferences" menu to access the user preferences system. - Enabled spacebar input for several games. Change-Id: I94c7df674089c92f32d5f07025f6a1059068af1e
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