File tree Expand file tree Collapse file tree 1 file changed +4
-0
lines changed
Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -12,14 +12,17 @@ pub trait BitMap<T> {
1212macro_rules! impl_bitmap {
1313 ( $ty: ident) => {
1414 impl BitMap <$ty> for $ty {
15+ #[ inline]
1516 fn get_bit( & self , index: u8 ) -> $ty {
1617 * self >> index & 0b1
1718 }
1819
20+ #[ inline]
1921 fn set_bit( & mut self , index: u8 , value: $ty) {
2022 * self = ( * self & !( 1 << index) ) | ( ( value & 1 ) << index) ;
2123 }
2224
25+ #[ inline]
2326 fn set_bits( & mut self , indices: :: core:: ops:: Range <u8 >, value: $ty) {
2427 let width = indices. end - indices. start;
2528 let bit_count = :: core:: mem:: size_of:: <$ty>( ) * 8 ;
@@ -29,6 +32,7 @@ macro_rules! impl_bitmap {
2932 * self = ( * self & !( mask << indices. start) ) | ( ( value & mask) << indices. start) ;
3033 }
3134
35+ #[ inline]
3236 fn get_bits( & self , indices: :: core:: ops:: Range <u8 >) -> $ty {
3337 let width = indices. end - indices. start;
3438 let bit_count = :: core:: mem:: size_of:: <$ty>( ) * 8 ;
You can’t perform that action at this time.
0 commit comments