|
From: | Paul Brook |
Subject: | Re: [Qemu-devel] [PATCH v6 2/4] cadence_ttc: initial version of device model |
Date: | Tue, 21 Feb 2012 13:04:17 +0000 |
User-agent: | KMail/1.13.7 (Linux/3.2.0-1-amd64; KDE/4.6.5; x86_64; ; ) |
> > +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
[Prev in Thread] | Current Thread | [Next in Thread] |