7 lines
191 B
C
7 lines
191 B
C
long dotProduct(const short *a, const short *b, unsigned int n) {
|
|
long sum = 0;
|
|
for (unsigned int i = 0; i < n; i++) {
|
|
sum += (long)a[i] * (long)b[i];
|
|
}
|
|
return sum;
|
|
}
|