diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2023-11-05 19:59:45 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2023-11-05 19:59:45 +0100 |
| commit | 0c9a5d0e5c1702d07b24eeac181f78d1689c05cc (patch) | |
| tree | b07e7ade80e4d0c5163db49ccb7b542a500f28c8 /cube.c | |
| parent | 1964938ca6abef6e5c81d9dccdf42c55abacb5e9 (diff) | |
| download | nissy-core-0c9a5d0e5c1702d07b24eeac181f78d1689c05cc.tar.gz nissy-core-0c9a5d0e5c1702d07b24eeac181f78d1689c05cc.zip | |
Added coord_eo
Diffstat (limited to 'cube.c')
| -rw-r--r-- | cube.c | 32 |
1 files changed, 32 insertions, 0 deletions
| @@ -2104,6 +2104,19 @@ _compose(cube_t c1, cube_t c2) | |||
| 2104 | return ret; | 2104 | return ret; |
| 2105 | } | 2105 | } |
| 2106 | 2106 | ||
| 2107 | static inline int16_t | ||
| 2108 | _coord_eo(cube_t c) | ||
| 2109 | { | ||
| 2110 | cube_t eo, shifted; | ||
| 2111 | int mask; | ||
| 2112 | |||
| 2113 | eo = _mm256_and_si256(c, _eo_avx2); | ||
| 2114 | shifted = _mm256_slli_epi32(eo, 3); | ||
| 2115 | mask = _mm256_movemask_epi8(shifted); | ||
| 2116 | |||
| 2117 | return (int16_t)(mask >> 17); | ||
| 2118 | } | ||
| 2119 | |||
| 2107 | 2120 | ||
| 2108 | /****************************************************************************** | 2121 | /****************************************************************************** |
| 2109 | Section: portable fast methods | 2122 | Section: portable fast methods |
| @@ -3420,6 +3433,19 @@ _compose(cube_t c1, cube_t c2) | |||
| 3420 | return ret; | 3433 | return ret; |
| 3421 | } | 3434 | } |
| 3422 | 3435 | ||
| 3436 | static inline int16_t | ||
| 3437 | _coord_eo(cube_t c) | ||
| 3438 | { | ||
| 3439 | int i, p; | ||
| 3440 | int16_t ret; | ||
| 3441 | |||
| 3442 | ret = 0; | ||
| 3443 | for (i = 1, p = 1; i < 12; i++, p *= 2) | ||
| 3444 | ret += p * (c.e[i] >> 4); | ||
| 3445 | |||
| 3446 | return ret; | ||
| 3447 | } | ||
| 3448 | |||
| 3423 | 3449 | ||
| 3424 | #endif | 3450 | #endif |
| 3425 | 3451 | ||
| @@ -3696,3 +3722,9 @@ transform(cube_t c, trans_t t) | |||
| 3696 | return zerocube(); | 3722 | return zerocube(); |
| 3697 | } | 3723 | } |
| 3698 | } | 3724 | } |
| 3725 | |||
| 3726 | int16_t | ||
| 3727 | coord_eo(cube_t c) | ||
| 3728 | { | ||
| 3729 | return _coord_eo(c); | ||
| 3730 | } | ||
