S12XEP signed 32 substraction issue

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S12XEP signed 32 substraction issue

1,018 Views
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?

Labels (1)
0 Kudos
Reply
1 Reply

870 Views
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 Kudos
Reply