Jason Rohrer <jasonrohrer@fastmail.fm>
http://bugs.debian.org/475334
Patch from upstream CVS to fix brokenness on amd64.
--- a/gamma256/gameSource/landscape.cpp
+++ b/gamma256/gameSource/landscape.cpp
@@ -135,21 +135,21 @@
  */
 // this is the readable version of the funcion
 // it has been turned into a set of macros below
-inline unsigned long random32_readable( unsigned long inSeed ) {
+inline unsigned int random32_readable( unsigned int inSeed ) {
     // this is the true hot-spot of the entire landscape function
     // thus, optimization is warranted.
     
     // multiplier = 3141592621
     // use hex to avoid warnings
-    //unsigned long multiplier = 0xBB40E62D;
-    //unsigned long increment = 1;
+    //unsigned int multiplier = 0xBB40E62D;
+    //unsigned int increment = 1;
 
     // better:
-    // unsigned long multiplier = 196314165
-    // unsigned long increment  = 907633515
+    // unsigned int multiplier = 196314165
+    // unsigned int increment  = 907633515
     
     // this will automatically be mod-ed by 2^32 because of the limit
-    // of the unsigned long type
+    // of the unsigned int type
     // return multiplier * inSeed + increment;
     //return 0xBB40E62D * inSeed + 1;
     //return 196314165 * inSeed + 907633515;
@@ -157,28 +157,28 @@
     //int n = ( inSeed << 13 ) ^ inSeed;
     //return n * (n * n * 15731 + 789221) + 1376312589;
 
-    //const unsigned long Num1 = (inSeed * 0xFEA09B9DLU) + 1;
-	//const unsigned long Num2 = ((inSeed * 0xB89C8895LU) + 1) >> 16;
+    //const unsigned int Num1 = (inSeed * 0xFEA09B9DU) + 1;
+	//const unsigned int Num2 = ((inSeed * 0xB89C8895U) + 1) >> 16;
 	//return Num1 ^ Num2;
 
     /*
     unsigned int rseed=(inSeed*15064013)^(inSeed*99991+604322121)^(inSeed*45120321)^(inSeed*5034121+13);
 
-    const unsigned long Num1 = (inSeed * 0xFEA09B9DLU) + 1;
+    const unsigned int Num1 = (inSeed * 0xFEA09B9DU) + 1;
 
-    const unsigned long Num2 = ((inSeed * 0xB89C8895LU) + 1) >> 16;
+    const unsigned int Num2 = ((inSeed * 0xB89C8895U) + 1) >> 16;
 
     rseed *= Num1 ^ Num2;
 
     return rseed;
     */
 
-    const unsigned long Num1 = (inSeed * 0xFEA09B9DLU) + 1;
-	const unsigned long Num2 = ((inSeed^Num1) * 0x9C129511LU) + 1;
-	const unsigned long Num3 = (inSeed * 0x2512CFB8LU) + 1;
-	const unsigned long Num4 = ((inSeed^Num3) * 0xB89C8895LU) + 1;
-	const unsigned long Num5 = (inSeed * 0x6BF962C1LU) + 1;
-	const unsigned long Num6 = ((inSeed^Num5) * 0x4BF962C1LU) + 1;
+    const unsigned int Num1 = (inSeed * 0xFEA09B9DU) + 1;
+	const unsigned int Num2 = ((inSeed^Num1) * 0x9C129511U) + 1;
+	const unsigned int Num3 = (inSeed * 0x2512CFB8U) + 1;
+	const unsigned int Num4 = ((inSeed^Num3) * 0xB89C8895U) + 1;
+	const unsigned int Num5 = (inSeed * 0x6BF962C1U) + 1;
+	const unsigned int Num6 = ((inSeed^Num5) * 0x4BF962C1U) + 1;
 
 	return Num2 ^ (Num4 >> 11) ^ (Num6 >> 22);
     }
@@ -186,22 +186,22 @@
 
 // faster as a set of macros
 #define Num1( inSeed ) \
-    ( ( inSeed * 0xFEA09B9DLU ) + 1 )
+    ( ( inSeed * 0xFEA09B9DU ) + 1 )
 
 #define Num2( inSeed ) \
-    ( ( ( inSeed ^ Num1( inSeed ) ) * 0x9C129511LU ) + 1 )
+    ( ( ( inSeed ^ Num1( inSeed ) ) * 0x9C129511U ) + 1 )
 
 #define Num3( inSeed ) \
-    ( ( inSeed * 0x2512CFB8LU ) + 1 )
+    ( ( inSeed * 0x2512CFB8U ) + 1 )
 
 #define Num4( inSeed ) \
-    ( ( ( inSeed ^ Num3( inSeed ) ) * 0xB89C8895LU ) + 1 )
+    ( ( ( inSeed ^ Num3( inSeed ) ) * 0xB89C8895U ) + 1 )
 
 #define Num5( inSeed ) \
-    ( ( inSeed * 0x6BF962C1LU ) + 1 )
+    ( ( inSeed * 0x6BF962C1U ) + 1 )
 
 #define Num6( inSeed ) \
-    ( ( ( inSeed ^ Num5( inSeed ) ) * 0x4BF962C1LU ) + 1 )
+    ( ( ( inSeed ^ Num5( inSeed ) ) * 0x4BF962C1U ) + 1 )
 
 #define random32( inSeed ) \
     ( Num2( inSeed ) ^ (Num4( inSeed ) >> 11) ^ (Num6( inSeed ) >> 22) )
@@ -236,10 +236,10 @@
  */
 // keep readable version around for reference
 // it has been replaced by a macro below
-inline double noise4dInt32_readable( unsigned long x,
-                                     unsigned long y,
-                                     unsigned long z,
-                                     unsigned long t ) {
+inline double noise4dInt32_readable( unsigned int x,
+                                     unsigned int y,
+                                     unsigned int z,
+                                     unsigned int t ) {
 
     
     //double maxIntAsDouble = 4294967295.0;
@@ -251,14 +251,14 @@
     // up when using addition.
         
     // mix x, y, z, and t
-    unsigned long randomSeed =
+    unsigned int randomSeed =
         x ^
         y * 57 ^
         z * 131 ^
         t * 2383;
 
-    // a random value between 0 and max unsigned long
-    unsigned long randomValue = random32( randomSeed );
+    // a random value between 0 and max unsigned int
+    unsigned int randomValue = random32( randomSeed );
 
     // a random value between 0 and 2
     double zeroTwoValue = randomValue * invHalfMaxIntAsDouble;
@@ -312,20 +312,20 @@
  * with 3 fixed integer parameters.
  */
 inline double blendNoise1d( double x,
-                     unsigned long y,
-                     unsigned long z,
-                     unsigned long t ) {
+                     unsigned int y,
+                     unsigned int z,
+                     unsigned int t ) {
 
     double floorX = floor( x );
-    unsigned long floorIntX = (unsigned long)floorX;
+    unsigned int floorIntX = (unsigned int)floorX;
     
     if( floorX == x ) {
-        unsigned long precomputedMix = mixFour( floorIntX, y, z, t );
+        unsigned int precomputedMix = mixFour( floorIntX, y, z, t );
         
         return noise1dInt32( precomputedMix );
         }
     else {
-        unsigned long ceilIntX = floorIntX + 1;
+        unsigned int ceilIntX = floorIntX + 1;
 
         // cosine interpolation
         // from http://freespace.virgin.net/hugo.elias/models/m_perlin.htm
@@ -337,7 +337,7 @@
         // macro
         // thus, we end up calling the noise1dInt32 function instead
         
-        unsigned long precomputedMix = mixFour( floorIntX, y, z, t );
+        unsigned int precomputedMix = mixFour( floorIntX, y, z, t );
         double valueAtFloor = noise1dInt32( precomputedMix );
 
         precomputedMix = mixFour( ceilIntX, y, z, t );
@@ -355,17 +355,17 @@
  */
 double blendNoise2d( double x,
                      double y,
-                     unsigned long z,
-                     unsigned long t ) {
+                     unsigned int z,
+                     unsigned int t ) {
 
     double floorY = floor( y );
-    unsigned long floorIntY = (unsigned long)floorY;
+    unsigned int floorIntY = (unsigned int)floorY;
     
     if( floorY == y ) {
         return blendNoise1d( x, floorIntY, z, t );
         }
     else {
-        unsigned long ceilIntY = floorIntY + 1;
+        unsigned int ceilIntY = floorIntY + 1;
 
         // cosine interpolation
         // from http://freespace.virgin.net/hugo.elias/models/m_perlin.htm
@@ -386,16 +386,16 @@
 double blendNoise3d( double x,
                      double y,
                      double z,
-                     unsigned long t ) {
+                     unsigned int t ) {
 
     double floorZ = floor( z );
-    unsigned long floorIntZ = (unsigned long)floorZ;
+    unsigned int floorIntZ = (unsigned int)floorZ;
     
     if( floorZ == z ) {
         return blendNoise2d( x, y, floorIntZ, t );
         }
     else {
-        unsigned long ceilIntZ = floorIntZ + 1;
+        unsigned int ceilIntZ = floorIntZ + 1;
         
         // cosine interpolation
         // from http://freespace.virgin.net/hugo.elias/models/m_perlin.htm
@@ -418,13 +418,13 @@
                 double t ) {
 
     double floorT = floor( t );
-    unsigned long floorIntT = (unsigned long)floorT;
+    unsigned int floorIntT = (unsigned int)floorT;
     
     if( floorT == t ) {
         return blendNoise3d( x, y, z, floorIntT );
         }
     else {
-        unsigned long ceilIntT = floorIntT + 1;
+        unsigned int ceilIntT = floorIntT + 1;
 
         // cosine interpolation
         // from http://freespace.virgin.net/hugo.elias/models/m_perlin.htm
