@@ -84,44 +84,54 @@ mod cmath {
8484 mod shims {
8585 use libc:: { c_float, c_int} ;
8686
87+ #[ inline]
8788 pub unsafe fn acosf ( n : c_float ) -> c_float {
8889 f64:: acos ( n as f64 ) as c_float
8990 }
9091
92+ #[ inline]
9193 pub unsafe fn asinf ( n : c_float ) -> c_float {
9294 f64:: asin ( n as f64 ) as c_float
9395 }
9496
97+ #[ inline]
9598 pub unsafe fn atan2f ( n : c_float , b : c_float ) -> c_float {
9699 f64:: atan2 ( n as f64 , b as f64 ) as c_float
97100 }
98101
102+ #[ inline]
99103 pub unsafe fn atanf ( n : c_float ) -> c_float {
100104 f64:: atan ( n as f64 ) as c_float
101105 }
102106
107+ #[ inline]
103108 pub unsafe fn coshf ( n : c_float ) -> c_float {
104109 f64:: cosh ( n as f64 ) as c_float
105110 }
106111
112+ #[ inline]
107113 pub unsafe fn frexpf ( x : c_float , value : & mut c_int ) -> c_float {
108114 let ( a, b) = f64:: frexp ( x as f64 ) ;
109115 * value = b as c_int ;
110116 a as c_float
111117 }
112118
119+ #[ inline]
113120 pub unsafe fn ldexpf ( x : c_float , n : c_int ) -> c_float {
114121 f64:: ldexp ( x as f64 , n as isize ) as c_float
115122 }
116123
124+ #[ inline]
117125 pub unsafe fn sinhf ( n : c_float ) -> c_float {
118126 f64:: sinh ( n as f64 ) as c_float
119127 }
120128
129+ #[ inline]
121130 pub unsafe fn tanf ( n : c_float ) -> c_float {
122131 f64:: tan ( n as f64 ) as c_float
123132 }
124133
134+ #[ inline]
125135 pub unsafe fn tanhf ( n : c_float ) -> c_float {
126136 f64:: tanh ( n as f64 ) as c_float
127137 }
@@ -272,8 +282,6 @@ impl f32 {
272282 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
273283 #[ inline]
274284 pub fn floor ( self ) -> f32 {
275- return floorf ( self ) ;
276-
277285 // On MSVC LLVM will lower many math intrinsics to a call to the
278286 // corresponding function. On MSVC, however, many of these functions
279287 // aren't actually available as symbols to call, but rather they are all
@@ -288,9 +296,9 @@ impl f32 {
288296 // redirect to this comment, so `floorf` is just one case of a missing
289297 // function on MSVC, but there are many others elsewhere.
290298 #[ cfg( target_env = "msvc" ) ]
291- fn floorf ( f : f32 ) -> f32 { ( f as f64 ) . floor ( ) as f32 }
299+ return ( self as f64 ) . floor ( ) as f32 ;
292300 #[ cfg( not( target_env = "msvc" ) ) ]
293- fn floorf ( f : f32 ) -> f32 { unsafe { intrinsics:: floorf32 ( f ) } }
301+ return unsafe { intrinsics:: floorf32 ( self ) } ;
294302 }
295303
296304 /// Returns the smallest integer greater than or equal to a number.
@@ -305,13 +313,11 @@ impl f32 {
305313 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
306314 #[ inline]
307315 pub fn ceil ( self ) -> f32 {
308- return ceilf ( self ) ;
309-
310316 // see notes above in `floor`
311317 #[ cfg( target_env = "msvc" ) ]
312- fn ceilf ( f : f32 ) -> f32 { ( f as f64 ) . ceil ( ) as f32 }
318+ return ( self as f64 ) . ceil ( ) as f32 ;
313319 #[ cfg( not( target_env = "msvc" ) ) ]
314- fn ceilf ( f : f32 ) -> f32 { unsafe { intrinsics:: ceilf32 ( f ) } }
320+ return unsafe { intrinsics:: ceilf32 ( self ) } ;
315321 }
316322
317323 /// Returns the nearest integer to a number. Round half-way cases away from
@@ -506,13 +512,11 @@ impl f32 {
506512 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
507513 #[ inline]
508514 pub fn powf ( self , n : f32 ) -> f32 {
509- return powf ( self , n) ;
510-
511515 // see notes above in `floor`
512516 #[ cfg( target_env = "msvc" ) ]
513- fn powf ( f : f32 , n : f32 ) -> f32 { ( f as f64 ) . powf ( n as f64 ) as f32 }
517+ return ( self as f64 ) . powf ( n as f64 ) as f32 ;
514518 #[ cfg( not( target_env = "msvc" ) ) ]
515- fn powf ( f : f32 , n : f32 ) -> f32 { unsafe { intrinsics:: powf32 ( f , n) } }
519+ return unsafe { intrinsics:: powf32 ( self , n) } ;
516520 }
517521
518522 /// Takes the square root of a number.
@@ -557,13 +561,11 @@ impl f32 {
557561 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
558562 #[ inline]
559563 pub fn exp ( self ) -> f32 {
560- return expf ( self ) ;
561-
562564 // see notes above in `floor`
563565 #[ cfg( target_env = "msvc" ) ]
564- fn expf ( f : f32 ) -> f32 { ( f as f64 ) . exp ( ) as f32 }
566+ return ( self as f64 ) . exp ( ) as f32 ;
565567 #[ cfg( not( target_env = "msvc" ) ) ]
566- fn expf ( f : f32 ) -> f32 { unsafe { intrinsics:: expf32 ( f ) } }
568+ return unsafe { intrinsics:: expf32 ( self ) } ;
567569 }
568570
569571 /// Returns `2^(self)`.
@@ -601,13 +603,11 @@ impl f32 {
601603 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
602604 #[ inline]
603605 pub fn ln ( self ) -> f32 {
604- return logf ( self ) ;
605-
606606 // see notes above in `floor`
607607 #[ cfg( target_env = "msvc" ) ]
608- fn logf ( f : f32 ) -> f32 { ( f as f64 ) . ln ( ) as f32 }
608+ return ( self as f64 ) . ln ( ) as f32 ;
609609 #[ cfg( not( target_env = "msvc" ) ) ]
610- fn logf ( f : f32 ) -> f32 { unsafe { intrinsics:: logf32 ( f ) } }
610+ return unsafe { intrinsics:: logf32 ( self ) } ;
611611 }
612612
613613 /// Returns the logarithm of the number with respect to an arbitrary base.
@@ -664,13 +664,11 @@ impl f32 {
664664 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
665665 #[ inline]
666666 pub fn log10 ( self ) -> f32 {
667- return log10f ( self ) ;
668-
669667 // see notes above in `floor`
670668 #[ cfg( target_env = "msvc" ) ]
671- fn log10f ( f : f32 ) -> f32 { ( f as f64 ) . log10 ( ) as f32 }
669+ return ( self as f64 ) . log10 ( ) as f32 ;
672670 #[ cfg( not( target_env = "msvc" ) ) ]
673- fn log10f ( f : f32 ) -> f32 { unsafe { intrinsics:: log10f32 ( f ) } }
671+ return unsafe { intrinsics:: log10f32 ( self ) } ;
674672 }
675673
676674 /// Converts radians to degrees.
@@ -884,13 +882,11 @@ impl f32 {
884882 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
885883 #[ inline]
886884 pub fn sin ( self ) -> f32 {
887- return sinf ( self ) ;
888-
889885 // see notes in `core::f32::Float::floor`
890886 #[ cfg( target_env = "msvc" ) ]
891- fn sinf ( f : f32 ) -> f32 { ( f as f64 ) . sin ( ) as f32 }
887+ return ( self as f64 ) . sin ( ) as f32 ;
892888 #[ cfg( not( target_env = "msvc" ) ) ]
893- fn sinf ( f : f32 ) -> f32 { unsafe { intrinsics:: sinf32 ( f ) } }
889+ return unsafe { intrinsics:: sinf32 ( self ) } ;
894890 }
895891
896892 /// Computes the cosine of a number (in radians).
@@ -907,13 +903,11 @@ impl f32 {
907903 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
908904 #[ inline]
909905 pub fn cos ( self ) -> f32 {
910- return cosf ( self ) ;
911-
912906 // see notes in `core::f32::Float::floor`
913907 #[ cfg( target_env = "msvc" ) ]
914- fn cosf ( f : f32 ) -> f32 { ( f as f64 ) . cos ( ) as f32 }
908+ return ( self as f64 ) . cos ( ) as f32 ;
915909 #[ cfg( not( target_env = "msvc" ) ) ]
916- fn cosf ( f : f32 ) -> f32 { unsafe { intrinsics:: cosf32 ( f ) } }
910+ return unsafe { intrinsics:: cosf32 ( self ) } ;
917911 }
918912
919913 /// Computes the tangent of a number (in radians).
0 commit comments