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
+6 -6
View File
@@ -603,12 +603,12 @@ func (s evexSuffix) evexOnly() bool {
// broadcast together with rounding/SAE.
func parseEvexSuffix(mnem string) (string, evexSuffix, error) {
sfx := evexSuffix{rounding: -1}
i := strings.IndexByte(mnem, '.')
if i < 0 {
before, after, ok := strings.Cut(mnem, ".")
if !ok {
return mnem, sfx, nil
}
base := mnem[:i]
parts := strings.Split(mnem[i+1:], ".")
base := before
parts := strings.Split(after, ".")
seen := map[string]bool{}
for j, p := range parts {
if seen[p] {
@@ -618,7 +618,7 @@ func parseEvexSuffix(mnem string) (string, evexSuffix, error) {
switch p {
case "Z":
if j != len(parts)-1 {
return "", sfx, fmt.Errorf("the .Z suffix must come last in %q", mnem[i+1:])
return "", sfx, fmt.Errorf("the .Z suffix must come last in %q", after)
}
sfx.zeroing = true
case "SAE":
@@ -638,7 +638,7 @@ func parseEvexSuffix(mnem string) (string, evexSuffix, error) {
}
}
if sfx.bcst && (sfx.sae || sfx.rounding >= 0) {
return "", sfx, fmt.Errorf("cannot combine .BCST with rounding or SAE in %q", mnem[i+1:])
return "", sfx, fmt.Errorf("cannot combine .BCST with rounding or SAE in %q", after)
}
return base, sfx, nil
}