From b2ff4eb2c933ccf1cf8f6afac498ab085461ab74 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Thu, 8 Aug 2019 00:47:12 +0100 Subject: [PATCH] compiler.h: add popcount --- src/compiler.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/compiler.h b/src/compiler.h index 8d8722e5..de5c17c6 100644 --- a/src/compiler.h +++ b/src/compiler.h @@ -106,3 +106,7 @@ typedef unsigned long ulong; typedef unsigned int uint; + +static inline int popcount(uint x) { + return __builtin_popcount(x); +}