aboutsummaryrefslogtreecommitdiff
path: root/src/solvers/tables.h
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2024-09-10 09:58:17 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2024-09-10 09:58:17 +0200
commit3c8f8c2e60cd089679cf5da5160baaf35977b220 (patch)
tree8b49c64260e33c714ccacc2e3a1b27582bdfe4a7 /src/solvers/tables.h
parent16cf844396181e743403b046c06a21f1dca39426 (diff)
downloadnissy-core-3c8f8c2e60cd089679cf5da5160baaf35977b220.tar.gz
nissy-core-3c8f8c2e60cd089679cf5da5160baaf35977b220.zip
Added next table offset to tableinfo
Diffstat (limited to 'src/solvers/tables.h')
-rw-r--r--src/solvers/tables.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/solvers/tables.h b/src/solvers/tables.h
index be0209f..9598a09 100644
--- a/src/solvers/tables.h
+++ b/src/solvers/tables.h
@@ -9,7 +9,8 @@
9#define INFO_OFFSET_BITS (INFO_OFFSET_ENTRIES + sizeof(uint64_t)) 9#define INFO_OFFSET_BITS (INFO_OFFSET_ENTRIES + sizeof(uint64_t))
10#define INFO_OFFSET_BASE (INFO_OFFSET_BITS + sizeof(uint8_t)) 10#define INFO_OFFSET_BASE (INFO_OFFSET_BITS + sizeof(uint8_t))
11#define INFO_OFFSET_MAXVALUE (INFO_OFFSET_BASE + sizeof(uint8_t)) 11#define INFO_OFFSET_MAXVALUE (INFO_OFFSET_BASE + sizeof(uint8_t))
12#define INFO_OFFSET_DISTRIBUTION (INFO_OFFSET_MAXVALUE + sizeof(uint8_t)) 12#define INFO_OFFSET_NEXT (INFO_OFFSET_MAXVALUE + sizeof(uint8_t))
13#define INFO_OFFSET_DISTRIBUTION (INFO_OFFSET_NEXT + sizeof(uint64_t))
13#define INFO_DISTRIBUTION_LEN 21 14#define INFO_DISTRIBUTION_LEN 21
14 15
15typedef struct { 16typedef struct {
@@ -21,6 +22,7 @@ typedef struct {
21 uint8_t bits; 22 uint8_t bits;
22 uint8_t base; 23 uint8_t base;
23 uint8_t maxvalue; 24 uint8_t maxvalue;
25 uint64_t next;
24 uint64_t distribution[INFO_DISTRIBUTION_LEN]; 26 uint64_t distribution[INFO_DISTRIBUTION_LEN];
25} tableinfo_t; 27} tableinfo_t;
26 28
@@ -49,6 +51,7 @@ readtableinfo(const void *buf, tableinfo_t *info)
49 info->bits = *OFFSET(buf, INFO_OFFSET_BITS); 51 info->bits = *OFFSET(buf, INFO_OFFSET_BITS);
50 info->base = *OFFSET(buf, INFO_OFFSET_BASE); 52 info->base = *OFFSET(buf, INFO_OFFSET_BASE);
51 info->maxvalue = *OFFSET(buf, INFO_OFFSET_MAXVALUE); 53 info->maxvalue = *OFFSET(buf, INFO_OFFSET_MAXVALUE);
54 info->next = *(const uint64_t* )OFFSET(buf, INFO_OFFSET_NEXT);
52 memcpy(info->distribution, OFFSET(buf, INFO_OFFSET_DISTRIBUTION), 55 memcpy(info->distribution, OFFSET(buf, INFO_OFFSET_DISTRIBUTION),
53 INFO_DISTRIBUTION_LEN * sizeof(uint64_t)); 56 INFO_DISTRIBUTION_LEN * sizeof(uint64_t));
54 57
@@ -85,6 +88,7 @@ writetableinfo(const tableinfo_t *info, void *buf)
85 *OFFSET(buf, INFO_OFFSET_BITS) = info->bits; 88 *OFFSET(buf, INFO_OFFSET_BITS) = info->bits;
86 *OFFSET(buf, INFO_OFFSET_BASE) = info->base; 89 *OFFSET(buf, INFO_OFFSET_BASE) = info->base;
87 *OFFSET(buf, INFO_OFFSET_MAXVALUE) = info->maxvalue; 90 *OFFSET(buf, INFO_OFFSET_MAXVALUE) = info->maxvalue;
91 *(uint64_t *)OFFSET(buf, INFO_OFFSET_NEXT) = info->next;
88 92
89 memcpy(OFFSET(buf, INFO_OFFSET_DISTRIBUTION), info->distribution, 93 memcpy(OFFSET(buf, INFO_OFFSET_DISTRIBUTION), info->distribution,
90 INFO_DISTRIBUTION_LEN * sizeof(uint64_t)); 94 INFO_DISTRIBUTION_LEN * sizeof(uint64_t));

Generated with cgit - Back to sebastiano.tronto.net