Improved code consistency
This commit is contained in:
parent
1ca61190eb
commit
08436c31c0
@ -6,9 +6,9 @@ import "git.akyoto.dev/cli/q/src/cpu"
|
||||
func DivRegister(code []byte, divisor cpu.Register) []byte {
|
||||
rex := byte(0x48)
|
||||
|
||||
if divisor >= 8 {
|
||||
if divisor > 0b111 {
|
||||
rex++
|
||||
divisor -= 8
|
||||
divisor &= 0b111
|
||||
}
|
||||
|
||||
return append(
|
||||
|
@ -4,9 +4,9 @@ import "git.akyoto.dev/cli/q/src/cpu"
|
||||
|
||||
// PopRegister pops a value from the stack and saves it into the register.
|
||||
func PopRegister(code []byte, register cpu.Register) []byte {
|
||||
if register >= 8 {
|
||||
if register > 0b111 {
|
||||
code = append(code, REX(0, 0, 0, 1))
|
||||
register -= 8
|
||||
register &= 0b111
|
||||
}
|
||||
|
||||
return append(
|
||||
|
@ -29,9 +29,9 @@ func PushNumber(code []byte, number int) []byte {
|
||||
|
||||
// PushRegister pushes the value inside the register onto the stack.
|
||||
func PushRegister(code []byte, register cpu.Register) []byte {
|
||||
if register >= 8 {
|
||||
if register > 0b111 {
|
||||
code = append(code, REX(0, 0, 0, 1))
|
||||
register -= 8
|
||||
register &= 0b111
|
||||
}
|
||||
|
||||
return append(
|
||||
|
Loading…
x
Reference in New Issue
Block a user