linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nicolas Pitre <nicolas.pitre@linaro.org>
To: John Stultz <john.stultz@linaro.org>
Cc: linux-kernel@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>,
	Josh Boyer <jwboyer@redhat.com>,
	One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>
Subject: Re: [PATCH] ktime: Fix ktime_divns to do signed division
Date: Fri, 1 May 2015 20:14:23 -0400 (EDT)	[thread overview]
Message-ID: <alpine.LFD.2.11.1505012008080.7750@knanqh.ubzr> (raw)
In-Reply-To: <1430520085-24535-1-git-send-email-john.stultz@linaro.org>

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

  parent reply	other threads:[~2015-05-02  0:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-01 22:41 [PATCH] ktime: Fix ktime_divns to do signed division John Stultz
2015-05-01 22:43 ` John Stultz
2015-05-01 23:54 ` Nicolas Pitre
2015-05-02  0:00   ` John Stultz
2015-05-02  0:14 ` Nicolas Pitre [this message]
2015-05-02  8:31 ` Trevor Cordes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LFD.2.11.1505012008080.7750@knanqh.ubzr \
    --to=nicolas.pitre@linaro.org \
    --cc=gnomes@lxorguk.ukuu.org.uk \
    --cc=john.stultz@linaro.org \
    --cc=jwboyer@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).