-
Notifications
You must be signed in to change notification settings - Fork 7.9k
FreeBSD crc32 cap detection for arm64 #4922
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,19 +23,30 @@ | |
# if defined(__linux__) | ||
# include <sys/auxv.h> | ||
# include <asm/hwcap.h> | ||
# elif defined(__FreeBSD__) | ||
# include <sys/auxv.h> | ||
# include <elf.h> | ||
# endif | ||
|
||
static inline int has_crc32_insn() { | ||
/* Only go through the runtime detection once. */ | ||
static int res = -1; | ||
if (res != -1) | ||
return res; | ||
# if defined(__linux__) | ||
# if defined(HWCAP_CRC32) | ||
res = getauxval(AT_HWCAP) & HWCAP_CRC32; | ||
return res; | ||
# elif defined(HWCAP2_CRC32) | ||
res = getauxval(AT_HWCAP2) & HWCAP2_CRC32; | ||
return res; | ||
# endif | ||
# elif defined(__FreeBSD__) | ||
# if defined(HWCAP_CRC32) | ||
zend_long crc32 = 0; | ||
if (elf_aux_info(AT_HWCAP, &crc32, sizeof(crc32)) == 0) | ||
res = crc32 & HWCAP_CRC32; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah I forgot about this one but a lot had changed since and it s an useless change now, FreeBSD uses a wrapper to be closer to Linux. |
||
# endif | ||
# else | ||
res = 0; | ||
return res; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Should be indented.