Ver código fonte

Improve consistency of rand() between 32-bit and 64-bit platforms

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@64709 15284696-431f-4ddb-bdfa-cd5b030d7da7
Glynn Clements 10 anos atrás
pai
commit
62cbc4825d
1 arquivos alterados com 2 adições e 2 exclusões
  1. 2 2
      raster/r.mapcalc/xrand.c

+ 2 - 2
raster/r.mapcalc/xrand.c

@@ -29,7 +29,7 @@ int f_rand(int argc, const int *argt, void **args)
 	    CELL *arg2 = args[2];
 
 	    for (i = 0; i < columns; i++) {
-		unsigned long x = (unsigned long)G_mrand48();
+		unsigned int x = (unsigned int)G_mrand48();
 		int lo = arg1[i];
 		int hi = arg2[i];
 
@@ -39,7 +39,7 @@ int f_rand(int argc, const int *argt, void **args)
 		    lo = hi;
 		    hi = tmp;
 		}
-		res[i] = (lo == hi) ? lo : lo + x % (unsigned long)(hi - lo);
+		res[i] = (lo == hi) ? lo : lo + x % (unsigned int)(hi - lo);
 	    }
 	    return 0;
 	}