Mercurial > libavcodec.hg
comparison ppc/check_altivec.c @ 7904:47717d5239fa libavcodec
AltiVec detection support for OpenBSD, patch by Brad, brad comstyle com.
author | diego |
---|---|
date | Mon, 22 Sep 2008 05:38:50 +0000 |
parents | 0d60b8b7f30b |
children | ae410599f388 |
comparison
equal
deleted
inserted
replaced
7903:ad95dd08b31a | 7904:47717d5239fa |
---|---|
23 */ | 23 */ |
24 | 24 |
25 #ifdef __APPLE__ | 25 #ifdef __APPLE__ |
26 #undef _POSIX_C_SOURCE | 26 #undef _POSIX_C_SOURCE |
27 #include <sys/sysctl.h> | 27 #include <sys/sysctl.h> |
28 #elif __OpenBSD__ | |
29 #include <sys/param.h> | |
30 #include <sys/sysctl.h> | |
31 #include <machine/cpu.h> | |
28 #elif __AMIGAOS4__ | 32 #elif __AMIGAOS4__ |
29 #include <exec/exec.h> | 33 #include <exec/exec.h> |
30 #include <interfaces/exec.h> | 34 #include <interfaces/exec.h> |
31 #include <proto/exec.h> | 35 #include <proto/exec.h> |
32 #endif /* __APPLE__ */ | 36 #endif /* __APPLE__ */ |
43 extern struct ExecIFace *IExec; | 47 extern struct ExecIFace *IExec; |
44 | 48 |
45 IExec->GetCPUInfoTags(GCIT_VectorUnit, &result, TAG_DONE); | 49 IExec->GetCPUInfoTags(GCIT_VectorUnit, &result, TAG_DONE); |
46 if (result == VECTORTYPE_ALTIVEC) return 1; | 50 if (result == VECTORTYPE_ALTIVEC) return 1; |
47 return 0; | 51 return 0; |
48 #elif __APPLE__ | 52 #elif defined(__APPLE__) || defined(__OpenBSD__) |
53 #ifdef __OpenBSD__ | |
54 int sels[2] = {CTL_MACHDEP, CPU_ALTIVEC}; | |
55 #else | |
49 int sels[2] = {CTL_HW, HW_VECTORUNIT}; | 56 int sels[2] = {CTL_HW, HW_VECTORUNIT}; |
57 #endif | |
50 int has_vu = 0; | 58 int has_vu = 0; |
51 size_t len = sizeof(has_vu); | 59 size_t len = sizeof(has_vu); |
52 int err; | 60 int err; |
53 | 61 |
54 err = sysctl(sels, 2, &has_vu, &len, NULL, 0); | 62 err = sysctl(sels, 2, &has_vu, &len, NULL, 0); |