File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Top Open diff view settings
src/librustc_data_structures Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Top Open diff view settings Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ pub trait BitSlice {
2424
2525impl BitSlice for [ Word ] {
2626 /// Clears bit at `idx` to 0; returns true iff this changed `self.`
27+ #[ inline]
2728 fn clear_bit ( & mut self , idx : usize ) -> bool {
2829 let words = self ;
2930 debug ! ( "clear_bit: words={} idx={}" ,
@@ -37,6 +38,7 @@ impl BitSlice for [Word] {
3738 }
3839
3940 /// Sets bit at `idx` to 1; returns true iff this changed `self.`
41+ #[ inline]
4042 fn set_bit ( & mut self , idx : usize ) -> bool {
4143 let words = self ;
4244 debug ! ( "set_bit: words={} idx={}" ,
@@ -50,6 +52,7 @@ impl BitSlice for [Word] {
5052 }
5153
5254 /// Extracts value of bit at `idx` in `self`.
55+ #[ inline]
5356 fn get_bit ( & self , idx : usize ) -> bool {
5457 let words = self ;
5558 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 {
2929}
3030
3131impl Idx for usize {
32+ #[ inline]
3233 fn new ( idx : usize ) -> Self { idx }
34+ #[ inline]
3335 fn index ( self ) -> usize { self }
3436}
3537
3638impl Idx for u32 {
39+ #[ inline]
3740 fn new ( idx : usize ) -> Self { assert ! ( idx <= u32 :: MAX as usize ) ; idx as u32 }
41+ #[ inline]
3842 fn index ( self ) -> usize { self as usize }
3943}
4044
@@ -73,11 +77,13 @@ macro_rules! newtype_index {
7377 pub struct $type( $( $pub) * u32 ) ;
7478
7579 impl Idx for $type {
80+ #[ inline]
7681 fn new( value: usize ) -> Self {
7782 assert!( value < ( $max) as usize ) ;
7883 $type( value as u32 )
7984 }
8085
86+ #[ inline]
8187 fn index( self ) -> usize {
8288 self . 0 as usize
8389 }
You can’t perform that action at this time.
0 commit comments