Codebase list libfec / 8dc44e1b-49f1-40c5-9567-ede052724aad/main sumsq_port.c
8dc44e1b-49f1-40c5-9567-ede052724aad/main

Tree @8dc44e1b-49f1-40c5-9567-ede052724aad/main (Download .tar.gz)

sumsq_port.c @8dc44e1b-49f1-40c5-9567-ede052724aad/mainraw · history · blame

/* Compute the sum of the squares of a vector of signed shorts

 *  Portable C version
 * Copyright 2004 Phil Karn, KA9Q
 * May be used under the terms of the GNU Lesser General Public License (LGPL)
 */

unsigned long long sumsq_port(signed short *in,int cnt){
  long long sum = 0;
  int i;

  for(i=0;i<cnt;i++){
    sum += (int)in[i] * (int)in[i];
  }
  return sum;
}