From: Tim Deegan Subject: Re: [PATCH] credit: track residual from divisions done during accounting Date: Tue, 26 Feb 2013 13:46:25 +0000 Message-ID: <20130226134625.GC93966@ocelot.phlegethon.org> References: <1361554003.16232.33.camel@Solace> <512B3CF702000078000C0AC6@nat28.tlf.novell.com> <512B4724.5000603@citrix.com> <512B594E02000078000C0BD1@nat28.tlf.novell.com> <512C9BD2.70903@eu.citrix.com> <512CAEA902000078000C10BF@nat28.tlf.novell.com> <20130226115229.GB93966@ocelot.phlegethon.org> <512CA3D3.3040002@citrix.com> <1361881287.7099.0.camel@hastur.hellion.org.uk> <512CB075.7050202@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <512CB075.7050202@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: George Dunlap Cc: Dario Faggioli , xen-devel , Ian Campbell , Jan Beulich , David Vrabel List-Id: xen-devel@lists.xenproject.org At 12:54 +0000 on 26 Feb (1361883253), George Dunlap wrote: > On 02/26/2013 12:21 PM, Ian Campbell wrote: > >On Tue, 2013-02-26 at 12:00 +0000, David Vrabel wrote: > >>On 26/02/13 11:52, Tim Deegan wrote: > >>>How about ASSERT(((typeof credits) val) == val) before the assignment? > > > >Why not just > > ASSERT(credits == val); /* Ensure we haven't truncated val */ > > I prefer this one to having "typeof credits" in the ASSERT. The main > thing is just to minimize the amount of effort a programmer has to > expend trying to figure out what's going on, so he can spend it on > something else. :-) Quite. It occurred to me afterwards that we could have a FITS_IN() macro for that purpose. Or, as mentioned, a comment. :) Tim.