diff options
Diffstat (limited to 'src/solvers/twostep/twostep.h')
| -rw-r--r-- | src/solvers/twostep/twostep.h | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/src/solvers/twostep/twostep.h b/src/solvers/twostep/twostep.h index 8947a50..e5b00f6 100644 --- a/src/solvers/twostep/twostep.h +++ b/src/solvers/twostep/twostep.h | |||
| @@ -1,5 +1,10 @@ | |||
| 1 | #ifndef SRC_SOLVERS_TWOSTEP_TWOSTEP_H | ||
| 2 | #define SRC_SOLVERS_TWOSTEP_TWOSTEP_H | ||
| 3 | |||
| 1 | #include "../coord/coord.h" | 4 | #include "../coord/coord.h" |
| 2 | 5 | ||
| 6 | STATIC size_t twostep_size_1(void); | ||
| 7 | STATIC size_t twostep_size_2(void); | ||
| 3 | STATIC long long dataid_twostep(const char *, char [SIZE(NISSY_SIZE_DATAID)]); | 8 | STATIC long long dataid_twostep(const char *, char [SIZE(NISSY_SIZE_DATAID)]); |
| 4 | STATIC long long gendata_twostep( | 9 | STATIC long long gendata_twostep( |
| 5 | const char *, unsigned long long, unsigned char *); | 10 | const char *, unsigned long long, unsigned char *); |
| @@ -10,6 +15,23 @@ STATIC long long solve_twostep(oriented_cube_t, const char *, unsigned, | |||
| 10 | const unsigned char *, unsigned, char *, | 15 | const unsigned char *, unsigned, char *, |
| 11 | long long [SIZE(NISSY_SIZE_SOLVE_STATS)], int (*)(void *), void *); | 16 | long long [SIZE(NISSY_SIZE_SOLVE_STATS)], int (*)(void *), void *); |
| 12 | 17 | ||
| 18 | STATIC size_t | ||
| 19 | twostep_size_1(void) | ||
| 20 | { | ||
| 21 | size_t s; | ||
| 22 | |||
| 23 | s = gendata_coord(&coordinate_dr, NULL); | ||
| 24 | s = (size_t)8 * DIV_ROUND_UP(s, 8); /* Preserve 8-byte alignment */ | ||
| 25 | |||
| 26 | return s; | ||
| 27 | } | ||
| 28 | |||
| 29 | STATIC size_t | ||
| 30 | twostep_size_2(void) | ||
| 31 | { | ||
| 32 | return gendata_multicoord(&multicoordinate_drfin, NULL); | ||
| 33 | } | ||
| 34 | |||
| 13 | STATIC long long | 35 | STATIC long long |
| 14 | dataid_twostep(const char *s, char dataid[SIZE(NISSY_SIZE_DATAID)]) | 36 | dataid_twostep(const char *s, char dataid[SIZE(NISSY_SIZE_DATAID)]) |
| 15 | { | 37 | { |
| @@ -26,9 +48,8 @@ gendata_twostep( | |||
| 26 | { | 48 | { |
| 27 | size_t r, s1, s2; | 49 | size_t r, s1, s2; |
| 28 | 50 | ||
| 29 | s1 = gendata_coord(&coordinate_dr, NULL); | 51 | s1 = twostep_size_1(); |
| 30 | s1 = DIV_ROUND_UP(s1, 8); /* Preserve 8-byte alignment */ | 52 | s2 = twostep_size_2(); |
| 31 | s2 = gendata_multicoord(&multicoordinate_drfin, NULL); | ||
| 32 | 53 | ||
| 33 | if (buf == NULL) | 54 | if (buf == NULL) |
| 34 | goto gendata_twostep_return_size; | 55 | goto gendata_twostep_return_size; |
| @@ -41,7 +62,7 @@ gendata_twostep( | |||
| 41 | return NISSY_ERROR_UNKNOWN; | 62 | return NISSY_ERROR_UNKNOWN; |
| 42 | 63 | ||
| 43 | r = gendata_multicoord(&multicoordinate_drfin, buf + s1); | 64 | r = gendata_multicoord(&multicoordinate_drfin, buf + s1); |
| 44 | if (r != NISSY_OK) | 65 | if (r == 0) |
| 45 | return NISSY_ERROR_UNKNOWN; | 66 | return NISSY_ERROR_UNKNOWN; |
| 46 | 67 | ||
| 47 | gendata_twostep_return_size: | 68 | gendata_twostep_return_size: |
| @@ -63,7 +84,8 @@ checkdata_twostep( | |||
| 63 | if (r != NISSY_OK) | 84 | if (r != NISSY_OK) |
| 64 | return r; | 85 | return r; |
| 65 | 86 | ||
| 66 | r = checkdata_multicoord(&multicoordinate_drfin, bufsize, buf); | 87 | r = checkdata_multicoord( |
| 88 | &multicoordinate_drfin, bufsize, buf + twostep_size_1()); | ||
| 67 | if (r != NISSY_OK) | 89 | if (r != NISSY_OK) |
| 68 | return r; | 90 | return r; |
| 69 | 91 | ||
| @@ -91,3 +113,5 @@ solve_twostep( | |||
| 91 | { | 113 | { |
| 92 | //TODO | 114 | //TODO |
| 93 | } | 115 | } |
| 116 | |||
| 117 | #endif /* SRC_SOLVERS_TWOSTEP_TWOSTEP_H */ | ||
