~ chicken-core (chicken-5) b443ae384c5f853222427b68a3f261a2768ec07a


commit b443ae384c5f853222427b68a3f261a2768ec07a
Author:     Kooda <kooda@upyum.com>
AuthorDate: Tue Dec 12 19:35:06 2017 +0100
Commit:     Kooda <kooda@upyum.com>
CommitDate: Tue Dec 12 21:18:49 2017 +0100

    Force the ordering of calls to random_word in random64.
    
    Thanks to Riastradh for the help.

diff --git a/runtime.c b/runtime.c
index 8cb56a6e..ce68a8a0 100644
--- a/runtime.c
+++ b/runtime.c
@@ -12705,11 +12705,17 @@ C_s_a_u_i_random_int(C_word **ptr, C_word n, C_word rn)
  * number in [0, 1], 0.00001010011111010100...; then round it.
  * More information on https://mumble.net/~campbell/2014/04/28/uniform-random-float
  */
+
+static inline C_u64 random64() {
 #ifdef C_SIXTY_FOUR
-# define random64() random_word()
+    return random_word();
 #else
-# define random64() ((((C_u64) random_word()) << 32) | ((C_u64) random_word()))
+    C_u64 v = 0;
+    v |= ((C_u64) random_word()) << 32;
+    v |= (C_u64) random_word();
+    return v;
 #endif
+}
 
 #ifdef __GNUC__
 # define	clz64	__builtin_clzll		
Trap