Skip to content

Commit

Permalink
Fix #6696
Browse files Browse the repository at this point in the history
  • Loading branch information
yjh0502 committed May 28, 2013
1 parent e6a838d commit 4521c34
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/libextra/smallintmap.rs
Expand Up @@ -246,7 +246,14 @@ impl Set<uint> for SmallIntSet {
fn symmetric_difference(&self,
other: &SmallIntSet,
f: &fn(&uint) -> bool) -> bool {
self.difference(other, f) && other.difference(self, f)
let len = cmp::max(self.map.v.len() ,other.map.v.len());

for uint::range(0, len) |i| {
if self.contains(&i) ^ other.contains(&i) {
if !f(&i) { return false; }
}
}
return true;
}

/// Visit the values representing the uintersection
Expand All @@ -256,7 +263,14 @@ impl Set<uint> for SmallIntSet {

/// Visit the values representing the union
fn union(&self, other: &SmallIntSet, f: &fn(&uint) -> bool) -> bool {
self.each(f) && other.each(|v| self.contains(v) || f(v))
let len = cmp::max(self.map.v.len() ,other.map.v.len());

for uint::range(0, len) |i| {
if self.contains(&i) || other.contains(&i) {
if !f(&i) { return false; }
}
}
return true;
}
}

Expand Down

5 comments on commit 4521c34

@bors
Copy link
Contributor

@bors bors commented on 4521c34 May 28, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from catamorphism
at yjh0502@4521c34

@bors
Copy link
Contributor

@bors bors commented on 4521c34 May 28, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging yjh0502/rust/issue_6696 = 4521c34 into auto

@bors
Copy link
Contributor

@bors bors commented on 4521c34 May 28, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yjh0502/rust/issue_6696 = 4521c34 merged ok, testing candidate = 5676056

@bors
Copy link
Contributor

@bors bors commented on 4521c34 May 28, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on 4521c34 May 28, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding incoming to auto = 5676056

Please sign in to comment.