]> git.lizzy.rs Git - rust.git/commitdiff
auto merge of #16559 : Gankro/rust/bitv, r=pcwalton
authorbors <bors@rust-lang.org>
Mon, 18 Aug 2014 00:46:10 +0000 (00:46 +0000)
committerbors <bors@rust-lang.org>
Mon, 18 Aug 2014 00:46:10 +0000 (00:46 +0000)
These were the only differing-size-based errors I noticed. Might be more.

1  2 
src/libcollections/bitv.rs

index f6210a5c0141a17abb5a2f97cc876b147085ce4b,864ae5b5352c6d68d35b038299929f3ab35fed41..1b3c6e148cdc456c8f476457e8deae578a7b4773
@@@ -72,9 -73,28 +72,28 @@@ use core::slice
  use core::uint;
  use std::hash;
  
 -use {Collection, Mutable, Set, MutableSet, MutableSeq};
 +use {Mutable, Set, MutableSet, MutableSeq};
  use vec::Vec;
  
+ // Take two BitV's, and return iterators of their words, where the shorter one
+ // has been padded with 0's
+ macro_rules! match_words(
+     ($a_expr:expr, $b_expr:expr) => ({
+         let a = $a_expr;
+         let b = $b_expr;
+         let a_len = a.storage.len();
+         let b_len = b.storage.len();
+         // have to uselessly pretend to pad the longer one for type matching
+         if a_len < b_len {
+             (a.mask_words(0).chain(iter::Repeat::new(0u).enumerate().take(b_len).skip(a_len)),
+              b.mask_words(0).chain(iter::Repeat::new(0u).enumerate().take(0).skip(0)))
+         } else {
+             (a.mask_words(0).chain(iter::Repeat::new(0u).enumerate().take(0).skip(0)),
+              b.mask_words(0).chain(iter::Repeat::new(0u).enumerate().take(a_len).skip(b_len)))
+         }
+     })
+ )
  
  static TRUE: bool = true;
  static FALSE: bool = false;