diff --git a/lib/common/compiler.h b/lib/common/compiler.h index 5e70570ec7a..67c070fa6ba 100644 --- a/lib/common/compiler.h +++ b/lib/common/compiler.h @@ -117,6 +117,17 @@ # endif #endif +/* portable `restrict` qualifier */ +#ifndef ZSTD_RESTRICT +# if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && !defined(__cplusplus) +# define ZSTD_RESTRICT restrict +# elif defined(__GNUC__) || defined(__clang__) +# define ZSTD_RESTRICT __restrict__ +# else +# define ZSTD_RESTRICT +# endif +#endif + /* target attribute */ #if defined(__GNUC__) || defined(__IAR_SYSTEMS_ICC__) diff --git a/lib/compress/zstd_lazy.c b/lib/compress/zstd_lazy.c index 18b7b43948f..f3e6a49c106 100644 --- a/lib/compress/zstd_lazy.c +++ b/lib/compress/zstd_lazy.c @@ -1183,9 +1183,9 @@ ZSTD_row_getMatchMask(const BYTE* const tagRow, const BYTE tag, const U32 headGr FORCE_INLINE_TEMPLATE ZSTD_ALLOW_POINTER_OVERFLOW_ATTR size_t ZSTD_RowFindBestMatch( - ZSTD_MatchState_t* ms, - const BYTE* const ip, const BYTE* const iLimit, - size_t* offsetPtr, + ZSTD_MatchState_t* ZSTD_RESTRICT ms, + const BYTE* const ZSTD_RESTRICT ip, const BYTE* const iLimit, + size_t* ZSTD_RESTRICT offsetPtr, const U32 mls, const ZSTD_dictMode_e dictMode, const U32 rowLog) {