Something went wrong. Try again.
🌱 A minimal programming language and compiler. git.urbach.dev/cli/q
high-performance programming-language compiler
Something went wrong. Try again.
12345678910111213141516171819package x86
import ( "encoding/binary"
"git.urbach.dev/cli/q/src/cpu")
// LoadAddress calculates the address with the RIP-relative offset and writes the result to the destination register.func LoadAddress(code []byte, destination cpu.Register, offset int) []byte { code = encode(code, AddressMemory, destination, 0b101, 8, 0x8D) return binary.LittleEndian.AppendUint32(code, uint32(offset))}
// LoadAddressAbs calculates the absolute address and writes the result to the destination register.func LoadAddressAbs(code []byte, destination cpu.Register, offset int) []byte { code = encode2(code, AddressMemory, destination, 0b101, 0b100, Scale1, 8, 0x8D) return binary.LittleEndian.AppendUint32(code, uint32(offset))}