From 2d66a0ffea4b03cd27b0f4363f8c4b8b0a1242e4 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Sun, 18 Aug 2024 15:31:06 +0200 Subject: Removed duplication --- src/arch/common.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'src/arch/common.h') diff --git a/src/arch/common.h b/src/arch/common.h index cd2d36e..d8d2305 100644 --- a/src/arch/common.h +++ b/src/arch/common.h @@ -17,3 +17,31 @@ _static_inline void copy_corners(cube_t *, cube_t); _static_inline void copy_edges(cube_t *, cube_t); _static_inline void set_eo(cube_t *, int64_t); _static_inline cube_t invcoord_esep(int64_t); + +_static_inline void invcoord_esep_array(int64_t, int64_t, uint8_t[static 12]); + +_static_inline void +invcoord_esep_array(int64_t set1, int64_t set2, uint8_t mem[static 12]) +{ + int64_t bit1, bit2, i, j, jj, k, l, s, v, w, is1; + uint8_t slice[3] = {0}; + + for (i = 0, j = 0, k = 4, l = 4; i < 12; i++) + { + v = binomial[11 - i][k]; + jj = j < 8; + w = jj * binomial[7 - (j * jj)][l]; + bit2 = set2 >= v; + bit1 = set1 >= w; + is1 = (1 - bit2) * bit1; + + set2 -= bit2 * v; + k -= bit2; + set1 -= is1 * w; + l -= is1; + j += (1 - bit2); + s = 2 * bit2 + (1 - bit2) * bit1; + + mem[i] = (slice[s]++) | (uint8_t)(s << 2); + } +} -- cgit v1.3