aboutsummaryrefslogtreecommitdiff
path: root/utils/genmovecode.sh
diff options
context:
space:
mode:
Diffstat (limited to 'utils/genmovecode.sh')
-rwxr-xr-xutils/genmovecode.sh16
1 files changed, 9 insertions, 7 deletions
diff --git a/utils/genmovecode.sh b/utils/genmovecode.sh
index 0857f31..9d5fa7a 100755
--- a/utils/genmovecode.sh
+++ b/utils/genmovecode.sh
@@ -4,16 +4,18 @@ type="${1:-src}"
4 4
5gcc -DDEBUG h48_to_"$type".c ../cube.c -o h48_to_"$type" 5gcc -DDEBUG h48_to_"$type".c ../cube.c -o h48_to_"$type"
6 6
7genfuncs() { 7lineavx() { printf '#define _move_cube_%s ' "$1"; }
8linesrc() { printf '_static cube_fast_t _move_cube_%s = ' "$1"; }
9sedavx() { sed '1,2s/$/ \\/ ; 3s/$/)/ ; 3q'; }
10sedsrc() { sed '3s/$/ };/ ; 3q'; }
11
12gen() {
8 for f in move_??_*.txt; do 13 for f in move_??_*.txt; do
9 move="$(echo $f | sed 's/.*_// ; s/\.txt//')" 14 move="$(echo $f | sed 's/.*_// ; s/\.txt//')"
10 printf 'static inline cube_fast_t\n_move_%s' "$move" 15 line$type "$move"
11 printf '(cube_fast_t c)\n{\n' 16 ./h48_to_"$type" <"$f" | sed$type
12 printf '\tcube_fast_t m = '
13 ./h48_to_"$type" <"$f" | sed '2,4s/^/\t/'
14 printf ';\n\n\treturn compose_fast(c, m);\n}\n\n'
15 done 17 done
16} 18}
17 19
18genfuncs 20gen
19rm -f h48_to_"$type" invert 21rm -f h48_to_"$type" invert

Generated with cgit - Back to sebastiano.tronto.net