AnsweredAssumed Answered

IF statement Optimization in codewarrior 5.1 version

Question asked by Ashwini Shetty on Jun 27, 2007
Latest reply on Jun 28, 2007 by CompilerGuru
hi ,
i have problem with the optimization in an IF loop.
The code is as follows:
#define mDeviceJoinReqClusterID  0x1201
#define mDataClusterId_c      0x1200         
  if (abc ==TRUE) // not necessary abc is always true , it is global variable.
   afAddrInfo.aClusterId[0] = (mDeviceJoinReqClusterID & 0xFF);
afAddrInfo.aClusterId[1] = ( mDeviceJoinReqClusterID>> 8);      
  else {
  afAddrInfo.aClusterId[0] = (mDataClusterId_c & 0xFF);
  afAddrInfo.aClusterId[1] = (mDataClusterId_c >> 8);
in the above if loop , it considers both as same part , i think the warning is C5912 .
and when i generate a list file and check it out i see that there is no code generated only for the second line of IF loop, i.e. afAddrInfo.aClusterId[1] = ( mDeviceJoinReqClusterID>> 8); where in all other lines will have code.
and in both loops i m suppose to get different values since both are using different MACRO values.
and also i place that second line as first , then code works fine. i meant no optimization.
how do i avoid it ? do i need to disable any optimization, and i want the code in same format.