diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2025-05-18 08:48:13 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2025-05-18 08:48:13 +0200 |
| commit | 8b94d135429a9f3253cc7f25a1453b412065c4a0 (patch) | |
| tree | 4a31d6def5421e95fb98505a2bc2653c18fca330 /src/solvers/coord/gendata.h | |
| parent | 30b43f08955158d4f2066f4b50fe8d1241b3177b (diff) | |
| download | nissy-core-8b94d135429a9f3253cc7f25a1453b412065c4a0.tar.gz nissy-core-8b94d135429a9f3253cc7f25a1453b412065c4a0.zip | |
Refactor solver dispatch and checkdata
Diffstat (limited to 'src/solvers/coord/gendata.h')
| -rw-r--r-- | src/solvers/coord/gendata.h | 35 |
1 files changed, 8 insertions, 27 deletions
diff --git a/src/solvers/coord/gendata.h b/src/solvers/coord/gendata.h index 7a974f8..1b65f49 100644 --- a/src/solvers/coord/gendata.h +++ b/src/solvers/coord/gendata.h | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | STATIC size_t gendata_coord(const coord_t [static 1], unsigned char *); | 1 | STATIC size_t gendata_coord(const coord_t [static 1], unsigned char *); |
| 2 | STATIC int64_t gendata_coord_dispatch(const char *, unsigned char *); | 2 | STATIC long long gendata_coord_dispatch(const char *, unsigned long long, |
| 3 | unsigned char *); | ||
| 3 | STATIC tableinfo_t genptable_coord( | 4 | STATIC tableinfo_t genptable_coord( |
| 4 | const coord_t [static 1], const unsigned char *, unsigned char *); | 5 | const coord_t [static 1], const unsigned char *, unsigned char *); |
| 5 | STATIC bool switch_to_fromnew(uint64_t, uint64_t, uint64_t); | 6 | STATIC bool switch_to_fromnew(uint64_t, uint64_t, uint64_t); |
| @@ -7,15 +8,17 @@ STATIC uint64_t genptable_coord_fillneighbors(const coord_t [static 1], | |||
| 7 | const unsigned char *, uint64_t, uint8_t, unsigned char *); | 8 | const unsigned char *, uint64_t, uint8_t, unsigned char *); |
| 8 | STATIC uint64_t genptable_coord_fillfromnew(const coord_t [static 1], | 9 | STATIC uint64_t genptable_coord_fillfromnew(const coord_t [static 1], |
| 9 | const unsigned char *, uint64_t, uint8_t, unsigned char *); | 10 | const unsigned char *, uint64_t, uint8_t, unsigned char *); |
| 10 | STATIC void getdistribution_coord(const unsigned char *, const char *, | ||
| 11 | uint64_t [static INFO_DISTRIBUTION_LEN]); | ||
| 12 | STATIC uint8_t get_coord_pval( | 11 | STATIC uint8_t get_coord_pval( |
| 13 | const coord_t [static 1], const unsigned char *, uint64_t); | 12 | const coord_t [static 1], const unsigned char *, uint64_t); |
| 14 | STATIC void set_coord_pval( | 13 | STATIC void set_coord_pval( |
| 15 | const coord_t [static 1], unsigned char *, uint64_t, uint8_t); | 14 | const coord_t [static 1], unsigned char *, uint64_t, uint8_t); |
| 16 | 15 | ||
| 17 | STATIC int64_t | 16 | STATIC long long |
| 18 | gendata_coord_dispatch(const char *coordstr, unsigned char *buf) | 17 | gendata_coord_dispatch( |
| 18 | const char *coordstr, | ||
| 19 | unsigned long long bufsize, | ||
| 20 | unsigned char *buf | ||
| 21 | ) | ||
| 19 | { | 22 | { |
| 20 | coord_t *coord; | 23 | coord_t *coord; |
| 21 | 24 | ||
| @@ -249,28 +252,6 @@ genptable_coord_fillfromnew( | |||
| 249 | return tot; | 252 | return tot; |
| 250 | } | 253 | } |
| 251 | 254 | ||
| 252 | STATIC void | ||
| 253 | getdistribution_coord( | ||
| 254 | const unsigned char *table, | ||
| 255 | const char *coord, | ||
| 256 | uint64_t distr[static INFO_DISTRIBUTION_LEN] | ||
| 257 | ) | ||
| 258 | { | ||
| 259 | uint8_t v; | ||
| 260 | uint64_t i; | ||
| 261 | coord_t *c; | ||
| 262 | |||
| 263 | memset(distr, 0, INFO_DISTRIBUTION_LEN * sizeof(uint64_t)); | ||
| 264 | |||
| 265 | if((c = parse_coord(strlen(coord), coord)) == NULL) | ||
| 266 | return; | ||
| 267 | |||
| 268 | for (i = 0; i < c->max; i++) { | ||
| 269 | v = get_coord_pval(c, table, i); | ||
| 270 | distr[v]++; | ||
| 271 | } | ||
| 272 | } | ||
| 273 | |||
| 274 | STATIC uint8_t | 255 | STATIC uint8_t |
| 275 | get_coord_pval( | 256 | get_coord_pval( |
| 276 | const coord_t coord[static 1], | 257 | const coord_t coord[static 1], |
