File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -246,7 +246,14 @@ impl Set<uint> for SmallIntSet {
246246 fn symmetric_difference ( & self ,
247247 other : & SmallIntSet ,
248248 f : & fn ( & uint ) -> bool ) -> bool {
249- self . difference ( other, f) && other. difference ( self , f)
249+ let len = cmp:: max ( self . map . v . len ( ) , other. map . v . len ( ) ) ;
250+
251+ for uint:: range( 0 , len) |i| {
252+ if self . contains ( & i) ^ other. contains ( & i) {
253+ if !f ( & i) { return false ; }
254+ }
255+ }
256+ return true ;
250257 }
251258
252259 /// Visit the values representing the uintersection
@@ -256,7 +263,14 @@ impl Set<uint> for SmallIntSet {
256263
257264 /// Visit the values representing the union
258265 fn union ( & self , other : & SmallIntSet , f : & fn ( & uint ) -> bool ) -> bool {
259- self . each ( f) && other. each ( |v| self . contains ( v) || f ( v) )
266+ let len = cmp:: max ( self . map . v . len ( ) , other. map . v . len ( ) ) ;
267+
268+ for uint:: range( 0 , len) |i| {
269+ if self . contains ( & i) || other. contains ( & i) {
270+ if !f ( & i) { return false ; }
271+ }
272+ }
273+ return true ;
260274 }
261275}
262276
You can’t perform that action at this time.
0 commit comments