Tool/software: TI C/C++ Compiler
Hello,
Here's code I tested.
when x=-100, alpha=1000
hpftest1 = 65436000, not -100000
int32 HPF(int32 x, int32 *x_old, int32 *y_old_h, int32 *y_old_l, uint16 alpha)
{
int64 tmp1, tmp2, tmp3;
tmp1 = ((int64)(x - *x_old)) * (int32)alpha;
hpftest1 = tmp1;
tmp2 = (((((int64)(*y_old_h))<<32) | *y_old_l) * (int32)alpha) >> HPF_SHIFT; // 48 bit * 16 bit >> 16 = 48 bit
hpftest2 = tmp2;
tmp3 = tmp1 + tmp2;
*y_old_h = tmp3 >> 32;
*y_old_l = tmp3 & 0xffffffff;
*x_old = x;
return tmp3 >> HPF_SHIFT;
}
I tested this code on x86 PC and it works correctly.
I think C2000 compiler has the problem to deal with long long type variable.
Any suggestions and ideas are appreciated.
Thank you.