Index: bitmap.h
===================================================================
--- bitmap.h	(revision 160447)
+++ bitmap.h	(working copy)
@@ -396,11 +396,20 @@ bmp_iter_set (bitmap_iterator *bi, unsig
   if (bi->bits)
     {
     next_bit:
+#if (GCC_VERSION >= 3004)
+      {
+	unsigned int n = __builtin_ctzl (bi->bits);
+	gcc_assert (sizeof (unsigned long) == sizeof (BITMAP_WORD));
+	bi->bits >>= n;
+	*bit_no += n;
+      }
+#else
       while (!(bi->bits & 1))
 	{
 	  bi->bits >>= 1;
 	  *bit_no += 1;
 	}
+#endif
       return true;
     }
 
@@ -443,11 +452,20 @@ bmp_iter_and (bitmap_iterator *bi, unsig
   if (bi->bits)
     {
     next_bit:
+#if (GCC_VERSION >= 3004)
+      {
+	unsigned int n = __builtin_ctzl (bi->bits);
+	gcc_assert (sizeof (unsigned long) == sizeof (BITMAP_WORD));
+	bi->bits >>= n;
+	*bit_no += n;
+      }
+#else
       while (!(bi->bits & 1))
 	{
 	  bi->bits >>= 1;
 	  *bit_no += 1;
 	}
+#endif
       return true;
     }
 
@@ -510,11 +528,20 @@ bmp_iter_and_compl (bitmap_iterator *bi,
   if (bi->bits)
     {
     next_bit:
+#if (GCC_VERSION >= 3004)
+      {
+	unsigned int n = __builtin_ctzl (bi->bits);
+	gcc_assert (sizeof (unsigned long) == sizeof (BITMAP_WORD));
+	bi->bits >>= n;
+	*bit_no += n;
+      }
+#else
       while (!(bi->bits & 1))
 	{
 	  bi->bits >>= 1;
 	  *bit_no += 1;
 	}
+#endif
       return true;
     }
 
