Commit 612af3ad authored by Linus Torvalds's avatar Linus Torvalds

Make types of big integers in bitops.h explicit.

"sparse" warns about implicit type conversions that may cause
surprising results. Did you know that large decimal types have
different type conversions from large hexadecimals?
parent 429de1ee
...@@ -115,12 +115,12 @@ static inline unsigned long generic_hweight64(__u64 w) ...@@ -115,12 +115,12 @@ static inline unsigned long generic_hweight64(__u64 w)
generic_hweight32((unsigned int)w); generic_hweight32((unsigned int)w);
#else #else
u64 res; u64 res;
res = (w & 0x5555555555555555) + ((w >> 1) & 0x5555555555555555); res = (w & 0x5555555555555555ul) + ((w >> 1) & 0x5555555555555555ul);
res = (res & 0x3333333333333333) + ((res >> 2) & 0x3333333333333333); res = (res & 0x3333333333333333ul) + ((res >> 2) & 0x3333333333333333ul);
res = (res & 0x0F0F0F0F0F0F0F0F) + ((res >> 4) & 0x0F0F0F0F0F0F0F0F); res = (res & 0x0F0F0F0F0F0F0F0Ful) + ((res >> 4) & 0x0F0F0F0F0F0F0F0Ful);
res = (res & 0x00FF00FF00FF00FF) + ((res >> 8) & 0x00FF00FF00FF00FF); res = (res & 0x00FF00FF00FF00FFul) + ((res >> 8) & 0x00FF00FF00FF00FFul);
res = (res & 0x0000FFFF0000FFFF) + ((res >> 16) & 0x0000FFFF0000FFFF); res = (res & 0x0000FFFF0000FFFFul) + ((res >> 16) & 0x0000FFFF0000FFFFul);
return (res & 0x00000000FFFFFFFF) + ((res >> 32) & 0x00000000FFFFFFFF); return (res & 0x00000000FFFFFFFFul) + ((res >> 32) & 0x00000000FFFFFFFFul);
#endif #endif
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment