diff --git a/gtkdoc-scangobj.in b/gtkdoc-scangobj.in
index d3f0b61..2cd83c5 100644
--- a/gtkdoc-scangobj.in
+++ b/gtkdoc-scangobj.in
@@ -1055,7 +1055,7 @@ describe_signed_constant (gsize size, gint64 value)
         desc = g_strdup ("G_MAXLONG");
       else if (value == G_MINLONG)
         desc = g_strdup ("G_MINLONG");
-      else if (value == G_MAXULONG)
+      else if ((gulong) value == G_MAXULONG)
         desc = g_strdup ("G_MAXULONG");
       break;
     case 8:
