diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2025-03-09 07:43:37 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2025-03-09 07:43:37 +0100 |
| commit | 11e6aeeaf5f08839c6effb8f68710081acf491bf (patch) | |
| tree | 8aab442a637fd35bb457946926fd9bc749ee0467 /src/solvers/coord/gendata.h | |
| parent | 110e079f81277b40ec76be0b86b074a632496109 (diff) | |
| download | nissy-core-11e6aeeaf5f08839c6effb8f68710081acf491bf.tar.gz nissy-core-11e6aeeaf5f08839c6effb8f68710081acf491bf.zip | |
Working (?) version of coordinate solver
Diffstat (limited to 'src/solvers/coord/gendata.h')
| -rw-r--r-- | src/solvers/coord/gendata.h | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/solvers/coord/gendata.h b/src/solvers/coord/gendata.h index 3d385e9..d366466 100644 --- a/src/solvers/coord/gendata.h +++ b/src/solvers/coord/gendata.h | |||
| @@ -1,26 +1,26 @@ | |||
| 1 | STATIC size_t gendata_coordinate(const coord_t *, void *); | 1 | STATIC size_t gendata_coord(const coord_t *, void *); |
| 2 | STATIC size_t gendata_coordinate_name(const char *, void *); | 2 | STATIC int64_t gendata_coord_dispatch(const char *, void *); |
| 3 | STATIC tableinfo_t genptable_coordinate(const coord_t *, const void *, uint8_t *); | 3 | STATIC tableinfo_t genptable_coord(const coord_t *, const void *, uint8_t *); |
| 4 | STATIC uint8_t get_coord_pval(const coord_t *, const uint8_t *, uint64_t); | 4 | STATIC uint8_t get_coord_pval(const coord_t *, const uint8_t *, uint64_t); |
| 5 | STATIC void set_coord_pval(const coord_t *, uint8_t *, uint64_t, uint8_t); | 5 | STATIC void set_coord_pval(const coord_t *, uint8_t *, uint64_t, uint8_t); |
| 6 | 6 | ||
| 7 | STATIC size_t | 7 | STATIC int64_t |
| 8 | gendata_coordinate_name(const char *name, void *buf) | 8 | gendata_coord_dispatch(const char *coordstr, void *buf) |
| 9 | { | 9 | { |
| 10 | coord_t *coord; | 10 | coord_t *coord; |
| 11 | 11 | ||
| 12 | coord = parse_coord(name, strlen(name)); | 12 | coord = parse_coord(coordstr, strlen(coordstr)); |
| 13 | |||
| 13 | if (coord == NULL) { | 14 | if (coord == NULL) { |
| 14 | LOG("Cannot generate data for coordinate '%s': not found\n", | 15 | LOG("Could not parse coordinate '%s'\n", coord); |
| 15 | name); | 16 | return NISSY_ERROR_INVALID_SOLVER; |
| 16 | return 0; | ||
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | return gendata_coordinate(coord, buf); | 19 | return (int64_t)gendata_coord(coord, buf); |
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | STATIC size_t | 22 | STATIC size_t |
| 23 | gendata_coordinate(const coord_t *coord, void *buf) | 23 | gendata_coord(const coord_t *coord, void *buf) |
| 24 | { | 24 | { |
| 25 | uint64_t coord_dsize, tablesize, ninfo; | 25 | uint64_t coord_dsize, tablesize, ninfo; |
| 26 | void *pruningbuf, *coord_data; | 26 | void *pruningbuf, *coord_data; |
| @@ -33,7 +33,7 @@ gendata_coordinate(const coord_t *coord, void *buf) | |||
| 33 | tablesize = DIV_ROUND_UP(coord->max, 2); | 33 | tablesize = DIV_ROUND_UP(coord->max, 2); |
| 34 | 34 | ||
| 35 | if (buf == NULL) | 35 | if (buf == NULL) |
| 36 | goto gendata_coordinate_return_size; | 36 | goto gendata_coord_return_size; |
| 37 | 37 | ||
| 38 | if (ninfo == 2) { | 38 | if (ninfo == 2) { |
| 39 | coord_data_info = (tableinfo_t) { | 39 | coord_data_info = (tableinfo_t) { |
| @@ -62,15 +62,15 @@ gendata_coordinate(const coord_t *coord, void *buf) | |||
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | table = ((uint8_t *)pruningbuf) + INFOSIZE; | 64 | table = ((uint8_t *)pruningbuf) + INFOSIZE; |
| 65 | pruning_info = genptable_coordinate(coord, coord_data, table); | 65 | pruning_info = genptable_coord(coord, coord_data, table); |
| 66 | writetableinfo(&pruning_info, INFOSIZE + tablesize, pruningbuf); | 66 | writetableinfo(&pruning_info, INFOSIZE + tablesize, pruningbuf); |
| 67 | 67 | ||
| 68 | gendata_coordinate_return_size: | 68 | gendata_coord_return_size: |
| 69 | return ninfo * INFOSIZE + coord_dsize + tablesize; | 69 | return ninfo * INFOSIZE + coord_dsize + tablesize; |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | STATIC tableinfo_t | 72 | STATIC tableinfo_t |
| 73 | genptable_coordinate(const coord_t *coord, const void *data, uint8_t *table) | 73 | genptable_coord(const coord_t *coord, const void *data, uint8_t *table) |
| 74 | { | 74 | { |
| 75 | uint64_t tablesize, i, j, d, tot; | 75 | uint64_t tablesize, i, j, d, tot; |
| 76 | tableinfo_t info; | 76 | tableinfo_t info; |
