aboutsummaryrefslogtreecommitdiff
path: root/src/solvers/tables.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/solvers/tables.h')
-rw-r--r--src/solvers/tables.h31
1 files changed, 16 insertions, 15 deletions
diff --git a/src/solvers/tables.h b/src/solvers/tables.h
index db888b5..9147972 100644
--- a/src/solvers/tables.h
+++ b/src/solvers/tables.h
@@ -1,13 +1,14 @@
1STATIC uint64_t read_unaligned_u64(const char [static sizeof(uint64_t)]); 1STATIC uint64_t read_unaligned_u64(const unsigned char [static sizeof(uint64_t)]);
2STATIC void write_unaligned_u64(char [static sizeof(uint64_t)], uint64_t); 2STATIC void write_unaligned_u64(unsigned char [static sizeof(uint64_t)], uint64_t);
3STATIC int64_t readtableinfo(size_t n, const char [n], tableinfo_t [static 1]); 3STATIC int64_t readtableinfo(
4 size_t n, const unsigned char [n], tableinfo_t [static 1]);
4STATIC int64_t readtableinfo_n( 5STATIC int64_t readtableinfo_n(
5 size_t n, const char [n], uint8_t, tableinfo_t [static 1]); 6 size_t n, const unsigned char [n], uint8_t, tableinfo_t [static 1]);
6STATIC int64_t writetableinfo( 7STATIC int64_t writetableinfo(
7 const tableinfo_t [static 1], size_t n, char [n]); 8 const tableinfo_t [static 1], size_t n, unsigned char [n]);
8 9
9STATIC uint64_t 10STATIC uint64_t
10read_unaligned_u64(const char buf[static sizeof(uint64_t)]) 11read_unaligned_u64(const unsigned char buf[static sizeof(uint64_t)])
11{ 12{
12 uint64_t ret; 13 uint64_t ret;
13 14
@@ -17,7 +18,7 @@ read_unaligned_u64(const char buf[static sizeof(uint64_t)])
17} 18}
18 19
19STATIC void 20STATIC void
20write_unaligned_u64(char buf[static sizeof(uint64_t)], uint64_t x) 21write_unaligned_u64(unsigned char buf[static sizeof(uint64_t)], uint64_t x)
21{ 22{
22 memcpy(buf, &x, sizeof(uint64_t)); 23 memcpy(buf, &x, sizeof(uint64_t));
23} 24}
@@ -25,7 +26,7 @@ write_unaligned_u64(char buf[static sizeof(uint64_t)], uint64_t x)
25STATIC int64_t 26STATIC int64_t
26readtableinfo( 27readtableinfo(
27 size_t buf_size, 28 size_t buf_size,
28 const char buf[buf_size], 29 const unsigned char buf[buf_size],
29 tableinfo_t info[static 1] 30 tableinfo_t info[static 1]
30) 31)
31{ 32{
@@ -69,7 +70,7 @@ readtableinfo(
69STATIC int64_t 70STATIC int64_t
70readtableinfo_n( 71readtableinfo_n(
71 size_t buf_size, 72 size_t buf_size,
72 const char buf[buf_size], 73 const unsigned char buf[buf_size],
73 uint8_t n, 74 uint8_t n,
74 tableinfo_t info[static 1] 75 tableinfo_t info[static 1]
75) 76)
@@ -87,12 +88,12 @@ STATIC int64_t
87writetableinfo( 88writetableinfo(
88 const tableinfo_t info[static 1], 89 const tableinfo_t info[static 1],
89 size_t data_size, 90 size_t data_size,
90 char buf[data_size] 91 unsigned char buf[data_size]
91) 92)
92{ 93{
93 size_t i; 94 size_t i;
94 bool end; 95 bool end;
95 char *c; 96 unsigned char *c;
96 97
97 if (data_size < info->fullsize) { 98 if (data_size < info->fullsize) {
98 LOG("Error writing table: buffer size is too small " 99 LOG("Error writing table: buffer size is too small "
@@ -125,10 +126,10 @@ writetableinfo(
125 *c = 0; 126 *c = 0;
126 } 127 }
127 128
128 *(uint8_t *)OFFSET(buf, INFO_OFFSET_H48H) = info->h48h; 129 *OFFSET(buf, INFO_OFFSET_H48H) = (unsigned char)info->h48h;
129 *(uint8_t *)OFFSET(buf, INFO_OFFSET_BITS) = info->bits; 130 *OFFSET(buf, INFO_OFFSET_BITS) = (unsigned char)info->bits;
130 *(uint8_t *)OFFSET(buf, INFO_OFFSET_BASE) = info->base; 131 *OFFSET(buf, INFO_OFFSET_BASE) = (unsigned char)info->base;
131 *(uint8_t *)OFFSET(buf, INFO_OFFSET_MAXVALUE) = info->maxvalue; 132 *OFFSET(buf, INFO_OFFSET_MAXVALUE) = (unsigned char)info->maxvalue;
132 133
133 return NISSY_OK; 134 return NISSY_OK;
134} 135}

Generated with cgit - Back to sebastiano.tronto.net