aboutsummaryrefslogtreecommitdiff
path: root/src/arch/common.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/common.h')
-rw-r--r--src/arch/common.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/arch/common.h b/src/arch/common.h
index d76b65f..f06f8d7 100644
--- a/src/arch/common.h
+++ b/src/arch/common.h
@@ -29,6 +29,8 @@ STATIC_INLINE uint64_t coord_cocsep(cube_t);
29STATIC_INLINE uint64_t coord_eo(cube_t); 29STATIC_INLINE uint64_t coord_eo(cube_t);
30STATIC_INLINE uint64_t coord_esep(cube_t); 30STATIC_INLINE uint64_t coord_esep(cube_t);
31STATIC_INLINE cube_t invcoord_esep(uint64_t); 31STATIC_INLINE cube_t invcoord_esep(uint64_t);
32STATIC_INLINE uint64_t coord_epudsep(cube_t);
33STATIC_INLINE cube_t invcoord_epudsep(uint64_t);
32 34
33STATIC_INLINE bool is_eo_even(cube_t); 35STATIC_INLINE bool is_eo_even(cube_t);
34 36
@@ -38,6 +40,8 @@ STATIC_INLINE void set_eo(cube_t [static 1], uint64_t);
38 40
39STATIC_INLINE void invcoord_esep_array(uint64_t, uint64_t, uint8_t[static 12]); 41STATIC_INLINE void invcoord_esep_array(uint64_t, uint64_t, uint8_t[static 12]);
40STATIC_INLINE cube_t invcoord_eoesep(uint64_t); 42STATIC_INLINE cube_t invcoord_eoesep(uint64_t);
43STATIC_INLINE uint64_t coord_epudsep_array(const uint8_t [8]);
44STATIC_INLINE void invcoord_epudsep_array(uint64_t, uint8_t [8]);
41 45
42STATIC_INLINE uint64_t coord_cp(cube_t); 46STATIC_INLINE uint64_t coord_cp(cube_t);
43STATIC_INLINE cube_t invcoord_cp(uint64_t); 47STATIC_INLINE cube_t invcoord_cp(uint64_t);
@@ -85,3 +89,38 @@ invcoord_eoesep(uint64_t i)
85 89
86 return c; 90 return c;
87} 91}
92
93STATIC_INLINE uint64_t
94coord_epudsep_array(const uint8_t e[8])
95{
96 uint8_t i, k, is;
97 uint64_t ret;
98
99 ret = 0;
100 k = 4;
101 for (i = 0; i < 8; i++) {
102 is = (e[i] & UINT8_C(4)) >> UINT8_C(2);
103 ret += is * binomial[7-i][k];
104 k -= is;
105 }
106
107 return ret;
108}
109
110STATIC_INLINE void
111invcoord_epudsep_array(uint64_t c, uint8_t ret[8])
112{
113 uint8_t i, k, is, x, y;
114
115 k = 4;
116 x = 0;
117 y = 4;
118 for (i = 0; i < 8; i++) {
119 is = c >= binomial[7-i][k];
120 ret[i] = is*y + (1-is)*x;
121 y += is;
122 x += 1-is;
123 c -= is * binomial[7-i][k];
124 k -= is;
125 }
126}

Generated with cgit - Back to sebastiano.tronto.net