diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2023-11-17 19:14:26 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2023-11-17 19:14:26 +0100 |
| commit | d6fdf14d5c320bdca455f910d58d652c5a7827da (patch) | |
| tree | 15642a013e719e81526cf02b6656ce22adb8a3cf /utils/genmovecode.sh | |
| parent | a26ae103faf8fa53b65f7757fb8b4255a37fcd22 (diff) | |
| download | nissy-core-d6fdf14d5c320bdca455f910d58d652c5a7827da.tar.gz nissy-core-d6fdf14d5c320bdca455f910d58d652c5a7827da.zip | |
Simplified move and transform code
Diffstat (limited to 'utils/genmovecode.sh')
| -rwxr-xr-x | utils/genmovecode.sh | 16 |
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 | ||
| 5 | gcc -DDEBUG h48_to_"$type".c ../cube.c -o h48_to_"$type" | 5 | gcc -DDEBUG h48_to_"$type".c ../cube.c -o h48_to_"$type" |
| 6 | 6 | ||
| 7 | genfuncs() { | 7 | lineavx() { printf '#define _move_cube_%s ' "$1"; } |
| 8 | linesrc() { printf '_static cube_fast_t _move_cube_%s = ' "$1"; } | ||
| 9 | sedavx() { sed '1,2s/$/ \\/ ; 3s/$/)/ ; 3q'; } | ||
| 10 | sedsrc() { sed '3s/$/ };/ ; 3q'; } | ||
| 11 | |||
| 12 | gen() { | ||
| 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 | ||
| 18 | genfuncs | 20 | gen |
| 19 | rm -f h48_to_"$type" invert | 21 | rm -f h48_to_"$type" invert |
