diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2024-08-18 15:31:06 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2024-08-18 15:31:06 +0200 |
| commit | 2d66a0ffea4b03cd27b0f4363f8c4b8b0a1242e4 (patch) | |
| tree | 03a0844aa4da4291e51971cf669b4c1dee639c9b /src/arch/common.h | |
| parent | 18c9a8b8905304cf5f8fc15825769046a3144866 (diff) | |
| download | nissy-core-2d66a0ffea4b03cd27b0f4363f8c4b8b0a1242e4.tar.gz nissy-core-2d66a0ffea4b03cd27b0f4363f8c4b8b0a1242e4.zip | |
Removed duplication
Diffstat (limited to 'src/arch/common.h')
| -rw-r--r-- | src/arch/common.h | 28 |
1 files changed, 28 insertions, 0 deletions
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); | |||
| 17 | _static_inline void copy_edges(cube_t *, cube_t); | 17 | _static_inline void copy_edges(cube_t *, cube_t); |
| 18 | _static_inline void set_eo(cube_t *, int64_t); | 18 | _static_inline void set_eo(cube_t *, int64_t); |
| 19 | _static_inline cube_t invcoord_esep(int64_t); | 19 | _static_inline cube_t invcoord_esep(int64_t); |
| 20 | |||
| 21 | _static_inline void invcoord_esep_array(int64_t, int64_t, uint8_t[static 12]); | ||
| 22 | |||
| 23 | _static_inline void | ||
| 24 | invcoord_esep_array(int64_t set1, int64_t set2, uint8_t mem[static 12]) | ||
| 25 | { | ||
| 26 | int64_t bit1, bit2, i, j, jj, k, l, s, v, w, is1; | ||
| 27 | uint8_t slice[3] = {0}; | ||
| 28 | |||
| 29 | for (i = 0, j = 0, k = 4, l = 4; i < 12; i++) | ||
| 30 | { | ||
| 31 | v = binomial[11 - i][k]; | ||
| 32 | jj = j < 8; | ||
| 33 | w = jj * binomial[7 - (j * jj)][l]; | ||
| 34 | bit2 = set2 >= v; | ||
| 35 | bit1 = set1 >= w; | ||
| 36 | is1 = (1 - bit2) * bit1; | ||
| 37 | |||
| 38 | set2 -= bit2 * v; | ||
| 39 | k -= bit2; | ||
| 40 | set1 -= is1 * w; | ||
| 41 | l -= is1; | ||
| 42 | j += (1 - bit2); | ||
| 43 | s = 2 * bit2 + (1 - bit2) * bit1; | ||
| 44 | |||
| 45 | mem[i] = (slice[s]++) | (uint8_t)(s << 2); | ||
| 46 | } | ||
| 47 | } | ||
