Hi,
Here is my modified code just enough to show the problem:
register long int ri0 = 80781; // add up the correlations
register long int rq0 = 81585;
register long int ri1 = 69462; // add up the correlations
register long int rq1 = 75898;
register long int real = 0;
register long int imag = 0;
register short shift_bit=15;
real=real+((ri1*ri0+rq1*rq0)>>shift_bit);
imag=imag+((rq1*ri0-ri1*rq0)>>shift_bit);
If I compile it into COFF format, then the real = 360209, imag = 14161; If I compile it into ELF format, then real = - 33007, imag = 14161. Something is wrong with the compiler? I thought the long int is 40 bit and it should be long enough to be able to handle the sum of products before the shift.
Please see attached project.
Thanks,
Zhao