diff options
Diffstat (limited to 'src/coord.c')
| -rw-r--r-- | src/coord.c | 37 |
1 files changed, 4 insertions, 33 deletions
diff --git a/src/coord.c b/src/coord.c index 06f7474..673434f 100644 --- a/src/coord.c +++ b/src/coord.c | |||
| @@ -2,9 +2,6 @@ | |||
| 2 | 2 | ||
| 3 | #include "coord.h" | 3 | #include "coord.h" |
| 4 | 4 | ||
| 5 | static uint64_t indexers_getind(Indexer **is, Cube *c); | ||
| 6 | static uint64_t indexers_getmax(Indexer **is); | ||
| 7 | static void indexers_makecube(Indexer **is, uint64_t ind, Cube *c); | ||
| 8 | static void gen_coord_comp(Coordinate *coord); | 5 | static void gen_coord_comp(Coordinate *coord); |
| 9 | static void gen_coord_sym(Coordinate *coord); | 6 | static void gen_coord_sym(Coordinate *coord); |
| 10 | static bool read_coord_mtable(Coordinate *coord); | 7 | static bool read_coord_mtable(Coordinate *coord); |
| @@ -169,7 +166,7 @@ invindex_eposepe(uint64_t ind, Cube *cube) | |||
| 169 | 166 | ||
| 170 | /* Other local functions *****************************************************/ | 167 | /* Other local functions *****************************************************/ |
| 171 | 168 | ||
| 172 | static uint64_t | 169 | uint64_t |
| 173 | indexers_getmax(Indexer **is) | 170 | indexers_getmax(Indexer **is) |
| 174 | { | 171 | { |
| 175 | int i; | 172 | int i; |
| @@ -181,7 +178,7 @@ indexers_getmax(Indexer **is) | |||
| 181 | return max; | 178 | return max; |
| 182 | } | 179 | } |
| 183 | 180 | ||
| 184 | static uint64_t | 181 | uint64_t |
| 185 | indexers_getind(Indexer **is, Cube *c) | 182 | indexers_getind(Indexer **is, Cube *c) |
| 186 | { | 183 | { |
| 187 | int i; | 184 | int i; |
| @@ -195,12 +192,12 @@ indexers_getind(Indexer **is, Cube *c) | |||
| 195 | return max; | 192 | return max; |
| 196 | } | 193 | } |
| 197 | 194 | ||
| 198 | static void | 195 | void |
| 199 | indexers_makecube(Indexer **is, uint64_t ind, Cube *c) | 196 | indexers_makecube(Indexer **is, uint64_t ind, Cube *c) |
| 200 | { | 197 | { |
| 201 | /* Warning: anti-indexers are applied in the same order as indexers. */ | 198 | /* Warning: anti-indexers are applied in the same order as indexers. */ |
| 202 | /* We assume order does not matter, but it would make more sense to */ | 199 | /* We assume order does not matter, but it would make more sense to */ |
| 203 | /* Apply them in reverse. */ | 200 | /* apply them in reverse. */ |
| 204 | 201 | ||
| 205 | int i; | 202 | int i; |
| 206 | uint64_t m; | 203 | uint64_t m; |
| @@ -629,32 +626,6 @@ move_coord(Coordinate *coord, Move m, uint64_t ind, Trans *offtrans) | |||
| 629 | return coord->max; /* Only reached in case of error */ | 626 | return coord->max; /* Only reached in case of error */ |
| 630 | } | 627 | } |
| 631 | 628 | ||
| 632 | bool | ||
| 633 | test_coord(Coordinate *coord) | ||
| 634 | { | ||
| 635 | uint64_t ui, uj; | ||
| 636 | Cube c; | ||
| 637 | |||
| 638 | if (coord->type != COMP_COORD) { | ||
| 639 | fprintf(stderr, "Can only test COMP_COORD\n"); | ||
| 640 | return false; | ||
| 641 | } | ||
| 642 | |||
| 643 | gen_coord(coord); | ||
| 644 | for (ui = 0; ui < coord->max; ui++) { | ||
| 645 | indexers_makecube(coord->i, ui, &c); | ||
| 646 | uj = indexers_getind(coord->i, &c); | ||
| 647 | if (ui != uj) { | ||
| 648 | fprintf(stderr, "%s: error: %" PRIu64 " different" | ||
| 649 | " from %" PRIu64 "\n", coord->name, uj, ui); | ||
| 650 | return false; | ||
| 651 | } | ||
| 652 | } | ||
| 653 | |||
| 654 | fprintf(stderr, "%s: test passed\n", coord->name); | ||
| 655 | return true; | ||
| 656 | } | ||
| 657 | |||
| 658 | uint64_t | 629 | uint64_t |
| 659 | trans_coord(Coordinate *coord, Trans t, uint64_t ind) | 630 | trans_coord(Coordinate *coord, Trans t, uint64_t ind) |
| 660 | { | 631 | { |
