2017-01-31 07:07:14 -05:00
|
|
|
/* contrib/powerpc-vsx/linux_aux.c
|
2017-01-31 06:59:11 -05:00
|
|
|
*
|
2017-02-22 16:09:20 -05:00
|
|
|
* Copyright (c) 2017 Glenn Randers-Pehrson
|
2017-01-31 06:59:11 -05:00
|
|
|
* Written by Vadim Barkov, 2017.
|
2017-03-16 08:21:03 -04:00
|
|
|
* Last changed in libpng 1.6.29 [March 16, 2017]
|
2017-01-31 06:59:11 -05:00
|
|
|
*
|
|
|
|
* This code is released under the libpng license.
|
|
|
|
* For conditions of distribution and use, see the disclaimer
|
|
|
|
* and license in png.h
|
|
|
|
*
|
2017-02-01 09:26:02 -05:00
|
|
|
* STATUS: TESTED
|
2017-01-31 06:59:11 -05:00
|
|
|
* BUG REPORTS: png-mng-implement@sourceforge.net
|
|
|
|
*
|
2017-02-01 08:58:54 -05:00
|
|
|
* png_have_vsx implemented for Linux by using the auxiliary vector mechanism.
|
2017-01-31 06:59:11 -05:00
|
|
|
*
|
|
|
|
* This code is strict ANSI-C and is probably moderately portable; it does
|
|
|
|
* however use <stdio.h> and it assumes that /proc/cpuinfo is never localized.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "sys/auxv.h"
|
|
|
|
#include "png.h"
|
|
|
|
|
|
|
|
static int
|
|
|
|
png_have_vsx(png_structp png_ptr)
|
|
|
|
{
|
2018-08-18 22:47:16 -04:00
|
|
|
unsigned long auxv = getauxval(AT_HWCAP);
|
2017-02-01 09:03:57 -05:00
|
|
|
|
|
|
|
PNG_UNUSED(png_ptr)
|
|
|
|
|
2018-08-18 22:47:16 -04:00
|
|
|
if(auxv & (PPC_FEATURE_HAS_ALTIVEC|PPC_FEATURE_HAS_VSX))
|
2017-02-01 08:58:54 -05:00
|
|
|
return 1;
|
2017-01-31 06:59:11 -05:00
|
|
|
else
|
2017-02-01 08:58:54 -05:00
|
|
|
return 0;
|
2017-01-31 06:59:11 -05:00
|
|
|
}
|