From e16c22fe025f82166c7f3f15a37c96bf4a06e4cf Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Thu, 4 May 2023 20:57:51 +0100 Subject: [PATCH] Introduce platform-agnostic `ALWAYS_INLINE` macro `` has been included in anticipation of the following commit. --- src/attributes.h | 8 ++++++++ src/crypto/sha256_avx2.cpp | 1 + src/crypto/sha256_sse41.cpp | 1 + src/crypto/sha256_x86_shani.cpp | 2 ++ 4 files changed, 12 insertions(+) diff --git a/src/attributes.h b/src/attributes.h index 9957bcd84b7..a4603b0270d 100644 --- a/src/attributes.h +++ b/src/attributes.h @@ -16,4 +16,12 @@ # define LIFETIMEBOUND #endif +#if defined(__GNUC__) +# define ALWAYS_INLINE inline __attribute__((always_inline)) +#elif defined(_MSC_VER) +# define ALWAYS_INLINE __forceinline +#else +# error No known always_inline attribute for this platform. +#endif + #endif // BITCOIN_ATTRIBUTES_H diff --git a/src/crypto/sha256_avx2.cpp b/src/crypto/sha256_avx2.cpp index 624bdb42e47..fc8726e8e92 100644 --- a/src/crypto/sha256_avx2.cpp +++ b/src/crypto/sha256_avx2.cpp @@ -7,6 +7,7 @@ #include #include +#include #include namespace sha256d64_avx2 { diff --git a/src/crypto/sha256_sse41.cpp b/src/crypto/sha256_sse41.cpp index 4eaf7d7b188..a535e8fb1af 100644 --- a/src/crypto/sha256_sse41.cpp +++ b/src/crypto/sha256_sse41.cpp @@ -7,6 +7,7 @@ #include #include +#include #include namespace sha256d64_sse41 { diff --git a/src/crypto/sha256_x86_shani.cpp b/src/crypto/sha256_x86_shani.cpp index e3143a55c24..b53c61a3a84 100644 --- a/src/crypto/sha256_x86_shani.cpp +++ b/src/crypto/sha256_x86_shani.cpp @@ -11,6 +11,8 @@ #include #include +#include + namespace { alignas(__m128i) const uint8_t MASK[16] = {0x03, 0x02, 0x01, 0x00, 0x07, 0x06, 0x05, 0x04, 0x0b, 0x0a, 0x09, 0x08, 0x0f, 0x0e, 0x0d, 0x0c};