S12XEP signed 32 substraction issue

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

S12XEP signed 32 substraction issue

1,009 次查看
mroczeks
Contributor IV
typedef signed long int S32;S32 b;S32 x1;S32 x2;

......

 b = x2 - x1;

 

 

 

As a result only lower 16 bits are present in b variable. Higher 16 bits are lost somewhere. I am observing it under CodeWarrior debugger (HiWave). Why?

标签 (1)
0 项奖励
回复
1 回复

861 次查看
kef
Specialist I

It should be fine. 

It is not clear what is storage class of b,x1 and x2. It is not clear what CW product version you are using? CW 4.6? Which compiler, C++ for XGATE?

 

Did you try disassembling C code? Does it look right? Could you show disassembled code  for b = x2 - x1? (Use search to find commented C source line in disassembled code).

 

0 项奖励
回复