Improved assembler performance
This commit is contained in:
@ -1,28 +1,10 @@
|
||||
package asm
|
||||
|
||||
import (
|
||||
"maps"
|
||||
|
||||
"git.urbach.dev/cli/q/src/data"
|
||||
)
|
||||
import "git.urbach.dev/cli/q/src/data"
|
||||
|
||||
// Assembler contains a list of instructions.
|
||||
type Assembler struct {
|
||||
Data data.Data
|
||||
Instructions []Instruction
|
||||
}
|
||||
|
||||
// Merge combines the contents of this assembler with another one.
|
||||
func (a *Assembler) Merge(b Assembler) {
|
||||
maps.Copy(a.Data, b.Data)
|
||||
a.Instructions = append(a.Instructions, b.Instructions...)
|
||||
}
|
||||
|
||||
// SetData sets the data for the given label.
|
||||
func (a *Assembler) SetData(label string, bytes []byte) {
|
||||
if a.Data == nil {
|
||||
a.Data = data.Data{}
|
||||
}
|
||||
|
||||
a.Data.Insert(label, bytes)
|
||||
Param Param
|
||||
}
|
||||
|
Reference in New Issue
Block a user