about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/libcollections/bit.rs10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/libcollections/bit.rs b/src/libcollections/bit.rs
index d9151298a35..ba3e144e628 100644
--- a/src/libcollections/bit.rs
+++ b/src/libcollections/bit.rs
@@ -210,15 +210,13 @@ impl BitVec {
         assert_eq!(self.len(), other.len());
         // This could theoretically be a `debug_assert!`.
         assert_eq!(self.storage.len(), other.storage.len());
-        let mut changed = false;
+        let mut changed_bits = 0;
         for (a, b) in self.blocks_mut().zip(other.blocks()) {
             let w = op(*a, b);
-            if *a != w {
-                changed = true;
-                *a = w;
-            }
+            changed_bits |= *a ^ w;
+            *a = w;
         }
-        changed
+        changed_bits != 0
     }
 
     /// Iterator over mutable refs to  the underlying blocks of data.