diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2024-09-10 15:39:49 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2024-09-10 15:39:49 +0200 |
| commit | 1f4900a3cc6ca74f94b73e224d14a09d52c4549c (patch) | |
| tree | 955773f6467db3d3f62a4d453ec0a9853c8fccaa | |
| parent | 3c8f8c2e60cd089679cf5da5160baaf35977b220 (diff) | |
| download | nissy-core-1f4900a3cc6ca74f94b73e224d14a09d52c4549c.tar.gz nissy-core-1f4900a3cc6ca74f94b73e224d14a09d52c4549c.zip | |
Added tabletype to tableinfo
| -rw-r--r-- | src/solvers/tables.h | 9 | ||||
| -rw-r--r-- | test/090_tables_readwrite/00_table.in | 1 | ||||
| -rw-r--r-- | test/090_tables_readwrite/00_table.out | 1 | ||||
| -rw-r--r-- | test/090_tables_readwrite/tables_readwrite_tests.c | 3 |
4 files changed, 13 insertions, 1 deletions
diff --git a/src/solvers/tables.h b/src/solvers/tables.h index 9598a09..29d0641 100644 --- a/src/solvers/tables.h +++ b/src/solvers/tables.h | |||
| @@ -2,7 +2,8 @@ | |||
| 2 | #define INFOSIZE 512 | 2 | #define INFOSIZE 512 |
| 3 | #define INFO_OFFSET_SOLVER 0 | 3 | #define INFO_OFFSET_SOLVER 0 |
| 4 | #define INFO_SOLVER_STRLEN 20 | 4 | #define INFO_SOLVER_STRLEN 20 |
| 5 | #define INFO_OFFSET_INFOSIZE INFO_SOLVER_STRLEN | 5 | #define INFO_OFFSET_TYPE INFO_SOLVER_STRLEN |
| 6 | #define INFO_OFFSET_INFOSIZE (INFO_OFFSET_TYPE + sizeof(uint64_t)) | ||
| 6 | #define INFO_OFFSET_FULLSIZE (INFO_OFFSET_INFOSIZE + sizeof(uint64_t)) | 7 | #define INFO_OFFSET_FULLSIZE (INFO_OFFSET_INFOSIZE + sizeof(uint64_t)) |
| 7 | #define INFO_OFFSET_HASH (INFO_OFFSET_FULLSIZE + sizeof(uint64_t)) | 8 | #define INFO_OFFSET_HASH (INFO_OFFSET_FULLSIZE + sizeof(uint64_t)) |
| 8 | #define INFO_OFFSET_ENTRIES (INFO_OFFSET_HASH + sizeof(uint64_t)) | 9 | #define INFO_OFFSET_ENTRIES (INFO_OFFSET_HASH + sizeof(uint64_t)) |
| @@ -13,8 +14,12 @@ | |||
| 13 | #define INFO_OFFSET_DISTRIBUTION (INFO_OFFSET_NEXT + sizeof(uint64_t)) | 14 | #define INFO_OFFSET_DISTRIBUTION (INFO_OFFSET_NEXT + sizeof(uint64_t)) |
| 14 | #define INFO_DISTRIBUTION_LEN 21 | 15 | #define INFO_DISTRIBUTION_LEN 21 |
| 15 | 16 | ||
| 17 | const uint64_t TABLETYPE_PRUNING = 0; | ||
| 18 | const uint64_t TABLETYPE_SPECIAL = 1; | ||
| 19 | |||
| 16 | typedef struct { | 20 | typedef struct { |
| 17 | char solver[INFO_SOLVER_STRLEN]; | 21 | char solver[INFO_SOLVER_STRLEN]; |
| 22 | uint64_t type; | ||
| 18 | uint64_t infosize; | 23 | uint64_t infosize; |
| 19 | uint64_t fullsize; | 24 | uint64_t fullsize; |
| 20 | uint64_t hash; | 25 | uint64_t hash; |
| @@ -44,6 +49,7 @@ readtableinfo(const void *buf, tableinfo_t *info) | |||
| 44 | 49 | ||
| 45 | memcpy(info->solver, OFFSET(buf, INFO_OFFSET_SOLVER), | 50 | memcpy(info->solver, OFFSET(buf, INFO_OFFSET_SOLVER), |
| 46 | INFO_SOLVER_STRLEN); | 51 | INFO_SOLVER_STRLEN); |
| 52 | info->type = *(const uint64_t *)OFFSET(buf, INFO_OFFSET_TYPE); | ||
| 47 | info->infosize = *(const uint64_t *)OFFSET(buf, INFO_OFFSET_INFOSIZE); | 53 | info->infosize = *(const uint64_t *)OFFSET(buf, INFO_OFFSET_INFOSIZE); |
| 48 | info->fullsize = *(const uint64_t *)OFFSET(buf, INFO_OFFSET_FULLSIZE); | 54 | info->fullsize = *(const uint64_t *)OFFSET(buf, INFO_OFFSET_FULLSIZE); |
| 49 | info->hash = *(const uint64_t *)OFFSET(buf, INFO_OFFSET_HASH); | 55 | info->hash = *(const uint64_t *)OFFSET(buf, INFO_OFFSET_HASH); |
| @@ -81,6 +87,7 @@ writetableinfo(const tableinfo_t *info, void *buf) | |||
| 81 | if (*OFFSET(buf, i) == 0) | 87 | if (*OFFSET(buf, i) == 0) |
| 82 | *OFFSET(buf, i) = 0; | 88 | *OFFSET(buf, i) = 0; |
| 83 | 89 | ||
| 90 | *(uint64_t *)OFFSET(buf, INFO_OFFSET_TYPE) = info->type; | ||
| 84 | *(uint64_t *)OFFSET(buf, INFO_OFFSET_INFOSIZE) = info->infosize; | 91 | *(uint64_t *)OFFSET(buf, INFO_OFFSET_INFOSIZE) = info->infosize; |
| 85 | *(uint64_t *)OFFSET(buf, INFO_OFFSET_FULLSIZE) = info->fullsize; | 92 | *(uint64_t *)OFFSET(buf, INFO_OFFSET_FULLSIZE) = info->fullsize; |
| 86 | *(uint64_t *)OFFSET(buf, INFO_OFFSET_HASH) = info->hash; | 93 | *(uint64_t *)OFFSET(buf, INFO_OFFSET_HASH) = info->hash; |
diff --git a/test/090_tables_readwrite/00_table.in b/test/090_tables_readwrite/00_table.in index a35f13a..f286968 100644 --- a/test/090_tables_readwrite/00_table.in +++ b/test/090_tables_readwrite/00_table.in | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | Test solver | 1 | Test solver |
| 2 | 2 | ||
| 3 | 0 | ||
| 3 | 512 | 4 | 512 |
| 4 | 100000000000 | 5 | 100000000000 |
| 5 | 12345678912345 | 6 | 12345678912345 |
diff --git a/test/090_tables_readwrite/00_table.out b/test/090_tables_readwrite/00_table.out index a35f13a..f286968 100644 --- a/test/090_tables_readwrite/00_table.out +++ b/test/090_tables_readwrite/00_table.out | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | Test solver | 1 | Test solver |
| 2 | 2 | ||
| 3 | 0 | ||
| 3 | 512 | 4 | 512 |
| 4 | 100000000000 | 5 | 100000000000 |
| 5 | 12345678912345 | 6 | 12345678912345 |
diff --git a/test/090_tables_readwrite/tables_readwrite_tests.c b/test/090_tables_readwrite/tables_readwrite_tests.c index b062460..f3162ea 100644 --- a/test/090_tables_readwrite/tables_readwrite_tests.c +++ b/test/090_tables_readwrite/tables_readwrite_tests.c | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | 6 | ||
| 7 | typedef struct { | 7 | typedef struct { |
| 8 | char solver[INFO_SOLVER_STRLEN]; | 8 | char solver[INFO_SOLVER_STRLEN]; |
| 9 | uint64_t type; | ||
| 9 | uint64_t infosize; | 10 | uint64_t infosize; |
| 10 | uint64_t fullsize; | 11 | uint64_t fullsize; |
| 11 | uint64_t hash; | 12 | uint64_t hash; |
| @@ -39,6 +40,7 @@ tableinfo_t test_readinfo(void) { | |||
| 39 | 40 | ||
| 40 | fgets(emptyline, 2, stdin); | 41 | fgets(emptyline, 2, stdin); |
| 41 | 42 | ||
| 43 | ret.type = readn(); | ||
| 42 | ret.infosize = readn(); | 44 | ret.infosize = readn(); |
| 43 | ret.fullsize = readn(); | 45 | ret.fullsize = readn(); |
| 44 | ret.hash = readn(); | 46 | ret.hash = readn(); |
| @@ -62,6 +64,7 @@ void test_writeinfo(tableinfo_t info) { | |||
| 62 | printf("%s\n", info.solver); | 64 | printf("%s\n", info.solver); |
| 63 | printf("\n"); | 65 | printf("\n"); |
| 64 | 66 | ||
| 67 | printf("%" PRIu64 "\n", info.type); | ||
| 65 | printf("%" PRIu64 "\n", info.infosize); | 68 | printf("%" PRIu64 "\n", info.infosize); |
| 66 | printf("%" PRIu64 "\n", info.fullsize); | 69 | printf("%" PRIu64 "\n", info.fullsize); |
| 67 | printf("%" PRIu64 "\n", info.hash); | 70 | printf("%" PRIu64 "\n", info.hash); |
