summaryrefslogtreecommitdiff
path: root/gcc/sbitmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/sbitmap.c')
-rw-r--r--gcc/sbitmap.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/sbitmap.c b/gcc/sbitmap.c
index f4abaeeba27..7c912a922af 100644
--- a/gcc/sbitmap.c
+++ b/gcc/sbitmap.c
@@ -316,6 +316,24 @@ sbitmap_difference (sbitmap dst, sbitmap a, sbitmap b)
*dstp++ = *ap++;
}
+/* Return true if there are any bits set in A are also set in B.
+ Return false otherwise. */
+
+bool
+sbitmap_any_common_bits (sbitmap a, sbitmap b)
+{
+ sbitmap_ptr ap = a->elms;
+ sbitmap_ptr bp = b->elms;
+ unsigned int i, n;
+
+ n = MIN (a->size, b->size);
+ for (i = 0; i < n; i++)
+ if ((*ap++ & *bp++) != 0)
+ return true;
+
+ return false;
+}
+
/* Set DST to be (A and B).
Return nonzero if any change is made. */