Skip to content

Commit 3f19875

Browse files
committed
scripted-diff: Use platform-agnostic ALWAYS_INLINE macro
-BEGIN VERIFY SCRIPT- sed -i 's/ inline __attribute__((always_inline)) / ALWAYS_INLINE /g' $(git grep -l "inline __attribute__((always_inline))") sed -i 's/ inline __attribute__((always_inline)) / ALWAYS_INLINE /g' $(git grep -l "inline __attribute__((always_inline))") -END VERIFY SCRIPT-
1 parent e16c22f commit 3f19875

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

src/crypto/sha256_avx2.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ __m256i inline sigma0(__m256i x) { return Xor(Or(ShR(x, 7), ShL(x, 25)), Or(ShR(
3737
__m256i inline sigma1(__m256i x) { return Xor(Or(ShR(x, 17), ShL(x, 15)), Or(ShR(x, 19), ShL(x, 13)), ShR(x, 10)); }
3838

3939
/** One round of SHA-256. */
40-
void inline __attribute__((always_inline)) Round(__m256i a, __m256i b, __m256i c, __m256i& d, __m256i e, __m256i f, __m256i g, __m256i& h, __m256i k)
40+
void ALWAYS_INLINE Round(__m256i a, __m256i b, __m256i c, __m256i& d, __m256i e, __m256i f, __m256i g, __m256i& h, __m256i k)
4141
{
4242
__m256i t1 = Add(h, Sigma1(e), Ch(e, f, g), k);
4343
__m256i t2 = Add(Sigma0(a), Maj(a, b, c));

src/crypto/sha256_sse41.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ __m128i inline sigma0(__m128i x) { return Xor(Or(ShR(x, 7), ShL(x, 25)), Or(ShR(
3737
__m128i inline sigma1(__m128i x) { return Xor(Or(ShR(x, 17), ShL(x, 15)), Or(ShR(x, 19), ShL(x, 13)), ShR(x, 10)); }
3838

3939
/** One round of SHA-256. */
40-
void inline __attribute__((always_inline)) Round(__m128i a, __m128i b, __m128i c, __m128i& d, __m128i e, __m128i f, __m128i g, __m128i& h, __m128i k)
40+
void ALWAYS_INLINE Round(__m128i a, __m128i b, __m128i c, __m128i& d, __m128i e, __m128i f, __m128i g, __m128i& h, __m128i k)
4141
{
4242
__m128i t1 = Add(h, Sigma1(e), Ch(e, f, g), k);
4343
__m128i t2 = Add(Sigma0(a), Maj(a, b, c));

src/crypto/sha256_x86_shani.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,58 +19,58 @@ alignas(__m128i) const uint8_t MASK[16] = {0x03, 0x02, 0x01, 0x00, 0x07, 0x06, 0
1919
alignas(__m128i) const uint8_t INIT0[16] = {0x8c, 0x68, 0x05, 0x9b, 0x7f, 0x52, 0x0e, 0x51, 0x85, 0xae, 0x67, 0xbb, 0x67, 0xe6, 0x09, 0x6a};
2020
alignas(__m128i) const uint8_t INIT1[16] = {0x19, 0xcd, 0xe0, 0x5b, 0xab, 0xd9, 0x83, 0x1f, 0x3a, 0xf5, 0x4f, 0xa5, 0x72, 0xf3, 0x6e, 0x3c};
2121

22-
void inline __attribute__((always_inline)) QuadRound(__m128i& state0, __m128i& state1, uint64_t k1, uint64_t k0)
22+
void ALWAYS_INLINE QuadRound(__m128i& state0, __m128i& state1, uint64_t k1, uint64_t k0)
2323
{
2424
const __m128i msg = _mm_set_epi64x(k1, k0);
2525
state1 = _mm_sha256rnds2_epu32(state1, state0, msg);
2626
state0 = _mm_sha256rnds2_epu32(state0, state1, _mm_shuffle_epi32(msg, 0x0e));
2727
}
2828

29-
void inline __attribute__((always_inline)) QuadRound(__m128i& state0, __m128i& state1, __m128i m, uint64_t k1, uint64_t k0)
29+
void ALWAYS_INLINE QuadRound(__m128i& state0, __m128i& state1, __m128i m, uint64_t k1, uint64_t k0)
3030
{
3131
const __m128i msg = _mm_add_epi32(m, _mm_set_epi64x(k1, k0));
3232
state1 = _mm_sha256rnds2_epu32(state1, state0, msg);
3333
state0 = _mm_sha256rnds2_epu32(state0, state1, _mm_shuffle_epi32(msg, 0x0e));
3434
}
3535

36-
void inline __attribute__((always_inline)) ShiftMessageA(__m128i& m0, __m128i m1)
36+
void ALWAYS_INLINE ShiftMessageA(__m128i& m0, __m128i m1)
3737
{
3838
m0 = _mm_sha256msg1_epu32(m0, m1);
3939
}
4040

41-
void inline __attribute__((always_inline)) ShiftMessageC(__m128i& m0, __m128i m1, __m128i& m2)
41+
void ALWAYS_INLINE ShiftMessageC(__m128i& m0, __m128i m1, __m128i& m2)
4242
{
4343
m2 = _mm_sha256msg2_epu32(_mm_add_epi32(m2, _mm_alignr_epi8(m1, m0, 4)), m1);
4444
}
4545

46-
void inline __attribute__((always_inline)) ShiftMessageB(__m128i& m0, __m128i m1, __m128i& m2)
46+
void ALWAYS_INLINE ShiftMessageB(__m128i& m0, __m128i m1, __m128i& m2)
4747
{
4848
ShiftMessageC(m0, m1, m2);
4949
ShiftMessageA(m0, m1);
5050
}
5151

52-
void inline __attribute__((always_inline)) Shuffle(__m128i& s0, __m128i& s1)
52+
void ALWAYS_INLINE Shuffle(__m128i& s0, __m128i& s1)
5353
{
5454
const __m128i t1 = _mm_shuffle_epi32(s0, 0xB1);
5555
const __m128i t2 = _mm_shuffle_epi32(s1, 0x1B);
5656
s0 = _mm_alignr_epi8(t1, t2, 0x08);
5757
s1 = _mm_blend_epi16(t2, t1, 0xF0);
5858
}
5959

60-
void inline __attribute__((always_inline)) Unshuffle(__m128i& s0, __m128i& s1)
60+
void ALWAYS_INLINE Unshuffle(__m128i& s0, __m128i& s1)
6161
{
6262
const __m128i t1 = _mm_shuffle_epi32(s0, 0x1B);
6363
const __m128i t2 = _mm_shuffle_epi32(s1, 0xB1);
6464
s0 = _mm_blend_epi16(t1, t2, 0xF0);
6565
s1 = _mm_alignr_epi8(t2, t1, 0x08);
6666
}
6767

68-
__m128i inline __attribute__((always_inline)) Load(const unsigned char* in)
68+
__m128i ALWAYS_INLINE Load(const unsigned char* in)
6969
{
7070
return _mm_shuffle_epi8(_mm_loadu_si128((const __m128i*)in), _mm_load_si128((const __m128i*)MASK));
7171
}
7272

73-
void inline __attribute__((always_inline)) Save(unsigned char* out, __m128i s)
73+
void ALWAYS_INLINE Save(unsigned char* out, __m128i s)
7474
{
7575
_mm_storeu_si128((__m128i*)out, _mm_shuffle_epi8(s, _mm_load_si128((const __m128i*)MASK)));
7676
}

0 commit comments

Comments
 (0)