Skip to content

Commit e16c22f

Browse files
committed
Introduce platform-agnostic ALWAYS_INLINE macro
`<attributes.h>` has been included in anticipation of the following commit.
1 parent 6c7ebcc commit e16c22f

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

src/attributes.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,12 @@
1616
# define LIFETIMEBOUND
1717
#endif
1818

19+
#if defined(__GNUC__)
20+
# define ALWAYS_INLINE inline __attribute__((always_inline))
21+
#elif defined(_MSC_VER)
22+
# define ALWAYS_INLINE __forceinline
23+
#else
24+
# error No known always_inline attribute for this platform.
25+
#endif
26+
1927
#endif // BITCOIN_ATTRIBUTES_H

src/crypto/sha256_avx2.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <stdint.h>
88
#include <immintrin.h>
99

10+
#include <attributes.h>
1011
#include <crypto/common.h>
1112

1213
namespace sha256d64_avx2 {

src/crypto/sha256_sse41.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <stdint.h>
88
#include <immintrin.h>
99

10+
#include <attributes.h>
1011
#include <crypto/common.h>
1112

1213
namespace sha256d64_sse41 {

src/crypto/sha256_x86_shani.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
#include <stdint.h>
1212
#include <immintrin.h>
1313

14+
#include <attributes.h>
15+
1416
namespace {
1517

1618
alignas(__m128i) const uint8_t MASK[16] = {0x03, 0x02, 0x01, 0x00, 0x07, 0x06, 0x05, 0x04, 0x0b, 0x0a, 0x09, 0x08, 0x0f, 0x0e, 0x0d, 0x0c};

0 commit comments

Comments
 (0)