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 {
535535/// a power of 2.
536536#[ inline]
537537pub 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" ) ;
543539 addr & !( align - 1 )
544540}
545541
@@ -549,11 +545,7 @@ pub const fn align_down(addr: u64, align: u64) -> u64 {
549545/// a power of 2.
550546#[ inline]
551547pub 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" ) ;
557549 let align_mask = align - 1 ;
558550 if addr & align_mask == 0 {
559551 addr // already aligned
Original file line number Diff line number Diff line change @@ -117,13 +117,10 @@ impl GlobalDescriptorTable {
117117 let mut table = [ 0 ; 8 ] ;
118118 let mut idx = 0 ;
119119
120- #[ cfg( feature = "const_fn" ) ]
121- assert ! (
120+ const_assert ! (
122121 next_free <= 8 ,
123122 "initializing a GDT from a slice requires it to be **at most** 8 elements."
124123 ) ;
125- #[ cfg( not( feature = "const_fn" ) ) ]
126- [ ( ) ; 1 ] [ !( next_free <= 8 ) as usize ] ;
127124
128125 while idx != next_free {
129126 table[ idx] = slice[ idx] ;
You can’t perform that action at this time.
0 commit comments