Moved sizeof functions to a separate package
This commit is contained in:
parent
6d77a8a120
commit
315ad23e31
13 changed files with 83 additions and 40 deletions
|
@ -4,11 +4,12 @@ import (
|
|||
"encoding/binary"
|
||||
|
||||
"git.akyoto.dev/cli/q/src/build/cpu"
|
||||
"git.akyoto.dev/cli/q/src/build/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(int64(number)) == 1 {
|
||||
if sizeof.Signed(int64(number)) == 1 {
|
||||
code = encode(code, mod, reg, rm, 8, opCode8)
|
||||
return append(code, byte(number))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue