[postgis-tickets] r15876 - Fix union issue (References #3871)

Paul Ramsey pramsey at cleverelephant.ca
Mon Oct 2 15:29:12 PDT 2017


Author: pramsey
Date: 2017-10-02 15:29:12 -0700 (Mon, 02 Oct 2017)
New Revision: 15876

Modified:
   trunk/liblwgeom/g_serialized.c
Log:
Fix union issue (References #3871)


Modified: trunk/liblwgeom/g_serialized.c
===================================================================
--- trunk/liblwgeom/g_serialized.c	2017-10-02 22:01:27 UTC (rev 15875)
+++ trunk/liblwgeom/g_serialized.c	2017-10-02 22:29:12 UTC (rev 15876)
@@ -243,14 +243,11 @@
 
 uint64_t gbox_get_sortable_hash(const GBOX *g)
 {
-	union x {
+
+	union floatuint {
 		uint32_t u;
-		float f
-	};
-	union y {
-		uint32_t u;
-		float f
-	};
+		float f;
+	} x, y;
 
 	/*
 	* Since in theory the bitwise representation of an IEEE
@@ -272,7 +269,7 @@
 	}
 	else
 	{
-		/* 
+		/*
 		* Here we'd like to get two ordinates from 4 in the box.
 		* Since it's just a sortable bit representation we can omit division from (A+B)/2.
 		* All it should do is subtract 1 from exponent anyways.



More information about the postgis-tickets mailing list