aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/solvers/twostep/twostep.h29
1 files changed, 24 insertions, 5 deletions
diff --git a/src/solvers/twostep/twostep.h b/src/solvers/twostep/twostep.h
index afb49da..e5b00f6 100644
--- a/src/solvers/twostep/twostep.h
+++ b/src/solvers/twostep/twostep.h
@@ -3,6 +3,8 @@
3 3
4#include "../coord/coord.h" 4#include "../coord/coord.h"
5 5
6STATIC size_t twostep_size_1(void);
7STATIC size_t twostep_size_2(void);
6STATIC long long dataid_twostep(const char *, char [SIZE(NISSY_SIZE_DATAID)]); 8STATIC long long dataid_twostep(const char *, char [SIZE(NISSY_SIZE_DATAID)]);
7STATIC long long gendata_twostep( 9STATIC long long gendata_twostep(
8 const char *, unsigned long long, unsigned char *); 10 const char *, unsigned long long, unsigned char *);
@@ -13,6 +15,23 @@ STATIC long long solve_twostep(oriented_cube_t, const char *, unsigned,
13 const unsigned char *, unsigned, char *, 15 const unsigned char *, unsigned, char *,
14 long long [SIZE(NISSY_SIZE_SOLVE_STATS)], int (*)(void *), void *); 16 long long [SIZE(NISSY_SIZE_SOLVE_STATS)], int (*)(void *), void *);
15 17
18STATIC size_t
19twostep_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
29STATIC size_t
30twostep_size_2(void)
31{
32 return gendata_multicoord(&multicoordinate_drfin, NULL);
33}
34
16STATIC long long 35STATIC long long
17dataid_twostep(const char *s, char dataid[SIZE(NISSY_SIZE_DATAID)]) 36dataid_twostep(const char *s, char dataid[SIZE(NISSY_SIZE_DATAID)])
18{ 37{
@@ -29,9 +48,8 @@ gendata_twostep(
29{ 48{
30 size_t r, s1, s2; 49 size_t r, s1, s2;
31 50
32 s1 = gendata_coord(&coordinate_dr, NULL); 51 s1 = twostep_size_1();
33 s1 = DIV_ROUND_UP(s1, 8); /* Preserve 8-byte alignment */ 52 s2 = twostep_size_2();
34 s2 = gendata_multicoord(&multicoordinate_drfin, NULL);
35 53
36 if (buf == NULL) 54 if (buf == NULL)
37 goto gendata_twostep_return_size; 55 goto gendata_twostep_return_size;
@@ -44,7 +62,7 @@ gendata_twostep(
44 return NISSY_ERROR_UNKNOWN; 62 return NISSY_ERROR_UNKNOWN;
45 63
46 r = gendata_multicoord(&multicoordinate_drfin, buf + s1); 64 r = gendata_multicoord(&multicoordinate_drfin, buf + s1);
47 if (r != NISSY_OK) 65 if (r == 0)
48 return NISSY_ERROR_UNKNOWN; 66 return NISSY_ERROR_UNKNOWN;
49 67
50gendata_twostep_return_size: 68gendata_twostep_return_size:
@@ -66,7 +84,8 @@ checkdata_twostep(
66 if (r != NISSY_OK) 84 if (r != NISSY_OK)
67 return r; 85 return r;
68 86
69 r = checkdata_multicoord(&multicoordinate_drfin, bufsize, buf); 87 r = checkdata_multicoord(
88 &multicoordinate_drfin, bufsize, buf + twostep_size_1());
70 if (r != NISSY_OK) 89 if (r != NISSY_OK)
71 return r; 90 return r;
72 91

Generated with cgit - Back to sebastiano.tronto.net