Re: [PATCH] Fix order_base_2(0)

From: Linus Torvalds
Date: Wed Dec 14 2011 - 18:55:56 EST


On Wed, Dec 14, 2011 at 3:40 AM, David Howells <dhowells@xxxxxxxxxx> wrote:
> The order_base_2() function is either wrongly documented or wrongly
> implemented.  In the preceding comment, it says that:
>
>        ob2(0) = 0

Let's just remove that comment. That's just crazy math and makes no
sense. Why would anybody do ilog2() on zero and expect anything valid?

At least "-1" would make a tiny amount as sense as an error return or
"underflow" or whatever. But returning 0 is just wrong. That's
ilog2(1), not 0.

Does anybody actually *want* order_base_2(0)?

Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/