Flattened package hierarchy

This commit is contained in:
Eduard Urbach 2024-08-25 20:38:22 +02:00
parent 12dcf672cb
commit a4dc5a4eff
Signed by: eduard
GPG key ID: 49226B848C78F6C8
89 changed files with 42 additions and 42 deletions

20
src/x64/Div.go Normal file
View file

@ -0,0 +1,20 @@
package x64
import "git.akyoto.dev/cli/q/src/cpu"
// DivRegister divides RDX:RAX by the value in the register.
func DivRegister(code []byte, divisor cpu.Register) []byte {
rex := byte(0x48)
if divisor >= 8 {
rex++
divisor -= 8
}
return append(
code,
rex,
0xF7,
0xF8+byte(divisor),
)
}