[libcxx-commits] [PATCH] D57778: std::abs should not return double (2735)

Zoe Carver via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Feb 5 12:32:50 PST 2019


zoecarver updated this revision to Diff 185377.
zoecarver edited the summary of this revision.
zoecarver added a comment.

Use proper format for diff.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57778/new/

https://reviews.llvm.org/D57778

Files:
  include/math.h


Index: include/math.h
===================================================================
--- include/math.h
+++ include/math.h
@@ -766,6 +766,14 @@
 inline _LIBCPP_INLINE_VISIBILITY
 long double
 abs(long double __lcpp_x) _NOEXCEPT {return ::fabsl(__lcpp_x);}
+    
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::enable_if<
+    std::is_integral<_A1>::value &&
+    !std::is_unsigned<_A1>::value, // allows for long long int, long int, int
+_A1>::type
+abs(_A1 __lcpp_x) _NOEXCEPT {return abs(__lcpp_x);}
 #endif // !(defined(_AIX) || defined(__sun__))
 
 // acos


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57778.185377.patch
Type: text/x-patch
Size: 589 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20190205/9a52f14b/attachment.bin>


More information about the libcxx-commits mailing list