nissy-core

The "engine" of nissy, including the H48 optimal solver.
git clone https://git.tronto.net/nissy-core
Download | Log | Files | Refs | README | LICENSE

commit fe534f1497da6447153064d7bba00243000f803b
parent b729562fc3c1b85f1ea9a19fadd1caaf85b85777
Author: Sebastiano Tronto <sebastiano@tronto.net>
Date:   Mon,  6 Apr 2026 15:18:26 +0200

Added popcount_u64

Diffstat:
Msrc/arch/avx2.h | 6++++++
Msrc/arch/common.h | 1+
Msrc/arch/neon.h | 11+++++++++++
Msrc/arch/portable.h | 11+++++++++++
4 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/src/arch/avx2.h b/src/arch/avx2.h @@ -34,6 +34,12 @@ popcount_u32(uint32_t x) return _mm_popcnt_u32(x); } +STATIC_INLINE int +popcount_u64(uint64_t x) +{ + return _mm_popcnt_u64(x); +} + STATIC void pieces(cube_t cube[static 1], uint8_t c[static 8], uint8_t e[static 12]) { diff --git a/src/arch/common.h b/src/arch/common.h @@ -13,6 +13,7 @@ #define EFLIP UINT8_C(0x10) STATIC_INLINE int popcount_u32(uint32_t); +STATIC_INLINE int popcount_u64(uint64_t); STATIC void pieces(cube_t [static 1], uint8_t [static 8], uint8_t [static 12]); STATIC_INLINE bool equal(cube_t, cube_t); diff --git a/src/arch/neon.h b/src/arch/neon.h @@ -47,6 +47,17 @@ popcount_u32(uint32_t x) return (int)x; } +STATIC_INLINE int +popcount_u64(uint64_t x) +{ + int top, bottom; + + bottom = popcount_u32((uint32_t)(x & UINT64_C(0xFFFFFFFF))); + top = popcount_u32((uint32_t)(x >> UINT64_C(32))); + + return top + bottom; +} + STATIC void pieces(cube_t cube[static 1], uint8_t c[static 8], uint8_t e[static 12]) { diff --git a/src/arch/portable.h b/src/arch/portable.h @@ -34,6 +34,17 @@ popcount_u32(uint32_t x) return (int)x; } +STATIC_INLINE int +popcount_u64(uint64_t x) +{ + int top, bottom; + + bottom = popcount_u32((uint32_t)(x & UINT64_C(0xFFFFFFFF))); + top = popcount_u32((uint32_t)(x >> UINT64_C(32))); + + return top + bottom; +} + STATIC void pieces(cube_t cube[static 1], uint8_t c[static 8], uint8_t e[static 12]) {