aboutsummaryrefslogtreecommitdiff
path: root/src/solvers/tables.h
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2024-09-10 19:43:05 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2024-09-10 19:43:05 +0200
commit70d3a3de3a2fdef7e47b2bd510261d69390a3a9c (patch)
tree2c545953d0b61b37c4f281cd47981e9350b5c09b /src/solvers/tables.h
parent1f4900a3cc6ca74f94b73e224d14a09d52c4549c (diff)
downloadnissy-core-70d3a3de3a2fdef7e47b2bd510261d69390a3a9c.tar.gz
nissy-core-70d3a3de3a2fdef7e47b2bd510261d69390a3a9c.zip
New tableinfo for gendata_h48, still work to do
Diffstat (limited to 'src/solvers/tables.h')
-rw-r--r--src/solvers/tables.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/solvers/tables.h b/src/solvers/tables.h
index 29d0641..44363fe 100644
--- a/src/solvers/tables.h
+++ b/src/solvers/tables.h
@@ -1,18 +1,21 @@
1#define OFFSET(B, K) (((uint8_t *)B) + K) 1#define OFFSET(B, K) (((uint8_t *)B) + K)
2
2#define INFOSIZE 512 3#define INFOSIZE 512
4#define INFO_SOLVER_STRLEN 100
5#define INFO_DISTRIBUTION_LEN 21
6
3#define INFO_OFFSET_SOLVER 0 7#define INFO_OFFSET_SOLVER 0
4#define INFO_SOLVER_STRLEN 20
5#define INFO_OFFSET_TYPE INFO_SOLVER_STRLEN 8#define INFO_OFFSET_TYPE INFO_SOLVER_STRLEN
6#define INFO_OFFSET_INFOSIZE (INFO_OFFSET_TYPE + sizeof(uint64_t)) 9#define INFO_OFFSET_INFOSIZE (INFO_OFFSET_TYPE + sizeof(uint64_t))
7#define INFO_OFFSET_FULLSIZE (INFO_OFFSET_INFOSIZE + sizeof(uint64_t)) 10#define INFO_OFFSET_FULLSIZE (INFO_OFFSET_INFOSIZE + sizeof(uint64_t))
8#define INFO_OFFSET_HASH (INFO_OFFSET_FULLSIZE + sizeof(uint64_t)) 11#define INFO_OFFSET_HASH (INFO_OFFSET_FULLSIZE + sizeof(uint64_t))
9#define INFO_OFFSET_ENTRIES (INFO_OFFSET_HASH + sizeof(uint64_t)) 12#define INFO_OFFSET_ENTRIES (INFO_OFFSET_HASH + sizeof(uint64_t))
10#define INFO_OFFSET_BITS (INFO_OFFSET_ENTRIES + sizeof(uint64_t)) 13#define INFO_OFFSET_CLASSES (INFO_OFFSET_ENTRIES + sizeof(uint64_t))
14#define INFO_OFFSET_BITS (INFO_OFFSET_CLASSES + sizeof(uint64_t))
11#define INFO_OFFSET_BASE (INFO_OFFSET_BITS + sizeof(uint8_t)) 15#define INFO_OFFSET_BASE (INFO_OFFSET_BITS + sizeof(uint8_t))
12#define INFO_OFFSET_MAXVALUE (INFO_OFFSET_BASE + sizeof(uint8_t)) 16#define INFO_OFFSET_MAXVALUE (INFO_OFFSET_BASE + sizeof(uint8_t))
13#define INFO_OFFSET_NEXT (INFO_OFFSET_MAXVALUE + sizeof(uint8_t)) 17#define INFO_OFFSET_NEXT (INFO_OFFSET_MAXVALUE + sizeof(uint8_t))
14#define INFO_OFFSET_DISTRIBUTION (INFO_OFFSET_NEXT + sizeof(uint64_t)) 18#define INFO_OFFSET_DISTRIBUTION (INFO_OFFSET_NEXT + sizeof(uint64_t))
15#define INFO_DISTRIBUTION_LEN 21
16 19
17const uint64_t TABLETYPE_PRUNING = 0; 20const uint64_t TABLETYPE_PRUNING = 0;
18const uint64_t TABLETYPE_SPECIAL = 1; 21const uint64_t TABLETYPE_SPECIAL = 1;
@@ -24,6 +27,7 @@ typedef struct {
24 uint64_t fullsize; 27 uint64_t fullsize;
25 uint64_t hash; 28 uint64_t hash;
26 uint64_t entries; 29 uint64_t entries;
30 uint64_t classes; /* Used only by cocsepdata, for now */
27 uint8_t bits; 31 uint8_t bits;
28 uint8_t base; 32 uint8_t base;
29 uint8_t maxvalue; 33 uint8_t maxvalue;
@@ -38,7 +42,7 @@ STATIC bool
38readtableinfo(const void *buf, tableinfo_t *info) 42readtableinfo(const void *buf, tableinfo_t *info)
39{ 43{
40 if (buf == NULL) { 44 if (buf == NULL) {
41 LOG("Error reading table: buffer in NULL\n"); 45 LOG("Error reading table: buffer is NULL\n");
42 return false; 46 return false;
43 } 47 }
44 48
@@ -54,6 +58,7 @@ readtableinfo(const void *buf, tableinfo_t *info)
54 info->fullsize = *(const uint64_t *)OFFSET(buf, INFO_OFFSET_FULLSIZE); 58 info->fullsize = *(const uint64_t *)OFFSET(buf, INFO_OFFSET_FULLSIZE);
55 info->hash = *(const uint64_t *)OFFSET(buf, INFO_OFFSET_HASH); 59 info->hash = *(const uint64_t *)OFFSET(buf, INFO_OFFSET_HASH);
56 info->entries = *(const uint64_t *)OFFSET(buf, INFO_OFFSET_ENTRIES); 60 info->entries = *(const uint64_t *)OFFSET(buf, INFO_OFFSET_ENTRIES);
61 info->classes = *(const uint64_t *)OFFSET(buf, INFO_OFFSET_CLASSES);
57 info->bits = *OFFSET(buf, INFO_OFFSET_BITS); 62 info->bits = *OFFSET(buf, INFO_OFFSET_BITS);
58 info->base = *OFFSET(buf, INFO_OFFSET_BASE); 63 info->base = *OFFSET(buf, INFO_OFFSET_BASE);
59 info->maxvalue = *OFFSET(buf, INFO_OFFSET_MAXVALUE); 64 info->maxvalue = *OFFSET(buf, INFO_OFFSET_MAXVALUE);
@@ -70,7 +75,7 @@ writetableinfo(const tableinfo_t *info, void *buf)
70 int i; 75 int i;
71 76
72 if (buf == NULL) { 77 if (buf == NULL) {
73 LOG("Error reading table: buffer in NULL\n"); 78 LOG("Error writing table: buffer is NULL\n");
74 return false; 79 return false;
75 } 80 }
76 81
@@ -92,6 +97,7 @@ writetableinfo(const tableinfo_t *info, void *buf)
92 *(uint64_t *)OFFSET(buf, INFO_OFFSET_FULLSIZE) = info->fullsize; 97 *(uint64_t *)OFFSET(buf, INFO_OFFSET_FULLSIZE) = info->fullsize;
93 *(uint64_t *)OFFSET(buf, INFO_OFFSET_HASH) = info->hash; 98 *(uint64_t *)OFFSET(buf, INFO_OFFSET_HASH) = info->hash;
94 *(uint64_t *)OFFSET(buf, INFO_OFFSET_ENTRIES) = info->entries; 99 *(uint64_t *)OFFSET(buf, INFO_OFFSET_ENTRIES) = info->entries;
100 *(uint64_t *)OFFSET(buf, INFO_OFFSET_CLASSES) = info->classes;
95 *OFFSET(buf, INFO_OFFSET_BITS) = info->bits; 101 *OFFSET(buf, INFO_OFFSET_BITS) = info->bits;
96 *OFFSET(buf, INFO_OFFSET_BASE) = info->base; 102 *OFFSET(buf, INFO_OFFSET_BASE) = info->base;
97 *OFFSET(buf, INFO_OFFSET_MAXVALUE) = info->maxvalue; 103 *OFFSET(buf, INFO_OFFSET_MAXVALUE) = info->maxvalue;

Generated with cgit - Back to sebastiano.tronto.net