Skip to content

Commit 67b0e43

Browse files
devnexennikic
authored andcommitted
crc32 feature detection from auxiliary vectors on FreeBSD
1 parent e11468a commit 67b0e43

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

ext/standard/crc32.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@
2626
# include <asm/hwcap.h>
2727
# elif defined(__APPLE__)
2828
# include <sys/sysctl.h>
29+
# elif defined(__FreeBSD__)
30+
# include <sys/auxv.h>
31+
32+
static unsigned long getauxval(unsigned long key) {
33+
unsigned long ret = 0;
34+
if (elf_aux_info(key, &ret, sizeof(ret)) != 0)
35+
return 0;
36+
return ret;
37+
}
2938
# endif
3039

3140
static inline int has_crc32_insn() {

0 commit comments

Comments
 (0)