use fixed_bitmaps::{Bitmap128, Bitmap8, BitmapSize};
fn main() {
let mut bitmap = Bitmap8::default();
println!("Default bitmap: {}", bitmap);
println!("Value of bitmap: {}", bitmap.to_u8());
bitmap |= Bitmap8::from(101);
println!("Bitmap after OR-ing with 101: {}", bitmap);
bitmap.set(4, true).unwrap();
println!("Bitmap value: {}", bitmap.to_u8());
match bitmap.set(8, true) {
Ok(_) => println!("That wasn't meant to happen... something's up with my implementation!"),
Err(error) => {
println!("Yep, threw an error as expected. Error message is as follows:");
eprintln!("{}", error);
}
}
let a = Bitmap8::from_set(2).unwrap();
let b = Bitmap8::from(0b100);
assert!(a == b);
let bitmap = Bitmap8::create_bit_mask(3, 6, true);
println!("{}", bitmap);
println!("{}", *bitmap);
println!("{}", 0b111000);
println!("{:b}", u8::MAX << 3);
let bitmap = Bitmap8::create_bit_mask(3, 6, false);
println!("{}", bitmap);
println!("{:b}", u8::MAX.wrapping_shl(8));
let a = Bitmap128::create_bit_mask(3, 6, false);
let b = Bitmap128::create_bit_mask(7, 8, false);
let c = Bitmap128::create_bit_mask(0, 1, false);
let d = Bitmap128::create_bit_mask(0, 0, false);
let e = Bitmap128::create_bit_mask(8, 8, false);
let f = Bitmap128::create_bit_mask(0, Bitmap128::MAP_LENGTH, false);
println!("{}", a);
println!("{}", b);
println!("{}", c);
println!("{}", d);
println!("{}", e);
println!("{}", f);
}