File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 11//! mcounteren register
22
3+ use crate :: bits:: bf_extract;
4+
35/// mcounteren register
46#[ derive( Clone , Copy , Debug ) ]
57pub struct Mcounteren {
@@ -10,26 +12,26 @@ impl Mcounteren {
1012 /// Supervisor "cycle\[h\]" Enable
1113 #[ inline]
1214 pub fn cy ( & self ) -> bool {
13- self . bits & ( 1 << 0 ) != 0
15+ bf_extract ( self . bits , 0 , 1 ) != 0
1416 }
1517
1618 /// Supervisor "time\[h\]" Enable
1719 #[ inline]
1820 pub fn tm ( & self ) -> bool {
19- self . bits & ( 1 << 1 ) != 0
21+ bf_extract ( self . bits , 1 , 1 ) != 0
2022 }
2123
2224 /// Supervisor "instret\[h\]" Enable
2325 #[ inline]
2426 pub fn ir ( & self ) -> bool {
25- self . bits & ( 1 << 2 ) != 0
27+ bf_extract ( self . bits , 2 , 1 ) != 0
2628 }
2729
2830 /// Supervisor "hpm\[x\]" Enable (bits 3-31)
2931 #[ inline]
3032 pub fn hpm ( & self , index : usize ) -> bool {
3133 assert ! ( ( 3 ..32 ) . contains( & index) ) ;
32- self . bits & ( 1 << index ) != 0
34+ bf_extract ( self . bits , index , 1 ) != 0
3335 }
3436}
3537
You can’t perform that action at this time.
0 commit comments