Messages in this thread | | | Date | Fri, 1 May 2015 20:14:23 -0400 (EDT) | From | Nicolas Pitre <> | 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
| |