generate the instruction table

This commit is contained in:
Michael McLoughlin
2018-11-24 13:47:30 -08:00
parent f1e1da6387
commit 70dcf2b611
8 changed files with 25542 additions and 11 deletions

View File

@@ -2,6 +2,7 @@ package load
import (
"path/filepath"
"sort"
"strconv"
"strings"
@@ -61,12 +62,16 @@ func (l *Loader) Load() ([]*inst.Instruction, error) {
}
}
// Convert to a slice to return.
// Convert to a slice, sorted by opcode.
is := make([]*inst.Instruction, 0, len(im))
for _, i := range im {
is = append(is, i)
}
sort.Slice(is, func(i, j int) bool {
return is[i].Opcode < is[j].Opcode
})
return is, nil
}