include/linux/bitops.h | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff -puN include/linux/bitops.h~hweight64-warning-fix include/linux/bitops.h --- 25/include/linux/bitops.h~hweight64-warning-fix 2003-06-04 11:35:36.000000000 -0700 +++ 25-akpm/include/linux/bitops.h 2003-06-04 11:36:24.000000000 -0700 @@ -110,17 +110,18 @@ static inline unsigned int generic_hweig static inline unsigned long generic_hweight64(u64 w) { +#if BITS_PER_LONG < 64 + return generic_hweight32((unsigned int)(w >> 32)) + + generic_hweight32((unsigned int)w); +#else u64 res; - if (sizeof(unsigned long) == 4) - return generic_hweight32((unsigned int)(w >> 32)) + - generic_hweight32((unsigned int)w); - res = (w & 0x5555555555555555) + ((w >> 1) & 0x5555555555555555); res = (res & 0x3333333333333333) + ((res >> 2) & 0x3333333333333333); res = (res & 0x0F0F0F0F0F0F0F0F) + ((res >> 4) & 0x0F0F0F0F0F0F0F0F); res = (res & 0x00FF00FF00FF00FF) + ((res >> 8) & 0x00FF00FF00FF00FF); res = (res & 0x0000FFFF0000FFFF) + ((res >> 16) & 0x0000FFFF0000FFFF); return (res & 0x00000000FFFFFFFF) + ((res >> 32) & 0x00000000FFFFFFFF); +#endif } static inline unsigned long hweight_long(unsigned long w) _