[Pixman] [PATCH 10/12] MIPS: disabled non 32-bit platforms

Siarhei Siamashka siarhei.siamashka at gmail.com
Wed Sep 18 10:14:34 PDT 2013


On Mon,  9 Sep 2013 00:52:49 +0200
Nemanja Lukic <nemanja.lukic at rt-rk.com> wrote:

> This patch add mechanism which allows optimizations to be run only
> on 32-bit platforms.
> ---
>  pixman/pixman-mips.c |    8 ++++++++
>  1 files changed, 8 insertions(+), 0 deletions(-)
> 
> diff --git a/pixman/pixman-mips.c b/pixman/pixman-mips.c
> index a9f228a..eadf912 100644
> --- a/pixman/pixman-mips.c
> +++ b/pixman/pixman-mips.c
> @@ -26,6 +26,7 @@
>  #include "pixman-private.h"
>  #include <string.h>
>  #include <stdlib.h>
> +#include <unistd.h>
>  
>  #ifdef USE_MIPS_DSPR2
>  static const char *mips_dspr2_cores[] = {"MIPS 74K", NULL};
> @@ -94,6 +95,8 @@ have_feature (const char **cores)
>  pixman_implementation_t *
>  _pixman_mips_get_implementations (pixman_implementation_t *imp)
>  {
> +    int long_bit;
> +
>  #ifdef USE_LOONGSON_MMI
>      /* I really don't know if some Loongson CPUs don't have MMI. */
>      if (!_pixman_disabled ("loongson-mmi") &&
> @@ -101,6 +104,11 @@ _pixman_mips_get_implementations (pixman_implementation_t *imp)
>  	imp = _pixman_implementation_create_mmx (imp);
>  #endif
>  
> +    /* disable runtime detection for non 32-bit platforms */
> +    long_bit = sysconf (_SC_LONG_BIT);

Just assuming that sysconf function and sysconf value _SC_LONG_BIT
are both supported might be not safe (and break pixman build on some
obscure systems).

Wouldn't a check for sizeof(uintptr_t) be more portable and simple?

> +    if (long_bit != 32)
> +        return imp;
> +
>  #ifdef USE_MIPS32R2
>      if (!_pixman_disabled ("mips32r2"))
>      {


-- 
Best regards,
Siarhei Siamashka


More information about the Pixman mailing list