File tree 1 file changed +16
-2
lines changed 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 {
246
246
fn symmetric_difference ( & self ,
247
247
other : & SmallIntSet ,
248
248
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 ;
250
257
}
251
258
252
259
/// Visit the values representing the uintersection
@@ -256,7 +263,14 @@ impl Set<uint> for SmallIntSet {
256
263
257
264
/// Visit the values representing the union
258
265
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 ;
260
274
}
261
275
}
262
276
You can’t perform that action at this time.
0 commit comments