summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
b901702)
Some C89 compilers with 32-bit longs won't automatically widen integer
constants to (unsigned) long long in order to represent values that
don't fit in an (unsigned) long, even if those compilers otherwise
support 64-bit long long.
The "ll" and "ull" suffixes seem to get things working.
/*
* Slide puzzle core game logic
/*
* Slide puzzle core game logic
- * Copyright © 2022-2023 Nick Bowler
+ * Copyright © 2022-2024 Nick Bowler
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include <time.h>
#include "game.h"
#include <time.h>
#include "game.h"
-#define B64(x) ((x) & 0xffffffffffffffff)
+#define B64(x) ((x) & 0xffffffffffffffffull)
/* Rotate val left by n bits. The behaviour is undefined if n is zero. */
static unsigned long long rot_left64(unsigned long long val, int n)
/* Rotate val left by n bits. The behaviour is undefined if n is zero. */
static unsigned long long rot_left64(unsigned long long val, int n)
- 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);