aboutsummaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2023-11-19 10:40:49 +0100
committerSebastiano Tronto <sebastiano@tronto.net>2023-11-19 10:40:49 +0100
commit13275a4bb8696e730a4fffdd05b8e1d046e489c6 (patch)
tree4db3ed3ada41158c451188c98e74fdde5ea296b2 /utils
parentd6fdf14d5c320bdca455f910d58d652c5a7827da (diff)
downloadnissy-core-13275a4bb8696e730a4fffdd05b8e1d046e489c6.tar.gz
nissy-core-13275a4bb8696e730a4fffdd05b8e1d046e489c6.zip
Simplified cube definition for move and transformations even more
Diffstat (limited to '')
-rwxr-xr-xutils/genmovecode.sh16
-rwxr-xr-xutils/gentranscode.sh17
-rw-r--r--utils/h48_to_avx.c19
-rw-r--r--utils/h48_to_lst.c (renamed from utils/h48_to_src.c)2
4 files changed, 15 insertions, 39 deletions
diff --git a/utils/genmovecode.sh b/utils/genmovecode.sh
index 9d5fa7a..d6440e5 100755
--- a/utils/genmovecode.sh
+++ b/utils/genmovecode.sh
@@ -1,21 +1,15 @@
1#!/bin/sh 1#!/bin/sh
2 2
3type="${1:-src}" 3gcc -DDEBUG h48_to_lst.c ../cube.c -o h48_to_lst
4
5gcc -DDEBUG h48_to_"$type".c ../cube.c -o h48_to_"$type"
6
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 4
12gen() { 5gen() {
13 for f in move_??_*.txt; do 6 for f in move_??_*.txt; do
14 move="$(echo $f | sed 's/.*_// ; s/\.txt//')" 7 move="$(echo $f | sed 's/.*_// ; s/\.txt//')"
15 line$type "$move" 8 printf '#define _move_cube_%s fastcube( \\\n ' "$move"
16 ./h48_to_"$type" <"$f" | sed$type 9 ./h48_to_lst <"$f"
10 printf ')\n'
17 done 11 done
18} 12}
19 13
20gen 14gen
21rm -f h48_to_"$type" invert 15rm -f h48_to_lst invert
diff --git a/utils/gentranscode.sh b/utils/gentranscode.sh
index b9d41b6..f9aeb7b 100755
--- a/utils/gentranscode.sh
+++ b/utils/gentranscode.sh
@@ -1,8 +1,6 @@
1#!/bin/sh 1#!/bin/sh
2 2
3type="${1:-src}" 3gcc -DDEBUG h48_to_lst.c ../cube.c -o h48_to_lst
4
5gcc -DDEBUG h48_to_"$type".c ../cube.c -o h48_to_"$type"
6gcc -DDEBUG invert.c ../cube.c -o invert 4gcc -DDEBUG invert.c ../cube.c -o invert
7 5
8lineavx() { printf '#define _trans_cube_%s ' "$1"; } 6lineavx() { printf '#define _trans_cube_%s ' "$1"; }
@@ -13,12 +11,15 @@ sedsrc() { sed '3s/$/ };/ ; 3q'; }
13gen() { 11gen() {
14 for f in transform_??_???.txt; do 12 for f in transform_??_???.txt; do
15 trans="$(echo $f | sed 's/.*_// ; s/\.txt//')" 13 trans="$(echo $f | sed 's/.*_// ; s/\.txt//')"
16 line$type "$trans" 14 printf '#define _trans_cube_%s fastcube( \\\n ' "$trans"
17 ./h48_to_"$type" <"$f" | sed$type 15 ./h48_to_lst <"$f"
18 line$type "${trans}_inverse" 16 printf ')\n'
19 ./invert <"$f" | ./h48_to_"$type" | sed$type 17 printf '#define _trans_cube_%s_inverse fastcube( \\\n ' \
18 "$trans"
19 ./invert <"$f" | ./h48_to_lst
20 printf ')\n'
20 done 21 done
21} 22}
22 23
23gen 24gen
24rm -f h48_to_"$type" invert 25rm -f h48_to_lst invert
diff --git a/utils/h48_to_avx.c b/utils/h48_to_avx.c
deleted file mode 100644
index ba82366..0000000
--- a/utils/h48_to_avx.c
+++ /dev/null
@@ -1,19 +0,0 @@
1#include <stdio.h>
2#include <inttypes.h>
3#include <stdbool.h>
4
5#include "../cube.h"
6
7#define STRLENMAX 1000
8
9int main() {
10 char str[STRLENMAX];
11 cube_t cube;
12
13 fgets(str, STRLENMAX, stdin);
14 cube = readcube("H48", str);
15 writecube("AVX", cube, str);
16 fputs(str, stdout);
17
18 return 0;
19}
diff --git a/utils/h48_to_src.c b/utils/h48_to_lst.c
index 6fdea5c..debb7f4 100644
--- a/utils/h48_to_src.c
+++ b/utils/h48_to_lst.c
@@ -12,7 +12,7 @@ int main() {
12 12
13 fgets(str, STRLENMAX, stdin); 13 fgets(str, STRLENMAX, stdin);
14 cube = readcube("H48", str); 14 cube = readcube("H48", str);
15 writecube("SRC", cube, str); 15 writecube("LST", cube, str);
16 fputs(str, stdout); 16 fputs(str, stdout);
17 17
18 return 0; 18 return 0;

Generated with cgit - Back to sebastiano.tronto.net