Title: [199139] tags/Safari-602.1.27/Source/WTF
- Revision
- 199139
- Author
- bshaf...@apple.com
- Date
- 2016-04-06 18:59:45 -0700 (Wed, 06 Apr 2016)
Log Message
Merged r199133. rdar://problem/25587476
Modified Paths
Diff
Modified: tags/Safari-602.1.27/Source/WTF/ChangeLog (199138 => 199139)
--- tags/Safari-602.1.27/Source/WTF/ChangeLog 2016-04-07 01:58:47 UTC (rev 199138)
+++ tags/Safari-602.1.27/Source/WTF/ChangeLog 2016-04-07 01:59:45 UTC (rev 199139)
@@ -1,5 +1,17 @@
2016-04-06 Babak Shafiei <bshaf...@apple.com>
+ Merge r199133.
+
+ 2016-04-06 Simon Fraser <simon.fra...@apple.com>
+
+ Fix Windows build by converting clampToInteger() into a template that only
+ takes integral types.
+
+ * wtf/MathExtras.h:
+ (clampToInteger):
+
+2016-04-06 Babak Shafiei <bshaf...@apple.com>
+
Merge r199130.
2016-04-06 Simon Fraser <simon.fra...@apple.com>
Modified: tags/Safari-602.1.27/Source/WTF/wtf/MathExtras.h (199138 => 199139)
--- tags/Safari-602.1.27/Source/WTF/wtf/MathExtras.h 2016-04-07 01:58:47 UTC (rev 199138)
+++ tags/Safari-602.1.27/Source/WTF/wtf/MathExtras.h 2016-04-07 01:59:45 UTC (rev 199139)
@@ -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
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes