Re: [RFC][PATCH 0/5] Fixes for abs() usage on 64bit values
From: Linus Torvalds
Date: Tue Sep 15 2015 - 19:43:21 EST
On Mon, Sep 14, 2015 at 10:20 PM, Ingo Molnar <mingo@xxxxxxxxxx> wrote:
>
> Linus, any preferences?
I like the "auto-expand to 64-bit when necessary", but yes, that thing
needs to continue to use a signed type. Using __builtin_choose_expr()
would seem to be the right thing to do (not Andrew's version that
makes the return type be s64 unconditionally).
Just a quick grep shows that we currently use "abs()" on unsigned long
and we expect it to be a signed comparison with zero, so the "simple"
typeof that John suggested definitely will not work.
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/