aboutsummaryrefslogtreecommitdiff
path: root/src/solvers/coord/gendata.h
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2025-08-05 09:04:00 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2025-08-05 09:04:00 +0200
commit3e7bb9b87ef9b47d8f643dbcae19a64ddbc81dbb (patch)
tree122faba06273ae0450a2994e22bad42202f11da7 /src/solvers/coord/gendata.h
parentf6efc882a279cddb624fe2f2470797561a6997b8 (diff)
downloadnissy-core-3e7bb9b87ef9b47d8f643dbcae19a64ddbc81dbb.tar.gz
nissy-core-3e7bb9b87ef9b47d8f643dbcae19a64ddbc81dbb.zip
Added DRFIN solver
Diffstat (limited to 'src/solvers/coord/gendata.h')
-rw-r--r--src/solvers/coord/gendata.h66
1 files changed, 57 insertions, 9 deletions
diff --git a/src/solvers/coord/gendata.h b/src/solvers/coord/gendata.h
index 0b108cd..cbc8774 100644
--- a/src/solvers/coord/gendata.h
+++ b/src/solvers/coord/gendata.h
@@ -1,4 +1,6 @@
1STATIC size_t gendata_coord(const coord_t [static 1], unsigned char *); 1STATIC size_t gendata_coord(const coord_t [static 1], unsigned char *);
2STATIC size_t gendata_multicoord(
3 const multicoord_t [static 1], unsigned char *);
2STATIC long long gendata_coord_dispatch(const char *, unsigned long long, 4STATIC long long gendata_coord_dispatch(const char *, unsigned long long,
3 unsigned char *); 5 unsigned char *);
4STATIC tableinfo_t genptable_coord( 6STATIC tableinfo_t genptable_coord(
@@ -23,15 +25,18 @@ gendata_coord_dispatch(
23) 25)
24{ 26{
25 coord_t *coord; 27 coord_t *coord;
28 multicoord_t *mcoord;
26 29
27 parse_coord_and_trans(coordstr, &coord, NULL); 30 parse_coord_and_trans(coordstr, &coord, &mcoord, NULL);
28 31
29 if (coord == NULL) { 32 if (coord != NULL)
30 LOG("Error: could not parse coordinate '%s'\n", coordstr); 33 return gendata_coord(coord, buf);
31 return NISSY_ERROR_INVALID_SOLVER; 34
32 } 35 if (mcoord != NULL)
36 return gendata_multicoord(mcoord, buf);
33 37
34 return gendata_coord(coord, buf); 38 LOG("Error: could not parse coordinate '%s'\n", coordstr);
39 return NISSY_ERROR_INVALID_SOLVER;
35} 40}
36 41
37STATIC size_t 42STATIC size_t
@@ -70,8 +75,7 @@ gendata_coord(const coord_t coord[static 1], unsigned char *buf)
70 .maxvalue = 0, 75 .maxvalue = 0,
71 }; 76 };
72 77
73 append_coord_name(coord, coord_data_info.solver); 78 append_name(&coord_data_info, coord->name);
74
75 writetableinfo(&coord_data_info, INFOSIZE + coord_dsize, buf); 79 writetableinfo(&coord_data_info, INFOSIZE + coord_dsize, buf);
76 80
77 pruningbuf = buf + INFOSIZE + coord_dsize; 81 pruningbuf = buf + INFOSIZE + coord_dsize;
@@ -91,6 +95,50 @@ gendata_coord_error:
91 return 0; 95 return 0;
92} 96}
93 97
98STATIC size_t
99gendata_multicoord(const multicoord_t mcoord[static 1], unsigned char *buf)
100{
101 unsigned char *b;
102 size_t i, s, ret;
103 tableinfo_t info;
104
105 info = (tableinfo_t) {
106 .solver = "multicoordinate table for ",
107 .type = TABLETYPE_MULTI,
108 .infosize = INFOSIZE,
109 .fullsize = INFOSIZE,
110 .hash = 0,
111 .next = INFOSIZE,
112
113 /* Unknown / non-applicable values */
114 .entries = 0,
115 .classes = 0,
116 .bits = 0,
117 .base = 0,
118 .maxvalue = 0,
119 };
120
121 append_name(&info, mcoord->name);
122 if (buf != NULL)
123 writetableinfo(&info, INFOSIZE, buf);
124 ret = INFOSIZE;
125
126 for (i = 0; mcoord->coordinates[i] != NULL; i++) {
127 b = buf == NULL ? NULL : buf + ret;
128 s = gendata_coord(mcoord->coordinates[i], b);
129 if (s == 0)
130 return 0;
131
132 ret += s;
133
134 /* Pad so that each coordinate's table is 8-byte aligned */
135 while (ret % 8 != 0)
136 buf[ret++] = 0;
137 }
138
139 return ret;
140}
141
94STATIC tableinfo_t 142STATIC tableinfo_t
95genptable_coord( 143genptable_coord(
96 const coord_t coord[static 1], 144 const coord_t coord[static 1],
@@ -118,7 +166,7 @@ genptable_coord(
118 166
119 memset(table, 0xFF, tablesize); 167 memset(table, 0xFF, tablesize);
120 memset(info.distribution, 0, INFO_DISTRIBUTION_LEN * sizeof(uint64_t)); 168 memset(info.distribution, 0, INFO_DISTRIBUTION_LEN * sizeof(uint64_t));
121 append_coord_name(coord, info.solver); 169 append_name(&info, coord->name);
122 170
123 tot = info.distribution[0] = 171 tot = info.distribution[0] =
124 genptable_coord_init_solved(coord, data, table); 172 genptable_coord_init_solved(coord, data, table);

Generated with cgit - Back to sebastiano.tronto.net