Reordered jump cases
This commit is contained in:
parent
e24d9ebb50
commit
c2401bf826
@ -3,7 +3,7 @@ main() {
|
||||
}
|
||||
|
||||
fibonacci(x) {
|
||||
if x == 1 || x == 0 {
|
||||
if x <= 1 {
|
||||
return x
|
||||
}
|
||||
|
||||
|
@ -81,22 +81,22 @@ func (a Assembler) Finalize() ([]byte, []byte) {
|
||||
code = x64.CompareRegisterRegister(code, operands.Destination, operands.Source)
|
||||
}
|
||||
|
||||
case JUMP, JE, JNE, JG, JL, JGE, JLE:
|
||||
case JE, JNE, JG, JGE, JL, JLE, JUMP:
|
||||
switch x.Mnemonic {
|
||||
case JUMP:
|
||||
code = x64.Jump8(code, 0x00)
|
||||
case JE:
|
||||
code = x64.Jump8IfEqual(code, 0x00)
|
||||
case JNE:
|
||||
code = x64.Jump8IfNotEqual(code, 0x00)
|
||||
case JG:
|
||||
code = x64.Jump8IfGreater(code, 0x00)
|
||||
case JL:
|
||||
code = x64.Jump8IfLess(code, 0x00)
|
||||
case JGE:
|
||||
code = x64.Jump8IfGreaterOrEqual(code, 0x00)
|
||||
case JL:
|
||||
code = x64.Jump8IfLess(code, 0x00)
|
||||
case JLE:
|
||||
code = x64.Jump8IfLessOrEqual(code, 0x00)
|
||||
case JUMP:
|
||||
code = x64.Jump8(code, 0x00)
|
||||
}
|
||||
|
||||
size := 1
|
||||
@ -183,7 +183,6 @@ restart:
|
||||
jump = []byte{0x0F, 0x8F}
|
||||
case 0xEB: // JMP
|
||||
jump = []byte{0xE9}
|
||||
|
||||
default:
|
||||
panic(fmt.Errorf("failed to increase pointer size for instruction 0x%x", opCode))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user