diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2026-04-06 14:19:43 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2026-04-06 14:19:43 +0100 |
| commit | 0d4fa9ebbfcadfff4baf8fc3cd32a63dcfd7dd43 (patch) | |
| tree | 3a31783cb703febeba25d1aaafb931323a4d9202 | |
| parent | ce4f47663d6baeb55fea253f17bb5f023ea48de1 (diff) | |
| parent | fe534f1497da6447153064d7bba00243000f803b (diff) | |
| download | nissy-core-0d4fa9ebbfcadfff4baf8fc3cd32a63dcfd7dd43.tar.gz nissy-core-0d4fa9ebbfcadfff4baf8fc3cd32a63dcfd7dd43.zip | |
Merge remote-tracking branch 'origin/master' into c-portability
Diffstat (limited to '')
| -rw-r--r-- | src/arch/avx2.h | 6 | ||||
| -rw-r--r-- | src/arch/common.h | 1 | ||||
| -rw-r--r-- | src/arch/neon.h | 11 | ||||
| -rw-r--r-- | src/arch/portable.h | 11 |
4 files changed, 29 insertions, 0 deletions
diff --git a/src/arch/avx2.h b/src/arch/avx2.h index e3fddd6..21a6f3b 100644 --- a/src/arch/avx2.h +++ b/src/arch/avx2.h | |||
| @@ -34,6 +34,12 @@ popcount_u32(uint32_t x) | |||
| 34 | return _mm_popcnt_u32(x); | 34 | return _mm_popcnt_u32(x); |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | STATIC_INLINE int | ||
| 38 | popcount_u64(uint64_t x) | ||
| 39 | { | ||
| 40 | return _mm_popcnt_u64(x); | ||
| 41 | } | ||
| 42 | |||
| 37 | STATIC void | 43 | STATIC void |
| 38 | pieces(cube_t cube[NON_NULL], uint8_t c[SIZE(8)], uint8_t e[SIZE(12)]) | 44 | pieces(cube_t cube[NON_NULL], uint8_t c[SIZE(8)], uint8_t e[SIZE(12)]) |
| 39 | { | 45 | { |
diff --git a/src/arch/common.h b/src/arch/common.h index 2a83fbf..a7c4a3b 100644 --- a/src/arch/common.h +++ b/src/arch/common.h | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | #define EFLIP UINT8_C(0x10) | 13 | #define EFLIP UINT8_C(0x10) |
| 14 | 14 | ||
| 15 | STATIC_INLINE int popcount_u32(uint32_t); | 15 | STATIC_INLINE int popcount_u32(uint32_t); |
| 16 | STATIC_INLINE int popcount_u64(uint64_t); | ||
| 16 | 17 | ||
| 17 | STATIC void pieces(cube_t [NON_NULL], uint8_t [SIZE(8)], uint8_t [SIZE(12)]); | 18 | STATIC void pieces(cube_t [NON_NULL], uint8_t [SIZE(8)], uint8_t [SIZE(12)]); |
| 18 | STATIC_INLINE bool equal(cube_t, cube_t); | 19 | STATIC_INLINE bool equal(cube_t, cube_t); |
diff --git a/src/arch/neon.h b/src/arch/neon.h index 1157938..501b722 100644 --- a/src/arch/neon.h +++ b/src/arch/neon.h | |||
| @@ -47,6 +47,17 @@ popcount_u32(uint32_t x) | |||
| 47 | return (int)x; | 47 | return (int)x; |
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | STATIC_INLINE int | ||
| 51 | popcount_u64(uint64_t x) | ||
| 52 | { | ||
| 53 | int top, bottom; | ||
| 54 | |||
| 55 | bottom = popcount_u32((uint32_t)(x & UINT64_C(0xFFFFFFFF))); | ||
| 56 | top = popcount_u32((uint32_t)(x >> UINT64_C(32))); | ||
| 57 | |||
| 58 | return top + bottom; | ||
| 59 | } | ||
| 60 | |||
| 50 | STATIC void | 61 | STATIC void |
| 51 | pieces(cube_t cube[NON_NULL], uint8_t c[SIZE(8)], uint8_t e[SIZE(12)]) | 62 | pieces(cube_t cube[NON_NULL], uint8_t c[SIZE(8)], uint8_t e[SIZE(12)]) |
| 52 | { | 63 | { |
diff --git a/src/arch/portable.h b/src/arch/portable.h index 311d427..f1491f0 100644 --- a/src/arch/portable.h +++ b/src/arch/portable.h | |||
| @@ -34,6 +34,17 @@ popcount_u32(uint32_t x) | |||
| 34 | return (int)x; | 34 | return (int)x; |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | STATIC_INLINE int | ||
| 38 | popcount_u64(uint64_t x) | ||
| 39 | { | ||
| 40 | int top, bottom; | ||
| 41 | |||
| 42 | bottom = popcount_u32((uint32_t)(x & UINT64_C(0xFFFFFFFF))); | ||
| 43 | top = popcount_u32((uint32_t)(x >> UINT64_C(32))); | ||
| 44 | |||
| 45 | return top + bottom; | ||
| 46 | } | ||
| 47 | |||
| 37 | STATIC void | 48 | STATIC void |
| 38 | pieces(cube_t cube[NON_NULL], uint8_t c[SIZE(8)], uint8_t e[SIZE(12)]) | 49 | pieces(cube_t cube[NON_NULL], uint8_t c[SIZE(8)], uint8_t e[SIZE(12)]) |
| 39 | { | 50 | { |
