Renamed x64 to x86
This commit is contained in:
parent
f558a69366
commit
9c53235e7e
80 changed files with 1757 additions and 1757 deletions
19
src/x86/encodeNum.go
Normal file
19
src/x86/encodeNum.go
Normal 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))
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue