Implement rseq_hweight_ulong with __builtin_popcountl
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 7 Mar 2024 17:32:36 +0000 (12:32 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 7 Mar 2024 17:32:36 +0000 (12:32 -0500)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I483d53c7c5402e034b8d468e0ed2ab048184f069

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.024538 seconds and 4 git commands to generate.