From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:44068) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SelIL-0001aU-26 for qemu-devel@nongnu.org; Wed, 13 Jun 2012 06:59:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SelIH-0002Vj-AY for qemu-devel@nongnu.org; Wed, 13 Jun 2012 06:59:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:22768) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SelIH-0002VN-1d for qemu-devel@nongnu.org; Wed, 13 Jun 2012 06:59:21 -0400 Message-ID: <4FD8727D.1070904@redhat.com> Date: Wed, 13 Jun 2012 12:59:09 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <4FD86E40.1000100@redhat.com> <4FD871B1.4000104@redhat.com> In-Reply-To: <4FD871B1.4000104@redhat.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC v0 6/8] xilinx dont cast to interface types with links List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Avi Kivity Cc: peter.maydell@linaro.org, aliguori@us.ibm.com, qemu-devel@nongnu.org, "Peter A. G. Crosthwaite" , paul@codesourcery.com, edgar.iglesias@gmail.com, afaerber@suse.de, john.williams@petalogix.com Il 13/06/2012 12:55, Avi Kivity ha scritto: >> > +#define INTERFACE_MAGIC ((GSList *) (intptr_t)0xBAD0BAD) >> > + >> > +static inline bool object_is_interface(Object *obj) { >> > + return obj->interfaces == INTERFACE_MAGIC; >> > +} > > Why play games? > > static GSList interface_magic; > > static inline bool object_is_interface(Object *obj) > { > return obj->interfaces == &interface_magic; > } Indeed that's beautiful. :) > though I think we can spare a bool (and developer's sanity) in Object. Yes, we could shrink the refcount to 16-bit and get place for some bitfields. Paolo