aboutsummaryrefslogtreecommitdiff
path: root/src/solvers/h48
diff options
context:
space:
mode:
Diffstat (limited to 'src/solvers/h48')
-rw-r--r--src/solvers/h48/gendata_cocsep.h4
-rw-r--r--src/solvers/h48/gendata_eoesep.h21
-rw-r--r--src/solvers/h48/gendata_h48.h90
-rw-r--r--src/solvers/h48/gendata_types_macros.h16
-rw-r--r--src/solvers/h48/solve.h18
5 files changed, 76 insertions, 73 deletions
diff --git a/src/solvers/h48/gendata_cocsep.h b/src/solvers/h48/gendata_cocsep.h
index f07b71a..2eac383 100644
--- a/src/solvers/h48/gendata_cocsep.h
+++ b/src/solvers/h48/gendata_cocsep.h
@@ -1,4 +1,4 @@
1STATIC size_t gendata_cocsep(char *, uint64_t *, cube_t *); 1STATIC size_t gendata_cocsep(unsigned char *, uint64_t *, cube_t *);
2STATIC uint32_t gendata_cocsep_dfs(cocsep_dfs_arg_t [static 1]); 2STATIC uint32_t gendata_cocsep_dfs(cocsep_dfs_arg_t [static 1]);
3STATIC void getdistribution_cocsep( 3STATIC void getdistribution_cocsep(
4 const uint32_t [static COCSEP_TABLESIZE], uint64_t [static 21]); 4 const uint32_t [static COCSEP_TABLESIZE], uint64_t [static 21]);
@@ -13,7 +13,7 @@ STATIC_INLINE int8_t get_h48_cdata(
13 13
14STATIC size_t 14STATIC size_t
15gendata_cocsep( 15gendata_cocsep(
16 char *buf, 16 unsigned char *buf,
17 uint64_t *selfsim, 17 uint64_t *selfsim,
18 cube_t *rep 18 cube_t *rep
19) 19)
diff --git a/src/solvers/h48/gendata_eoesep.h b/src/solvers/h48/gendata_eoesep.h
index 4bf5a84..f1e3d4c 100644
--- a/src/solvers/h48/gendata_eoesep.h
+++ b/src/solvers/h48/gendata_eoesep.h
@@ -1,7 +1,7 @@
1STATIC int64_t coord_eoesep_sym(cube_t, const uint32_t [static ESEP_MAX]); 1STATIC int64_t coord_eoesep_sym(cube_t, const uint32_t [static ESEP_MAX]);
2STATIC size_t gendata_esep_classes( 2STATIC size_t gendata_esep_classes(
3 uint32_t [static ESEP_MAX], uint16_t [static ESEP_CLASSES]); 3 uint32_t [static ESEP_MAX], uint16_t [static ESEP_CLASSES]);
4STATIC size_t gendata_eoesep(char *, uint8_t); 4STATIC size_t gendata_eoesep(unsigned char *, uint8_t);
5STATIC uint32_t gendata_eoesep_bfs(uint8_t, uint8_t [static EOESEP_BUF], 5STATIC uint32_t gendata_eoesep_bfs(uint8_t, uint8_t [static EOESEP_BUF],
6 uint32_t [static ESEP_MAX], uint16_t [static ESEP_CLASSES]); 6 uint32_t [static ESEP_MAX], uint16_t [static ESEP_CLASSES]);
7STATIC uint32_t gendata_eoesep_fromnew(uint8_t, uint8_t [static EOESEP_BUF], 7STATIC uint32_t gendata_eoesep_fromnew(uint8_t, uint8_t [static EOESEP_BUF],
@@ -14,7 +14,7 @@ STATIC bool gendata_eoesep_next(cube_t, uint8_t,
14 uint8_t [static EOESEP_BUF], uint32_t [static ESEP_MAX]); 14 uint8_t [static EOESEP_BUF], uint32_t [static ESEP_MAX]);
15STATIC uint8_t get_eoesep_pval( 15STATIC uint8_t get_eoesep_pval(
16 const uint8_t [static DIV_ROUND_UP(EOESEP_TABLESIZE, 2)], int64_t); 16 const uint8_t [static DIV_ROUND_UP(EOESEP_TABLESIZE, 2)], int64_t);
17STATIC uint8_t get_eoesep_pval_cube(const void *, cube_t); 17STATIC uint8_t get_eoesep_pval_cube(const unsigned char *, cube_t);
18STATIC void set_eoesep_pval( 18STATIC void set_eoesep_pval(
19 uint8_t [static DIV_ROUND_UP(EOESEP_TABLESIZE, 2)], int64_t, uint8_t); 19 uint8_t [static DIV_ROUND_UP(EOESEP_TABLESIZE, 2)], int64_t, uint8_t);
20 20
@@ -67,9 +67,10 @@ gendata_esep_classes(
67} 67}
68 68
69STATIC size_t 69STATIC size_t
70gendata_eoesep(char *buf, uint8_t maxdepth) 70gendata_eoesep(unsigned char *buf, uint8_t maxdepth)
71{ 71{
72 uint8_t *buf8, d; 72 uint8_t d;
73 unsigned char *buf8;
73 uint16_t rep[ESEP_CLASSES]; 74 uint16_t rep[ESEP_CLASSES];
74 uint32_t *esep_classes, done, level; 75 uint32_t *esep_classes, done, level;
75 int64_t coord; 76 int64_t coord;
@@ -81,7 +82,7 @@ gendata_eoesep(char *buf, uint8_t maxdepth)
81 LOG("Computing eoesep data\n"); 82 LOG("Computing eoesep data\n");
82 memset(buf, 0xFF, EOESEP_FULLSIZE); 83 memset(buf, 0xFF, EOESEP_FULLSIZE);
83 esep_classes = (uint32_t *)(buf + INFOSIZE); 84 esep_classes = (uint32_t *)(buf + INFOSIZE);
84 buf8 = (uint8_t *)(buf + INFOSIZE + 4*ESEP_MAX); 85 buf8 = buf + INFOSIZE + 4*ESEP_MAX;
85 gendata_esep_classes(esep_classes, rep); 86 gendata_esep_classes(esep_classes, rep);
86 87
87 info = (tableinfo_t) { 88 info = (tableinfo_t) {
@@ -258,17 +259,13 @@ get_eoesep_pval(
258} 259}
259 260
260STATIC uint8_t 261STATIC uint8_t
261get_eoesep_pval_cube(const void *data, cube_t c) 262get_eoesep_pval_cube(const unsigned char *data, cube_t c)
262{ 263{
263 int64_t coord; 264 int64_t coord;
264 const uint8_t *table;
265 const uint32_t *esep_classes;
266 265
267 esep_classes = (const uint32_t *)data; 266 coord = coord_eoesep_sym(c, (const uint32_t *)data);
268 table = (const uint8_t *)data + 4*ESEP_MAX;
269 coord = coord_eoesep_sym(c, esep_classes);
270 267
271 return get_eoesep_pval(table, coord); 268 return get_eoesep_pval(data + 4*ESEP_MAX, coord);
272} 269}
273 270
274STATIC void 271STATIC void
diff --git a/src/solvers/h48/gendata_h48.h b/src/solvers/h48/gendata_h48.h
index 18157dc..a878978 100644
--- a/src/solvers/h48/gendata_h48.h
+++ b/src/solvers/h48/gendata_h48.h
@@ -13,20 +13,20 @@ STATIC_INLINE bool gendata_h48k2_dfs_stop(
13STATIC void gendata_h48k2_dfs(h48k2_dfs_arg_t [static 1]); 13STATIC void gendata_h48k2_dfs(h48k2_dfs_arg_t [static 1]);
14STATIC tableinfo_t makeinfo_h48k2(gendata_h48_arg_t [static 1]); 14STATIC tableinfo_t makeinfo_h48k2(gendata_h48_arg_t [static 1]);
15STATIC void *getdistribution_h48_runthread(void *); 15STATIC void *getdistribution_h48_runthread(void *);
16STATIC void getdistribution_h48(const uint8_t *, 16STATIC void getdistribution_h48(const unsigned char *,
17 uint64_t [static INFO_DISTRIBUTION_LEN], uint8_t, uint8_t); 17 uint64_t [static INFO_DISTRIBUTION_LEN], uint8_t, uint8_t);
18 18
19STATIC const uint32_t *get_cocsepdata_constptr(const void *); 19STATIC const uint32_t *get_cocsepdata_constptr(const unsigned char *);
20STATIC const uint8_t *get_h48data_constptr(const void *); 20STATIC const unsigned char *get_h48data_constptr(const unsigned char *);
21 21
22STATIC_INLINE uint8_t get_h48_pval(const uint8_t *, int64_t, uint8_t); 22STATIC_INLINE uint8_t get_h48_pval(const unsigned char *, int64_t, uint8_t);
23STATIC_INLINE void set_h48_pval(uint8_t *, int64_t, uint8_t, uint8_t); 23STATIC_INLINE void set_h48_pval(unsigned char *, int64_t, uint8_t, uint8_t);
24STATIC_INLINE uint8_t get_h48_pval_atomic( 24STATIC_INLINE uint8_t get_h48_pval_atomic(
25 _Atomic const uint8_t *, int64_t, uint8_t); 25 _Atomic const unsigned char *, int64_t, uint8_t);
26STATIC_INLINE void set_h48_pval_atomic( 26STATIC_INLINE void set_h48_pval_atomic(
27 _Atomic uint8_t *, int64_t, uint8_t, uint8_t); 27 _Atomic unsigned char *, int64_t, uint8_t, uint8_t);
28 28
29size_t gendata_h48_derive(uint8_t, const void *, void *); 29size_t gendata_h48_derive(uint8_t, const unsigned char *, unsigned char *);
30 30
31STATIC uint64_t 31STATIC uint64_t
32gendata_h48short(gendata_h48short_arg_t arg[static 1]) 32gendata_h48short(gendata_h48short_arg_t arg[static 1])
@@ -67,7 +67,7 @@ gendata_h48(gendata_h48_arg_t arg[static 1])
67{ 67{
68 uint64_t size, cocsepsize, h48size, fallbacksize, fallback2size, of; 68 uint64_t size, cocsepsize, h48size, fallbacksize, fallback2size, of;
69 long long r; 69 long long r;
70 void *cocsepdata_offset; 70 unsigned char *cocsepdata_offset;
71 tableinfo_t cocsepinfo, h48info, fallbackinfo; 71 tableinfo_t cocsepinfo, h48info, fallbackinfo;
72 gendata_h48_arg_t arg_h0k4; 72 gendata_h48_arg_t arg_h0k4;
73 73
@@ -95,9 +95,9 @@ gendata_h48(gendata_h48_arg_t arg[static 1])
95 95
96 gendata_cocsep(arg->buf, arg->selfsim, arg->crep); 96 gendata_cocsep(arg->buf, arg->selfsim, arg->crep);
97 97
98 cocsepdata_offset = (char *)arg->buf + INFOSIZE; 98 cocsepdata_offset = arg->buf + INFOSIZE;
99 arg->cocsepdata = (uint32_t *)cocsepdata_offset; 99 arg->cocsepdata = (uint32_t *)cocsepdata_offset;
100 arg->h48buf = (char *)arg->buf + cocsepsize; 100 arg->h48buf = (_Atomic unsigned char*)arg->buf + cocsepsize;
101 101
102 arg->base = 99; /* TODO: set this somewhere else */ 102 arg->base = 99; /* TODO: set this somewhere else */
103 103
@@ -136,8 +136,8 @@ gendata_h48(gendata_h48_arg_t arg[static 1])
136 arg_h0k4.base = 0; 136 arg_h0k4.base = 0;
137 arg_h0k4.maxdepth = 20; 137 arg_h0k4.maxdepth = 20;
138 arg_h0k4.buf_size = arg->buf_size - h48size; 138 arg_h0k4.buf_size = arg->buf_size - h48size;
139 arg_h0k4.buf = (char *)arg->buf + cocsepsize + h48size; 139 arg_h0k4.buf = arg->buf + cocsepsize + h48size;
140 arg_h0k4.h48buf = (char *)arg->h48buf + h48size; 140 arg_h0k4.h48buf = arg->h48buf + h48size;
141 141
142 gendata_h48h0k4(&arg_h0k4); 142 gendata_h48h0k4(&arg_h0k4);
143 143
@@ -145,7 +145,7 @@ gendata_h48(gendata_h48_arg_t arg[static 1])
145 145
146 /* Add eoesep fallback table */ 146 /* Add eoesep fallback table */
147 147
148 gendata_eoesep((char *)arg->buf + (size - fallback2size), 20); 148 gendata_eoesep(arg->buf + (size - fallback2size), 20);
149 149
150 /* Update tableinfo with correct next values */ 150 /* Update tableinfo with correct next values */
151 151
@@ -157,7 +157,7 @@ gendata_h48(gendata_h48_arg_t arg[static 1])
157 } 157 }
158 h48info.next = h48size; 158 h48info.next = h48size;
159 r = writetableinfo(&h48info, 159 r = writetableinfo(&h48info,
160 arg->buf_size - cocsepsize, (char *)arg->buf + cocsepsize); 160 arg->buf_size - cocsepsize, arg->buf + cocsepsize);
161 if (r != NISSY_OK) { 161 if (r != NISSY_OK) {
162 LOG("[H48 gendata] Error: could not write info " 162 LOG("[H48 gendata] Error: could not write info "
163 "for h48 table\n"); 163 "for h48 table\n");
@@ -174,8 +174,8 @@ gendata_h48(gendata_h48_arg_t arg[static 1])
174 174
175 of = cocsepsize + h48size; 175 of = cocsepsize + h48size;
176 fallbackinfo.next = fallbacksize; 176 fallbackinfo.next = fallbacksize;
177 r = writetableinfo(&fallbackinfo, 177 r = writetableinfo(
178 arg->buf_size - of, (char *)arg->buf + of); 178 &fallbackinfo, arg->buf_size - of, arg->buf + of);
179 if (r != NISSY_OK) { 179 if (r != NISSY_OK) {
180 LOG("[H48 gendata] Error: could not write info for " 180 LOG("[H48 gendata] Error: could not write info for "
181 "h48 fallback table\n"); 181 "h48 fallback table\n");
@@ -189,7 +189,7 @@ gendata_h48(gendata_h48_arg_t arg[static 1])
189STATIC void 189STATIC void
190gendata_h48h0k4(gendata_h48_arg_t arg[static 1]) 190gendata_h48h0k4(gendata_h48_arg_t arg[static 1])
191{ 191{
192 _Atomic uint8_t *table; 192 _Atomic unsigned char *table;
193 uint8_t val; 193 uint8_t val;
194 int64_t i, sc, done, d, h48max; 194 int64_t i, sc, done, d, h48max;
195 uint64_t t, tt, isize, cc, bufsize; 195 uint64_t t, tt, isize, cc, bufsize;
@@ -212,7 +212,7 @@ gendata_h48h0k4(gendata_h48_arg_t arg[static 1])
212 .next = 0, 212 .next = 0,
213 }; 213 };
214 214
215 table = (_Atomic uint8_t *)arg->h48buf + INFOSIZE; 215 table = arg->h48buf + INFOSIZE;
216 memset(table, 0xFF, H48_TABLESIZE(0, 4)); 216 memset(table, 0xFF, H48_TABLESIZE(0, 4));
217 217
218 h48max = (int64_t)H48_COORDMAX(0); 218 h48max = (int64_t)H48_COORDMAX(0);
@@ -261,7 +261,7 @@ gendata_h48h0k4(gendata_h48_arg_t arg[static 1])
261 261
262 arg->info.maxvalue = d - 1; 262 arg->info.maxvalue = d - 1;
263 bufsize = arg->buf_size - COCSEP_FULLSIZE; 263 bufsize = arg->buf_size - COCSEP_FULLSIZE;
264 writetableinfo(&arg->info, bufsize, arg->h48buf); 264 writetableinfo(&arg->info, bufsize, (unsigned char *)arg->h48buf);
265} 265}
266 266
267STATIC void * 267STATIC void *
@@ -374,7 +374,7 @@ gendata_h48k2(gendata_h48_arg_t arg[static 1])
374 }; 374 };
375 375
376 uint8_t t; 376 uint8_t t;
377 uint8_t *table; 377 unsigned char *table;
378 int64_t j; 378 int64_t j;
379 uint64_t i, ii, inext, count, bufsize; 379 uint64_t i, ii, inext, count, bufsize;
380 h48map_t shortcubes; 380 h48map_t shortcubes;
@@ -383,7 +383,7 @@ gendata_h48k2(gendata_h48_arg_t arg[static 1])
383 pthread_t thread[THREADS]; 383 pthread_t thread[THREADS];
384 pthread_mutex_t shortcubes_mutex, table_mutex[CHUNKS]; 384 pthread_mutex_t shortcubes_mutex, table_mutex[CHUNKS];
385 385
386 table = (uint8_t *)arg->h48buf + INFOSIZE; 386 table = (unsigned char *)arg->h48buf + INFOSIZE;
387 memset(table, 0xFF, H48_TABLESIZE(arg->h, arg->k)); 387 memset(table, 0xFF, H48_TABLESIZE(arg->h, arg->k));
388 388
389 LOG("[H48 gendata] Computing depth <=%" PRIu8 "\n", shortdepth) 389 LOG("[H48 gendata] Computing depth <=%" PRIu8 "\n", shortdepth)
@@ -439,7 +439,7 @@ gendata_h48k2(gendata_h48_arg_t arg[static 1])
439 } 439 }
440 440
441 bufsize = arg->buf_size - COCSEP_FULLSIZE; 441 bufsize = arg->buf_size - COCSEP_FULLSIZE;
442 writetableinfo(&arg->info, bufsize, arg->h48buf); 442 writetableinfo(&arg->info, bufsize, (unsigned char *)arg->h48buf);
443} 443}
444 444
445STATIC void * 445STATIC void *
@@ -653,7 +653,7 @@ STATIC void *
653getdistribution_h48_runthread(void *arg) 653getdistribution_h48_runthread(void *arg)
654{ 654{
655 getdistribution_h48_data_t *data = (getdistribution_h48_data_t *)arg; 655 getdistribution_h48_data_t *data = (getdistribution_h48_data_t *)arg;
656 const uint8_t *table; 656 const unsigned char *table;
657 uint8_t j, k, m; 657 uint8_t j, k, m;
658 int64_t i; 658 int64_t i;
659 659
@@ -671,7 +671,7 @@ getdistribution_h48_runthread(void *arg)
671 671
672STATIC void 672STATIC void
673getdistribution_h48( 673getdistribution_h48(
674 const uint8_t *table, 674 const unsigned char *table,
675 uint64_t distr[static INFO_DISTRIBUTION_LEN], 675 uint64_t distr[static INFO_DISTRIBUTION_LEN],
676 uint8_t h, 676 uint8_t h,
677 uint8_t k 677 uint8_t k
@@ -708,50 +708,55 @@ getdistribution_h48(
708} 708}
709 709
710STATIC const uint32_t * 710STATIC const uint32_t *
711get_cocsepdata_constptr(const void *data) 711get_cocsepdata_constptr(const unsigned char *data)
712{ 712{
713 return (uint32_t *)((char *)data + INFOSIZE); 713 return (uint32_t *)(data + INFOSIZE);
714} 714}
715 715
716STATIC const uint8_t * 716STATIC const unsigned char *
717get_h48data_constptr(const void *data) 717get_h48data_constptr(const unsigned char *data)
718{ 718{
719 return (uint8_t *)data + COCSEP_FULLSIZE + INFOSIZE; 719 return data + COCSEP_FULLSIZE + INFOSIZE;
720} 720}
721 721
722STATIC_INLINE uint8_t 722STATIC_INLINE uint8_t
723get_h48_pval(const uint8_t *table, int64_t i, uint8_t k) 723get_h48_pval(const unsigned char *table, int64_t i, uint8_t k)
724{ 724{
725 return (table[H48_INDEX(i, k)] & H48_MASK(i, k)) >> H48_SHIFT(i, k); 725 return (table[H48_INDEX(i, k)] & H48_MASK(i, k)) >> H48_SHIFT(i, k);
726} 726}
727 727
728STATIC_INLINE uint8_t 728STATIC_INLINE uint8_t
729get_h48_pval_atomic(_Atomic const uint8_t *table, int64_t i, uint8_t k) 729get_h48_pval_atomic(_Atomic const unsigned char *table, int64_t i, uint8_t k)
730{ 730{
731 return (table[H48_INDEX(i, k)] & H48_MASK(i, k)) >> H48_SHIFT(i, k); 731 return (table[H48_INDEX(i, k)] & H48_MASK(i, k)) >> H48_SHIFT(i, k);
732} 732}
733 733
734STATIC_INLINE void 734STATIC_INLINE void
735set_h48_pval(uint8_t *table, int64_t i, uint8_t k, uint8_t val) 735set_h48_pval(unsigned char *table, int64_t i, uint8_t k, uint8_t val)
736{ 736{
737 table[H48_INDEX(i, k)] = (table[H48_INDEX(i, k)] & (~H48_MASK(i, k))) 737 table[H48_INDEX(i, k)] = (table[H48_INDEX(i, k)] & (~H48_MASK(i, k)))
738 | (val << H48_SHIFT(i, k)); 738 | (val << H48_SHIFT(i, k));
739} 739}
740 740
741STATIC_INLINE void 741STATIC_INLINE void
742set_h48_pval_atomic(_Atomic uint8_t *table, int64_t i, uint8_t k, uint8_t val) 742set_h48_pval_atomic(
743 _Atomic unsigned char *table,
744 int64_t i,
745 uint8_t k,
746 uint8_t val
747)
743{ 748{
744 table[H48_INDEX(i, k)] = (table[H48_INDEX(i, k)] & (~H48_MASK(i, k))) 749 table[H48_INDEX(i, k)] = (table[H48_INDEX(i, k)] & (~H48_MASK(i, k)))
745 | (val << H48_SHIFT(i, k)); 750 | (val << H48_SHIFT(i, k));
746} 751}
747 752
748size_t 753size_t
749gendata_h48_derive(uint8_t h, const void *fulltable, void *buf) 754gendata_h48_derive(uint8_t h, const unsigned char *fulltable, unsigned char *buf)
750{ 755{
751 size_t cocsepsize, h48size; 756 size_t cocsepsize, h48size;
752 uint8_t val_full, val_derive; 757 uint8_t val_full, val_derive;
753 const uint8_t *h48full; 758 const unsigned char *h48full;
754 uint8_t *h48derive; 759 unsigned char *h48derive;
755 int64_t i, j, h48max; 760 int64_t i, j, h48max;
756 uint64_t bufsize; 761 uint64_t bufsize;
757 gendata_h48_arg_t arg; 762 gendata_h48_arg_t arg;
@@ -770,14 +775,14 @@ gendata_h48_derive(uint8_t h, const void *fulltable, void *buf)
770 arg.k = fulltableinfo.bits; 775 arg.k = fulltableinfo.bits;
771 arg.maxdepth = 20; 776 arg.maxdepth = 20;
772 arg.buf = buf; 777 arg.buf = buf;
773 arg.cocsepdata = (uint32_t *)((char *)buf + INFOSIZE); 778 arg.cocsepdata = (uint32_t *)(buf + INFOSIZE);
774 arg.base = fulltableinfo.base; 779 arg.base = fulltableinfo.base;
775 arg.info = makeinfo_h48k2(&arg); 780 arg.info = makeinfo_h48k2(&arg);
776 781
777 /* Technically this step is redundant, except that we 782 /* Technically this step is redundant, except that we
778 need selfsim and crep */ 783 need selfsim and crep */
779 cocsepsize = gendata_cocsep(buf, arg.selfsim, arg.crep); 784 cocsepsize = gendata_cocsep(buf, arg.selfsim, arg.crep);
780 arg.h48buf = (_Atomic uint8_t *)buf + cocsepsize; 785 arg.h48buf = (_Atomic unsigned char *)buf + cocsepsize;
781 h48size = H48_TABLESIZE(h, arg.k) + INFOSIZE; 786 h48size = H48_TABLESIZE(h, arg.k) + INFOSIZE;
782 787
783 if (buf == NULL) 788 if (buf == NULL)
@@ -798,8 +803,8 @@ gendata_h48_derive(uint8_t h, const void *fulltable, void *buf)
798 goto gendata_h48_derive_error; 803 goto gendata_h48_derive_error;
799 } 804 }
800 805
801 h48full = (const uint8_t *)fulltable + cocsepsize + INFOSIZE; 806 h48full = fulltable + cocsepsize + INFOSIZE;
802 h48derive = (uint8_t *)arg.h48buf + INFOSIZE; 807 h48derive = (unsigned char *)arg.h48buf + INFOSIZE;
803 memset(h48derive, 0xFF, H48_TABLESIZE(h, arg.k)); 808 memset(h48derive, 0xFF, H48_TABLESIZE(h, arg.k));
804 memset(arg.info.distribution, 0, 809 memset(arg.info.distribution, 0,
805 INFO_DISTRIBUTION_LEN * sizeof(uint64_t)); 810 INFO_DISTRIBUTION_LEN * sizeof(uint64_t));
@@ -819,7 +824,8 @@ gendata_h48_derive(uint8_t h, const void *fulltable, void *buf)
819 getdistribution_h48(h48derive, arg.info.distribution, h, arg.k); 824 getdistribution_h48(h48derive, arg.info.distribution, h, arg.k);
820 825
821 bufsize = arg.buf_size - COCSEP_FULLSIZE - INFOSIZE; 826 bufsize = arg.buf_size - COCSEP_FULLSIZE - INFOSIZE;
822 if (writetableinfo(&arg.info, bufsize, arg.h48buf) != NISSY_OK) { 827 if (writetableinfo(&arg.info, bufsize, (unsigned char *)arg.h48buf)
828 != NISSY_OK) {
823 LOG("H48 derive gendata] Error: could not write info " 829 LOG("H48 derive gendata] Error: could not write info "
824 "for table\n"); 830 "for table\n");
825 goto gendata_h48_derive_error; 831 goto gendata_h48_derive_error;
diff --git a/src/solvers/h48/gendata_types_macros.h b/src/solvers/h48/gendata_types_macros.h
index 3f0c666..c4b1b5a 100644
--- a/src/solvers/h48/gendata_types_macros.h
+++ b/src/solvers/h48/gendata_types_macros.h
@@ -55,7 +55,7 @@ typedef struct {
55 uint8_t maxdepth; 55 uint8_t maxdepth;
56 uint16_t *n; 56 uint16_t *n;
57 uint32_t *buf32; 57 uint32_t *buf32;
58 uint8_t *visited; 58 unsigned char *visited;
59 uint64_t *selfsim; 59 uint64_t *selfsim;
60 cube_t *rep; 60 cube_t *rep;
61} cocsep_dfs_arg_t; 61} cocsep_dfs_arg_t;
@@ -67,8 +67,8 @@ typedef struct {
67 uint8_t maxdepth; 67 uint8_t maxdepth;
68 tableinfo_t info; 68 tableinfo_t info;
69 uint64_t buf_size; 69 uint64_t buf_size;
70 void *buf; 70 unsigned char *buf;
71 void *h48buf; 71 _Atomic unsigned char *h48buf;
72 uint32_t *cocsepdata; 72 uint32_t *cocsepdata;
73 uint64_t selfsim[COCSEP_CLASSES]; 73 uint64_t selfsim[COCSEP_CLASSES];
74 cube_t crep[COCSEP_CLASSES]; 74 cube_t crep[COCSEP_CLASSES];
@@ -85,7 +85,7 @@ typedef struct {
85typedef struct { 85typedef struct {
86 uint8_t depth; 86 uint8_t depth;
87 uint32_t *cocsepdata; 87 uint32_t *cocsepdata;
88 _Atomic uint8_t *table; 88 _Atomic unsigned char *table;
89 uint64_t *selfsim; 89 uint64_t *selfsim;
90 cube_t *crep; 90 cube_t *crep;
91 uint64_t start; 91 uint64_t start;
@@ -100,7 +100,7 @@ typedef struct {
100 uint8_t base; 100 uint8_t base;
101 uint8_t shortdepth; 101 uint8_t shortdepth;
102 uint32_t *cocsepdata; 102 uint32_t *cocsepdata;
103 uint8_t *table; 103 unsigned char *table;
104 uint64_t *selfsim; 104 uint64_t *selfsim;
105 cube_t *crep; 105 cube_t *crep;
106 h48map_t *shortcubes; 106 h48map_t *shortcubes;
@@ -117,8 +117,8 @@ typedef struct {
117 uint8_t k; 117 uint8_t k;
118 uint32_t *cocsepdata; 118 uint32_t *cocsepdata;
119 uint64_t *selfsim; 119 uint64_t *selfsim;
120 uint8_t *table; 120 unsigned char *table;
121 _Atomic uint8_t *table_atomic; 121 _Atomic unsigned char *table_atomic;
122 pthread_mutex_t **table_mutex; 122 pthread_mutex_t **table_mutex;
123} gendata_h48_mark_t; 123} gendata_h48_mark_t;
124 124
@@ -127,5 +127,5 @@ typedef struct {
127 int64_t max; 127 int64_t max;
128 uint8_t k; 128 uint8_t k;
129 uint64_t *distr; 129 uint64_t *distr;
130 const uint8_t *table; 130 const unsigned char *table;
131} getdistribution_h48_data_t; 131} getdistribution_h48_data_t;
diff --git a/src/solvers/h48/solve.h b/src/solvers/h48/solve.h
index 0fd419d..cf7095c 100644
--- a/src/solvers/h48/solve.h
+++ b/src/solvers/h48/solve.h
@@ -22,9 +22,9 @@ typedef struct {
22 uint8_t k; 22 uint8_t k;
23 uint8_t base; 23 uint8_t base;
24 const uint32_t *cocsepdata; 24 const uint32_t *cocsepdata;
25 const uint8_t *h48data; 25 const unsigned char *h48data;
26 const uint8_t *h48data_fallback_h0k4; 26 const unsigned char *h48data_fallback_h0k4;
27 const void *h48data_fallback_eoesep; 27 const unsigned char *h48data_fallback_eoesep;
28 uint32_t movemask_normal; 28 uint32_t movemask_normal;
29 uint32_t movemask_inverse; 29 uint32_t movemask_inverse;
30 int64_t nodes_visited; 30 int64_t nodes_visited;
@@ -53,7 +53,7 @@ STATIC int64_t solve_h48_maketasks(
53STATIC void *solve_h48_runthread(void *); 53STATIC void *solve_h48_runthread(void *);
54STATIC int64_t solve_h48_dfs(dfsarg_solve_h48_t [static 1]); 54STATIC int64_t solve_h48_dfs(dfsarg_solve_h48_t [static 1]);
55STATIC int64_t solve_h48(cube_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, 55STATIC int64_t solve_h48(cube_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t,
56 uint64_t, const void *, size_t n, char [n], 56 uint64_t, const unsigned char *, size_t n, char [n],
57 long long [static NISSY_SIZE_SOLVE_STATS]); 57 long long [static NISSY_SIZE_SOLVE_STATS]);
58 58
59STATIC_INLINE bool 59STATIC_INLINE bool
@@ -349,7 +349,7 @@ solve_h48(
349 uint8_t optimal, 349 uint8_t optimal,
350 uint8_t threads, 350 uint8_t threads,
351 uint64_t data_size, 351 uint64_t data_size,
352 const void *data, 352 const unsigned char *data,
353 size_t solutions_size, 353 size_t solutions_size,
354 char solutions[solutions_size], 354 char solutions[solutions_size],
355 long long stats[static NISSY_SIZE_SOLVE_STATS] 355 long long stats[static NISSY_SIZE_SOLVE_STATS]
@@ -365,8 +365,8 @@ solve_h48(
365 int64_t nodes_visited, table_lookups, table_fallbacks; 365 int64_t nodes_visited, table_lookups, table_fallbacks;
366 tableinfo_t info, fbinfo, fbinfo2; 366 tableinfo_t info, fbinfo, fbinfo2;
367 const uint32_t *cocsepdata; 367 const uint32_t *cocsepdata;
368 const uint8_t *fallback, *h48data; 368 const unsigned char *fallback, *h48data;
369 const void *fallback2; 369 const unsigned char *fallback2;
370 solution_moves_t solution_moves[THREADS]; 370 solution_moves_t solution_moves[THREADS];
371 solution_settings_t settings; 371 solution_settings_t settings;
372 solution_list_t sollist; 372 solution_list_t sollist;
@@ -379,8 +379,8 @@ solve_h48(
379 if (readtableinfo_n(data_size, data, 2, &info) != NISSY_OK) 379 if (readtableinfo_n(data_size, data, 2, &info) != NISSY_OK)
380 goto solve_h48_error_data; 380 goto solve_h48_error_data;
381 381
382 cocsepdata = (uint32_t *)((char *)data + INFOSIZE); 382 cocsepdata = (uint32_t *)(data + INFOSIZE);
383 h48data = (uint8_t *)data + COCSEP_FULLSIZE + INFOSIZE; 383 h48data = data + COCSEP_FULLSIZE + INFOSIZE;
384 384
385 /* Read fallback table(s) */ 385 /* Read fallback table(s) */
386 fallback = NULL; 386 fallback = NULL;

Generated with cgit - Back to sebastiano.tronto.net