[GRASS-SVN] r64720 - grass/branches/releasebranch_7_0/raster/r.mapcalc

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Feb 22 01:11:30 PST 2015


Author: martinl
Date: 2015-02-22 01:11:30 -0800 (Sun, 22 Feb 2015)
New Revision: 64720

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


Modified: grass/branches/releasebranch_7_0/raster/r.mapcalc/xrand.c
===================================================================
--- grass/branches/releasebranch_7_0/raster/r.mapcalc/xrand.c	2015-02-22 09:09:56 UTC (rev 64719)
+++ grass/branches/releasebranch_7_0/raster/r.mapcalc/xrand.c	2015-02-22 09:11:30 UTC (rev 64720)
@@ -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