bennyboy Wrote:Now, I'm not an expert in computer languages.As somebody who has made a compiler for his programming language, I would expect compilers to output the same code for switch-case and if-else. Think of it this way, the way to translate this:
Code:
var codebyte = currentDirective & 0xff000;
switch (codebyte){
case 0x00000:
//Call a Register load from register function here.
break;
case 0x01000:
//Call a Register load from value function here.
break;
}
Code:
mov eax, dword ptr [currentDirective]
and eax, 0xff000
mov dword ptr [codebyte], eax
cmp dword ptr [codebyte], 0x00000 # Point #1
jnz label0
#Call a Register load from register function here.
label0:
cmp dword ptr [codebyte], 0x01000 # Point #2
jnz label1
#Call a Register load from value function here.
label1: