summaryrefslogtreecommitdiff
path: root/Build/source/libs/libpng/libpng-src/contrib/powerpc-vsx/linux_aux.c
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/libs/libpng/libpng-src/contrib/powerpc-vsx/linux_aux.c')
-rw-r--r--Build/source/libs/libpng/libpng-src/contrib/powerpc-vsx/linux_aux.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/Build/source/libs/libpng/libpng-src/contrib/powerpc-vsx/linux_aux.c b/Build/source/libs/libpng/libpng-src/contrib/powerpc-vsx/linux_aux.c
new file mode 100644
index 00000000000..796922d77c1
--- /dev/null
+++ b/Build/source/libs/libpng/libpng-src/contrib/powerpc-vsx/linux_aux.c
@@ -0,0 +1,36 @@
+/* contrib/powerpc-vsx/linux_aux.c
+ *
+ * Copyright (c) 2017 Glenn Randers-Pehrson
+ * Written by Vadim Barkov, 2017.
+ * Last changed in libpng 1.6.29 [March 16, 2017]
+ *
+ * This code is released under the libpng license.
+ * For conditions of distribution and use, see the disclaimer
+ * and license in png.h
+ *
+ * STATUS: TESTED
+ * BUG REPORTS: png-mng-implement@sourceforge.net
+ *
+ * png_have_vsx implemented for Linux by using the auxiliary vector mechanism.
+ *
+ * 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)
+{
+
+ const unsigned long auxv = getauxval( AT_HWCAP );
+
+ PNG_UNUSED(png_ptr)
+
+ if(auxv & (PPC_FEATURE_HAS_ALTIVEC|PPC_FEATURE_HAS_VSX ))
+ return 1;
+ else
+ return 0;
+}
+