Skip to content

Commit

Permalink
Extend the XNN_RESTRICT macro to use __restrict__ or __restrict
Browse files Browse the repository at this point in the history
… for `gcc`/`clang` and `MSVC`, respectively.

PiperOrigin-RevId: 633848169
  • Loading branch information
gonnet authored and xnnpack-bot committed May 15, 2024
1 parent 8d5f4e0 commit 7e91832
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/xnnpack/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,14 @@
#define XNN_MIN_ELEMENTS(count) static count
#endif

#if defined(__cplusplus) || XNN_COMPILER_MSVC
#define XNN_RESTRICT
#if defined(__cplusplus)
#if XNN_COMPILER_MSVC
#define XNN_RESTRICT __restrict
#elif XNN_COMPILER_GCC || XNN_COMPILER_CLANG
#define XNN_RESTRICT __restrict__
#else
#define XNN_RESTRICT
#endif
#else
#define XNN_RESTRICT restrict
#endif
Expand Down

0 comments on commit 7e91832

Please sign in to comment.