Jan Kiszka wrote:
> Gilles Chanteperdrix wrote:
>> Jan Kiszka wrote:
>>
>>> -#define test_claimed(owner) ((long) (owner) & 1)
>>> -#define clear_claimed(owner) ((xnthread_t *) ((long) (owner) & ~1))
>>> -#define set_claimed(owner, bit) \
>>> -        ((xnthread_t *) ((long) clear_claimed(owner) | !!(bit)))
>>> +#define __CLAIMED_BIT              XN_HANDLE_SPARE3
>>> +
>>> +#define test_claimed(owner)        xnhandle_test_spare(owner, 
>>> __CLAIMED_BIT)
>>> +#define clear_claimed(owner)       xnhandle_mask_spare(owner)
>>> +#define set_claimed(owner, bit) ({ \
>>> +   xnhandle_t __tmp = xnhandle_mask_spare(owner); \
>>> +   if (bit) \
>>> +           xnhandle_set_spare(__tmp, __CLAIMED_BIT); \
>>> +   __tmp; \
>>> +})
>> I liked doing this with no conditional.
> 
> You mean let the caller pass 'bit' as 0 or __CLAIMED_BIT (the latter
> would require some renaming then, I guess)?

the if is ok. I guess the compiler does !! with an if too...

-- 
                                                 Gilles.

_______________________________________________
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core

Reply via email to