diff --git a/src/include/lib/simplehash.h b/src/include/lib/simplehash.h
index 48db837ec8..d7711781de 100644
--- a/src/include/lib/simplehash.h
+++ b/src/include/lib/simplehash.h
@@ -964,8 +964,8 @@ SH_DELETE_ITEM(SH_TYPE * tb, SH_ELEMENT_TYPE * entry)
 SH_SCOPE void
 SH_START_ITERATE(SH_TYPE * tb, SH_ITERATOR * iter)
 {
-	int			i;
-	uint64		startelem = PG_UINT64_MAX;
+	uint32		i;
+	uint32		startelem = PG_UINT32_MAX;
 
 	/*
 	 * Search for the first empty element. As deletions during iterations are
@@ -983,7 +983,7 @@ SH_START_ITERATE(SH_TYPE * tb, SH_ITERATOR * iter)
 		}
 	}
 
-	Assert(startelem < SH_MAX_SIZE);
+	Assert(startelem < PG_UINT32_MAX);
 
 	/*
 	 * Iterate backwards, that allows the current element to be deleted, even