Title: [199133] trunk/Source/WTF
Revision
199133
Author
[email protected]
Date
2016-04-06 18:46:53 -0700 (Wed, 06 Apr 2016)

Log Message

Fix Windows build by converting clampToInteger() into a template that only
takes integral types.

* wtf/MathExtras.h:
(clampToInteger):

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (199132 => 199133)


--- trunk/Source/WTF/ChangeLog	2016-04-07 01:44:23 UTC (rev 199132)
+++ trunk/Source/WTF/ChangeLog	2016-04-07 01:46:53 UTC (rev 199133)
@@ -1,5 +1,13 @@
 2016-04-06  Simon Fraser  <[email protected]>
 
+        Fix Windows build by converting clampToInteger() into a template that only
+        takes integral types.
+
+        * wtf/MathExtras.h:
+        (clampToInteger):
+
+2016-04-06  Simon Fraser  <[email protected]>
+
         Page tiles are missing when graphics acceleration is unavailable
         https://bugs.webkit.org/show_bug.cgi?id=156325
 

Modified: trunk/Source/WTF/wtf/MathExtras.h (199132 => 199133)


--- trunk/Source/WTF/wtf/MathExtras.h	2016-04-07 01:44:23 UTC (rev 199132)
+++ trunk/Source/WTF/wtf/MathExtras.h	2016-04-07 01:46:53 UTC (rev 199133)
@@ -181,19 +181,13 @@
     return clampTo<int>(value);
 }
 
-inline int clampToInteger(unsigned x)
+template<typename T>
+inline int clampToInteger(T x)
 {
-    const unsigned intMax = static_cast<unsigned>(std::numeric_limits<int>::max());
+    static_assert(std::numeric_limits<T>::is_integer, "T must be an integer.");
 
-    if (x >= intMax)
-        return std::numeric_limits<int>::max();
-    return static_cast<int>(x);
-}
+    const T intMax = static_cast<unsigned>(std::numeric_limits<int>::max());
 
-inline int clampToInteger(size_t x)
-{
-    const size_t intMax = static_cast<size_t>(std::numeric_limits<int>::max());
-
     if (x >= intMax)
         return std::numeric_limits<int>::max();
     return static_cast<int>(x);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to