aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2024-10-04 14:29:00 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2024-10-04 14:29:00 +0200
commit283effb16646112ee9c6bba57e021e80f322b29f (patch)
tree3c0ad588e550f86df21687e82a17e9f1f60443be
parentfc150adaf3bff133da0e59d842f13b7b21297fc0 (diff)
downloadnissy-core-283effb16646112ee9c6bba57e021e80f322b29f.tar.gz
nissy-core-283effb16646112ee9c6bba57e021e80f322b29f.zip
Avoid repeating typedefs in tests
-rw-r--r--src/solvers/h48/coordinate.h8
-rw-r--r--src/solvers/h48/coordinate_macros.h6
-rw-r--r--src/solvers/h48/gendata_cocsep.h22
-rw-r--r--src/solvers/h48/gendata_h48.h73
-rw-r--r--src/solvers/h48/gendata_types_macros.h94
-rw-r--r--src/solvers/h48/h48.h1
-rw-r--r--src/solvers/h48/map.h18
-rw-r--r--src/solvers/h48/map_types_macros.h16
-rw-r--r--src/solvers/tables.h40
-rw-r--r--src/solvers/tables_types_macros.h38
-rw-r--r--test/090_tables_readwrite/tables_readwrite_tests.c20
-rw-r--r--test/100_gendata_cocsep/gendata_cocsep_tests.c21
-rw-r--r--test/101_cocsep_transform_invariant/cocsep_transform_invariant.c6
-rw-r--r--test/102_cocsep_selfsim/cocsep_selfsim_tests.c3
-rw-r--r--test/103_cocsep_selfsim_distribution/cocsep_selfsim_distribution_tests.c5
-rw-r--r--test/104_cocsep_ttrep/cocsep_ttrep_tests.c10
-rw-r--r--test/110_coord_invcoord_h48/coord_invcoord_h48_tests.c3
-rw-r--r--test/111_h48map/h48map_tests.c13
-rw-r--r--test/112_gendata_h48short/gendata_h48short_tests.c29
-rw-r--r--test/test.h5
20 files changed, 170 insertions, 261 deletions
diff --git a/src/solvers/h48/coordinate.h b/src/solvers/h48/coordinate.h
index 25e13f9..6caac2a 100644
--- a/src/solvers/h48/coordinate.h
+++ b/src/solvers/h48/coordinate.h
@@ -1,9 +1,5 @@
1#define H48_ESIZE(h) ((COMB_12_4 * COMB_8_4) << (int64_t)(h)) 1/* Macros defined in a separate file for easier testing */
2 2#include "coordinate_macros.h"
3#define COCLASS_MASK (UINT32_C(0xFFFF) << UINT32_C(16))
4#define COCLASS(x) (((x) & COCLASS_MASK) >> UINT32_C(16))
5#define TTREP_MASK (UINT32_C(0xFF) << UINT32_C(8))
6#define TTREP(x) (((x) & TTREP_MASK) >> UINT32_C(8))
7 3
8STATIC_INLINE int64_t coord_h48(cube_t, const uint32_t *, uint8_t); 4STATIC_INLINE int64_t coord_h48(cube_t, const uint32_t *, uint8_t);
9STATIC_INLINE int64_t coord_h48_edges(cube_t, int64_t, uint8_t, uint8_t); 5STATIC_INLINE int64_t coord_h48_edges(cube_t, int64_t, uint8_t, uint8_t);
diff --git a/src/solvers/h48/coordinate_macros.h b/src/solvers/h48/coordinate_macros.h
new file mode 100644
index 0000000..5b67177
--- /dev/null
+++ b/src/solvers/h48/coordinate_macros.h
@@ -0,0 +1,6 @@
1#define H48_ESIZE(h) ((COMB_12_4 * COMB_8_4) << (int64_t)(h))
2
3#define COCLASS_MASK (UINT32_C(0xFFFF) << UINT32_C(16))
4#define COCLASS(x) (((x) & COCLASS_MASK) >> UINT32_C(16))
5#define TTREP_MASK (UINT32_C(0xFF) << UINT32_C(8))
6#define TTREP(x) (((x) & TTREP_MASK) >> UINT32_C(8))
diff --git a/src/solvers/h48/gendata_cocsep.h b/src/solvers/h48/gendata_cocsep.h
index 5f0fae9..3daaf2a 100644
--- a/src/solvers/h48/gendata_cocsep.h
+++ b/src/solvers/h48/gendata_cocsep.h
@@ -1,25 +1,3 @@
1#define COCSEP_CLASSES ((size_t)3393)
2#define COCSEP_TABLESIZE ((size_t)POW_3_7 << (size_t)7)
3#define COCSEP_VISITEDSIZE DIV_ROUND_UP(COCSEP_TABLESIZE, (size_t)8)
4#define COCSEP_FULLSIZE (INFOSIZE + (size_t)4 * COCSEP_TABLESIZE)
5
6#define VISITED_IND(i) ((uint32_t)(i) / UINT32_C(8))
7#define VISITED_MASK(i) (UINT32_C(1) << ((uint32_t)(i) % UINT32_C(8)))
8
9#define CBOUND_MASK UINT32_C(0xFF)
10#define CBOUND(x) ((x) & CBOUND_MASK)
11
12typedef struct {
13 cube_t cube;
14 uint8_t depth;
15 uint8_t maxdepth;
16 uint16_t *n;
17 uint32_t *buf32;
18 uint8_t *visited;
19 uint64_t *selfsim;
20 cube_t *rep;
21} cocsep_dfs_arg_t;
22
23STATIC_INLINE bool get_visited(const uint8_t *, int64_t); 1STATIC_INLINE bool get_visited(const uint8_t *, int64_t);
24STATIC_INLINE void set_visited(uint8_t *, int64_t); 2STATIC_INLINE void set_visited(uint8_t *, int64_t);
25 3
diff --git a/src/solvers/h48/gendata_h48.h b/src/solvers/h48/gendata_h48.h
index 6db3998..5da9dc3 100644
--- a/src/solvers/h48/gendata_h48.h
+++ b/src/solvers/h48/gendata_h48.h
@@ -1,16 +1,3 @@
1#define H48_COORDMAX_NOEO ((int64_t)(COCSEP_CLASSES * COMB_12_4 * COMB_8_4))
2#define H48_COORDMAX(h) (H48_COORDMAX_NOEO << (int64_t)(h))
3#define H48_DIV(k) ((size_t)8 / (size_t)(k))
4#define H48_TABLESIZE(h, k) DIV_ROUND_UP((size_t)H48_COORDMAX((h)), H48_DIV(k))
5
6#define H48_COEFF(k) (INT64_C(8) / (int64_t)(k))
7#define H48_INDEX(i, k) ((i) / H48_COEFF(k))
8#define H48_SHIFT(i, k) ((uint8_t)(k) * (uint8_t)((i) % H48_COEFF(k)))
9#define H48_MASK(i, k) ((UINT8_BIT(k) - UINT8_C(1)) << H48_SHIFT(i, k))
10
11#define MAXLEN 20
12#define CHUNKS COCSEP_CLASSES
13
14/* 1/*
15TODO: This loop over similar h48 coordinates can be improved by only 2TODO: This loop over similar h48 coordinates can be improved by only
16transforming edges, but we need to compose transformations (i.e. conjugate 3transforming edges, but we need to compose transformations (i.e. conjugate
@@ -30,66 +17,6 @@ _t by _ttrep).
30 ARG_ACTION \ 17 ARG_ACTION \
31 } 18 }
32 19
33typedef struct {
34 uint8_t h;
35 uint8_t k;
36 uint8_t base;
37 uint8_t maxdepth;
38 tableinfo_t info;
39 void *buf;
40 void *h48buf;
41 uint32_t *cocsepdata;
42 uint64_t selfsim[COCSEP_CLASSES];
43 cube_t crep[COCSEP_CLASSES];
44} gendata_h48_arg_t;
45
46typedef struct {
47 uint8_t maxdepth;
48 const uint32_t *cocsepdata;
49 const cube_t *crep;
50 const uint64_t *selfsim;
51 h48map_t *map;
52} gendata_h48short_arg_t;
53
54typedef struct {
55 uint8_t depth;
56 uint32_t *cocsepdata;
57 _Atomic uint8_t *table;
58 uint64_t *selfsim;
59 cube_t *crep;
60 uint64_t start;
61 uint64_t end;
62 pthread_mutex_t *table_mutex[CHUNKS];
63} h48h0k4_bfs_arg_t;
64
65typedef struct {
66 cube_t cube;
67 uint8_t h;
68 uint8_t k;
69 uint8_t base;
70 uint8_t shortdepth;
71 uint32_t *cocsepdata;
72 _Atomic uint8_t *table;
73 uint64_t *selfsim;
74 cube_t *crep;
75 h48map_t *shortcubes;
76 pthread_mutex_t *shortcubes_mutex;
77 pthread_mutex_t *table_mutex[CHUNKS];
78 uint64_t *next;
79 uint64_t *count;
80} h48k2_dfs_arg_t;
81
82typedef struct {
83 cube_t cube;
84 int8_t depth;
85 uint8_t h;
86 uint8_t k;
87 uint32_t *cocsepdata;
88 uint64_t *selfsim;
89 _Atomic uint8_t *table;
90 pthread_mutex_t **table_mutex;
91} gendata_h48_mark_t;
92
93STATIC uint64_t gendata_h48short(gendata_h48short_arg_t *); 20STATIC uint64_t gendata_h48short(gendata_h48short_arg_t *);
94STATIC size_t gendata_h48(gendata_h48_arg_t *); 21STATIC size_t gendata_h48(gendata_h48_arg_t *);
95STATIC size_t gendata_h48h0k4(gendata_h48_arg_t *); 22STATIC size_t gendata_h48h0k4(gendata_h48_arg_t *);
diff --git a/src/solvers/h48/gendata_types_macros.h b/src/solvers/h48/gendata_types_macros.h
new file mode 100644
index 0000000..4b503ab
--- /dev/null
+++ b/src/solvers/h48/gendata_types_macros.h
@@ -0,0 +1,94 @@
1#define COCSEP_CLASSES ((size_t)3393)
2#define COCSEP_TABLESIZE ((size_t)POW_3_7 << (size_t)7)
3#define COCSEP_VISITEDSIZE DIV_ROUND_UP(COCSEP_TABLESIZE, (size_t)8)
4#define COCSEP_FULLSIZE (INFOSIZE + (size_t)4 * COCSEP_TABLESIZE)
5
6#define VISITED_IND(i) ((uint32_t)(i) / UINT32_C(8))
7#define VISITED_MASK(i) (UINT32_C(1) << ((uint32_t)(i) % UINT32_C(8)))
8
9#define CBOUND_MASK UINT32_C(0xFF)
10#define CBOUND(x) ((x) & CBOUND_MASK)
11
12#define H48_COORDMAX_NOEO ((int64_t)(COCSEP_CLASSES * COMB_12_4 * COMB_8_4))
13#define H48_COORDMAX(h) (H48_COORDMAX_NOEO << (int64_t)(h))
14#define H48_DIV(k) ((size_t)8 / (size_t)(k))
15#define H48_TABLESIZE(h, k) DIV_ROUND_UP((size_t)H48_COORDMAX((h)), H48_DIV(k))
16
17#define H48_COEFF(k) (INT64_C(8) / (int64_t)(k))
18#define H48_INDEX(i, k) ((i) / H48_COEFF(k))
19#define H48_SHIFT(i, k) ((uint8_t)(k) * (uint8_t)((i) % H48_COEFF(k)))
20#define H48_MASK(i, k) ((UINT8_BIT(k) - UINT8_C(1)) << H48_SHIFT(i, k))
21
22#define MAXLEN 20
23#define CHUNKS COCSEP_CLASSES
24
25typedef struct {
26 cube_t cube;
27 uint8_t depth;
28 uint8_t maxdepth;
29 uint16_t *n;
30 uint32_t *buf32;
31 uint8_t *visited;
32 uint64_t *selfsim;
33 cube_t *rep;
34} cocsep_dfs_arg_t;
35
36typedef struct {
37 uint8_t h;
38 uint8_t k;
39 uint8_t base;
40 uint8_t maxdepth;
41 tableinfo_t info;
42 void *buf;
43 void *h48buf;
44 uint32_t *cocsepdata;
45 uint64_t selfsim[COCSEP_CLASSES];
46 cube_t crep[COCSEP_CLASSES];
47} gendata_h48_arg_t;
48
49typedef struct {
50 uint8_t maxdepth;
51 const uint32_t *cocsepdata;
52 const cube_t *crep;
53 const uint64_t *selfsim;
54 h48map_t *map;
55} gendata_h48short_arg_t;
56
57typedef struct {
58 uint8_t depth;
59 uint32_t *cocsepdata;
60 _Atomic uint8_t *table;
61 uint64_t *selfsim;
62 cube_t *crep;
63 uint64_t start;
64 uint64_t end;
65 pthread_mutex_t *table_mutex[CHUNKS];
66} h48h0k4_bfs_arg_t;
67
68typedef struct {
69 cube_t cube;
70 uint8_t h;
71 uint8_t k;
72 uint8_t base;
73 uint8_t shortdepth;
74 uint32_t *cocsepdata;
75 _Atomic uint8_t *table;
76 uint64_t *selfsim;
77 cube_t *crep;
78 h48map_t *shortcubes;
79 pthread_mutex_t *shortcubes_mutex;
80 pthread_mutex_t *table_mutex[CHUNKS];
81 uint64_t *next;
82 uint64_t *count;
83} h48k2_dfs_arg_t;
84
85typedef struct {
86 cube_t cube;
87 int8_t depth;
88 uint8_t h;
89 uint8_t k;
90 uint32_t *cocsepdata;
91 uint64_t *selfsim;
92 _Atomic uint8_t *table;
93 pthread_mutex_t **table_mutex;
94} gendata_h48_mark_t;
diff --git a/src/solvers/h48/h48.h b/src/solvers/h48/h48.h
index 176ce22..3cf02b7 100644
--- a/src/solvers/h48/h48.h
+++ b/src/solvers/h48/h48.h
@@ -1,5 +1,6 @@
1#include "coordinate.h" 1#include "coordinate.h"
2#include "map.h" 2#include "map.h"
3#include "gendata_types_macros.h"
3#include "gendata_cocsep.h" 4#include "gendata_cocsep.h"
4#include "gendata_h48.h" 5#include "gendata_h48.h"
5#include "stats.h" 6#include "stats.h"
diff --git a/src/solvers/h48/map.h b/src/solvers/h48/map.h
index e74a5dd..e6903ce 100644
--- a/src/solvers/h48/map.h
+++ b/src/solvers/h48/map.h
@@ -1,19 +1,5 @@
1#define MAP_UNSET UINT64_C(0xFFFFFFFFFFFFFFFF) 1/* Type definitions and macros are in a separate file for easier testing */
2#define MAP_KEYMASK UINT64_C(0xFFFFFFFFFF) 2#include "map_types_macros.h"
3#define MAP_KEYSHIFT UINT64_C(40)
4#define MAP_UNSET_VAL (MAP_UNSET >> MAP_KEYSHIFT)
5
6typedef struct {
7 uint64_t n;
8 uint64_t capacity;
9 uint64_t randomizer;
10 uint64_t *table;
11} h48map_t;
12
13typedef struct {
14 uint64_t key;
15 uint64_t val;
16} kvpair_t;
17 3
18STATIC void h48map_create(h48map_t *, uint64_t, uint64_t); 4STATIC void h48map_create(h48map_t *, uint64_t, uint64_t);
19STATIC void h48map_clear(h48map_t *); 5STATIC void h48map_clear(h48map_t *);
diff --git a/src/solvers/h48/map_types_macros.h b/src/solvers/h48/map_types_macros.h
new file mode 100644
index 0000000..b77c68a
--- /dev/null
+++ b/src/solvers/h48/map_types_macros.h
@@ -0,0 +1,16 @@
1#define MAP_UNSET UINT64_C(0xFFFFFFFFFFFFFFFF)
2#define MAP_KEYMASK UINT64_C(0xFFFFFFFFFF)
3#define MAP_KEYSHIFT UINT64_C(40)
4#define MAP_UNSET_VAL (MAP_UNSET >> MAP_KEYSHIFT)
5
6typedef struct {
7 uint64_t n;
8 uint64_t capacity;
9 uint64_t randomizer;
10 uint64_t *table;
11} h48map_t;
12
13typedef struct {
14 uint64_t key;
15 uint64_t val;
16} kvpair_t;
diff --git a/src/solvers/tables.h b/src/solvers/tables.h
index a668988..9da90df 100644
--- a/src/solvers/tables.h
+++ b/src/solvers/tables.h
@@ -1,41 +1,5 @@
1#define OFFSET(B, K) (((uint8_t *)B) + K) 1/* Type definitions and macros are in a separate file for easier testing */
2 2#include "tables_types_macros.h"
3#define INFOSIZE 512
4#define INFO_SOLVER_STRLEN 100
5#define INFO_DISTRIBUTION_LEN 21
6
7#define TABLETYPE_PRUNING 0
8#define TABLETYPE_SPECIAL 1
9
10#define INFO_OFFSET_DISTRIBUTION 0
11#define INFO_OFFSET_TYPE (INFO_DISTRIBUTION_LEN * sizeof(uint64_t))
12#define INFO_OFFSET_INFOSIZE (INFO_OFFSET_TYPE + sizeof(uint64_t))
13#define INFO_OFFSET_FULLSIZE (INFO_OFFSET_INFOSIZE + 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))
16#define INFO_OFFSET_CLASSES (INFO_OFFSET_ENTRIES + sizeof(uint64_t))
17#define INFO_OFFSET_NEXT (INFO_OFFSET_CLASSES + sizeof(uint64_t))
18#define INFO_OFFSET_SOLVER (INFO_OFFSET_NEXT + sizeof(uint64_t))
19#define INFO_OFFSET_H48H (INFO_OFFSET_SOLVER + INFO_SOLVER_STRLEN)
20#define INFO_OFFSET_BITS (INFO_OFFSET_H48H + sizeof(uint8_t))
21#define INFO_OFFSET_BASE (INFO_OFFSET_BITS + sizeof(uint8_t))
22#define INFO_OFFSET_MAXVALUE (INFO_OFFSET_BASE + sizeof(uint8_t))
23
24typedef struct {
25 uint64_t distribution[INFO_DISTRIBUTION_LEN];
26 uint64_t type;
27 uint64_t infosize;
28 uint64_t fullsize;
29 uint64_t hash;
30 uint64_t entries;
31 uint64_t classes; /* Used only by cocsepdata, for now */
32 uint64_t next;
33 char solver[INFO_SOLVER_STRLEN];
34 uint8_t h48h; /* Specific to H48 tables */
35 uint8_t bits;
36 uint8_t base;
37 uint8_t maxvalue;
38} tableinfo_t;
39 3
40STATIC bool readtableinfo(const void *, tableinfo_t *); 4STATIC bool readtableinfo(const void *, tableinfo_t *);
41STATIC bool readtableinfo_n(const void *, uint8_t, tableinfo_t *); 5STATIC bool readtableinfo_n(const void *, uint8_t, tableinfo_t *);
diff --git a/src/solvers/tables_types_macros.h b/src/solvers/tables_types_macros.h
new file mode 100644
index 0000000..39b3986
--- /dev/null
+++ b/src/solvers/tables_types_macros.h
@@ -0,0 +1,38 @@
1#define OFFSET(B, K) (((uint8_t *)B) + K)
2
3#define INFOSIZE 512
4#define INFO_SOLVER_STRLEN 100
5#define INFO_DISTRIBUTION_LEN 21
6
7#define TABLETYPE_PRUNING 0
8#define TABLETYPE_SPECIAL 1
9
10#define INFO_OFFSET_DISTRIBUTION 0
11#define INFO_OFFSET_TYPE (INFO_DISTRIBUTION_LEN * sizeof(uint64_t))
12#define INFO_OFFSET_INFOSIZE (INFO_OFFSET_TYPE + sizeof(uint64_t))
13#define INFO_OFFSET_FULLSIZE (INFO_OFFSET_INFOSIZE + 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))
16#define INFO_OFFSET_CLASSES (INFO_OFFSET_ENTRIES + sizeof(uint64_t))
17#define INFO_OFFSET_NEXT (INFO_OFFSET_CLASSES + sizeof(uint64_t))
18#define INFO_OFFSET_SOLVER (INFO_OFFSET_NEXT + sizeof(uint64_t))
19#define INFO_OFFSET_H48H (INFO_OFFSET_SOLVER + INFO_SOLVER_STRLEN)
20#define INFO_OFFSET_BITS (INFO_OFFSET_H48H + sizeof(uint8_t))
21#define INFO_OFFSET_BASE (INFO_OFFSET_BITS + sizeof(uint8_t))
22#define INFO_OFFSET_MAXVALUE (INFO_OFFSET_BASE + sizeof(uint8_t))
23
24typedef struct {
25 uint64_t distribution[INFO_DISTRIBUTION_LEN];
26 uint64_t type;
27 uint64_t infosize;
28 uint64_t fullsize;
29 uint64_t hash;
30 uint64_t entries;
31 uint64_t classes; /* Used only by cocsepdata, for now */
32 uint64_t next;
33 char solver[INFO_SOLVER_STRLEN];
34 uint8_t h48h; /* Specific to H48 tables */
35 uint8_t bits;
36 uint8_t base;
37 uint8_t maxvalue;
38} tableinfo_t;
diff --git a/test/090_tables_readwrite/tables_readwrite_tests.c b/test/090_tables_readwrite/tables_readwrite_tests.c
index 73c4e21..9238207 100644
--- a/test/090_tables_readwrite/tables_readwrite_tests.c
+++ b/test/090_tables_readwrite/tables_readwrite_tests.c
@@ -1,25 +1,5 @@
1#include "../test.h" 1#include "../test.h"
2 2
3#define INFOSIZE 512
4#define INFO_SOLVER_STRLEN 100
5#define INFO_DISTRIBUTION_LEN 21
6
7typedef struct {
8 uint64_t distribution[INFO_DISTRIBUTION_LEN];
9 uint64_t type;
10 uint64_t infosize;
11 uint64_t fullsize;
12 uint64_t hash;
13 uint64_t entries;
14 uint64_t classes;
15 uint64_t next;
16 char solver[INFO_SOLVER_STRLEN];
17 uint8_t h48h;
18 uint8_t bits;
19 uint8_t base;
20 uint8_t maxvalue;
21} tableinfo_t;
22
23bool readtableinfo(const void *, tableinfo_t *); 3bool readtableinfo(const void *, tableinfo_t *);
24bool writetableinfo(const tableinfo_t *, void *); 4bool writetableinfo(const tableinfo_t *, void *);
25 5
diff --git a/test/100_gendata_cocsep/gendata_cocsep_tests.c b/test/100_gendata_cocsep/gendata_cocsep_tests.c
index 62f52fb..296df28 100644
--- a/test/100_gendata_cocsep/gendata_cocsep_tests.c
+++ b/test/100_gendata_cocsep/gendata_cocsep_tests.c
@@ -1,26 +1,5 @@
1#include "../test.h" 1#include "../test.h"
2 2
3#define INFOSIZE 512
4#define INFO_SOLVER_STRLEN 100
5#define INFO_DISTRIBUTION_LEN 21
6#define COCSEP_CLASSES 3393
7
8typedef struct {
9 uint64_t distribution[INFO_DISTRIBUTION_LEN];
10 uint64_t type;
11 uint64_t infosize;
12 uint64_t fullsize;
13 uint64_t hash;
14 uint64_t entries;
15 uint64_t classes; /* Used only by cocsepdata, for now */
16 uint64_t next;
17 char solver[INFO_SOLVER_STRLEN];
18 uint8_t h48h;
19 uint8_t bits;
20 uint8_t base;
21 uint8_t maxvalue;
22} tableinfo_t;
23
24size_t gendata_cocsep(void *, uint64_t *, cube_t *); 3size_t gendata_cocsep(void *, uint64_t *, cube_t *);
25bool readtableinfo(const void *, tableinfo_t *); 4bool readtableinfo(const void *, tableinfo_t *);
26 5
diff --git a/test/101_cocsep_transform_invariant/cocsep_transform_invariant.c b/test/101_cocsep_transform_invariant/cocsep_transform_invariant.c
index 67f70a5..853586a 100644
--- a/test/101_cocsep_transform_invariant/cocsep_transform_invariant.c
+++ b/test/101_cocsep_transform_invariant/cocsep_transform_invariant.c
@@ -1,11 +1,5 @@
1#include "../test.h" 1#include "../test.h"
2 2
3#define COCLASS_MASK (UINT32_C(0xFFFF) << UINT32_C(16))
4#define COCLASS(x) (((x) & COCLASS_MASK) >> UINT32_C(16))
5
6#define INFOSIZE 512
7#define COCSEP_CLASSES 3393
8
9size_t gendata_cocsep(void *, uint64_t *, cube_t *); 3size_t gendata_cocsep(void *, uint64_t *, cube_t *);
10cube_t transform(cube_t, uint8_t); 4cube_t transform(cube_t, uint8_t);
11int64_t coord_cocsep(cube_t); 5int64_t coord_cocsep(cube_t);
diff --git a/test/102_cocsep_selfsim/cocsep_selfsim_tests.c b/test/102_cocsep_selfsim/cocsep_selfsim_tests.c
index 490952a..dd778aa 100644
--- a/test/102_cocsep_selfsim/cocsep_selfsim_tests.c
+++ b/test/102_cocsep_selfsim/cocsep_selfsim_tests.c
@@ -7,9 +7,6 @@
7 */ 7 */
8#include "../test.h" 8#include "../test.h"
9 9
10#define COCSEP_CLASSES 3393
11#define INFOSIZE 512
12
13size_t gendata_cocsep(void *, uint64_t *, cube_t *); 10size_t gendata_cocsep(void *, uint64_t *, cube_t *);
14int64_t coord_cocsep(cube_t); 11int64_t coord_cocsep(cube_t);
15 12
diff --git a/test/103_cocsep_selfsim_distribution/cocsep_selfsim_distribution_tests.c b/test/103_cocsep_selfsim_distribution/cocsep_selfsim_distribution_tests.c
index 84e3fd8..a907317 100644
--- a/test/103_cocsep_selfsim_distribution/cocsep_selfsim_distribution_tests.c
+++ b/test/103_cocsep_selfsim_distribution/cocsep_selfsim_distribution_tests.c
@@ -1,7 +1,5 @@
1#include "../test.h" 1#include "../test.h"
2 2
3#define COCSEP_CLASSES 3393
4
5size_t gendata_cocsep(void *, uint64_t *, cube_t *); 3size_t gendata_cocsep(void *, uint64_t *, cube_t *);
6int64_t coord_cocsep(cube_t); 4int64_t coord_cocsep(cube_t);
7 5
@@ -19,8 +17,7 @@ int bcount(uint64_t x) {
19void run(void) { 17void run(void) {
20 char buf[2000000]; 18 char buf[2000000];
21 int size[65], tot, j; 19 int size[65], tot, j;
22 int64_t i; 20 uint64_t i, selfsim[COCSEP_CLASSES], sim;
23 uint64_t selfsim[COCSEP_CLASSES], sim;
24 cube_t rep[COCSEP_CLASSES]; 21 cube_t rep[COCSEP_CLASSES];
25 22
26 memset(size, 0, 65 * sizeof(int)); 23 memset(size, 0, 65 * sizeof(int));
diff --git a/test/104_cocsep_ttrep/cocsep_ttrep_tests.c b/test/104_cocsep_ttrep/cocsep_ttrep_tests.c
index efe5a26..0b853c3 100644
--- a/test/104_cocsep_ttrep/cocsep_ttrep_tests.c
+++ b/test/104_cocsep_ttrep/cocsep_ttrep_tests.c
@@ -1,11 +1,5 @@
1#include "../test.h" 1#include "../test.h"
2 2
3#define TTREP_MASK (UINT32_C(0xFF) << UINT32_C(8))
4#define TTREP(x) (((x) & TTREP_MASK) >> UINT32_C(8))
5
6#define COCSEP_CLASSES 3393
7#define INFOSIZE 512
8
9uint8_t inverse_trans(uint8_t); 3uint8_t inverse_trans(uint8_t);
10cube_t transform_corners(cube_t, uint8_t); 4cube_t transform_corners(cube_t, uint8_t);
11int64_t coord_cocsep(cube_t); 5int64_t coord_cocsep(cube_t);
@@ -15,8 +9,8 @@ void run(void) {
15 uint8_t t; 9 uint8_t t;
16 char buf[2000000]; 10 char buf[2000000];
17 uint32_t *cocsepdata, tt; 11 uint32_t *cocsepdata, tt;
18 uint64_t selfsim[COCSEP_CLASSES]; 12 uint64_t i, selfsim[COCSEP_CLASSES];
19 int64_t i, j, k, l; 13 int64_t j, k, l;
20 cube_t rep[COCSEP_CLASSES], c, d; 14 cube_t rep[COCSEP_CLASSES], c, d;
21 15
22 gendata_cocsep(buf, selfsim, rep); 16 gendata_cocsep(buf, selfsim, rep);
diff --git a/test/110_coord_invcoord_h48/coord_invcoord_h48_tests.c b/test/110_coord_invcoord_h48/coord_invcoord_h48_tests.c
index 1fcbabd..025ff2b 100644
--- a/test/110_coord_invcoord_h48/coord_invcoord_h48_tests.c
+++ b/test/110_coord_invcoord_h48/coord_invcoord_h48_tests.c
@@ -1,8 +1,5 @@
1#include "../test.h" 1#include "../test.h"
2 2
3#define COCSEP_CLASSES 3393
4#define INFOSIZE 512
5
6size_t gendata_cocsep(void *, uint64_t *, cube_t *); 3size_t gendata_cocsep(void *, uint64_t *, cube_t *);
7int64_t coord_h48(cube_t, const uint32_t *, uint8_t); 4int64_t coord_h48(cube_t, const uint32_t *, uint8_t);
8cube_t invcoord_h48(int64_t, const cube_t *, uint8_t); 5cube_t invcoord_h48(int64_t, const cube_t *, uint8_t);
diff --git a/test/111_h48map/h48map_tests.c b/test/111_h48map/h48map_tests.c
index d70bc3a..7fdfb3d 100644
--- a/test/111_h48map/h48map_tests.c
+++ b/test/111_h48map/h48map_tests.c
@@ -1,20 +1,7 @@
1#include "../test.h" 1#include "../test.h"
2 2
3#define MAP_KEYSHIFT UINT64_C(40)
4#define MAXPOS 1000 3#define MAXPOS 1000
5 4
6typedef struct {
7 uint64_t n;
8 uint64_t capacity;
9 uint64_t randomizer;
10 uint64_t *table;
11} h48map_t;
12
13typedef struct {
14 uint64_t key;
15 uint64_t val;
16} kvpair_t;
17
18void h48map_create(h48map_t *, uint64_t, uint64_t); 5void h48map_create(h48map_t *, uint64_t, uint64_t);
19void h48map_destroy(h48map_t *); 6void h48map_destroy(h48map_t *);
20void h48map_insertmin(h48map_t *, uint64_t, uint64_t); 7void h48map_insertmin(h48map_t *, uint64_t, uint64_t);
diff --git a/test/112_gendata_h48short/gendata_h48short_tests.c b/test/112_gendata_h48short/gendata_h48short_tests.c
index fb432d3..b6ff00e 100644
--- a/test/112_gendata_h48short/gendata_h48short_tests.c
+++ b/test/112_gendata_h48short/gendata_h48short_tests.c
@@ -1,33 +1,6 @@
1#include "../test.h" 1#include "../test.h"
2 2
3#define COCSEP_CLASSES 3393 3#define MAXPOS 200
4#define INFOSIZE 512
5#define MAXPOS 200
6
7typedef struct {
8 uint64_t n;
9 uint64_t capacity;
10 uint64_t randomizer;
11 uint64_t *table;
12 uint32_t *info;
13 uint32_t *cocsepdata;
14 uint32_t *h48data;
15 uint64_t selfsim[COCSEP_CLASSES];
16 cube_t crep[COCSEP_CLASSES];
17} h48map_t;
18
19typedef struct {
20 uint64_t key;
21 uint64_t val;
22} kvpair_t;
23
24typedef struct {
25 uint8_t maxdepth;
26 const uint32_t *cocsepdata;
27 const cube_t *crep;
28 const uint64_t *selfsim;
29 h48map_t *map;
30} gendata_h48short_arg_t;
31 4
32void h48map_create(h48map_t *, uint64_t, uint64_t); 5void h48map_create(h48map_t *, uint64_t, uint64_t);
33void h48map_destroy(h48map_t *); 6void h48map_destroy(h48map_t *);
diff --git a/test/test.h b/test/test.h
index d7658cb..b90a399 100644
--- a/test/test.h
+++ b/test/test.h
@@ -1,6 +1,7 @@
1#define TEST_H 1#define TEST_H
2 2
3#include <inttypes.h> 3#include <inttypes.h>
4#include <pthread.h>
4#include <stdarg.h> 5#include <stdarg.h>
5#include <stdbool.h> 6#include <stdbool.h>
6#include <stdio.h> 7#include <stdio.h>
@@ -8,6 +9,10 @@
8#include <string.h> 9#include <string.h>
9 10
10#include "../src/arch/arch.h" 11#include "../src/arch/arch.h"
12#include "../src/solvers/tables_types_macros.h"
13#include "../src/solvers/h48/coordinate_macros.h"
14#include "../src/solvers/h48/map_types_macros.h"
15#include "../src/solvers/h48/gendata_types_macros.h"
11 16
12#define STRLENMAX 10000 17#define STRLENMAX 10000
13 18

Generated with cgit - Back to sebastiano.tronto.net