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

Unified Diff: Source/platform/LayoutUnit.h

Issue 346913004: Some inline ARM assembly for saturated arithmetic, a small speed-up for (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Implicit casting removed Created 6 years, 6 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/wtf/SaturatedArithmetic.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/LayoutUnit.h
diff --git a/Source/platform/LayoutUnit.h b/Source/platform/LayoutUnit.h
index e931ced19ca4048a14c083c604a00dbc55007c30..4f677d1dd60f97ad79948760415d97bdbe7cf79e 100644
--- a/Source/platform/LayoutUnit.h
+++ b/Source/platform/LayoutUnit.h
@@ -220,21 +220,14 @@ private:
return ::fabs(value) <= std::numeric_limits<int>::max() / kFixedPointDenominator;
}
- inline void setValue(int value)
+ ALWAYS_INLINE void setValue(int value)
{
- if (value > intMaxForLayoutUnit)
- m_value = std::numeric_limits<int>::max();
- else if (value < intMinForLayoutUnit)
- m_value = std::numeric_limits<int>::min();
- else
- m_value = value * kFixedPointDenominator;
+ m_value = saturatedSet(value, kLayoutUnitFractionalBits);
}
+
inline void setValue(unsigned value)
{
- if (value >= static_cast<unsigned>(intMaxForLayoutUnit))
- m_value = std::numeric_limits<int>::max();
- else
- m_value = value * kFixedPointDenominator;
+ m_value = saturatedSet(value, kLayoutUnitFractionalBits);
}
int m_value;
« no previous file with comments | « no previous file | Source/wtf/SaturatedArithmetic.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698