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,
87
87
-> i32 {
88
88
0
89
89
}
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;
45
45
target_arch = "sparc64" ) ) ) ]
46
46
const MIN_ALIGN : usize = 16 ;
47
47
48
- // MALLOCX_ALIGN(a) macro
49
- fn mallocx_align ( a : usize ) -> c_int {
50
- a. trailing_zeros ( ) as c_int
51
- }
52
-
53
48
fn layout_to_flags ( layout : & Layout ) -> c_int {
54
49
// If our alignment is less than the minimum alignment they we may not
55
50
// have to pass special flags asking for a higher alignment. If the
@@ -59,7 +54,7 @@ fn layout_to_flags(layout: &Layout) -> c_int {
59
54
if layout. align ( ) <= MIN_ALIGN && layout. align ( ) <= layout. size ( ) {
60
55
0
61
56
} else {
62
- mallocx_align ( layout. align ( ) )
57
+ ffi :: MALLOCX_ALIGN ( layout. align ( ) )
63
58
}
64
59
}
65
60
You can’t perform that action at this time.
0 commit comments