]> git.baikalelectronics.ru Git - kernel.git/commit
tile: fix bug where fls(0) was not returning 0
authorChris Metcalf <cmetcalf@tilera.com>
Fri, 25 May 2012 16:32:09 +0000 (12:32 -0400)
committerChris Metcalf <cmetcalf@tilera.com>
Fri, 25 May 2012 19:00:43 +0000 (15:00 -0400)
commit3b40c6ab94858685b63ce27133b836cdd0754555
tree951254ba2d3ed4fef376351c4ed68b06be3b928d
parent717c1368543cd221a6db5fbc2d9ef1996f9ea926
tile: fix bug where fls(0) was not returning 0

This is because __builtin_clz(0) returns 64 for the "undefined" case
of 0, since the builtin just does a right-shift 32 and "clz" instruction.
So, use the alpha approach of casting to u32 and using __builtin_clzll().

Cc: stable@vger.kernel.org
Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
arch/tile/include/asm/bitops.h