blob: 6d0b4c13a498fab41cac239ed673b201e4fbc8ff [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 * Portable C version
4 * Copyright 2004 Phil Karn, KA9Q
5 * May be used under the terms of the GNU Lesser General Public License (LGPL)
6 */
7
8unsigned long long sumsq_port(signed short *in,int cnt){
9 long long sum = 0;
10 int i;
11
12 for(i=0;i<cnt;i++){
13 sum += (int)in[i] * (int)in[i];
14 }
15 return sum;
16}