[GRASS-SVN] r64709 - grass/trunk/raster/r.mapcalc

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Feb 20 17:50:11 PST 2015


Author: glynn
Date: 2015-02-20 17:50:11 -0800 (Fri, 20 Feb 2015)
New Revision: 64709

Modified:
   grass/trunk/raster/r.mapcalc/xrand.c
Log:
Improve consistency of rand() between 32-bit and 64-bit platforms


Modified: grass/trunk/raster/r.mapcalc/xrand.c
===================================================================
--- grass/trunk/raster/r.mapcalc/xrand.c	2015-02-20 21:25:55 UTC (rev 64708)
+++ grass/trunk/raster/r.mapcalc/xrand.c	2015-02-21 01:50:11 UTC (rev 64709)
@@ -29,7 +29,7 @@
 	    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 @@
 		    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;
 	}



More information about the grass-commit mailing list