mirror of
https://github.com/php/php-src.git
synced 2025-08-17 14:38:49 +02:00
Mac M1 crc32 detection support
Closes GH-6556.
This commit is contained in:
parent
151fce1129
commit
6e90c75507
1 changed files with 6 additions and 0 deletions
|
@ -24,6 +24,8 @@
|
||||||
# if defined(__linux__)
|
# if defined(__linux__)
|
||||||
# include <sys/auxv.h>
|
# include <sys/auxv.h>
|
||||||
# include <asm/hwcap.h>
|
# include <asm/hwcap.h>
|
||||||
|
# elif defined(__APPLE__)
|
||||||
|
# include <sys/sysctl.h>
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
static inline int has_crc32_insn() {
|
static inline int has_crc32_insn() {
|
||||||
|
@ -37,6 +39,10 @@ static inline int has_crc32_insn() {
|
||||||
# elif defined(HWCAP2_CRC32)
|
# elif defined(HWCAP2_CRC32)
|
||||||
res = getauxval(AT_HWCAP2) & HWCAP2_CRC32;
|
res = getauxval(AT_HWCAP2) & HWCAP2_CRC32;
|
||||||
return res;
|
return res;
|
||||||
|
# elif defined(__APPLE__)
|
||||||
|
size_t reslen = sizeof(res);
|
||||||
|
if (sysctlbyname("hw.optional.armv8_crc32", &res, &reslen, NULL, 0) < 0)
|
||||||
|
res = 0;
|
||||||
# else
|
# else
|
||||||
res = 0;
|
res = 0;
|
||||||
return res;
|
return res;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue