Re: [PATCH] ktime: Fix ktime_divns to do signed division

2015-05-02 Thread Trevor Cordes
On 2015-05-01 John Stultz wrote: > It was noted that the 32bit implementation of ktime_divns > was doing unsgined division adn didn't properly handle > negative values. > > This patch fixes the problem by checking and preserving > the sign bit, and then reapplying it if appropriate > after the div

Re: [PATCH] ktime: Fix ktime_divns to do signed division

2015-05-01 Thread Nicolas Pitre
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) { > +

Re: [PATCH] ktime: Fix ktime_divns to do signed division

2015-05-01 Thread John Stultz
On Fri, May 1, 2015 at 4:54 PM, Nicolas Pitre wrote: > On Fri, 1 May 2015, John Stultz wrote: > >> It was noted that the 32bit implementation of ktime_divns >> was doing unsgined division adn didn't properly handle >> negative values. >> >> This patch fixes the problem by checking and preserving >

Re: [PATCH] ktime: Fix ktime_divns to do signed division

2015-05-01 Thread Nicolas Pitre
On Fri, 1 May 2015, John Stultz wrote: > It was noted that the 32bit implementation of ktime_divns > was doing unsgined division adn didn't properly handle > negative values. > > This patch fixes the problem by checking and preserving > the sign bit, and then reapplying it if appropriate > after

Re: [PATCH] ktime: Fix ktime_divns to do signed division

2015-05-01 Thread John Stultz
Bah. I forgot to add [RFC] to the subject. This patch isn't yet ready for submission, I just wanted to get some initial feedback on it. thanks -john On Fri, May 1, 2015 at 3:41 PM, John Stultz wrote: > It was noted that the 32bit implementation of ktime_divns > was doing unsgined division adn di

[PATCH] ktime: Fix ktime_divns to do signed division

2015-05-01 Thread John Stultz
It was noted that the 32bit implementation of ktime_divns was doing unsgined division adn didn't properly handle negative values. This patch fixes the problem by checking and preserving the sign bit, and then reapplying it if appropriate after the division. Unfortunately there is some duplication