@@ -167,8 +167,8 @@ Due to ADL restrictions, user code calling Highway ops must either:
167
167
hn::Add()`; or
168
168
* add using-declarations for each op used: ` using hwy::HWY_NAMESPACE::Add; ` .
169
169
170
- Additionally, each function that calls Highway ops must either be prefixed with
171
- ` HWY_ATTR ` , OR reside between ` HWY_BEFORE_NAMESPACE() ` and
170
+ Additionally, each function that calls Highway ops (such as ` Load ` ) must either
171
+ be prefixed with ` HWY_ATTR ` , OR reside between ` HWY_BEFORE_NAMESPACE() ` and
172
172
` HWY_AFTER_NAMESPACE() ` . Lambda functions currently require ` HWY_ATTR ` before
173
173
their opening brace.
174
174
@@ -190,6 +190,27 @@ they use static or dynamic dispatch.
190
190
[ quick-reference] ( g3doc/quick_reference.md ) ) if ` HWY_TARGET_INCLUDE ` is
191
191
defined and ` foreach_target.h ` is included.
192
192
193
+ When using dynamic dispatch, ` foreach_target.h ` is included from translation
194
+ units (.cc files), not headers. Headers containing vector code shared between
195
+ several translation units require a special include guard, for example the
196
+ following taken from ` examples/skeleton-inl.h ` :
197
+
198
+ ```
199
+ #if defined(HIGHWAY_HWY_EXAMPLES_SKELETON_INL_H_) == defined(HWY_TARGET_TOGGLE)
200
+ #ifdef HIGHWAY_HWY_EXAMPLES_SKELETON_INL_H_
201
+ #undef HIGHWAY_HWY_EXAMPLES_SKELETON_INL_H_
202
+ #else
203
+ #define HIGHWAY_HWY_EXAMPLES_SKELETON_INL_H_
204
+ #endif
205
+
206
+ #include "hwy/highway.h"
207
+ // Your vector code
208
+ #endif
209
+ ```
210
+
211
+ By convention, we name such headers ` -inl.h ` because their contents (often
212
+ function templates) are usually inlined.
213
+
193
214
## Compiler flags
194
215
195
216
Applications should be compiled with optimizations enabled - without inlining,
0 commit comments