File tree 2 files changed +9
-0
lines changed
src/librustc_data_structures
2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ pub trait BitSlice {
24
24
25
25
impl BitSlice for [ Word ] {
26
26
/// Clears bit at `idx` to 0; returns true iff this changed `self.`
27
+ #[ inline]
27
28
fn clear_bit ( & mut self , idx : usize ) -> bool {
28
29
let words = self ;
29
30
debug ! ( "clear_bit: words={} idx={}" ,
@@ -37,6 +38,7 @@ impl BitSlice for [Word] {
37
38
}
38
39
39
40
/// Sets bit at `idx` to 1; returns true iff this changed `self.`
41
+ #[ inline]
40
42
fn set_bit ( & mut self , idx : usize ) -> bool {
41
43
let words = self ;
42
44
debug ! ( "set_bit: words={} idx={}" ,
@@ -50,6 +52,7 @@ impl BitSlice for [Word] {
50
52
}
51
53
52
54
/// Extracts value of bit at `idx` in `self`.
55
+ #[ inline]
53
56
fn get_bit ( & self , idx : usize ) -> bool {
54
57
let words = self ;
55
58
let BitLookup { word, bit_mask, .. } = bit_lookup ( idx) ;
Original file line number Diff line number Diff line change @@ -29,12 +29,16 @@ pub trait Idx: Copy + 'static + Eq + Debug {
29
29
}
30
30
31
31
impl Idx for usize {
32
+ #[ inline]
32
33
fn new ( idx : usize ) -> Self { idx }
34
+ #[ inline]
33
35
fn index ( self ) -> usize { self }
34
36
}
35
37
36
38
impl Idx for u32 {
39
+ #[ inline]
37
40
fn new ( idx : usize ) -> Self { assert ! ( idx <= u32 :: MAX as usize ) ; idx as u32 }
41
+ #[ inline]
38
42
fn index ( self ) -> usize { self as usize }
39
43
}
40
44
@@ -73,11 +77,13 @@ macro_rules! newtype_index {
73
77
pub struct $type( $( $pub) * u32 ) ;
74
78
75
79
impl Idx for $type {
80
+ #[ inline]
76
81
fn new( value: usize ) -> Self {
77
82
assert!( value < ( $max) as usize ) ;
78
83
$type( value as u32 )
79
84
}
80
85
86
+ #[ inline]
81
87
fn index( self ) -> usize {
82
88
self . 0 as usize
83
89
}
You can’t perform that action at this time.
0 commit comments