1 // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
12 fn to_bytes(&self) -> Vec<u8> ;
16 fn to_bytes(&self) -> Vec<u8> {
21 // the position of this function is significant! - if it comes before methods
22 // then it works, if it comes after it then it doesn't!
23 fn to_bools(bitv: Storage) -> Vec<bool> {
27 let x = 1u64 & (bitv.storage[w] >> b);
32 struct Storage { storage: Vec<u64> }
35 let bools = vec!(false, false, true, false, false, true, true, false);
36 let bools2 = to_bools(Storage{storage: vec!(0b01100100)});
38 for i in range(0u, 8) {
39 println!("{} => {} vs {}", i, bools[i], bools2[i]);
42 assert_eq!(bools, bools2);