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

Unified Diff: src/core/SkNx.h

Issue 1154523004: Everyone gets a namespace {}. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 7 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/Sk4px.h ('k') | src/core/SkPMFloat.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkNx.h
diff --git a/src/core/SkNx.h b/src/core/SkNx.h
index af7194840a4f028c8bc9dca0c339349a4a79866a..0f5aa829dfc99a5c271897d2e6bc97c55904b663 100644
--- a/src/core/SkNx.h
+++ b/src/core/SkNx.h
@@ -17,6 +17,13 @@
#include <math.h>
#define REQUIRE(x) static_assert(x, #x)
+// This file may be included multiple times by .cpp files with different flags, leading
+// to different definitions. Usually that doesn't matter because it's all inlined, but
+// in Debug modes the compilers may not inline everything. So wrap everything in an
+// anonymous namespace to give each includer their own silo of this code (or the linker
+// will probably pick one randomly for us, which is rarely correct).
+namespace {
+
// The default implementations just fall back on a pair of size N/2.
// SkNb is a _very_ minimal class representing a vector of bools returned by comparison operators.
@@ -251,6 +258,7 @@ protected:
T fVal;
};
+} // namespace
// Generic syntax sugar that should work equally well for all implementations.
template <typename T> T operator - (const T& l) { return T(0) - l; }
« no previous file with comments | « src/core/Sk4px.h ('k') | src/core/SkPMFloat.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698