aboutsummaryrefslogtreecommitdiff
path: root/src/arch/portable.h
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2026-04-06 15:18:26 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2026-04-06 15:18:26 +0200
commitfe534f1497da6447153064d7bba00243000f803b (patch)
tree851cd657931dce7584baf00cf092360416161793 /src/arch/portable.h
parentb729562fc3c1b85f1ea9a19fadd1caaf85b85777 (diff)
downloadnissy-core-fe534f1497da6447153064d7bba00243000f803b.tar.gz
nissy-core-fe534f1497da6447153064d7bba00243000f803b.zip
Added popcount_u64
Diffstat (limited to '')
-rw-r--r--src/arch/portable.h11
1 files changed, 11 insertions, 0 deletions
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)
34 return (int)x; 34 return (int)x;
35} 35}
36 36
37STATIC_INLINE int
38popcount_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
37STATIC void 48STATIC void
38pieces(cube_t cube[static 1], uint8_t c[static 8], uint8_t e[static 12]) 49pieces(cube_t cube[static 1], uint8_t c[static 8], uint8_t e[static 12])
39{ 50{

Generated with cgit - Back to sebastiano.tronto.net