@@ -44,23 +44,7 @@ impl f32 {
4444 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
4545 #[ inline]
4646 pub fn floor ( self ) -> f32 {
47- // On MSVC LLVM will lower many math intrinsics to a call to the
48- // corresponding function. On MSVC, however, many of these functions
49- // aren't actually available as symbols to call, but rather they are all
50- // `static inline` functions in header files. This means that from a C
51- // perspective it's "compatible", but not so much from an ABI
52- // perspective (which we're worried about).
53- //
54- // The inline header functions always just cast to a f64 and do their
55- // operation, so we do that here as well, but only for MSVC targets.
56- //
57- // Note that there are many MSVC-specific float operations which
58- // redirect to this comment, so `floorf` is just one case of a missing
59- // function on MSVC, but there are many others elsewhere.
60- #[ cfg( target_env = "msvc" ) ]
61- return ( self as f64 ) . floor ( ) as f32 ;
62- #[ cfg( not( target_env = "msvc" ) ) ]
63- return unsafe { intrinsics:: floorf32 ( self ) } ;
47+ unsafe { intrinsics:: floorf32 ( self ) }
6448 }
6549
6650 /// Returns the smallest integer greater than or equal to a number.
@@ -78,11 +62,7 @@ impl f32 {
7862 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
7963 #[ inline]
8064 pub fn ceil ( self ) -> f32 {
81- // see notes above in `floor`
82- #[ cfg( target_env = "msvc" ) ]
83- return ( self as f64 ) . ceil ( ) as f32 ;
84- #[ cfg( not( target_env = "msvc" ) ) ]
85- return unsafe { intrinsics:: ceilf32 ( self ) } ;
65+ unsafe { intrinsics:: ceilf32 ( self ) }
8666 }
8767
8868 /// Returns the nearest integer to a number. Round half-way cases away from
@@ -348,11 +328,7 @@ impl f32 {
348328 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
349329 #[ inline]
350330 pub fn powf ( self , n : f32 ) -> f32 {
351- // see notes above in `floor`
352- #[ cfg( target_env = "msvc" ) ]
353- return ( self as f64 ) . powf ( n as f64 ) as f32 ;
354- #[ cfg( not( target_env = "msvc" ) ) ]
355- return unsafe { intrinsics:: powf32 ( self , n) } ;
331+ unsafe { intrinsics:: powf32 ( self , n) }
356332 }
357333
358334 /// Returns the square root of a number.
@@ -399,11 +375,7 @@ impl f32 {
399375 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
400376 #[ inline]
401377 pub fn exp ( self ) -> f32 {
402- // see notes above in `floor`
403- #[ cfg( target_env = "msvc" ) ]
404- return ( self as f64 ) . exp ( ) as f32 ;
405- #[ cfg( not( target_env = "msvc" ) ) ]
406- return unsafe { intrinsics:: expf32 ( self ) } ;
378+ unsafe { intrinsics:: expf32 ( self ) }
407379 }
408380
409381 /// Returns `2^(self)`.
@@ -447,11 +419,7 @@ impl f32 {
447419 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
448420 #[ inline]
449421 pub fn ln ( self ) -> f32 {
450- // see notes above in `floor`
451- #[ cfg( target_env = "msvc" ) ]
452- return ( self as f64 ) . ln ( ) as f32 ;
453- #[ cfg( not( target_env = "msvc" ) ) ]
454- return unsafe { intrinsics:: logf32 ( self ) } ;
422+ unsafe { intrinsics:: logf32 ( self ) }
455423 }
456424
457425 /// Returns the logarithm of the number with respect to an arbitrary base.
@@ -521,11 +489,7 @@ impl f32 {
521489 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
522490 #[ inline]
523491 pub fn log10 ( self ) -> f32 {
524- // see notes above in `floor`
525- #[ cfg( target_env = "msvc" ) ]
526- return ( self as f64 ) . log10 ( ) as f32 ;
527- #[ cfg( not( target_env = "msvc" ) ) ]
528- return unsafe { intrinsics:: log10f32 ( self ) } ;
492+ unsafe { intrinsics:: log10f32 ( self ) }
529493 }
530494
531495 /// The positive difference of two numbers.
@@ -625,11 +589,7 @@ impl f32 {
625589 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
626590 #[ inline]
627591 pub fn sin ( self ) -> f32 {
628- // see notes in `core::f32::Float::floor`
629- #[ cfg( target_env = "msvc" ) ]
630- return ( self as f64 ) . sin ( ) as f32 ;
631- #[ cfg( not( target_env = "msvc" ) ) ]
632- return unsafe { intrinsics:: sinf32 ( self ) } ;
592+ unsafe { intrinsics:: sinf32 ( self ) }
633593 }
634594
635595 /// Computes the cosine of a number (in radians).
@@ -649,11 +609,7 @@ impl f32 {
649609 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
650610 #[ inline]
651611 pub fn cos ( self ) -> f32 {
652- // see notes in `core::f32::Float::floor`
653- #[ cfg( target_env = "msvc" ) ]
654- return ( self as f64 ) . cos ( ) as f32 ;
655- #[ cfg( not( target_env = "msvc" ) ) ]
656- return unsafe { intrinsics:: cosf32 ( self ) } ;
612+ unsafe { intrinsics:: cosf32 ( self ) }
657613 }
658614
659615 /// Computes the tangent of a number (in radians).
0 commit comments