diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2025-04-21 14:33:01 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2025-04-21 14:44:07 +0200 |
| commit | 510a7471348788fccba6b7c4b9f7b7cc9aee6ba9 (patch) | |
| tree | 58df7791242d9a4f52e80da93ad3af20ed5e3528 /src/solvers/coord/gendata.h | |
| parent | 1d9b8acfeece68c4f55d2499d8aed127f98a383c (diff) | |
| download | nissy-core-510a7471348788fccba6b7c4b9f7b7cc9aee6ba9.tar.gz nissy-core-510a7471348788fccba6b7c4b9f7b7cc9aee6ba9.zip | |
Always use unsigned char * for data buffers
Before this commit I was inconsistently using one of void *, char *
and uint8_t *.
Diffstat (limited to 'src/solvers/coord/gendata.h')
| -rw-r--r-- | src/solvers/coord/gendata.h | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/src/solvers/coord/gendata.h b/src/solvers/coord/gendata.h index ae7b39e..7a974f8 100644 --- a/src/solvers/coord/gendata.h +++ b/src/solvers/coord/gendata.h | |||
| @@ -1,21 +1,21 @@ | |||
| 1 | STATIC size_t gendata_coord(const coord_t [static 1], void *); | 1 | STATIC size_t gendata_coord(const coord_t [static 1], unsigned char *); |
| 2 | STATIC int64_t gendata_coord_dispatch(const char *, void *); | 2 | STATIC int64_t gendata_coord_dispatch(const char *, unsigned char *); |
| 3 | STATIC tableinfo_t genptable_coord( | 3 | STATIC tableinfo_t genptable_coord( |
| 4 | const coord_t [static 1], const void *, uint8_t *); | 4 | const coord_t [static 1], const unsigned char *, unsigned char *); |
| 5 | STATIC bool switch_to_fromnew(uint64_t, uint64_t, uint64_t); | 5 | STATIC bool switch_to_fromnew(uint64_t, uint64_t, uint64_t); |
| 6 | STATIC uint64_t genptable_coord_fillneighbors( | 6 | STATIC uint64_t genptable_coord_fillneighbors(const coord_t [static 1], |
| 7 | const coord_t [static 1], const void *, uint64_t, uint8_t, uint8_t *); | 7 | const unsigned char *, uint64_t, uint8_t, unsigned char *); |
| 8 | STATIC uint64_t genptable_coord_fillfromnew( | 8 | STATIC uint64_t genptable_coord_fillfromnew(const coord_t [static 1], |
| 9 | const coord_t [static 1], const void *, uint64_t, uint8_t, uint8_t *); | 9 | const unsigned char *, uint64_t, uint8_t, unsigned char *); |
| 10 | STATIC void getdistribution_coord( | 10 | STATIC void getdistribution_coord(const unsigned char *, const char *, |
| 11 | const uint8_t *, const char *, uint64_t [static INFO_DISTRIBUTION_LEN]); | 11 | uint64_t [static INFO_DISTRIBUTION_LEN]); |
| 12 | STATIC uint8_t get_coord_pval( | 12 | STATIC uint8_t get_coord_pval( |
| 13 | const coord_t [static 1], const uint8_t *, uint64_t); | 13 | const coord_t [static 1], const unsigned char *, uint64_t); |
| 14 | STATIC void set_coord_pval( | 14 | STATIC void set_coord_pval( |
| 15 | const coord_t [static 1], uint8_t *, uint64_t, uint8_t); | 15 | const coord_t [static 1], unsigned char *, uint64_t, uint8_t); |
| 16 | 16 | ||
| 17 | STATIC int64_t | 17 | STATIC int64_t |
| 18 | gendata_coord_dispatch(const char *coordstr, void *buf) | 18 | gendata_coord_dispatch(const char *coordstr, unsigned char *buf) |
| 19 | { | 19 | { |
| 20 | coord_t *coord; | 20 | coord_t *coord; |
| 21 | 21 | ||
| @@ -30,14 +30,14 @@ gendata_coord_dispatch(const char *coordstr, void *buf) | |||
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | STATIC size_t | 32 | STATIC size_t |
| 33 | gendata_coord(const coord_t coord[static 1], void *buf) | 33 | gendata_coord(const coord_t coord[static 1], unsigned char *buf) |
| 34 | { | 34 | { |
| 35 | uint64_t coord_dsize, tablesize, ninfo; | 35 | uint64_t coord_dsize, tablesize, ninfo; |
| 36 | void *pruningbuf, *coord_data; | 36 | unsigned char *pruningbuf, *coord_data; |
| 37 | uint8_t *table; | 37 | unsigned char *table; |
| 38 | tableinfo_t coord_data_info, pruning_info; | 38 | tableinfo_t coord_data_info, pruning_info; |
| 39 | 39 | ||
| 40 | coord_data = buf == NULL ? NULL : ((uint8_t *)buf) + INFOSIZE; | 40 | coord_data = buf == NULL ? NULL : buf + INFOSIZE; |
| 41 | coord_dsize = coord->gendata(coord_data); | 41 | coord_dsize = coord->gendata(coord_data); |
| 42 | if (coord_dsize == SIZE_MAX) | 42 | if (coord_dsize == SIZE_MAX) |
| 43 | goto gendata_coord_error; | 43 | goto gendata_coord_error; |
| @@ -69,12 +69,12 @@ gendata_coord(const coord_t coord[static 1], void *buf) | |||
| 69 | 69 | ||
| 70 | writetableinfo(&coord_data_info, INFOSIZE + coord_dsize, buf); | 70 | writetableinfo(&coord_data_info, INFOSIZE + coord_dsize, buf); |
| 71 | 71 | ||
| 72 | pruningbuf = ((uint8_t *)buf) + INFOSIZE + coord_dsize; | 72 | pruningbuf = buf + INFOSIZE + coord_dsize; |
| 73 | } else { | 73 | } else { |
| 74 | pruningbuf = buf; | 74 | pruningbuf = buf; |
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | table = ((uint8_t *)pruningbuf) + INFOSIZE; | 77 | table = pruningbuf + INFOSIZE; |
| 78 | pruning_info = genptable_coord(coord, coord_data, table); | 78 | pruning_info = genptable_coord(coord, coord_data, table); |
| 79 | writetableinfo(&pruning_info, INFOSIZE + tablesize, pruningbuf); | 79 | writetableinfo(&pruning_info, INFOSIZE + tablesize, pruningbuf); |
| 80 | 80 | ||
| @@ -89,8 +89,8 @@ gendata_coord_error: | |||
| 89 | STATIC tableinfo_t | 89 | STATIC tableinfo_t |
| 90 | genptable_coord( | 90 | genptable_coord( |
| 91 | const coord_t coord[static 1], | 91 | const coord_t coord[static 1], |
| 92 | const void *data, | 92 | const unsigned char *data, |
| 93 | uint8_t *table | 93 | unsigned char *table |
| 94 | ) | 94 | ) |
| 95 | { | 95 | { |
| 96 | uint64_t tablesize, i, d, tot, t, nm; | 96 | uint64_t tablesize, i, d, tot, t, nm; |
| @@ -161,10 +161,10 @@ switch_to_fromnew(uint64_t done, uint64_t max, uint64_t nm) | |||
| 161 | STATIC uint64_t | 161 | STATIC uint64_t |
| 162 | genptable_coord_fillneighbors( | 162 | genptable_coord_fillneighbors( |
| 163 | const coord_t coord[static 1], | 163 | const coord_t coord[static 1], |
| 164 | const void *data, | 164 | const unsigned char *data, |
| 165 | uint64_t i, | 165 | uint64_t i, |
| 166 | uint8_t d, | 166 | uint8_t d, |
| 167 | uint8_t *table | 167 | unsigned char *table |
| 168 | ) | 168 | ) |
| 169 | { | 169 | { |
| 170 | bool isnasty; | 170 | bool isnasty; |
| @@ -198,10 +198,10 @@ genptable_coord_fillneighbors( | |||
| 198 | STATIC uint64_t | 198 | STATIC uint64_t |
| 199 | genptable_coord_fillfromnew( | 199 | genptable_coord_fillfromnew( |
| 200 | const coord_t coord[static 1], | 200 | const coord_t coord[static 1], |
| 201 | const void *data, | 201 | const unsigned char *data, |
| 202 | uint64_t i, | 202 | uint64_t i, |
| 203 | uint8_t d, | 203 | uint8_t d, |
| 204 | uint8_t *table | 204 | unsigned char *table |
| 205 | ) | 205 | ) |
| 206 | { | 206 | { |
| 207 | bool found; | 207 | bool found; |
| @@ -251,7 +251,7 @@ genptable_coord_fillfromnew( | |||
| 251 | 251 | ||
| 252 | STATIC void | 252 | STATIC void |
| 253 | getdistribution_coord( | 253 | getdistribution_coord( |
| 254 | const uint8_t *table, | 254 | const unsigned char *table, |
| 255 | const char *coord, | 255 | const char *coord, |
| 256 | uint64_t distr[static INFO_DISTRIBUTION_LEN] | 256 | uint64_t distr[static INFO_DISTRIBUTION_LEN] |
| 257 | ) | 257 | ) |
| @@ -274,7 +274,7 @@ getdistribution_coord( | |||
| 274 | STATIC uint8_t | 274 | STATIC uint8_t |
| 275 | get_coord_pval( | 275 | get_coord_pval( |
| 276 | const coord_t coord[static 1], | 276 | const coord_t coord[static 1], |
| 277 | const uint8_t *table, | 277 | const unsigned char *table, |
| 278 | uint64_t i | 278 | uint64_t i |
| 279 | ) | 279 | ) |
| 280 | { | 280 | { |
| @@ -284,7 +284,7 @@ get_coord_pval( | |||
| 284 | STATIC void | 284 | STATIC void |
| 285 | set_coord_pval( | 285 | set_coord_pval( |
| 286 | const coord_t coord[static 1], | 286 | const coord_t coord[static 1], |
| 287 | uint8_t *table, | 287 | unsigned char *table, |
| 288 | uint64_t i, | 288 | uint64_t i, |
| 289 | uint8_t val | 289 | uint8_t val |
| 290 | ) | 290 | ) |
