File tree Expand file tree Collapse file tree 2 files changed +9
-10
lines changed Expand file tree Collapse file tree 2 files changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -810,20 +810,19 @@ impl Align {
810810 self . bits ( ) . try_into ( ) . unwrap ( )
811811 }
812812
813- /// Computes the best alignment possible for the given offset
814- /// (the largest power of two that the offset is a multiple of).
813+ /// Obtain the greatest factor of `size` that is an alignment
814+ /// (the largest power of two the Size is a multiple of).
815815 ///
816- /// N.B., for an offset of `0`, this happens to return `2^64`.
816+ /// Note that all numbers are factors of 0
817817 #[ inline]
818- pub fn max_for_offset ( offset : Size ) -> Align {
819- Align { pow2 : offset . bytes ( ) . trailing_zeros ( ) as u8 }
818+ pub fn max_aligned_factor ( size : Size ) -> Align {
819+ Align { pow2 : size . bytes ( ) . trailing_zeros ( ) as u8 }
820820 }
821821
822- /// Lower the alignment, if necessary, such that the given offset
823- /// is aligned to it (the offset is a multiple of the alignment).
822+ /// Reduces Align to an aligned factor of `size`.
824823 #[ inline]
825- pub fn restrict_for_offset ( self , offset : Size ) -> Align {
826- self . min ( Align :: max_for_offset ( offset ) )
824+ pub fn restrict_for_offset ( self , size : Size ) -> Align {
825+ self . min ( Align :: max_aligned_factor ( size ) )
827826 }
828827}
829828
Original file line number Diff line number Diff line change @@ -534,7 +534,7 @@ fn layout_of_uncached<'tcx>(
534534 (
535535 BackendRepr :: Memory { sized : true } ,
536536 AbiAndPrefAlign {
537- abi : Align :: max_for_offset ( size) ,
537+ abi : Align :: max_aligned_factor ( size) ,
538538 pref : dl. vector_align ( size) . pref ,
539539 } ,
540540 )
You can’t perform that action at this time.
0 commit comments