Fixed move with negative numbers on arm64
This commit is contained in:
@ -15,9 +15,18 @@ func MoveRegisterRegister(destination cpu.Register, source cpu.Register) uint32
|
||||
|
||||
// MoveRegisterNumber moves an integer into the given register.
|
||||
func MoveRegisterNumber(destination cpu.Register, number int) uint32 {
|
||||
if number < 0 {
|
||||
return MoveInvertedWideImmediate(destination, ^number)
|
||||
}
|
||||
|
||||
return MoveZero(destination, 0, uint16(number))
|
||||
}
|
||||
|
||||
// MoveInvertedWideImmediate moves an inverted 16-bit immediate value to a register.
|
||||
func MoveInvertedWideImmediate(destination cpu.Register, number int) uint32 {
|
||||
return 0b100100101<<23 | regImm(destination, number)
|
||||
}
|
||||
|
||||
// MoveKeep moves a 16-bit integer into the given register and keeps all other bits.
|
||||
func MoveKeep(destination cpu.Register, halfword int, number uint16) uint32 {
|
||||
return mov(0b11, halfword, number, destination)
|
||||
|
Reference in New Issue
Block a user