summaryrefslogtreecommitdiff
path: root/lib/igt_aux.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/igt_aux.h')
-rw-r--r--lib/igt_aux.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/igt_aux.h b/lib/igt_aux.h
index 43dd15fe..faddd478 100644
--- a/lib/igt_aux.h
+++ b/lib/igt_aux.h
@@ -385,4 +385,9 @@ static inline bool igt_list_empty(const struct igt_list *list)
&pos->member != (head); \
pos = tmp, tmp = igt_list_next_entry(pos, member))
+#define igt_hweight(x) \
+ __builtin_choose_expr(sizeof(x) == 8, \
+ __builtin_popcountll(x), \
+ __builtin_popcount(x))
+
#endif /* IGT_AUX_H */