blob: 9ed6a3900e4039f28e8d88e79302f6c138eb5496 [file] [log] [blame]
Bill Yi4e213d52015-06-23 13:53:11 -07001/* Compute the sum of the squares of a vector of signed shorts
2
3 * Copyright 2004 Phil Karn, KA9Q
4 * May be used under the terms of the GNU Lesser General Public License (LGPL)
5 */
6
7#include <stdlib.h>
8#include "fec.h"
9
10unsigned long long sumsq_port(signed short *,int);
11
12#ifdef __i386__
13unsigned long long sumsq_mmx(signed short *,int);
14unsigned long long sumsq_sse(signed short *,int);
15unsigned long long sumsq_sse2(signed short *,int);
16#endif
17
18#ifdef __VEC__
19unsigned long long sumsq_av(signed short *,int);
20#endif
21
22unsigned long long sumsq(signed short *in,int cnt){
23 switch(Cpu_mode){
24 case PORT:
25 default:
26 return sumsq_port(in,cnt);
27#ifdef __i386__
28 case SSE:
29 case MMX:
30 return sumsq_mmx(in,cnt);
31 case SSE2:
32 return sumsq_sse2(in,cnt);
33#endif
34
35#ifdef __VEC__
36 case ALTIVEC:
37 return sumsq_av(in,cnt);
38#endif
39 }
40}