[GRASS-SVN] r33717 - grass/trunk/lib/gis

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Oct 7 06:02:00 EDT 2008


Author: glynn
Date: 2008-10-07 06:01:59 -0400 (Tue, 07 Oct 2008)
New Revision: 33717

Modified:
   grass/trunk/lib/gis/null_val.c
Log:
Make G_is_[fd]_null_value() check for any NaN, not just all-ones


Modified: grass/trunk/lib/gis/null_val.c
===================================================================
--- grass/trunk/lib/gis/null_val.c	2008-10-07 09:07:12 UTC (rev 33716)
+++ grass/trunk/lib/gis/null_val.c	2008-10-07 10:01:59 UTC (rev 33717)
@@ -427,22 +427,7 @@
 
 int G_is_f_null_value(const FCELL * fcellVal)
 {
-    int i;			/* counter */
-
-    /* Check if the null patterns have been initialized */
-    if (!initialized) {
-	InitError();
-    }
-
-    /* Check if the FCELL value matches the null pattern */
-    for (i = 0; i < sizeof(FCELL); i++) {
-	if (((unsigned char *)fcellVal)[i] !=
-	    ((unsigned char *)&fcellNullPattern)[i]) {
-	    return FALSE;
-	}
-    }
-
-    return TRUE;
+    return *fcellVal != *fcellVal;
 }
 
 /****************************************************************************
@@ -467,22 +452,7 @@
 
 int G_is_d_null_value(const DCELL * dcellVal)
 {
-    int i;			/* counter */
-
-    /* Check if the null patterns have been initialized */
-    if (!initialized) {
-	InitError();
-    }
-
-    /* Check if the DCELL value matches the null pattern */
-    for (i = 0; i < sizeof(DCELL); i++) {
-	if (((unsigned char *)dcellVal)[i] !=
-	    ((unsigned char *)&dcellNullPattern)[i]) {
-	    return FALSE;
-	}
-    }
-
-    return TRUE;
+    return *dcellVal != *dcellVal;
 }
 
 /****************************************************************************



More information about the grass-commit mailing list