Title: [246670] trunk/Source/WTF
Revision
246670
Author
[email protected]
Date
2019-06-20 22:19:27 -0700 (Thu, 20 Jun 2019)

Log Message

Try to use C++14 std::enable_if_t in CheckedArithmetic.h again
https://bugs.webkit.org/show_bug.cgi?id=199099

Reviewed by Ross Kirsling.

r242235 changed CheckedArithmetic to not use C++14. Let's try
C++14 again.

* wtf/CheckedArithmetic.h: Use C++14 std::make_unsigned_t and std::enable_if_t.

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (246669 => 246670)


--- trunk/Source/WTF/ChangeLog	2019-06-21 05:15:06 UTC (rev 246669)
+++ trunk/Source/WTF/ChangeLog	2019-06-21 05:19:27 UTC (rev 246670)
@@ -1,3 +1,15 @@
+2019-06-20  Fujii Hironori  <[email protected]>
+
+        Try to use C++14 std::enable_if_t in CheckedArithmetic.h again
+        https://bugs.webkit.org/show_bug.cgi?id=199099
+
+        Reviewed by Ross Kirsling.
+
+        r242235 changed CheckedArithmetic to not use C++14. Let's try
+        C++14 again.
+
+        * wtf/CheckedArithmetic.h: Use C++14 std::make_unsigned_t and std::enable_if_t.
+
 2019-06-18  Darin Adler  <[email protected]>
 
         Tidy up the remaining bits of the AtomicString to AtomString rename

Modified: trunk/Source/WTF/wtf/CheckedArithmetic.h (246669 => 246670)


--- trunk/Source/WTF/wtf/CheckedArithmetic.h	2019-06-21 05:15:06 UTC (rev 246669)
+++ trunk/Source/WTF/wtf/CheckedArithmetic.h	2019-06-21 05:19:27 UTC (rev 246670)
@@ -181,7 +181,7 @@
     {
         // When converting value to unsigned Source, value will become a big value if value is negative.
         // Casted value will become bigger than Target::max as Source is bigger than Target.
-        return static_cast<typename std::make_unsigned<Source>::type>(value) <= std::numeric_limits<Target>::max();
+        return static_cast<std::make_unsigned_t<Source>>(value) <= std::numeric_limits<Target>::max();
     }
 };
 
@@ -541,7 +541,7 @@
     }
 };
 
-template <class OverflowHandler, typename = typename std::enable_if<!std::is_scalar<OverflowHandler>::value>::type>
+template <class OverflowHandler, typename = std::enable_if_t<!std::is_scalar<OverflowHandler>::value>>
 inline constexpr bool observesOverflow() { return true; }
 
 template <>
@@ -553,7 +553,7 @@
     return true;
 }
 
-template <class OverflowHandler, typename U, typename V, typename R, typename = typename std::enable_if<!std::is_scalar<OverflowHandler>::value>::type>
+template <class OverflowHandler, typename U, typename V, typename R, typename = std::enable_if_t<!std::is_scalar<OverflowHandler>::value>>
 static inline bool safeAdd(U lhs, V rhs, R& result)
 {
     if (observesOverflow<OverflowHandler>())
@@ -567,7 +567,7 @@
     return ArithmeticOperations<U, V, R>::sub(lhs, rhs, result);
 }
 
-template <class OverflowHandler, typename U, typename V, typename R, typename = typename std::enable_if<!std::is_scalar<OverflowHandler>::value>::type>
+template <class OverflowHandler, typename U, typename V, typename R, typename = std::enable_if_t<!std::is_scalar<OverflowHandler>::value>>
 static inline bool safeSub(U lhs, V rhs, R& result)
 {
     if (observesOverflow<OverflowHandler>())
@@ -581,7 +581,7 @@
     return ArithmeticOperations<U, V, R>::multiply(lhs, rhs, result);
 }
 
-template <class OverflowHandler, typename U, typename V, typename R, typename = typename std::enable_if<!std::is_scalar<OverflowHandler>::value>::type>
+template <class OverflowHandler, typename U, typename V, typename R, typename = std::enable_if_t<!std::is_scalar<OverflowHandler>::value>>
 static inline bool safeMultiply(U lhs, V rhs, R& result)
 {
     if (observesOverflow<OverflowHandler>())
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to