]> git.karo-electronics.de Git - karo-tx-linux.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 1 Jun 2012 07:15:53 +0000 (15:15 +0800)
commit55dfa192b4b01123e289f8435dd15cd3717c3698
tree04e22a542c114b29fc021ec3b417b38ba0f58fa2
parent83f5ec1fcfbaca44ac717f790170d66d3750e3c3
tile: fix bug where fls(0) was not returning 0

commit 9f1d62bed7f015d11b9164078b7fea433b474114 upstream.

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().

Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/tile/include/asm/bitops.h