I am forced to store output in an `unsigned int` array. However, the output is the solution to a linear combination of previous elements in the array *modulo* 2147483647, that is *modulo* 2^31-1. 

Below is a code snippet from a larger function. Quickly, this snippet will yield wrong answers as `ii` wraps around the index of `xx`. (Note that `xx` is seeded before the function is called, so that no element in the array is empty.)

```
#include <stdint.h>
typedef unsigned int uint32;
typedef unit_least64_t uint64;
static uint32 xx[47];

...

xx[ii] = 12345 * (uint64)(xx[i0] + xx[ii]) % 2147483647;  // i0, ii are defined elsewhere

```

However, if we swap the last line with the following, we will continually get the correct solution.

```
xx[ii] = 12345 * ( (uint64)xx[i0] + (uint64)xx[ii] ) % 2147483647;

```

Perhaps, it is obvious, but why is it necessary to do two typecasts to unit64 instead of one?