Skip to content

Commit f32be3b

Browse files
committed
Support SHA256_Transform_shani() with MSVC, too
1 parent 42497c1 commit f32be3b

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

ext/hash/hash_sha_ni.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@
2727
#include "php_hash.h"
2828
#include "php_hash_sha.h"
2929

30-
#if (defined(__i386__) || defined(__x86_64__)) && defined(HAVE_IMMINTRIN_H)
30+
#if defined(PHP_HASH_INTRIN_SHA_NATIVE) || defined(PHP_HASH_INTRIN_SHA_RESOLVER)
3131

3232
# include <immintrin.h>
3333

34-
# if PHP_HASH_INTRIN_SHA_RESOLVER
34+
# if 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
@@ -56,10 +56,10 @@ PHP_HASH_API void PHP_SHA256Update(PHP_SHA256_CTX *, const unsigned char *, size
5656
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]);
5757
#endif
5858

59-
#if (defined(__i386__) || defined(__x86_64__)) && defined(HAVE_IMMINTRIN_H)
59+
#if ((defined(__i386__) || defined(__x86_64__)) && defined(HAVE_IMMINTRIN_H)) || ((defined(_M_X64) || defined(_M_IX86)) && defined(ZEND_INTRIN_SSSE3_RESOLVER))
6060
# if defined(__SSSE3__) && defined(__SHA__)
6161
# define PHP_HASH_INTRIN_SHA_NATIVE 1
62-
# elif defined(HAVE_FUNC_ATTRIBUTE_TARGET)
62+
# elif defined(HAVE_FUNC_ATTRIBUTE_TARGET) || defined(_M_X64) || defined(_M_IX86)
6363
# define PHP_HASH_INTRIN_SHA_RESOLVER 1
6464
# endif
6565

0 commit comments

Comments
 (0)