Reduced memory allocations

This commit is contained in:
Eduard Urbach 2024-07-17 15:23:57 +02:00
parent 58eed722c1
commit 814364612f
Signed by: eduard
GPG key ID: 49226B848C78F6C8
3 changed files with 11 additions and 3 deletions

View file

@ -13,3 +13,12 @@ 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, data []byte) {
if a.Data == nil {
a.Data = map[string][]byte{}
}
a.Data[label] = data
}