[MPlayer-dev-eng] [PATCH] PowerPC AltiVec detection support for OpenBSD

Diego Biurrun diego at biurrun.de
Sun Apr 10 13:22:02 CEST 2011


On Sat, Apr 09, 2011 at 03:24:07PM -0400, Brad wrote:
> The following diff allows the CPU detection code to use the sysctl(3) OpenBSD provides
> for AltiVec detection with PowerPC CPUs.

Hmmm, this is dragging that file further into #ifdef hell.
I'm not sure if this doubtful code snippet is worth the trouble
of travelling further down that path.

> --- cpudetect.c	(revision 33237)
> +++ cpudetect.c	(working copy)
> @@ -457,13 +461,17 @@
>  #if HAVE_ALTIVEC
> -#ifdef __APPLE__
> +#if defined(__APPLE__) || defined(__OpenBSD__)
>      {
> +#ifdef __OpenBSD__
> +        int sels[2] = {CTL_MACHDEP, CPU_ALTIVEC};
> +#else
>          int sels[2] = {CTL_HW, HW_VECTORUNIT};
> +#endif

Maybe

  #ifdef __OpenBSD__
  #define CTL_HW CTL_MACHDEP
  #define CPU_ALTIVEC HW_VECTORUNIT
  #endif

somewhere could simplify this mess a bit.

Diego


More information about the MPlayer-dev-eng mailing list