]> git.draconx.ca Git - cdecl99.git/blobdiff - t/rng.c
libcdecl: Replace uintmax_t with unsigned (long) long.
[cdecl99.git] / t / rng.c
diff --git a/t/rng.c b/t/rng.c
index 2e2fc09ebfe15c48edae62e304a11f0cfbc831b0..a827b2e05f610255de5368784750b6b5a737b787 100644 (file)
--- a/t/rng.c
+++ b/t/rng.c
@@ -24,7 +24,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <inttypes.h>
 #include <errno.h>
 #include <limits.h>
 
@@ -32,7 +31,7 @@
 #  include "test.h"
 #endif
 
-#define B64(x) ((x) & 0xffffffffffffffff)
+#define B64(x) ((x) & 0xffffffffffffffffull)
 
 struct test_rng {
        unsigned long long state[4];
@@ -65,9 +64,9 @@ static unsigned long long splitmix64(unsigned long long *state)
 {
        unsigned long long z;
 
-       z = B64(*state += 0x9e3779b97f4a7c15);
-       z = B64((z ^ (z >> 30)) * 0xbf58476d1ce4e5b9);
-       z = B64((z ^ (z >> 27)) * 0x94d049bb133111eb);
+       z = B64(*state += 0x9e3779b97f4a7c15ull);
+       z = B64((z ^ (z >> 30)) * 0xbf58476d1ce4e5b9ull);
+       z = B64((z ^ (z >> 27)) * 0x94d049bb133111ebull);
 
        return z ^ (z >> 31);
 }
@@ -75,11 +74,11 @@ static unsigned long long splitmix64(unsigned long long *state)
 #if !TEST_RNG_NO_EXTERNAL_API
 struct test_rng *test_rng_alloc(const char *seed_str)
 {
+       test_uintmax limit, seed_val;
        unsigned long long seed;
-       uintmax_t limit, seed_val;
        struct test_rng *rng;
 
-       limit  = (uintmax_t)0xffffffff;
+       limit  = 0xffffffff;
        limit |= (limit << 16 << 16);
 
        if (!test_strtoumax(&seed_val, seed_str, limit)) {