File tree Expand file tree Collapse file tree 1 file changed +3
-8
lines changed Expand file tree Collapse file tree 1 file changed +3
-8
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ export eq_vec;
20
20
// union, intersection, and difference. At that point, we could write
21
21
// an optimizing version of this module that produces a different obj
22
22
// for the case where nbits <= 32.
23
+ // (Issue #2341)
23
24
24
25
#[ doc = "The bitvector type" ]
25
26
type bitv = @{ storage : [ mut uint ] , nbits : uint } ;
@@ -104,24 +105,18 @@ pure fn get(v: bitv, i: uint) -> bool {
104
105
}
105
106
106
107
// FIXME: This doesn't account for the actual size of the vectors,
107
- // so it could end up comparing garbage bits
108
+ // so it could end up comparing garbage bits (#2342)
108
109
#[ doc = "
109
110
Compares two bitvectors
110
111
111
112
Both bitvectors must be the same length. Returns `true` if both bitvectors
112
113
contain identical elements.
113
114
" ]
114
115
fn equal ( v0 : bitv , v1 : bitv ) -> bool {
115
- // FIXME: when we can break or return from inside an iterator loop,
116
- // we can eliminate this painful while-loop
117
-
118
116
let len = vec:: len ( v1. storage ) ;
119
- let mut i = 0 u;
120
- while i < len {
117
+ for uint:: iterate( 0 u, len) { |i|
121
118
if v0. storage [ i] != v1. storage [ i] { ret false ; }
122
- i = i + 1 u;
123
119
}
124
- ret true;
125
120
}
126
121
127
122
#[ doc = "Set all bits to 0" ]
You can’t perform that action at this time.
0 commit comments