Implement rseq_hweight_ulong with __builtin_popcountl
[librseq.git] / src / rseq-alloc-utils.h
index e486dcf7b7efffdc5fd9524d814df8b412b25da0..6a57c3d8f814756daf73bedbc72ae084a6507d8c 100644 (file)
@@ -110,11 +110,7 @@ long rseq_get_page_len(void)
 static inline
 int rseq_hweight_ulong(unsigned long v)
 {
-       int count;
-
-       for (count = 0; v; count++)
-               v &= v - 1;
-       return count;
+       return __builtin_popcountl(v);
 }
 
 #endif /* _RSEQ_ALLOC_UTILS_H */
This page took 0.02531 seconds and 4 git commands to generate.