Skip to content

Commit 388cd85

Browse files
zaotiran
authored andcommitted
Remove nested comments in blake2 (#4173)
Replace occurence of nested comments in blake2 reference implementation with preprocessor directive for disabling unused code. `blake2s-load-xop.h` is conditionally pulled in only on chips with XOP support, among others the AMD Bulldozer. The malformed comments in the source file breaks the build of `hashlib`'s `_blake2` on GCC 6.3.0. Official reference code on github uses `#if` so this change should be uncontroversial.
1 parent 8bc7d63 commit 388cd85

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Modules/_blake2/impl/blake2s-load-xop.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,18 @@
1818

1919
#define TOB(x) ((x)*4*0x01010101 + 0x03020100) /* ..or not TOB */
2020

21+
#if 0
2122
/* Basic VPPERM emulation, for testing purposes */
22-
/*static __m128i _mm_perm_epi8(const __m128i src1, const __m128i src2, const __m128i sel)
23+
static __m128i _mm_perm_epi8(const __m128i src1, const __m128i src2, const __m128i sel)
2324
{
2425
const __m128i sixteen = _mm_set1_epi8(16);
2526
const __m128i t0 = _mm_shuffle_epi8(src1, sel);
2627
const __m128i s1 = _mm_shuffle_epi8(src2, _mm_sub_epi8(sel, sixteen));
2728
const __m128i mask = _mm_or_si128(_mm_cmpeq_epi8(sel, sixteen),
2829
_mm_cmpgt_epi8(sel, sixteen)); /* (>=16) = 0xff : 00 */
2930
return _mm_blendv_epi8(t0, s1, mask);
30-
}*/
31+
}
32+
#endif
3133

3234
#define LOAD_MSG_0_1(buf) \
3335
buf = _mm_perm_epi8(m0, m1, _mm_set_epi32(TOB(6),TOB(4),TOB(2),TOB(0)) );

0 commit comments

Comments
 (0)