diff --git a/contrib/hstore/crc32.c b/contrib/hstore/crc32.c
index dc93db727c171b80024ce439cc10abfa4796bf47..5f4f7a3178c645ce615bdc353addebe7b64bf5ff 100644
--- a/contrib/hstore/crc32.c
+++ b/contrib/hstore/crc32.c
@@ -90,7 +90,7 @@ static const unsigned int crc32tab[256] = {
 unsigned int
 crc32_sz(char *buf, int size)
 {
-	unsigned int crc = ~0;
+	unsigned int crc = ~((unsigned int) 0);
 	char	   *p;
 	int			len,
 				nr;
diff --git a/contrib/ltree/crc32.c b/contrib/ltree/crc32.c
index 8f37f47fe22f55f3caf361385c33e9959a923f4b..f0078d6e4263e9a6ab5e5f2f0b9c7e35ed922de3 100644
--- a/contrib/ltree/crc32.c
+++ b/contrib/ltree/crc32.c
@@ -1,6 +1,6 @@
 /* Both POSIX and CRC32 checksums */
 
-/* $PostgreSQL: pgsql/contrib/ltree/crc32.c,v 1.7 2006/09/22 21:39:57 tgl Exp $ */
+/* $PostgreSQL: pgsql/contrib/ltree/crc32.c,v 1.8 2007/07/15 22:40:28 tgl Exp $ */
 
 #include <sys/types.h>
 #include <stdio.h>
@@ -99,7 +99,7 @@ static const unsigned int crc32tab[256] = {
 unsigned int
 ltree_crc32_sz(char *buf, int size)
 {
-	unsigned int crc = ~0;
+	unsigned int crc = ~((unsigned int) 0);
 	char	   *p;
 	int			len,
 				nr;
diff --git a/contrib/tsearch2/crc32.c b/contrib/tsearch2/crc32.c
index 2bccacc104a75dcb497c36388184f8dbf52094fc..bc5c7605dd3443c20b45be797a08f4edb7ef3565 100644
--- a/contrib/tsearch2/crc32.c
+++ b/contrib/tsearch2/crc32.c
@@ -1,6 +1,6 @@
 /* Both POSIX and CRC32 checksums */
 
-/* $PostgreSQL: pgsql/contrib/tsearch2/crc32.c,v 1.3 2006/03/11 04:38:30 momjian Exp $ */
+/* $PostgreSQL: pgsql/contrib/tsearch2/crc32.c,v 1.4 2007/07/15 22:40:28 tgl Exp $ */
 
 #include <sys/types.h>
 #include <stdio.h>
@@ -92,7 +92,7 @@ static const unsigned int crc32tab[256] = {
 unsigned int
 crc32_sz(char *buf, int size)
 {
-	unsigned int crc = ~0;
+	unsigned int crc = ~((unsigned int) 0);
 	char	   *p;
 	int			len,
 				nr;