x86: rel types and generated tests
This commit is contained in:
19
internal/gen/util.go
Normal file
19
internal/gen/util.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package gen
|
||||
|
||||
// cross returns the cross product of the lists in x.
|
||||
func cross(x [][]string) [][]string {
|
||||
r := [][]string{nil}
|
||||
for _, s := range x {
|
||||
var nxt [][]string
|
||||
for _, pre := range r {
|
||||
for _, a := range s {
|
||||
concat := make([]string, len(pre), len(pre)+1)
|
||||
copy(concat, pre)
|
||||
concat = append(concat, a)
|
||||
nxt = append(nxt, concat)
|
||||
}
|
||||
}
|
||||
r = nxt
|
||||
}
|
||||
return r
|
||||
}
|
||||
Reference in New Issue
Block a user