Skip to content

Commit f92d797

Browse files
committed
---
yaml --- r: 15738 b: refs/heads/try c: f029e1f h: refs/heads/master v: v3
1 parent 06a2896 commit f92d797

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5-
refs/heads/try: cfa09d35a355dee59008306f98330ff0472eb09d
5+
refs/heads/try: f029e1f486d965c0a20410644e9faa9b294e03c9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/src/libstd/bitv.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export eq_vec;
2020
// union, intersection, and difference. At that point, we could write
2121
// an optimizing version of this module that produces a different obj
2222
// for the case where nbits <= 32.
23+
// (Issue #2341)
2324

2425
#[doc = "The bitvector type"]
2526
type bitv = @{storage: [mut uint], nbits: uint};
@@ -104,24 +105,18 @@ pure fn get(v: bitv, i: uint) -> bool {
104105
}
105106

106107
// 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)
108109
#[doc = "
109110
Compares two bitvectors
110111
111112
Both bitvectors must be the same length. Returns `true` if both bitvectors
112113
contain identical elements.
113114
"]
114115
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-
118116
let len = vec::len(v1.storage);
119-
let mut i = 0u;
120-
while i < len {
117+
for uint::iterate(0u, len) {|i|
121118
if v0.storage[i] != v1.storage[i] { ret false; }
122-
i = i + 1u;
123119
}
124-
ret true;
125120
}
126121

127122
#[doc = "Set all bits to 0"]

0 commit comments

Comments
 (0)