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