bug fix of bitmap constructor

This commit is contained in:
AmauryBrodu 2023-03-29 15:05:07 +02:00
parent 1da8b8465f
commit 60410efd1a

View File

@ -20,15 +20,13 @@ impl BitMap {
/// ### Parameters /// ### Parameters
/// - **nitems** is the number of bits in the bitmap. /// - **nitems** is the number of bits in the bitmap.
///---------------------------------------------------------------------- ///----------------------------------------------------------------------
pub fn init_bitmap(&self, n_items: usize) -> BitMap { pub fn init_bitmap(n_items: usize) -> BitMap {
let mut tmp: Vec<u32>; let mut tmp: Vec<u32>;
BitMap{ BitMap{
num_bits: n_items, num_bits: n_items,
num_words: (n_items + SECTOR_SIZE as usize -1) / SECTOR_SIZE as usize, num_words: (n_items + SECTOR_SIZE as usize -1) / SECTOR_SIZE as usize,
map: tmp, map: tmp,
}; }
*self
} }
/// Set the "nth" bit in a bitmap. /// Set the "nth" bit in a bitmap.