I am viewing some source code of c6400 dsplib,here is part of DSP_autocor
void DSP_autocor(short *restrict r, const short *restrict x, int nx, int nr)
{
int i, k;
int sum;
...
for (k = nr; k < nx + nr; k++)
{
sum += x[k] * x[k-i];
}
...
}
My question is will 'sum' overflow when accumulation?
Should it be modified as 'sum+=x[k]*x[k-i]>>15'?