diff options
Diffstat (limited to 'src/nissy.c')
| -rw-r--r-- | src/nissy.c | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/src/nissy.c b/src/nissy.c index 8aa0334..bf56f40 100644 --- a/src/nissy.c +++ b/src/nissy.c | |||
| @@ -142,47 +142,6 @@ my_strnlen(const char *str, size_t maxlen) | |||
| 142 | } | 142 | } |
| 143 | 143 | ||
| 144 | long long | 144 | long long |
| 145 | nissy_compose( | ||
| 146 | const char cube[static NISSY_SIZE_CUBE], | ||
| 147 | const char permutation[static NISSY_SIZE_CUBE], | ||
| 148 | char result[static NISSY_SIZE_CUBE] | ||
| 149 | ) | ||
| 150 | { | ||
| 151 | cube_t c, p, res; | ||
| 152 | long long err; | ||
| 153 | |||
| 154 | c = readcube(cube); | ||
| 155 | |||
| 156 | if (!isconsistent(c)) { | ||
| 157 | LOG("[compose] Error: the given cube is invalid\n"); | ||
| 158 | err = NISSY_ERROR_INVALID_CUBE; | ||
| 159 | goto nissy_compose_error; | ||
| 160 | } | ||
| 161 | |||
| 162 | p = readcube(permutation); | ||
| 163 | |||
| 164 | if (!isconsistent(p)) { | ||
| 165 | LOG("[compose] Error: given permutation is invalid\n"); | ||
| 166 | err = NISSY_ERROR_INVALID_CUBE; | ||
| 167 | goto nissy_compose_error; | ||
| 168 | } | ||
| 169 | |||
| 170 | res = compose(c, p); | ||
| 171 | |||
| 172 | if (!isconsistent(res)) { | ||
| 173 | LOG("[compose] Unknown error: resulting cube is invalid\n"); | ||
| 174 | err = NISSY_ERROR_UNKNOWN; | ||
| 175 | goto nissy_compose_error; | ||
| 176 | } | ||
| 177 | |||
| 178 | return write_result(res, result); | ||
| 179 | |||
| 180 | nissy_compose_error: | ||
| 181 | writecube(ZERO_CUBE, NISSY_SIZE_CUBE, result); | ||
| 182 | return err; | ||
| 183 | } | ||
| 184 | |||
| 185 | long long | ||
| 186 | nissy_inverse( | 145 | nissy_inverse( |
| 187 | const char cube[static NISSY_SIZE_CUBE], | 146 | const char cube[static NISSY_SIZE_CUBE], |
| 188 | char result[static NISSY_SIZE_CUBE] | 147 | char result[static NISSY_SIZE_CUBE] |
