aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkNx.h
diff options
context:
space:
mode:
authorGravatar Mike Klein <mtklein@chromium.org>2016-10-14 17:09:03 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-10-14 21:57:50 +0000
commit1e76464f87ea55a8749eb94b8e6c79638983d65a (patch)
treecb7fc78b152f335e1437cb0f957943a0cd8ba80a /src/core/SkNx.h
parente5e7eb1478b6a856480c03ac986c4e6bb32d9f80 (diff)
Wrap SkNx types in anonymous namespace again.
This should make each compilation unit's SkNx types distinct from each other's as far as C++ cares. This keeps us from violating the One Definition Rule with different implementations for the same function. Here's an example I like. Sk4i SkNx_cast(Sk4b) has at least 4 different sensible implementations: - SSE2: punpcklbw xmm, zero; punpcklbw xmm, zero - SSSE3: load mask; pshufb xmm, mask - SSE4.1: pmovzxbd - AVX2: vpmovzxbd We really want all these to inline, but if for some reason they don't (Debug build, poor inliner) and they're compiled in SkOpts.cpp, SkOpts_ssse3.cpp, SkOpts_sse41.cpp, SkOpts_hsw.cpp... boom! BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=3461 Change-Id: I0088ebfd7640c1b0de989738ed43c81b530dc0d9 Reviewed-on: https://skia-review.googlesource.com/3461 Reviewed-by: Matt Sarett <msarett@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'src/core/SkNx.h')
-rw-r--r--src/core/SkNx.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/core/SkNx.h b/src/core/SkNx.h
index 6b63199a08..afba75a487 100644
--- a/src/core/SkNx.h
+++ b/src/core/SkNx.h
@@ -16,6 +16,8 @@
#include <math.h>
#include <type_traits>
+namespace {
+
#define SI static inline
// The default SkNx<N,T> just proxies down to a pair of SkNx<N/2, T>.
@@ -312,6 +314,8 @@ SI SkNx<N,T> SkNx_fma(const SkNx<N,T>& f, const SkNx<N,T>& m, const SkNx<N,T>& a
return f*m+a;
}
+} // namespace
+
typedef SkNx<2, float> Sk2f;
typedef SkNx<4, float> Sk4f;
typedef SkNx<8, float> Sk8f;