Implemented bit shifting on arm64

This commit is contained in:
2025-03-15 19:45:14 +01:00
parent 93042f81e7
commit b8f05c8994
10 changed files with 120 additions and 16 deletions

15
src/arm/Shift.go Normal file
View File

@ -0,0 +1,15 @@
package arm
import (
"git.urbach.dev/cli/q/src/cpu"
)
// ShiftLeftNumber shifts the register value a specified amount of bits to the left.
func ShiftLeftNumber(destination cpu.Register, source cpu.Register, bits int) uint32 {
return 0b110100110<<23 | reg2BitmaskImm(destination, source, 1, 64-bits, (^bits)&mask6)
}
// ShiftRightSignedNumber shifts the signed register value a specified amount of bits to the right.
func ShiftRightSignedNumber(destination cpu.Register, source cpu.Register, bits int) uint32 {
return 0b100100110<<23 | reg2BitmaskImm(destination, source, 1, bits&mask6, 0b111111)
}