From 83338a2f753ebbb7ba7b154cc60b2f427b6121b0 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Wed, 26 Mar 2025 19:22:50 +0100 Subject: Added inverse coordinate for CO this is necessary for DR coordinate --- src/core/io_moves.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/core/io_moves.h') diff --git a/src/core/io_moves.h b/src/core/io_moves.h index b00682b..c94b6b7 100644 --- a/src/core/io_moves.h +++ b/src/core/io_moves.h @@ -1,5 +1,6 @@ STATIC uint8_t readmove(char); STATIC int64_t readmoves(const char *, size_t n, uint8_t [n]); +STATIC int64_t countmoves(const char *); STATIC uint8_t readmodifier(char); STATIC int64_t writemoves(size_t n, const uint8_t [n], size_t m, char [m]); @@ -71,6 +72,21 @@ readmoves(const char *buf, size_t n, uint8_t ret[n]) return (int64_t)c; } +STATIC int64_t +countmoves(const char *buf) +{ + uint8_t m; + uint64_t c; + + FOREACH_READMOVE(buf, m, c, INT_MAX, NISSY_ERROR_INVALID_MOVES, + {} + ) + + (void)m; /* Ignore "variable set but not used" warning */ + + return (int64_t)c; +} + STATIC int64_t writemoves( size_t nmoves, -- cgit v1.3