diff --git a/src/compiler.h b/src/compiler.h index 814bdd8b..550507fd 100644 --- a/src/compiler.h +++ b/src/compiler.h @@ -111,6 +111,6 @@ typedef unsigned long ulong; typedef unsigned int uint; -static inline int popcount(uint x) { - return __builtin_popcount(x); +static inline int attr_const popcntul(unsigned long a) { + return __builtin_popcountl(a); } diff --git a/src/utils.h b/src/utils.h index 683c7a30..13a77faa 100644 --- a/src/utils.h +++ b/src/utils.h @@ -136,10 +136,6 @@ static inline int attr_const normalize_i_range(int i, int min, int max) { /// clamp `val` into interval [min, max] #define clamp(val, min, max) max2(min2(val, max), min) -static inline int attr_const popcountl(unsigned long a) { - return __builtin_popcountl(a); -} - /** * Normalize a double value to a specific range. * diff --git a/src/x.c b/src/x.c index 86b257b5..9db8e210 100644 --- a/src/x.c +++ b/src/x.c @@ -632,10 +632,10 @@ struct xvisual_info x_get_visual_info(xcb_connection_t *c, xcb_visualid_t visual return (struct xvisual_info){-1, -1, -1, -1, -1, 0}; } - int red_size = popcountl(pictfmt->direct.red_mask), - blue_size = popcountl(pictfmt->direct.blue_mask), - green_size = popcountl(pictfmt->direct.green_mask), - alpha_size = popcountl(pictfmt->direct.alpha_mask); + int red_size = popcntul(pictfmt->direct.red_mask), + blue_size = popcntul(pictfmt->direct.blue_mask), + green_size = popcntul(pictfmt->direct.green_mask), + alpha_size = popcntul(pictfmt->direct.alpha_mask); return (struct xvisual_info){ .red_size = red_size,