style: modernize to splitseq, cut, min, maps.copy and range-over-int

This commit is contained in:
2026-08-29 16:04:32 +02:00
parent eacf33d0f7
commit 9beff4ae85
40 changed files with 90 additions and 234 deletions
+4 -4
View File
@@ -7,6 +7,8 @@
// by round-tripping through golang.org/x/arch's decoder in the tests.
package asm
import "maps"
import "strings"
// Reg is an x86-64 register. In Plan 9 assembly the classic names (AX, BX, …)
@@ -121,13 +123,11 @@ func buildRegByName() map[string]Reg {
}
// 8-bit: AL..BH, SPL..DIL, R8B..R15B.
for n, r := range map[string]Reg{
maps.Copy(m, map[string]Reg{
"AL": AL, "CL": CL, "DL": DL, "BL": BL,
"AH": AH, "CH": CH, "DH": DH, "BH": BH,
"SPL": SPL, "BPL": BPL, "SIL": SIL, "DIL": DIL,
} {
m[n] = r
}
})
for i := 8; i <= 15; i++ {
m["R"+itoa(i)+"B"] = Reg{idx: i, size: 1}
}