mirror of
https://git.tukaani.org/xz.git
synced 2024-04-04 12:36:23 +02:00
liblzma: Create crc_always_inline macro.
This macro must be used instead of the inline keyword. On MSVC, it is a replacement for __forceinline which is an MSVC specific keyword that should not be used with inline (it will issue a warning if it is). It does not use a build system check to determine if __attribute__((__always_inline__)) since all compilers that can use CLMUL extensions (except the special case for MSVC) should support this attribute. If this assumption is incorrect then it will result in a bug report instead of silently producing slow code.
This commit is contained in:
parent
96b663f67c
commit
a5966c276b
1 changed files with 15 additions and 0 deletions
|
@ -33,6 +33,21 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
// The inline keyword is only a suggestion to the compiler to substitute the
|
||||||
|
// body of the function into the places where it is called. If a function
|
||||||
|
// is large and called multiple times then compiler may choose to ignore the
|
||||||
|
// inline suggestion at a sometimes high performance cost.
|
||||||
|
//
|
||||||
|
// MSVC's __forceinline is a keyword that should be used in place of inline.
|
||||||
|
// If both __forceinline and inline are used, MSVC will issue a warning.
|
||||||
|
// Since MSVC's keyword is a replacement keyword, the lzma_always_inline
|
||||||
|
// macro must also contain the inline keyword when its not used in MSVC.
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
# define crc_always_inline __forceinline
|
||||||
|
#else
|
||||||
|
# define crc_always_inline __attribute__((__always_inline__)) inline
|
||||||
|
#endif
|
||||||
|
|
||||||
#undef CRC_GENERIC
|
#undef CRC_GENERIC
|
||||||
#undef CRC_CLMUL
|
#undef CRC_CLMUL
|
||||||
#undef CRC_USE_IFUNC
|
#undef CRC_USE_IFUNC
|
||||||
|
|
Loading…
Reference in a new issue