Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

next / bitvector_next gets stuck with IntSet, causing infinite loop #8570

Closed
danluu opened this issue Oct 3, 2014 · 1 comment
Closed

next / bitvector_next gets stuck with IntSet, causing infinite loop #8570

danluu opened this issue Oct 3, 2014 · 1 comment

Comments

@danluu
Copy link
Contributor

danluu commented Oct 3, 2014

julia> s = IntSet(2^32);

julia> length(s)
1

julia> for b in s; println(b); end
0
0
0
0
0
0
0
0
^CERROR: interrupt

julia> show(s)
IntSet([0, 0, 0, 0, 0, 0, 0, 0, 0^CERROR: interrupt

It's possible that doing #3039 will also fix this?

@JeffBezanson
Copy link
Member

Here's a patch; don't have time to write a test and commit right now:

diff --git a/src/support/bitvector.c b/src/support/bitvector.c
index 5742ac1..9f78dff 100644
--- a/src/support/bitvector.c
+++ b/src/support/bitvector.c
@@ -118,7 +118,7 @@ uint64_t bitvector_next(uint32_t *b, uint64_t n0, uint64_t n
     while (i < nw-1) {
         w = b[i];
         if (w != 0) {
-            return ntz(w) + (i<<5);
+            return ntz(w) + (((uint64_t)i)<<5);
         }
         i++;
     }

ivarne pushed a commit that referenced this issue Oct 16, 2014
(cherry picked from commit 496351e)
ref: #8571
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants