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

Unified Diff: src/core/SkOpts.cpp

Issue 1270573002: Port SkUtils opts to SkOpts. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: derek Created 5 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 | « src/core/SkOpts.h ('k') | src/core/SkUtils.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkOpts.cpp
diff --git a/src/core/SkOpts.cpp b/src/core/SkOpts.cpp
index 7da306c99d538417eb2948210f1e2bc9629fa8cb..45715a5c1518ec69192e38fc1829bf092665751f 100644
--- a/src/core/SkOpts.cpp
+++ b/src/core/SkOpts.cpp
@@ -20,7 +20,9 @@
#include <cpu-features.h>
#endif
-static float rsqrt_portable(float x) {
+namespace portable { // This helps identify methods from this file when debugging / profiling.
+
+static float rsqrt(float x) {
// Get initial estimate.
int i = *SkTCast<int*>(&x);
i = 0x5F1FFFF9 - (i>>1);
@@ -32,9 +34,17 @@ static float rsqrt_portable(float x) {
return estimate;
}
+template <typename T>
+static void memsetT(T dst[], T val, int n) { while (n --> 0) { *dst++ = val; } }
+
+} // namespace portable
+
namespace SkOpts {
// Define default function pointer values here...
- decltype(rsqrt) rsqrt = rsqrt_portable;
+ decltype(rsqrt) rsqrt = portable::rsqrt;
+ decltype(memset16) memset16 = portable::memsetT<uint16_t>;
+ decltype(memset32) memset32 = portable::memsetT<uint32_t>;
+
// Each Init_foo() is defined in src/opts/SkOpts_foo.cpp.
void Init_sse2();
« no previous file with comments | « src/core/SkOpts.h ('k') | src/core/SkUtils.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698