Improved x64 encoder
This commit is contained in:
parent
b776775f8f
commit
2c2b6e93db
15 changed files with 317 additions and 53 deletions
16
src/build/arch/x64/SIB.go
Normal file
16
src/build/arch/x64/SIB.go
Normal 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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue