Renamed x64 to x86

This commit is contained in:
Eduard Urbach 2025-02-05 23:16:18 +01:00
parent f558a69366
commit 9c53235e7e
Signed by: eduard
GPG key ID: 49226B848C78F6C8
80 changed files with 1757 additions and 1757 deletions

19
src/x86/encodeNum.go Normal file
View file

@ -0,0 +1,19 @@
package x86
import (
"encoding/binary"
"git.akyoto.dev/cli/q/src/cpu"
"git.akyoto.dev/cli/q/src/sizeof"
)
// encodeNum encodes an instruction with up to two registers and a number parameter.
func encodeNum(code []byte, mod AddressMode, reg cpu.Register, rm cpu.Register, number int, opCode8 byte, opCode32 byte) []byte {
if sizeof.Signed(int64(number)) == 1 {
code = encode(code, mod, reg, rm, 8, opCode8)
return append(code, byte(number))
}
code = encode(code, mod, reg, rm, 8, opCode32)
return binary.LittleEndian.AppendUint32(code, uint32(number))
}