char * ConditionStr1(int condition)
{
switch(condition)
{
case 0: return "EQ";
case 1: return "NE";
case 2: return "CS";
case 3: return "CC";
case 4: return "MI";
case 5: return "PL";
case 6: return "VS";
case 7: return "VC";
case 8: return "HI";
case 9: return "LS";
case 10: return "GE";
case 11: return "LT";
case 12: return "GT";
case 13: return "LE";
case 14: return "";
default: return 0;
}
}
编译后的结果如下。
ConditionStr1:
0000807C E1A01000 MOV r1,r0
>>> SWITCH\#3 switch(condition)
00008080 E351000E CMP r1,#0xe
00008084 908FF101 ADDLS pc,pc,r1,LSL #2
00008088 EA00003B B 0x817c <SWITCH\#20>
0000808C EA00000D B 0x80c8 <SWITCH\#5>
00008090 EA00000F B 0x80d4 <SWITCH\#6>
00008094 EA000011 B 0x80e0 <SWITCH\#7>
00008098 EA000013 B 0x80ec <SWITCH\#8>
0000809C EA000015 B 0x80f8 <SWITCH\#9>
000080A0 EA000017 B 0x8104 <SWITCH\#10>
000080A4 EA000019 B 0x8110 <SWITCH\#11>
000080A8 EA00001B B 0x811c <SWITCH\#12>
000080AC EA00001D B 0x8128 <SWITCH\#13>
000080B0 EA00001F B 0x8134 <SWITCH\#14>
000080B4 EA000021 B 0x8140 <SWITCH\#15>
000080B8 EA000023 B 0x814c <SWITCH\#16>
000080BC EA000025 B 0x8158 <SWITCH\#17>
000080C0 EA000027 B 0x8164 <SWITCH\#18>
000080C4 EA000029 B 0x8170 <SWITCH\#19>