[postgis-tickets] r17747 - Remove 32-bit build warnings

Paul Ramsey pramsey at cleverelephant.ca
Tue Aug 20 03:02:28 PDT 2019


Author: pramsey
Date: 2019-08-20 15:02:28 -0700 (Tue, 20 Aug 2019)
New Revision: 17747

Modified:
   trunk/liblwgeom/gbox.c
   trunk/liblwgeom/lwgeom.c
Log:
Remove 32-bit build warnings


Modified: trunk/liblwgeom/gbox.c
===================================================================
--- trunk/liblwgeom/gbox.c	2019-08-20 21:40:59 UTC (rev 17746)
+++ trunk/liblwgeom/gbox.c	2019-08-20 22:02:28 UTC (rev 17747)
@@ -727,17 +727,17 @@
 inline static uint64_t
 uint64_interleave_2(uint64_t x, uint64_t y)
 {
-	x = (x | (x << 16)) & 0x0000FFFF0000FFFF;
-	x = (x | (x << 8)) & 0x00FF00FF00FF00FF;
-	x = (x | (x << 4)) & 0x0F0F0F0F0F0F0F0F;
-	x = (x | (x << 2)) & 0x3333333333333333;
-	x = (x | (x << 1)) & 0x5555555555555555;
+	x = (x | (x << 16)) & 0x0000FFFF0000FFFFULL;
+	x = (x | (x << 8)) & 0x00FF00FF00FF00FFULL;
+	x = (x | (x << 4)) & 0x0F0F0F0F0F0F0F0FULL;
+	x = (x | (x << 2)) & 0x3333333333333333ULL;
+	x = (x | (x << 1)) & 0x5555555555555555ULL;
 
-	y = (y | (y << 16)) & 0x0000FFFF0000FFFF;
-	y = (y | (y << 8)) & 0x00FF00FF00FF00FF;
-	y = (y | (y << 4)) & 0x0F0F0F0F0F0F0F0F;
-	y = (y | (y << 2)) & 0x3333333333333333;
-	y = (y | (y << 1)) & 0x5555555555555555;
+	y = (y | (y << 16)) & 0x0000FFFF0000FFFFULL;
+	y = (y | (y << 8)) & 0x00FF00FF00FF00FFULL;
+	y = (y | (y << 4)) & 0x0F0F0F0F0F0F0F0FULL;
+	y = (y | (y << 2)) & 0x3333333333333333ULL;
+	y = (y | (y << 1)) & 0x5555555555555555ULL;
 
 	return x | (y << 1);
 }
@@ -754,9 +754,9 @@
 	// Initial prefix scan round, prime with x and y
 	{
 		uint64_t a = x ^ y;
-		uint64_t b = 0xFFFFFFFF ^ a;
-		uint64_t c = 0xFFFFFFFF ^ (x | y);
-		uint64_t d = x & (y ^ 0xFFFFFFFF);
+		uint64_t b = 0xFFFFFFFFULL ^ a;
+		uint64_t c = 0xFFFFFFFFULL ^ (x | y);
+		uint64_t d = x & (y ^ 0xFFFFFFFFULL);
 
 		A = a | (b >> 1);
 		B = (a >> 1) ^ a;
@@ -816,7 +816,7 @@
 
 	// Recover index bits
 	uint64_t i0 = x ^ y;
-	uint64_t i1 = b | (0xFFFFFFFF ^ (i0 | a));
+	uint64_t i1 = b | (0xFFFFFFFFULL ^ (i0 | a));
 
 	return uint64_interleave_2(i0, i1);
 }

Modified: trunk/liblwgeom/lwgeom.c
===================================================================
--- trunk/liblwgeom/lwgeom.c	2019-08-20 21:40:59 UTC (rev 17746)
+++ trunk/liblwgeom/lwgeom.c	2019-08-20 22:02:28 UTC (rev 17747)
@@ -2451,7 +2451,7 @@
 
 	int digits_left_of_decimal = (int) (1 + log10(fabs(d)));
 	uint8_t bits_needed = bits_for_precision(decimal_digits + digits_left_of_decimal);
-	uint64_t mask = 0xffffffffffffffff << (52 - bits_needed);
+	uint64_t mask = 0xffffffffffffffffULL << (52 - bits_needed);
 	uint64_t dint = 0;
 	size_t dsz = sizeof(d) < sizeof(dint) ? sizeof(d) : sizeof(dint);
 



More information about the postgis-tickets mailing list