This repository was archived by the owner on Apr 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +5
-15
lines changed Expand file tree Collapse file tree 2 files changed +5
-15
lines changed Original file line number Diff line number Diff line change @@ -22,21 +22,16 @@ macro_rules! bench_fn {
22
22
#[ bench]
23
23
#[ allow( unused_mut) ]
24
24
pub fn $id( bh: & mut Bencher ) {
25
- // Type of the system libm fn:
26
- type FnTy = unsafe extern "C" fn ( $( $arg_ids: $arg_tys) ,* ) -> $ret_ty;
27
-
28
- // FIXME: extern "C" wrapper
29
- extern "C" fn libm_fn( $( $arg_ids: $arg_tys) ,* ) -> $ret_ty {
30
- libm:: $id( $( $arg_ids) ,* )
31
- }
25
+ type FnTy
26
+ = unsafe extern "C" fn ( $( $arg_ids: $arg_tys) ,* ) -> $ret_ty;
32
27
33
28
// Generate a tuple of arguments containing random values:
34
29
let mut rng = rand:: thread_rng( ) ;
35
30
let mut x: ( $( $arg_tys, ) + ) = ( $( rng. gen :: <$arg_tys>( ) , ) + ) ;
36
31
37
32
adjust_input!( fn : $id, input: x) ;
38
33
39
- bh. iter( || test:: black_box( x) . call( libm_fn as FnTy ) )
34
+ bh. iter( || test:: black_box( x) . call( libm :: $id as FnTy ) )
40
35
}
41
36
} ;
42
37
}
Original file line number Diff line number Diff line change @@ -80,12 +80,7 @@ macro_rules! system_libm {
80
80
type FnTy
81
81
= unsafe extern "C" fn ( $( $arg_ids: $arg_tys) ,* ) -> $ret_ty;
82
82
83
- // FIXME: extern "C" wrapper over our libm functions
84
- // Shouldn't be needed once they are all extern "C"
85
- extern "C" fn libm_fn( $( $arg_ids: $arg_tys) ,* ) -> $ret_ty {
86
- libm:: $id( $( $arg_ids) ,* )
87
- }
88
- extern "C" {
83
+ extern "C" {
89
84
// The system's libm function:
90
85
fn $id( $( $arg_ids: $arg_tys) ,* ) -> $ret_ty;
91
86
}
@@ -98,7 +93,7 @@ macro_rules! system_libm {
98
93
// correct_input!(fn: $id, input: args);
99
94
adjust_input!( fn : $id, input: args) ;
100
95
101
- let result = args. call( libm_fn as FnTy ) ;
96
+ let result = args. call( libm :: $id as FnTy ) ;
102
97
let expected = args. call( $id as FnTy ) ;
103
98
assert_approx_eq!(
104
99
result == expected,
You can’t perform that action at this time.
0 commit comments