[cfe-commits] [libcxx] r156064 - /libcxx/trunk/include/cmath

Howard Hinnant hhinnant at apple.com
Thu May 3 07:58:34 PDT 2012


Author: hhinnant
Date: Thu May  3 09:58:34 2012
New Revision: 156064

URL: http://llvm.org/viewvc/llvm-project?rev=156064&view=rev
Log:
Change std::abs from a template function to three overloads for float, double and long double.

Modified:
    libcxx/trunk/include/cmath

Modified: libcxx/trunk/include/cmath
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/cmath?rev=156064&r1=156063&r2=156064&view=diff
==============================================================================
--- libcxx/trunk/include/cmath (original)
+++ libcxx/trunk/include/cmath Thu May  3 09:58:34 2012
@@ -648,10 +648,17 @@
 
 // abs
 
-template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if<is_floating_point<_A1>::value, _A1>::type
-abs(_A1 __x) {return fabs(__x);}
+float
+abs(float __x) {return fabsf(__x);}
+
+inline _LIBCPP_INLINE_VISIBILITY
+double
+abs(double __x) {return fabs(__x);}
+
+inline _LIBCPP_INLINE_VISIBILITY
+long double
+abs(long double __x) {return fabsl(__x);}
 
 #ifndef __sun__
 





More information about the cfe-commits mailing list