[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen staging] xen/bitops: Further reduce the #ifdef-ary in generic_hweight64()



commit ff7e72a1cac7dfe33ea3c5a528debcead18e0b22
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Tue Jun 4 13:40:08 2019 +0100
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Tue Jun 4 14:43:51 2019 +0100

    xen/bitops: Further reduce the #ifdef-ary in generic_hweight64()
    
    This #ifdef-ary isn't necessary, and the logic can live in a plain if()
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 xen/include/xen/bitops.h | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/xen/include/xen/bitops.h b/xen/include/xen/bitops.h
index b512800dd9..dfb70417c2 100644
--- a/xen/include/xen/bitops.h
+++ b/xen/include/xen/bitops.h
@@ -184,10 +184,9 @@ static inline unsigned int generic_hweight8(unsigned int w)
 
 static inline unsigned int generic_hweight64(uint64_t w)
 {
-#if BITS_PER_LONG < 64
-    return generic_hweight32((unsigned int)(w >> 32)) +
-        generic_hweight32((unsigned int)w);
-#else
+    if ( BITS_PER_LONG < 64 )
+        return generic_hweight32(w >> 32) + generic_hweight32(w);
+
     w -= (w >> 1) & 0x5555555555555555ul;
     w =  (w & 0x3333333333333333ul) + ((w >> 2) & 0x3333333333333333ul);
     w =  (w + (w >> 4)) & 0x0f0f0f0f0f0f0f0ful;
@@ -199,7 +198,6 @@ static inline unsigned int generic_hweight64(uint64_t w)
     w += w >> 16;
 
     return (w + (w >> 32)) & 0xFF;
-#endif
 }
 
 static inline unsigned long hweight_long(unsigned long w)
--
generated by git-patchbot for /home/xen/git/xen.git#staging

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.