AnsweredAssumed Answered

Switch statement problems with Codewarrior 5.0

Question asked by Faruk Chaudhry on Aug 23, 2009
Latest reply on Aug 24, 2009 by CompilerGuru

Hello,

 

For switch statments with a lot of labels, the simulator does not select the correct label.  It produces a lot of exta instructions.  If a few labels are used, then it works fine.  Below is the sample code.  For example, if level = 4, the simulator selects 12.

 

Thansks

 

switch(DISPLevelCode)
  {
   
    case 1:     DISPGraphData = 0x03;
                   break;
    case 2:     DISPGraphData = 0x0F;
                   break;
    case 3:     DISPGraphData = 0x3F;
                   break;
    case 4:     DISPGraphData = 0xFF;
                   break;
    case 8:     DISPGraphData = 0x01;
                   break;
    case 9:     DISPGraphData = 0x07;
                   break;
    case 10:   DISPGraphData = 0x1F;
                   break;
    case 11:   DISPGraphData = 0x7F;
                   break;
    case 12:   DISPGraphData = 0xFF;
                  break;
    default:    DISPGraphData = 0x00;

Outcomes