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 {
2222 #[ bench]
2323 #[ allow( unused_mut) ]
2424 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;
3227
3328 // Generate a tuple of arguments containing random values:
3429 let mut rng = rand:: thread_rng( ) ;
3530 let mut x: ( $( $arg_tys, ) + ) = ( $( rng. gen :: <$arg_tys>( ) , ) + ) ;
3631
3732 adjust_input!( fn : $id, input: x) ;
3833
39- bh. iter( || test:: black_box( x) . call( libm_fn as FnTy ) )
34+ bh. iter( || test:: black_box( x) . call( libm :: $id as FnTy ) )
4035 }
4136 } ;
4237}
Original file line number Diff line number Diff line change @@ -80,12 +80,7 @@ macro_rules! system_libm {
8080 type FnTy
8181 = unsafe extern "C" fn ( $( $arg_ids: $arg_tys) ,* ) -> $ret_ty;
8282
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" {
8984 // The system's libm function:
9085 fn $id( $( $arg_ids: $arg_tys) ,* ) -> $ret_ty;
9186 }
@@ -98,7 +93,7 @@ macro_rules! system_libm {
9893 // correct_input!(fn: $id, input: args);
9994 adjust_input!( fn : $id, input: args) ;
10095
101- let result = args. call( libm_fn as FnTy ) ;
96+ let result = args. call( libm :: $id as FnTy ) ;
10297 let expected = args. call( $id as FnTy ) ;
10398 assert_approx_eq!(
10499 result == expected,
You can’t perform that action at this time.
0 commit comments