Introduce platform-agnostic ALWAYS_INLINE macro

`<attributes.h>` has been included in anticipation of the following
commit.
This commit is contained in:
Hennadii Stepanov 2023-05-04 20:57:51 +01:00
parent 6c7ebcc14b
commit e16c22fe02
No known key found for this signature in database
GPG key ID: 410108112E7EA81F
4 changed files with 12 additions and 0 deletions

View file

@ -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

View file

@ -7,6 +7,7 @@
#include <stdint.h>
#include <immintrin.h>
#include <attributes.h>
#include <crypto/common.h>
namespace sha256d64_avx2 {

View file

@ -7,6 +7,7 @@
#include <stdint.h>
#include <immintrin.h>
#include <attributes.h>
#include <crypto/common.h>
namespace sha256d64_sse41 {

View file

@ -11,6 +11,8 @@
#include <stdint.h>
#include <immintrin.h>
#include <attributes.h>
namespace {
alignas(__m128i) const uint8_t MASK[16] = {0x03, 0x02, 0x01, 0x00, 0x07, 0x06, 0x05, 0x04, 0x0b, 0x0a, 0x09, 0x08, 0x0f, 0x0e, 0x0d, 0x0c};