From fe534f1497da6447153064d7bba00243000f803b Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Mon, 6 Apr 2026 15:18:26 +0200 Subject: Added popcount_u64 --- src/arch/portable.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/arch/portable.h') diff --git a/src/arch/portable.h b/src/arch/portable.h index 4b66fb6..162ed1a 100644 --- 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]) { -- cgit v1.3