From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH 1 of 3 v4/leftover] libxl: enable automatic placement of guests on NUMA nodes Date: Tue, 17 Jul 2012 16:59:15 +0100 Message-ID: <1342540755.16704.11.camel@zakaz.uk.xensource.com> References: <0411b2cebd725b193465.1341932614@Solace> <20485.35590.105351.434937@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20485.35590.105351.434937@mariner.uk.xensource.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: Ian Jackson Cc: Andre Przywara , Stefano Stabellini , George Dunlap , Juergen Gross , xen-devel , Dario Faggioli List-Id: xen-devel@lists.xenproject.org On Tue, 2012-07-17 at 16:55 +0100, Ian Jackson wrote: > > +/* Subtract two values and translate the result in [0, 1] */ > > +static double normalized_diff(double a, double b) > > +{ > > +#define max(a, b) (a > b ? a : b) > > + if (!a && a == b) > > + return 0.0; > > + return (a - b) / max(a, b); > > +} > > 1. This macro max() should be in libxl_internal.h. > 2. It should be MAX so people are warned it's a macro > 3. It should have all the necessary ()s for macro precedence safety You probably also want to do the necessary tricks to avoid multiple evaluation of the arguments?