All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Brook <paul@codesourcery.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: monstr@monstr.eu, qemu-devel@nongnu.org,
	John Linn <john.linn@xilinx.com>,
	"Peter A. G. Crosthwaite" <peter.crosthwaite@petalogix.com>,
	duyl@xilinx.com, linnj@xilinx.com, edgar.iglesias@gmail.com,
	afaerber@suse.de, john.williams@petalogix.com
Subject: Re: [Qemu-devel] [PATCH v6 2/4] cadence_ttc: initial version of device model
Date: Tue, 21 Feb 2012 13:04:17 +0000	[thread overview]
Message-ID: <201202211304.18584.paul@codesourcery.com> (raw)
In-Reply-To: <CAFEAcA94=MZxFhh3b-H8vMrcMOq2qsmiO_w2EjGT0vLpr3CjAQ@mail.gmail.com>

> > +static inline int64_t is_between(int64_t x, int64_t a, int64_t b)
> > +{
> > +    if (a < b) {
> > +        return x > a && x <= b;
> > +    }
> > +    return x < a && x >= b;
> > +}
> 
> This looks slightly odd -- should the boundary condition for whether
> a value equal to the max/min really change depending on :whether a
> or b is greater?

This is a ugly hack.  Instead of figuring out whether we have a count-up or 
count-down timer the code checks for both, and have the "in_between" function 
magically DTRT.  I haven't followed the paths through in enough detail to 
figure out whether it gets all the corner cases right.

Paul

  reply	other threads:[~2012-02-21 13:04 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-20  1:45 [Qemu-devel] [PATCH v6 0/4] Zynq-7000 EPP platform model Peter A. G. Crosthwaite
2012-02-20  1:37 ` Peter Crosthwaite
2012-02-20  1:45 ` [Qemu-devel] [PATCH v6 1/4] cadence_uart: initial version of device model Peter A. G. Crosthwaite
2012-02-20 18:58   ` Peter Maydell
2012-02-23  1:41     ` Peter Crosthwaite
2012-02-20  1:45 ` [Qemu-devel] [PATCH v6 2/4] cadence_ttc: " Peter A. G. Crosthwaite
2012-02-20 19:32   ` Peter Maydell
2012-02-21 13:04     ` Paul Brook [this message]
2012-02-23  1:24       ` Peter Crosthwaite
2012-02-27 15:45         ` Paul Brook
2012-02-28  1:04           ` Peter Crosthwaite
2012-02-28  1:55             ` Peter Crosthwaite
2012-02-28 12:07             ` Paul Brook
2012-02-28 13:42               ` Peter Crosthwaite
2012-02-23  1:42     ` Peter Crosthwaite
2012-02-20  1:45 ` [Qemu-devel] [PATCH v6 3/4] cadence_gem: " Peter A. G. Crosthwaite
2012-02-20  1:45 ` [Qemu-devel] [PATCH v6 4/4] xilinx_zynq: machine model initial version Peter A. G. Crosthwaite
2012-02-20  6:25 ` [Qemu-devel] [PULL] Zynq-7000 EPP platform model Peter Crosthwaite
2012-02-20  7:24   ` Andreas Färber
2012-02-24 16:37   ` Anthony Liguori
2012-02-27  4:31     ` Peter Crosthwaite

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=201202211304.18584.paul@codesourcery.com \
    --to=paul@codesourcery.com \
    --cc=afaerber@suse.de \
    --cc=duyl@xilinx.com \
    --cc=edgar.iglesias@gmail.com \
    --cc=john.linn@xilinx.com \
    --cc=john.williams@petalogix.com \
    --cc=linnj@xilinx.com \
    --cc=monstr@monstr.eu \
    --cc=peter.crosthwaite@petalogix.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.