summary refs log tree commit diff
path: root/lisc/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'lisc/util.c')
-rw-r--r--lisc/util.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/lisc/util.c b/lisc/util.c
index 4f0298c..63c73bd 100644
--- a/lisc/util.c
+++ b/lisc/util.c
@@ -299,13 +299,25 @@ BSOP(bsunion, |=)
 BSOP(bsinter, &=)
 BSOP(bsdiff, &= ~)
 
+int
+bsequal(BSet *a, BSet *b)
+{
+	uint i;
+
+	assert(a->nt == b->nt);
+	for (i=0; i<a->nt; i++)
+		if (a->t[i] != b->t[i])
+			return 0;
+	return 1;
+}
+
 void
 bszero(BSet *bs)
 {
 	bsdiff(bs, bs);
 }
 
-/* Iterates on a bitset, use as follows.
+/* iterates on a bitset, use as follows
  *
  * 	for (i=0; bsiter(set, &i); i++)
  * 		use(i);
@@ -326,3 +338,14 @@ bsiter(BSet *bs, uint *elt)
 	}
 	return 0;
 }
+
+void
+dumpts(BSet *bs, Tmp *tmp, FILE *f)
+{
+	uint t;
+
+	fprintf(f, "[");
+	for (t=Tmp0; bsiter(bs, &t); t++)
+		fprintf(f, " %s", tmp[t].name);
+	fprintf(f, " ]\n");
+}