summary refs log tree commit diff
path: root/lisc
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2016-02-26 13:55:13 -0500
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2016-02-26 13:55:13 -0500
commit956154e06e9130e75cac30a18dddfa04bda347ba (patch)
treecf1c400141b968779a68c0c7c362c287b094a1f9 /lisc
parent06c2e75a76a4827e14c7e70b7c35bb434f22c8d5 (diff)
downloadroux-956154e06e9130e75cac30a18dddfa04bda347ba.tar.gz
dirty fix bogus bsiter()
Diffstat (limited to 'lisc')
-rw-r--r--lisc/util.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lisc/util.c b/lisc/util.c
index 63c73bd..4f09d93 100644
--- a/lisc/util.c
+++ b/lisc/util.c
@@ -328,15 +328,16 @@ bsiter(BSet *bs, uint *elt)
 {
 	uint i;
 
-	for (i = *elt; i < bsmax(bs); i++) {
+	for (i=*elt;; i++) {
 		while (i < bsmax(bs) && !bs->t[i/NBit])
 			i = (i + NBit) & -NBit;
+		if (i >= bsmax(bs))
+			return 0;
 		if (bshas(bs, i)) {
 			*elt = i;
 			return 1;
 		}
 	}
-	return 0;
 }
 
 void