diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2024-09-11 19:48:57 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2024-09-11 19:48:57 +0200 |
| commit | 10b65003102675bd19c0e5174ff249be2a163bc7 (patch) | |
| tree | 10388535f1395f084a1a0456094f90cc2390fc62 /src/solvers/tables.h | |
| parent | e6ff0ce6926fa921a13055c9c35d8e60b691e776 (diff) | |
| download | nissy-core-10b65003102675bd19c0e5174ff249be2a163bc7.tar.gz nissy-core-10b65003102675bd19c0e5174ff249be2a163bc7.zip | |
Simplified solver
Diffstat (limited to 'src/solvers/tables.h')
| -rw-r--r-- | src/solvers/tables.h | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/solvers/tables.h b/src/solvers/tables.h index 988de52..bad3b2c 100644 --- a/src/solvers/tables.h +++ b/src/solvers/tables.h | |||
| @@ -14,7 +14,8 @@ | |||
| 14 | #define INFO_OFFSET_HASH (INFO_OFFSET_FULLSIZE + sizeof(uint64_t)) | 14 | #define INFO_OFFSET_HASH (INFO_OFFSET_FULLSIZE + sizeof(uint64_t)) |
| 15 | #define INFO_OFFSET_ENTRIES (INFO_OFFSET_HASH + sizeof(uint64_t)) | 15 | #define INFO_OFFSET_ENTRIES (INFO_OFFSET_HASH + sizeof(uint64_t)) |
| 16 | #define INFO_OFFSET_CLASSES (INFO_OFFSET_ENTRIES + sizeof(uint64_t)) | 16 | #define INFO_OFFSET_CLASSES (INFO_OFFSET_ENTRIES + sizeof(uint64_t)) |
| 17 | #define INFO_OFFSET_BITS (INFO_OFFSET_CLASSES + sizeof(uint64_t)) | 17 | #define INFO_OFFSET_H48H (INFO_OFFSET_CLASSES + sizeof(uint64_t)) |
| 18 | #define INFO_OFFSET_BITS (INFO_OFFSET_H48H + sizeof(uint8_t)) | ||
| 18 | #define INFO_OFFSET_BASE (INFO_OFFSET_BITS + sizeof(uint8_t)) | 19 | #define INFO_OFFSET_BASE (INFO_OFFSET_BITS + sizeof(uint8_t)) |
| 19 | #define INFO_OFFSET_MAXVALUE (INFO_OFFSET_BASE + sizeof(uint8_t)) | 20 | #define INFO_OFFSET_MAXVALUE (INFO_OFFSET_BASE + sizeof(uint8_t)) |
| 20 | #define INFO_OFFSET_NEXT (INFO_OFFSET_MAXVALUE + sizeof(uint8_t)) | 21 | #define INFO_OFFSET_NEXT (INFO_OFFSET_MAXVALUE + sizeof(uint8_t)) |
| @@ -28,6 +29,7 @@ typedef struct { | |||
| 28 | uint64_t hash; | 29 | uint64_t hash; |
| 29 | uint64_t entries; | 30 | uint64_t entries; |
| 30 | uint64_t classes; /* Used only by cocsepdata, for now */ | 31 | uint64_t classes; /* Used only by cocsepdata, for now */ |
| 32 | uint8_t h48h; /* Specific to H48 tables */ | ||
| 31 | uint8_t bits; | 33 | uint8_t bits; |
| 32 | uint8_t base; | 34 | uint8_t base; |
| 33 | uint8_t maxvalue; | 35 | uint8_t maxvalue; |
| @@ -36,6 +38,7 @@ typedef struct { | |||
| 36 | } tableinfo_t; | 38 | } tableinfo_t; |
| 37 | 39 | ||
| 38 | STATIC bool readtableinfo(const void *, tableinfo_t *); | 40 | STATIC bool readtableinfo(const void *, tableinfo_t *); |
| 41 | STATIC bool readtableinfo_n(const void *, uint8_t, tableinfo_t *); | ||
| 39 | STATIC bool writetableinfo(const tableinfo_t *, void *); | 42 | STATIC bool writetableinfo(const tableinfo_t *, void *); |
| 40 | 43 | ||
| 41 | STATIC bool | 44 | STATIC bool |
| @@ -59,6 +62,7 @@ readtableinfo(const void *buf, tableinfo_t *info) | |||
| 59 | info->hash = *(const uint64_t *)OFFSET(buf, INFO_OFFSET_HASH); | 62 | info->hash = *(const uint64_t *)OFFSET(buf, INFO_OFFSET_HASH); |
| 60 | info->entries = *(const uint64_t *)OFFSET(buf, INFO_OFFSET_ENTRIES); | 63 | info->entries = *(const uint64_t *)OFFSET(buf, INFO_OFFSET_ENTRIES); |
| 61 | info->classes = *(const uint64_t *)OFFSET(buf, INFO_OFFSET_CLASSES); | 64 | info->classes = *(const uint64_t *)OFFSET(buf, INFO_OFFSET_CLASSES); |
| 65 | info->h48h = *OFFSET(buf, INFO_OFFSET_H48H); | ||
| 62 | info->bits = *OFFSET(buf, INFO_OFFSET_BITS); | 66 | info->bits = *OFFSET(buf, INFO_OFFSET_BITS); |
| 63 | info->base = *OFFSET(buf, INFO_OFFSET_BASE); | 67 | info->base = *OFFSET(buf, INFO_OFFSET_BASE); |
| 64 | info->maxvalue = *OFFSET(buf, INFO_OFFSET_MAXVALUE); | 68 | info->maxvalue = *OFFSET(buf, INFO_OFFSET_MAXVALUE); |
| @@ -70,6 +74,16 @@ readtableinfo(const void *buf, tableinfo_t *info) | |||
| 70 | } | 74 | } |
| 71 | 75 | ||
| 72 | STATIC bool | 76 | STATIC bool |
| 77 | readtableinfo_n(const void *buf, uint8_t n, tableinfo_t *info) | ||
| 78 | { | ||
| 79 | for ( ; n > 0; n--, buf = (char *)buf + info->next) | ||
| 80 | if (!readtableinfo(buf, info)) | ||
| 81 | return false; | ||
| 82 | |||
| 83 | return true; | ||
| 84 | } | ||
| 85 | |||
| 86 | STATIC bool | ||
| 73 | writetableinfo(const tableinfo_t *info, void *buf) | 87 | writetableinfo(const tableinfo_t *info, void *buf) |
| 74 | { | 88 | { |
| 75 | int i; | 89 | int i; |
| @@ -98,6 +112,7 @@ writetableinfo(const tableinfo_t *info, void *buf) | |||
| 98 | *(uint64_t *)OFFSET(buf, INFO_OFFSET_HASH) = info->hash; | 112 | *(uint64_t *)OFFSET(buf, INFO_OFFSET_HASH) = info->hash; |
| 99 | *(uint64_t *)OFFSET(buf, INFO_OFFSET_ENTRIES) = info->entries; | 113 | *(uint64_t *)OFFSET(buf, INFO_OFFSET_ENTRIES) = info->entries; |
| 100 | *(uint64_t *)OFFSET(buf, INFO_OFFSET_CLASSES) = info->classes; | 114 | *(uint64_t *)OFFSET(buf, INFO_OFFSET_CLASSES) = info->classes; |
| 115 | *OFFSET(buf, INFO_OFFSET_H48H) = info->h48h; | ||
| 101 | *OFFSET(buf, INFO_OFFSET_BITS) = info->bits; | 116 | *OFFSET(buf, INFO_OFFSET_BITS) = info->bits; |
| 102 | *OFFSET(buf, INFO_OFFSET_BASE) = info->base; | 117 | *OFFSET(buf, INFO_OFFSET_BASE) = info->base; |
| 103 | *OFFSET(buf, INFO_OFFSET_MAXVALUE) = info->maxvalue; | 118 | *OFFSET(buf, INFO_OFFSET_MAXVALUE) = info->maxvalue; |
