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

type="${1:-src}"

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

lineavx() { printf '#define _move_cube_%s ' "$1"; }
linesrc() { printf '_static cube_fast_t _move_cube_%s = ' "$1"; }
sedavx() { sed '1,2s/$/ \\/ ; 3s/$/)/ ; 3q'; }
sedsrc() { sed '3s/$/ };/ ; 3q'; }

gen() {
	for f in move_??_*.txt; do
		move="$(echo $f | sed 's/.*_// ; s/\.txt//')"
		line$type "$move"
		./h48_to_"$type" <"$f" | sed$type
	done
}

gen
rm -f h48_to_"$type" invert

Generated with cgit - Back to sebastiano.tronto.net