OSDN Git Service

* testsuite/lib/libstdc++.exp: Load target-supports-dg.exp.
[pf3gnuchains/gcc-fork.git] / gcc / bitmap.c
index 275e440..140dd00 100644 (file)
@@ -222,20 +222,6 @@ bitmap_gc_alloc (void)
   return map;
 }
 
-/* Create a new malloced bitmap.  Elements will be allocated from the
-   default bitmap obstack.  */
-
-bitmap
-bitmap_malloc_alloc (void)
-{
-  bitmap map;
-
-  map = xmalloc (sizeof (bitmap_head));
-  bitmap_initialize (map, &bitmap_default_obstack);
-
-  return map;
-}
-
 /* Release an obstack allocated bitmap.  */
 
 void
@@ -249,15 +235,6 @@ bitmap_obstack_free (bitmap map)
     }
 }
 
-/* Release a malloc allocated bitmap.  */
-
-void
-bitmap_malloc_free (bitmap map)
-{
-  bitmap_clear (map);
-  free (map);
-}
-
 \f
 /* Return nonzero if all bits in an element are zero.  */
 
@@ -424,14 +401,26 @@ bitmap_find_bit (bitmap head, unsigned int bit)
       || head->indx == indx)
     return head->current;
 
-  if (head->indx > indx)
+  if (head->indx < indx)
+    /* INDX is beyond head->indx.  Search from head->current
+       forward.  */
+    for (element = head->current;
+        element->next != 0 && element->indx < indx;
+        element = element->next)
+      ;
+
+  else if (head->indx / 2 < indx)
+    /* INDX is less than head->indx and closer to head->indx than to
+       0.  Search from head->current backward.  */
     for (element = head->current;
         element->prev != 0 && element->indx > indx;
         element = element->prev)
       ;
 
   else
-    for (element = head->current;
+    /* INDX is less than head->indx and closer to 0 than to
+       head->indx.  Search from head->first forward.  */
+    for (element = head->first;
         element->next != 0 && element->indx < indx;
         element = element->next)
       ;