summaryrefslogtreecommitdiff
path: root/src/maths.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/maths.c')
-rw-r--r--src/maths.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/maths.c b/src/maths.c
index 71a1389..ea5ad8a 100644
--- a/src/maths.c
+++ b/src/maths.c
@@ -2311,7 +2311,7 @@ dx = 0; /* TODO: uninitialized?? */
#define DEG_3 31
#define SEP_3 3
-static long table [DEG_3] =
+static int32_t table [DEG_3] =
{
-851904987, -43806228, -2029755270, 1390239686, -1912102820,
-485608943, 1969813258, -1590463333, -1944053249, 455935928,
@@ -2324,8 +2324,8 @@ static long table [DEG_3] =
#define TABLE_END (table + sizeof (table) / sizeof (table [0]))
-static long * front_ptr = table + SEP_3;
-static long * rear_ptr = table;
+static int32_t * front_ptr = table + SEP_3;
+static int32_t * rear_ptr = table;
void SetSeededFastRandom(int seed);
@@ -2359,7 +2359,7 @@ int FastRandom(void)
{
- long i;
+ int32_t i;
/*
@@ -2370,7 +2370,7 @@ int FastRandom(void)
*/
*front_ptr += *rear_ptr;
- i = (long) ((unsigned long) *front_ptr >> 1);
+ i = (int32_t) ((uint32_t) *front_ptr >> 1);
/* `front_ptr' and `rear_ptr' can't wrap at the same time. */
@@ -2402,12 +2402,12 @@ int FastRandom(void)
#define SEEDED_DEG_3 13
#define SEEDED_SEP_3 3
-static long seeded_table [SEEDED_DEG_3];
+static int32_t seeded_table [SEEDED_DEG_3];
#define SEEDED_TABLE_END (seeded_table + sizeof (seeded_table) / sizeof (seeded_table [0]))
-static long * seeded_front_ptr = seeded_table + SEEDED_SEP_3;
-static long * seeded_rear_ptr = seeded_table;
+static int32_t * seeded_front_ptr = seeded_table + SEEDED_SEP_3;
+static int32_t * seeded_rear_ptr = seeded_table;
@@ -2415,7 +2415,7 @@ int SeededFastRandom(void)
{
- long i;
+ int32_t i;
/*
@@ -2426,7 +2426,7 @@ int SeededFastRandom(void)
*/
*seeded_front_ptr += *seeded_rear_ptr;
- i = (long) ((unsigned long) *seeded_front_ptr >> 1);
+ i = (int32_t) ((uint32_t) *seeded_front_ptr >> 1);
/* `front_ptr' and `rear_ptr' can't wrap at the same time. */
@@ -2458,7 +2458,7 @@ void SetSeededFastRandom(int seed)
{
int i;
- long number = seed;
+ int32_t number = seed;
for(i = 0; i < SEEDED_DEG_3; ++i) {