diff options
Diffstat (limited to 'src/core/io_moves.h')
| -rw-r--r-- | src/core/io_moves.h | 16 |
1 files changed, 16 insertions, 0 deletions
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 @@ | |||
| 1 | STATIC uint8_t readmove(char); | 1 | STATIC uint8_t readmove(char); |
| 2 | STATIC int64_t readmoves(const char *, size_t n, uint8_t [n]); | 2 | STATIC int64_t readmoves(const char *, size_t n, uint8_t [n]); |
| 3 | STATIC int64_t countmoves(const char *); | ||
| 3 | STATIC uint8_t readmodifier(char); | 4 | STATIC uint8_t readmodifier(char); |
| 4 | STATIC int64_t writemoves(size_t n, const uint8_t [n], size_t m, char [m]); | 5 | STATIC int64_t writemoves(size_t n, const uint8_t [n], size_t m, char [m]); |
| 5 | 6 | ||
| @@ -72,6 +73,21 @@ readmoves(const char *buf, size_t n, uint8_t ret[n]) | |||
| 72 | } | 73 | } |
| 73 | 74 | ||
| 74 | STATIC int64_t | 75 | STATIC int64_t |
| 76 | countmoves(const char *buf) | ||
| 77 | { | ||
| 78 | uint8_t m; | ||
| 79 | uint64_t c; | ||
| 80 | |||
| 81 | FOREACH_READMOVE(buf, m, c, INT_MAX, NISSY_ERROR_INVALID_MOVES, | ||
| 82 | {} | ||
| 83 | ) | ||
| 84 | |||
| 85 | (void)m; /* Ignore "variable set but not used" warning */ | ||
| 86 | |||
| 87 | return (int64_t)c; | ||
| 88 | } | ||
| 89 | |||
| 90 | STATIC int64_t | ||
| 75 | writemoves( | 91 | writemoves( |
| 76 | size_t nmoves, | 92 | size_t nmoves, |
| 77 | const uint8_t m[nmoves], | 93 | const uint8_t m[nmoves], |
