Bill Yi | 4e213d5 | 2015-06-23 13:53:11 -0700 | [diff] [blame] | 1 | /* 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 | |||||
8 | unsigned 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 | } |