aboutsummaryrefslogtreecommitdiff
path: root/utils/gentranscode.sh
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2023-11-17 19:14:26 +0100
committerSebastiano Tronto <sebastiano@tronto.net>2023-11-17 19:14:26 +0100
commitd6fdf14d5c320bdca455f910d58d652c5a7827da (patch)
tree15642a013e719e81526cf02b6656ce22adb8a3cf /utils/gentranscode.sh
parenta26ae103faf8fa53b65f7757fb8b4255a37fcd22 (diff)
downloadnissy-core-d6fdf14d5c320bdca455f910d58d652c5a7827da.tar.gz
nissy-core-d6fdf14d5c320bdca455f910d58d652c5a7827da.zip
Simplified move and transform code
Diffstat (limited to '')
-rwxr-xr-xutils/gentranscode.sh38
1 files changed, 10 insertions, 28 deletions
diff --git a/utils/gentranscode.sh b/utils/gentranscode.sh
index 198ac93..b9d41b6 100755
--- a/utils/gentranscode.sh
+++ b/utils/gentranscode.sh
@@ -5,38 +5,20 @@ type="${1:-src}"
5gcc -DDEBUG h48_to_"$type".c ../cube.c -o h48_to_"$type" 5gcc -DDEBUG h48_to_"$type".c ../cube.c -o h48_to_"$type"
6gcc -DDEBUG invert.c ../cube.c -o invert 6gcc -DDEBUG invert.c ../cube.c -o invert
7 7
8# Old version 8lineavx() { printf '#define _trans_cube_%s ' "$1"; }
9genarray() { 9linesrc() { printf '_static cube_fast_t _trans_cube_%s = ' "$1"; }
10 for f in transform_??_???.txt; do 10sedavx() { sed '1,2s/$/ \\/ ; 3s/$/)/ ; 3q'; }
11 trans="$(echo $f | sed 's/.*_// ; s/\.txt//')" 11sedsrc() { sed '3s/$/ };/ ; 3q'; }
12 printf '[%s] = ' "$trans"
13 if [ "$1" = "-i" ]; then
14 ./invert <"$f" | ./h48_to_"$type"
15 else
16 ./h48_to_"$type" <"$f"
17 fi
18 printf ',\n'
19 done
20}
21 12
22genfuncs() { 13gen() {
23 for f in transform_??_???.txt; do 14 for f in transform_??_???.txt; do
24 trans="$(echo $f | sed 's/.*_// ; s/\.txt//')" 15 trans="$(echo $f | sed 's/.*_// ; s/\.txt//')"
25 printf 'static inline cube_fast_t\n_trans_%s' "$trans" 16 line$type "$trans"
26 printf '(cube_fast_t c)\n{\n' 17 ./h48_to_"$type" <"$f" | sed$type
27 printf '\tcube_fast_t ret;\n\n' 18 line$type "${trans}_inverse"
28 printf '\tcube_fast_t tn = ' 19 ./invert <"$f" | ./h48_to_"$type" | sed$type
29 ./h48_to_"$type" <"$f" | sed '2,4s/^/\t/'
30 printf ';\n\tcube_fast_t ti = '
31 ./invert <"$f" | ./h48_to_"$type" | sed '2,4 s/^/\t/'
32 printf ';\n\n\tret = compose_fast(tn, c);\n'
33 printf '\tret = compose_fast(ret, ti);\n'
34 if [ -n "$(echo "$trans" | grep "m")" ]; then
35 printf '\tret = invertco_fast(ret);\n'
36 fi
37 printf '\n\treturn ret;\n}\n\n'
38 done 20 done
39} 21}
40 22
41genfuncs 23gen
42rm -f h48_to_"$type" invert 24rm -f h48_to_"$type" invert

Generated with cgit - Back to sebastiano.tronto.net