This commit is contained in:
2018-09-10 21:14:02 +02:00
parent 60daedad0c
commit 4ad311e389
2 changed files with 7 additions and 7 deletions

View File

@@ -25,7 +25,7 @@ type Storage = HashMap<u64, Block, BitBuildHasher>;
pub type BitHashMap<V> = HashMap<u64, V, BitBuildHasher>;
#[inline]
fn block_bit(x: &u64, d: &u64) -> (u64, u64) {
fn block_bit(x: u64, d: u64) -> (u64, u64) {
(x / d, x % d)
}
@@ -91,8 +91,8 @@ impl BitSet {
}
#[inline]
pub fn contains(&self, value: &u64) -> bool {
let (block, bit) = block_bit(value, &BITS);
pub fn contains(&self, value: u64) -> bool {
let (block, bit) = block_bit(value, BITS);
match self.blocks.get(&block) {
Some(block) => (block & (1 << bit)) != 0,
@@ -121,7 +121,7 @@ impl BitSet {
#[inline]
pub fn insert(&mut self, value: u64) -> bool {
let (block, bit) = block_bit(&value, &BITS);
let (block, bit) = block_bit(value, BITS);
let block = self.blocks.entry(block).or_insert(0);
let n = 1 << bit;
@@ -137,8 +137,8 @@ impl BitSet {
}
#[inline]
pub fn remove(&mut self, value: &u64) -> bool {
let (block, bit) = block_bit(value, &BITS);
pub fn remove(&mut self, value: u64) -> bool {
let (block, bit) = block_bit(value, BITS);
let block = self.blocks.entry(block).or_insert(0);
let n = 1 << bit;