@@ -6,6 +6,8 @@ pub trait RawReg:
6
6
+ Default
7
7
+ core:: ops:: BitOr < Output = Self >
8
8
+ core:: ops:: BitAnd < Output = Self >
9
+ + core:: ops:: BitOrAssign
10
+ + core:: ops:: BitAndAssign
9
11
+ core:: ops:: Not < Output = Self >
10
12
+ core:: ops:: Shl < u8 , Output = Self >
11
13
{
@@ -30,7 +32,7 @@ macro_rules! raw_reg {
30
32
const fn $mask<const WI : u8 >( ) -> $U {
31
33
<$U>:: MAX >> ( $size - WI )
32
34
}
33
- }
35
+ } ;
34
36
}
35
37
36
38
raw_reg ! ( u8 , 8 , mask_u8) ;
@@ -507,8 +509,8 @@ macro_rules! impl_bit_proxy {
507
509
/// Writes bit to the field
508
510
#[ inline( always) ]
509
511
pub fn bit( self , value: bool ) -> & ' a mut REG :: Writer {
510
- self . w. bits = ( self . w . bits & !( U :: one( ) << { OF } ) )
511
- | ( ( U :: from( value) & U :: one( ) ) << { OF } ) ;
512
+ self . w. bits &= !( U :: one( ) << { OF } ) ;
513
+ self . w . bits |= ( U :: from( value) & U :: one( ) ) << { OF } ;
512
514
self . w
513
515
}
514
516
/// Writes `variant` to the field
@@ -542,8 +544,8 @@ where
542
544
/// Passing incorrect value can cause undefined behaviour. See reference manual
543
545
#[ inline( always) ]
544
546
pub unsafe fn bits ( self , value : N ) -> & ' a mut REG :: Writer {
545
- self . w . bits = ( self . w . bits & !( U :: mask :: < WI > ( ) << { OF } ) )
546
- | ( ( value. into ( ) & U :: mask :: < WI > ( ) ) << { OF } ) ;
547
+ self . w . bits &= !( U :: mask :: < WI > ( ) << { OF } ) ;
548
+ self . w . bits |= ( value. into ( ) & U :: mask :: < WI > ( ) ) << { OF } ;
547
549
self . w
548
550
}
549
551
/// Writes `variant` to the field
@@ -552,7 +554,6 @@ where
552
554
unsafe { self . bits ( variant. into ( ) ) }
553
555
}
554
556
}
555
-
556
557
impl < ' a , U , REG , N , FI , const WI : u8 , const OF : u8 > FieldWriterSafe < ' a , U , REG , N , FI , WI , OF >
557
558
where
558
559
REG : Writable + RegisterSpec < Ux = U > ,
@@ -563,8 +564,8 @@ where
563
564
/// Writes raw bits to the field
564
565
#[ inline( always) ]
565
566
pub fn bits ( self , value : N ) -> & ' a mut REG :: Writer {
566
- self . w . bits = ( self . w . bits & !( U :: mask :: < WI > ( ) << { OF } ) )
567
- | ( ( value. into ( ) & U :: mask :: < WI > ( ) ) << { OF } ) ;
567
+ self . w . bits &= !( U :: mask :: < WI > ( ) << { OF } ) ;
568
+ self . w . bits |= ( value. into ( ) & U :: mask :: < WI > ( ) ) << { OF } ;
568
569
self . w
569
570
}
570
571
/// Writes `variant` to the field
0 commit comments