Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Inline a few UndefMask methods.
This saves 2.5 seconds on the test program.
  • Loading branch information
wesleywiser committed Jun 30, 2018
1 parent 8f969ed commit c431f3f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/librustc/mir/interpret/mod.rs
Expand Up @@ -635,11 +635,13 @@ impl UndefMask {
}
}

#[inline]
pub fn get(&self, i: Size) -> bool {
let (block, bit) = bit_index(i);
(self.blocks[block] & 1 << bit) != 0
}

#[inline]
pub fn set(&mut self, i: Size, new_state: bool) {
let (block, bit) = bit_index(i);
if new_state {
Expand All @@ -664,6 +666,7 @@ impl UndefMask {
}
}

#[inline]
fn bit_index(bits: Size) -> (usize, usize) {
let bits = bits.bytes();
let a = bits / BLOCK_SIZE;
Expand Down

0 comments on commit c431f3f

Please sign in to comment.