Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Side by Side Diff: third_party/WebKit/Source/platform/LayoutUnit.h

Issue 1456173004: wtf: Eliminate inliner abuse in saturatedSet function. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « build/common.gypi ('k') | third_party/WebKit/Source/wtf/SaturatedArithmetic.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012, Google Inc. All rights reserved. 2 * Copyright (c) 2012, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 { 211 {
212 return value <= static_cast<unsigned>(std::numeric_limits<int>::max()) / kFixedPointDenominator; 212 return value <= static_cast<unsigned>(std::numeric_limits<int>::max()) / kFixedPointDenominator;
213 } 213 }
214 static bool isInBounds(double value) 214 static bool isInBounds(double value)
215 { 215 {
216 return ::fabs(value) <= std::numeric_limits<int>::max() / kFixedPointDen ominator; 216 return ::fabs(value) <= std::numeric_limits<int>::max() / kFixedPointDen ominator;
217 } 217 }
218 218
219 ALWAYS_INLINE void setValue(int value) 219 ALWAYS_INLINE void setValue(int value)
220 { 220 {
221 m_value = saturatedSet(value, kLayoutUnitFractionalBits); 221 m_value = saturatedSet<kLayoutUnitFractionalBits>(value);
222 } 222 }
223 223
224 inline void setValue(unsigned value) 224 inline void setValue(unsigned value)
225 { 225 {
226 m_value = saturatedSet(value, kLayoutUnitFractionalBits); 226 m_value = saturatedSet<kLayoutUnitFractionalBits>(value);
227 } 227 }
228 228
229 int m_value; 229 int m_value;
230 }; 230 };
231 231
232 inline bool operator<=(const LayoutUnit& a, const LayoutUnit& b) 232 inline bool operator<=(const LayoutUnit& a, const LayoutUnit& b)
233 { 233 {
234 return a.rawValue() <= b.rawValue(); 234 return a.rawValue() <= b.rawValue();
235 } 235 }
236 236
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
789 if (value >= max) 789 if (value >= max)
790 return max; 790 return max;
791 if (value <= min) 791 if (value <= min)
792 return min; 792 return min;
793 return value; 793 return value;
794 } 794 }
795 795
796 } // namespace blink 796 } // namespace blink
797 797
798 #endif // LayoutUnit_h 798 #endif // LayoutUnit_h
OLDNEW
« no previous file with comments | « build/common.gypi ('k') | third_party/WebKit/Source/wtf/SaturatedArithmetic.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698