commit 1f4900a3cc6ca74f94b73e224d14a09d52c4549c
parent 3c8f8c2e60cd089679cf5da5160baaf35977b220
Author: Sebastiano Tronto <sebastiano@tronto.net>
Date: Tue, 10 Sep 2024 15:39:49 +0200
Added tabletype to tableinfo
Diffstat:
4 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/src/solvers/tables.h b/src/solvers/tables.h
@@ -2,7 +2,8 @@
#define INFOSIZE 512
#define INFO_OFFSET_SOLVER 0
#define INFO_SOLVER_STRLEN 20
-#define INFO_OFFSET_INFOSIZE INFO_SOLVER_STRLEN
+#define INFO_OFFSET_TYPE INFO_SOLVER_STRLEN
+#define INFO_OFFSET_INFOSIZE (INFO_OFFSET_TYPE + sizeof(uint64_t))
#define INFO_OFFSET_FULLSIZE (INFO_OFFSET_INFOSIZE + sizeof(uint64_t))
#define INFO_OFFSET_HASH (INFO_OFFSET_FULLSIZE + sizeof(uint64_t))
#define INFO_OFFSET_ENTRIES (INFO_OFFSET_HASH + sizeof(uint64_t))
@@ -13,8 +14,12 @@
#define INFO_OFFSET_DISTRIBUTION (INFO_OFFSET_NEXT + sizeof(uint64_t))
#define INFO_DISTRIBUTION_LEN 21
+const uint64_t TABLETYPE_PRUNING = 0;
+const uint64_t TABLETYPE_SPECIAL = 1;
+
typedef struct {
char solver[INFO_SOLVER_STRLEN];
+ uint64_t type;
uint64_t infosize;
uint64_t fullsize;
uint64_t hash;
@@ -44,6 +49,7 @@ readtableinfo(const void *buf, tableinfo_t *info)
memcpy(info->solver, OFFSET(buf, INFO_OFFSET_SOLVER),
INFO_SOLVER_STRLEN);
+ info->type = *(const uint64_t *)OFFSET(buf, INFO_OFFSET_TYPE);
info->infosize = *(const uint64_t *)OFFSET(buf, INFO_OFFSET_INFOSIZE);
info->fullsize = *(const uint64_t *)OFFSET(buf, INFO_OFFSET_FULLSIZE);
info->hash = *(const uint64_t *)OFFSET(buf, INFO_OFFSET_HASH);
@@ -81,6 +87,7 @@ writetableinfo(const tableinfo_t *info, void *buf)
if (*OFFSET(buf, i) == 0)
*OFFSET(buf, i) = 0;
+ *(uint64_t *)OFFSET(buf, INFO_OFFSET_TYPE) = info->type;
*(uint64_t *)OFFSET(buf, INFO_OFFSET_INFOSIZE) = info->infosize;
*(uint64_t *)OFFSET(buf, INFO_OFFSET_FULLSIZE) = info->fullsize;
*(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
@@ -1,5 +1,6 @@
Test solver
+0
512
100000000000
12345678912345
diff --git a/test/090_tables_readwrite/00_table.out b/test/090_tables_readwrite/00_table.out
@@ -1,5 +1,6 @@
Test solver
+0
512
100000000000
12345678912345
diff --git a/test/090_tables_readwrite/tables_readwrite_tests.c b/test/090_tables_readwrite/tables_readwrite_tests.c
@@ -6,6 +6,7 @@
typedef struct {
char solver[INFO_SOLVER_STRLEN];
+ uint64_t type;
uint64_t infosize;
uint64_t fullsize;
uint64_t hash;
@@ -39,6 +40,7 @@ tableinfo_t test_readinfo(void) {
fgets(emptyline, 2, stdin);
+ ret.type = readn();
ret.infosize = readn();
ret.fullsize = readn();
ret.hash = readn();
@@ -62,6 +64,7 @@ void test_writeinfo(tableinfo_t info) {
printf("%s\n", info.solver);
printf("\n");
+ printf("%" PRIu64 "\n", info.type);
printf("%" PRIu64 "\n", info.infosize);
printf("%" PRIu64 "\n", info.fullsize);
printf("%" PRIu64 "\n", info.hash);