File tree Expand file tree Collapse file tree 2 files changed +3
-14
lines changed Expand file tree Collapse file tree 2 files changed +3
-14
lines changed Original file line number Diff line number Diff line change @@ -535,11 +535,7 @@ impl Sub<PhysAddr> for PhysAddr {
535
535
/// a power of 2.
536
536
#[ inline]
537
537
pub const fn align_down ( addr : u64 , align : u64 ) -> u64 {
538
- #[ cfg( feature = "const_fn" ) ]
539
- assert ! ( align. is_power_of_two( ) , "`align` must be a power of two" ) ;
540
- #[ cfg( not( feature = "const_fn" ) ) ]
541
- [ ( ) ; 1 ] [ !align. is_power_of_two ( ) as usize ] ;
542
-
538
+ const_assert ! ( align. is_power_of_two( ) , "`align` must be a power of two" ) ;
543
539
addr & !( align - 1 )
544
540
}
545
541
@@ -549,11 +545,7 @@ pub const fn align_down(addr: u64, align: u64) -> u64 {
549
545
/// a power of 2.
550
546
#[ inline]
551
547
pub const fn align_up ( addr : u64 , align : u64 ) -> u64 {
552
- #[ cfg( feature = "const_fn" ) ]
553
- assert ! ( align. is_power_of_two( ) , "`align` must be a power of two" ) ;
554
- #[ cfg( not( feature = "const_fn" ) ) ]
555
- [ ( ) ; 1 ] [ !align. is_power_of_two ( ) as usize ] ;
556
-
548
+ const_assert ! ( align. is_power_of_two( ) , "`align` must be a power of two" ) ;
557
549
let align_mask = align - 1 ;
558
550
if addr & align_mask == 0 {
559
551
addr // already aligned
Original file line number Diff line number Diff line change @@ -117,13 +117,10 @@ impl GlobalDescriptorTable {
117
117
let mut table = [ 0 ; 8 ] ;
118
118
let mut idx = 0 ;
119
119
120
- #[ cfg( feature = "const_fn" ) ]
121
- assert ! (
120
+ const_assert ! (
122
121
next_free <= 8 ,
123
122
"initializing a GDT from a slice requires it to be **at most** 8 elements."
124
123
) ;
125
- #[ cfg( not( feature = "const_fn" ) ) ]
126
- [ ( ) ; 1 ] [ !( next_free <= 8 ) as usize ] ;
127
124
128
125
while idx != next_free {
129
126
table[ idx] = slice[ idx] ;
You can’t perform that action at this time.
0 commit comments