From d6fdf14d5c320bdca455f910d58d652c5a7827da Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Fri, 17 Nov 2023 19:14:26 +0100 Subject: Simplified move and transform code --- old/moves_trans/genmovecode.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 old/moves_trans/genmovecode.sh (limited to 'old/moves_trans/genmovecode.sh') diff --git a/old/moves_trans/genmovecode.sh b/old/moves_trans/genmovecode.sh new file mode 100755 index 0000000..0857f31 --- /dev/null +++ b/old/moves_trans/genmovecode.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +type="${1:-src}" + +gcc -DDEBUG h48_to_"$type".c ../cube.c -o h48_to_"$type" + +genfuncs() { + for f in move_??_*.txt; do + move="$(echo $f | sed 's/.*_// ; s/\.txt//')" + printf 'static inline cube_fast_t\n_move_%s' "$move" + printf '(cube_fast_t c)\n{\n' + printf '\tcube_fast_t m = ' + ./h48_to_"$type" <"$f" | sed '2,4s/^/\t/' + printf ';\n\n\treturn compose_fast(c, m);\n}\n\n' + done +} + +genfuncs +rm -f h48_to_"$type" invert -- cgit v1.3