Skip to content

Commit 1d36927

Browse files
committed
Support SHA256_Transform_shani() with MSVC, too
Closes GH-15312.
1 parent 5d1181f commit 1d36927

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

ext/hash/hash_sha_ni.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
# include <immintrin.h>
3333

34-
# if PHP_HASH_INTRIN_SHA_RESOLVER
34+
# if defined(PHP_HASH_INTRIN_SHA_RESOLVER) && defined(HAVE_FUNC_ATTRIBUTE_TARGET)
3535
static __m128i be32dec_128(const uint8_t * src) __attribute__((target("ssse3")));
3636
void SHA256_Transform_shani(uint32_t state[PHP_STATIC_RESTRICT 8], const uint8_t block[PHP_STATIC_RESTRICT 64]) __attribute__((target("ssse3,sha")));
3737
# endif

ext/hash/php_hash_sha.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ PHP_HASH_API void PHP_SHA256Update(PHP_SHA256_CTX *, const unsigned char *, size
5555
void SHA256_Transform_sse2(uint32_t state[PHP_STATIC_RESTRICT 8], const uint8_t block[PHP_STATIC_RESTRICT 64], uint32_t W[PHP_STATIC_RESTRICT 64], uint32_t S[PHP_STATIC_RESTRICT 8]);
5656
#endif
5757

58-
#if (defined(__i386__) || defined(__x86_64__)) && defined(HAVE_IMMINTRIN_H)
58+
#if ((defined(__i386__) || defined(__x86_64__)) && defined(HAVE_IMMINTRIN_H)) || defined(_M_X64) || defined(_M_IX86)
5959
# if defined(__SSSE3__) && defined(__SHA__)
6060
# define PHP_HASH_INTRIN_SHA_NATIVE 1
61-
# elif defined(HAVE_FUNC_ATTRIBUTE_TARGET)
61+
# elif defined(HAVE_FUNC_ATTRIBUTE_TARGET) || defined(_M_X64) || defined(_M_IX86)
6262
# define PHP_HASH_INTRIN_SHA_RESOLVER 1
6363
# endif
6464
#endif

0 commit comments

Comments
 (0)