Improved x64 encoder

This commit is contained in:
Eduard Urbach 2024-07-20 00:58:39 +02:00
parent b776775f8f
commit 2c2b6e93db
Signed by: eduard
GPG key ID: 49226B848C78F6C8
15 changed files with 317 additions and 53 deletions

16
src/build/arch/x64/SIB.go Normal file
View file

@ -0,0 +1,16 @@
package x64
const (
Scale1 = byte(0b00)
Scale2 = byte(0b01)
Scale4 = byte(0b10)
Scale8 = byte(0b11)
)
// SIB is used to generate an SIB byte.
// - scale: 2 bits
// - index: 3 bits
// - base: 3 bits
func SIB(scale byte, index byte, base byte) byte {
return (scale << 6) | (index << 3) | base
}