aboutsummaryrefslogtreecommitdiff
path: root/old/moves_trans/genmovecode.sh
blob: 0857f312acd4b77f8fc9244afe62c3e9fe42de82 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh

type="${1:-src}"

gcc -DDEBUG h48_to_"$type".c ../cube.c -o h48_to_"$type"

genfuncs() {
	for f in move_??_*.txt; do
		move="$(echo $f | sed 's/.*_// ; s/\.txt//')"
		printf 'static inline cube_fast_t\n_move_%s' "$move"
		printf '(cube_fast_t c)\n{\n'
		printf '\tcube_fast_t m = '
		./h48_to_"$type" <"$f" | sed '2,4s/^/\t/'
		printf ';\n\n\treturn compose_fast(c, m);\n}\n\n'
	done
}

genfuncs
rm -f h48_to_"$type" invert

Generated with cgit - Back to sebastiano.tronto.net