···11+/*
22+ This file is part of Darling.
33+44+ Copyright (C) 2020 Lubos Dolezel
55+66+ Darling is free software: you can redistribute it and/or modify
77+ it under the terms of the GNU General Public License as published by
88+ the Free Software Foundation, either version 3 of the License, or
99+ (at your option) any later version.
1010+1111+ Darling is distributed in the hope that it will be useful,
1212+ but WITHOUT ANY WARRANTY; without even the implied warranty of
1313+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1414+ GNU General Public License for more details.
1515+1616+ You should have received a copy of the GNU General Public License
1717+ along with Darling. If not, see <http://www.gnu.org/licenses/>.
1818+*/
1919+2020+#include <vDSP/vDSP.h>
2121+2222+void vDSP_vsadd(const float *__A, vDSP_Stride __IA, const float *__B, float *__C, vDSP_Stride __IC, vDSP_Length __N)
2323+{
2424+ if (__IA == 1 && __IC == 1)
2525+ {
2626+ #pragma clang loop vectorize(enable)
2727+ for (vDSP_Length i = 0; i < __N; i++)
2828+ __C[i] = __A[i] + __B[i];
2929+ }
3030+ else
3131+ {
3232+ #pragma clang loop vectorize(enable)
3333+ for (vDSP_Length i = 0; i < __N; i++)
3434+ __C[i * __IC] = __A[i * __IA] + __B[i * __IA];
3535+ }
3636+}
···11+/*
22+ This file is part of Darling.
33+44+ Copyright (C) 2020 Lubos Dolezel
55+66+ Darling is free software: you can redistribute it and/or modify
77+ it under the terms of the GNU General Public License as published by
88+ the Free Software Foundation, either version 3 of the License, or
99+ (at your option) any later version.
1010+1111+ Darling is distributed in the hope that it will be useful,
1212+ but WITHOUT ANY WARRANTY; without even the implied warranty of
1313+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1414+ GNU General Public License for more details.
1515+1616+ You should have received a copy of the GNU General Public License
1717+ along with Darling. If not, see <http://www.gnu.org/licenses/>.
1818+*/
1919+2020+#include <vDSP/vDSP.h>
2121+#include <math.h>
2222+2323+void vDSP_maxmgv(const float *__A, vDSP_Stride __IA, float *__C, vDSP_Length __N)
2424+{
2525+ *__C = -INFINITY;
2626+2727+ if (__N != 1)
2828+ {
2929+ #pragma clang loop vectorize(enable)
3030+ for (vDSP_Length i = 0; i < __N; i++)
3131+ {
3232+ if (*__C < fabsf(__A[i * __IA]))
3333+ *__C = fabsf(__A[i * __IA]);
3434+ }
3535+ }
3636+ else
3737+ {
3838+ #pragma clang loop vectorize(enable)
3939+ for (vDSP_Length i = 0; i < __N; i++)
4040+ {
4141+ if (*__C < fabsf(__A[i]))
4242+ *__C = fabsf(__A[i]);
4343+ }
4444+ }
4545+}