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

Unified Diff: third_party/WebKit/Source/wtf/asm/SaturatedArithmeticARM.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/wtf/SaturatedArithmeticTest.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/wtf/asm/SaturatedArithmeticARM.h
diff --git a/third_party/WebKit/Source/wtf/asm/SaturatedArithmeticARM.h b/third_party/WebKit/Source/wtf/asm/SaturatedArithmeticARM.h
index 5527cacf9b2a3f47988c7963d2d2101cc8353b9e..d0a728015638e76d76491474496a007d7a5982ae 100644
--- a/third_party/WebKit/Source/wtf/asm/SaturatedArithmeticARM.h
+++ b/third_party/WebKit/Source/wtf/asm/SaturatedArithmeticARM.h
@@ -46,11 +46,12 @@ inline int getMinSaturatedSetResultForTesting(int FractionalShift)
return std::numeric_limits<int>::min();
}
-ALWAYS_INLINE int saturatedSet(int value, int FractionalShift)
+template <int FractionalShift>
+ALWAYS_INLINE int saturatedSet(int value)
{
// Figure out how many bits are left for storing the integer part of
// the fixed point number, and saturate our input to that
- const int saturate = 32 - FractionalShift;
+ enum { Saturate = 32 - FractionalShift };
int result;
@@ -66,21 +67,22 @@ ALWAYS_INLINE int saturatedSet(int value, int FractionalShift)
"lsl %[output],%[shift]"
: [output] "=r" (result)
: [value] "r" (value),
- [saturate] "n" (saturate),
+ [saturate] "n" (Saturate),
[shift] "n" (FractionalShift));
return result;
}
-ALWAYS_INLINE int saturatedSet(unsigned value, int FractionalShift)
+template <int FractionalShift>
+ALWAYS_INLINE int saturatedSet(unsigned value)
{
// Here we are being passed an unsigned value to saturate,
// even though the result is returned as a signed integer. The ARM
// instruction for unsigned saturation therefore needs to be given one
// less bit (i.e. the sign bit) for the saturation to work correctly; hence
// the '31' below.
- const int saturate = 31 - FractionalShift;
+ enum { Saturate = 31 - FractionalShift };
// The following ARM code will Saturate the passed value to the number of
// bits used for the whole part of the fixed point representation, then
@@ -96,7 +98,7 @@ ALWAYS_INLINE int saturatedSet(unsigned value, int FractionalShift)
"lsl %[output],%[shift]"
: [output] "=r" (result)
: [value] "r" (value),
- [saturate] "n" (saturate),
+ [saturate] "n" (Saturate),
[shift] "n" (FractionalShift));
return result;
« no previous file with comments | « third_party/WebKit/Source/wtf/SaturatedArithmeticTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698