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

Unified Diff: Source/platform/LayoutUnit.h

Issue 378253003: Saturated arithmetic changed to use templates to fix build-issues (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 5 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') | Source/wtf/SaturatedArithmetic.h » ('J')
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 4f677d1dd60f97ad79948760415d97bdbe7cf79e..2ea2be3511e6c70c67046826d13a60150ab6e3b8 100644
--- a/Source/platform/LayoutUnit.h
+++ b/Source/platform/LayoutUnit.h
@@ -222,12 +222,24 @@ private:
ALWAYS_INLINE void setValue(int value)
{
- m_value = saturatedSet(value, kLayoutUnitFractionalBits);
+ // The inner function needs to be implemented as a template to
+ // maintain a common interface for both C++ and ARM versions. The first
+ // parameter specifies how many bits we saturate to (for ARM).
+ m_value = saturatedSetSigned<
+ 32-kLayoutUnitFractionalBits,
Sami 2014/07/09 13:59:26 Please add spaces around the '-'.
picksi 2014/07/09 14:27:52 Done.
+ kLayoutUnitFractionalBits>(value);
}
- inline void setValue(unsigned value)
+ ALWAYS_INLINE void setValue(unsigned value)
{
- m_value = saturatedSet(value, kLayoutUnitFractionalBits);
+ // The inner function needs to be implemented as a template to
+ // maintain a common interface for both C++ and ARM versions. The first
+ // parameter specifies how many bits we saturate to (for ARM). This is
+ // one bit less than the signed version due to the ARM instructions for
+ // unsigned saturation.
+ m_value = saturatedSetUnsigned<
+ 31-kLayoutUnitFractionalBits,
Sami 2014/07/09 13:59:26 Ditto.
picksi 2014/07/09 14:27:52 Done.
+ kLayoutUnitFractionalBits>(value);
}
int m_value;
« no previous file with comments | « no previous file | Source/wtf/SaturatedArithmetic.h » ('j') | Source/wtf/SaturatedArithmetic.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698