[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LFD.2.11.1505012008080.7750@knanqh.ubzr>
Date: Fri, 1 May 2015 20:14:23 -0400 (EDT)
From: Nicolas Pitre <nicolas.pitre@...aro.org>
To: John Stultz <john.stultz@...aro.org>
cc: linux-kernel@...r.kernel.org, Thomas Gleixner <tglx@...utronix.de>,
Josh Boyer <jwboyer@...hat.com>,
One Thousand Gnomes <gnomes@...rguk.ukuu.org.uk>
Subject: Re: [PATCH] ktime: Fix ktime_divns to do signed division
On Fri, 1 May 2015, John Stultz wrote:
> static inline u64 ktime_divns(const ktime_t kt, s64 div)
> {
> if (__builtin_constant_p(div) && !(div >> 32)) {
> - u64 ns = kt.tv64;
> + s64 ns = kt.tv64;
> + int neg = 0;
> +
> + if (ns < 0) {
> + neg = 1;
> + ns = -ns;
> + }
Minor comment: you could save some realestate with:
s64 ns = kt.tv64;
bool neg = (ns < 0);
if (neg)
ns = -ns;
Nicolas
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists