Improved code quality

This commit is contained in:
2025-02-20 16:55:17 +01:00
parent 9779476fe7
commit 36d0142573
12 changed files with 51 additions and 37 deletions

View File

@ -3,6 +3,7 @@ package asm
import (
"fmt"
"math"
"strconv"
"strings"
"git.akyoto.dev/cli/q/src/cpu"
@ -31,12 +32,12 @@ func (mem *Memory) Format(custom string) string {
tmp.WriteString("+")
}
tmp.WriteString(fmt.Sprint(mem.Offset))
tmp.WriteString(strconv.Itoa(int(mem.Offset)))
}
tmp.WriteString("], ")
tmp.WriteString(custom)
tmp.WriteString(", ")
tmp.WriteString(fmt.Sprint(mem.Length))
tmp.WriteString(strconv.Itoa(int(mem.Length)))
return tmp.String()
}

View File

@ -1,8 +1,6 @@
package asm
import (
"fmt"
)
import "strconv"
// MemoryNumber operates with a memory address and a number.
type MemoryNumber struct {
@ -12,7 +10,7 @@ type MemoryNumber struct {
// String returns a human readable version.
func (data *MemoryNumber) String() string {
return data.Address.Format(fmt.Sprint(data.Number))
return data.Address.Format(strconv.Itoa(data.Number))
}
// MemoryNumber adds an instruction with a memory address and a number.

View File

@ -1,7 +1,7 @@
package asm
import (
"fmt"
"strconv"
)
// Number operates with just a number.
@ -11,7 +11,7 @@ type Number struct {
// String returns a human readable version.
func (data *Number) String() string {
return fmt.Sprintf("%d", data.Number)
return strconv.Itoa(data.Number)
}
// Number adds an instruction with a number.