qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC v0 6/8] xilinx dont cast to interface types with l


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [RFC v0 6/8] xilinx dont cast to interface types with links
Date: Wed, 13 Jun 2012 12:59:09 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120605 Thunderbird/13.0

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]