aboutsummaryrefslogtreecommitdiff
path: root/utils/gentranscode.sh
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2024-04-13 09:24:47 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2024-04-13 09:24:47 +0200
commitae055f1fc993d406939f57f11553d218e1efde82 (patch)
tree4a9e03d6eb9afc38cfd7e1735f7b70f17bdcf0d3 /utils/gentranscode.sh
parent72e018b066bd5cc3ce0181b43865a227e8b9b6ec (diff)
downloadcubecore-ae055f1fc993d406939f57f11553d218e1efde82.tar.gz
cubecore-ae055f1fc993d406939f57f11553d218e1efde82.zip
Simplified moves and trans
Diffstat (limited to 'utils/gentranscode.sh')
-rwxr-xr-xutils/gentranscode.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/utils/gentranscode.sh b/utils/gentranscode.sh
new file mode 100755
index 0000000..4fe7df8
--- /dev/null
+++ b/utils/gentranscode.sh
@@ -0,0 +1,37 @@
1#!/bin/sh
2
3gcc -DDEBUG h48_to_lst.c ../cube.c -o h48_to_lst
4gcc -DDEBUG invert.c ../cube.c -o invert
5
6lineavx() { printf '#define _trans_cube_%s ' "$1"; }
7linesrc() { printf '_static cube_fast_t _trans_cube_%s = ' "$1"; }
8sedavx() { sed '1,2s/$/ \\/ ; 3s/$/)/ ; 3q'; }
9sedsrc() { sed '3s/$/ };/ ; 3q'; }
10
11gen() {
12 for f in transform_??_???.txt; do
13 trans="$(echo $f | sed 's/.*_// ; s/\.txt//')"
14 printf '[%s] = {\n' "$trans"
15
16 printf '\t[NORMAL] = {\n'
17 lst="$(./h48_to_lst <"$f")"
18 c="$(echo $lst | cut -d ' ' -f -8 | rev | cut -c 2- | rev)"
19 e="$(echo $lst | cut -d ' ' -f 9-)"
20 printf '\t\t.corner = {%s},\n' "$c"
21 printf '\t\t.edge = {%s}\n' "$e"
22 printf '\t},\n'
23
24 printf '\t[INVERSE] = {\n'
25 inv="$(./invert <"$f" | ./h48_to_lst)"
26 c="$(echo $inv | cut -d ' ' -f -8 | rev | cut -c 2- | rev)"
27 e="$(echo $inv | cut -d ' ' -f 9-)"
28 printf '\t\t.corner = {%s},\n' "$c"
29 printf '\t\t.edge = {%s}\n' "$e"
30 printf '\t}\n'
31
32 printf '},\n'
33 done
34}
35
36gen
37rm -f h48_to_lst invert

Generated with cgit - Back to sebastiano.tronto.net