Changeset 199133 in webkit
- Timestamp:
- Apr 6, 2016 6:46:53 PM (8 years ago)
- Location:
- trunk/Source/WTF
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r199130 r199133 1 2016-04-06 Simon Fraser <simon.fraser@apple.com> 2 3 Fix Windows build by converting clampToInteger() into a template that only 4 takes integral types. 5 6 * wtf/MathExtras.h: 7 (clampToInteger): 8 1 9 2016-04-06 Simon Fraser <simon.fraser@apple.com> 2 10 -
trunk/Source/WTF/wtf/MathExtras.h
r199130 r199133 182 182 } 183 183 184 inline int clampToInteger(unsigned x) 185 { 186 const unsigned intMax = static_cast<unsigned>(std::numeric_limits<int>::max()); 187 188 if (x >= intMax) 189 return std::numeric_limits<int>::max(); 190 return static_cast<int>(x); 191 } 192 193 inline int clampToInteger(size_t x) 194 { 195 const size_t intMax = static_cast<size_t>(std::numeric_limits<int>::max()); 184 template<typename T> 185 inline int clampToInteger(T x) 186 { 187 static_assert(std::numeric_limits<T>::is_integer, "T must be an integer."); 188 189 const T intMax = static_cast<unsigned>(std::numeric_limits<int>::max()); 196 190 197 191 if (x >= intMax)
Note: See TracChangeset
for help on using the changeset viewer.