File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed
Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -87,3 +87,11 @@ pub extern "C" fn pthread_atfork(_prefork: *mut u8,
8787 -> i32 {
8888 0
8989}
90+
91+ /// Computes `flags` from `align`.
92+ ///
93+ /// Equivalent to the MALLOCX_ALIGN(a) macro.
94+ #[ inline]
95+ pub fn MALLOCX_ALIGN ( aling : usize ) -> c_int {
96+ aling. trailing_zeros ( ) as c_int
97+ }
Original file line number Diff line number Diff line change @@ -45,11 +45,6 @@ const MIN_ALIGN: usize = 8;
4545 target_arch = "sparc64" ) ) ) ]
4646const MIN_ALIGN : usize = 16 ;
4747
48- // MALLOCX_ALIGN(a) macro
49- fn mallocx_align ( a : usize ) -> c_int {
50- a. trailing_zeros ( ) as c_int
51- }
52-
5348fn layout_to_flags ( layout : & Layout ) -> c_int {
5449 // If our alignment is less than the minimum alignment they we may not
5550 // have to pass special flags asking for a higher alignment. If the
@@ -59,7 +54,7 @@ fn layout_to_flags(layout: &Layout) -> c_int {
5954 if layout. align ( ) <= MIN_ALIGN && layout. align ( ) <= layout. size ( ) {
6055 0
6156 } else {
62- mallocx_align ( layout. align ( ) )
57+ ffi :: MALLOCX_ALIGN ( layout. align ( ) )
6358 }
6459}
6560
You can’t perform that action at this time.
0 commit comments