Fixed move with negative numbers on arm64
This commit is contained in:
@ -22,16 +22,17 @@ func MoveRegisterNumber(code []byte, destination cpu.Register, number int) []byt
|
|||||||
func MoveRegisterNumberMI(code []byte, destination cpu.Register, number int) []byte {
|
func MoveRegisterNumberMI(code []byte, destination cpu.Register, number int) []byte {
|
||||||
movz := MoveZero(destination, 0, uint16(number))
|
movz := MoveZero(destination, 0, uint16(number))
|
||||||
code = binary.LittleEndian.AppendUint32(code, movz)
|
code = binary.LittleEndian.AppendUint32(code, movz)
|
||||||
|
num := uint64(number)
|
||||||
halfword := 1
|
halfword := 1
|
||||||
|
|
||||||
for {
|
for {
|
||||||
number >>= 16
|
num >>= 16
|
||||||
|
|
||||||
if number == 0 {
|
if num == 0 {
|
||||||
return code
|
return code
|
||||||
}
|
}
|
||||||
|
|
||||||
movk := MoveKeep(destination, halfword, uint16(number))
|
movk := MoveKeep(destination, halfword, uint16(num))
|
||||||
code = binary.LittleEndian.AppendUint32(code, movk)
|
code = binary.LittleEndian.AppendUint32(code, movk)
|
||||||
halfword++
|
halfword++
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user