[Spice-devel] [spice-server 1/3] utils: Remove get/set/clear_bit

Christophe Fergeau cfergeau at redhat.com
Fri Oct 5 06:56:16 UTC 2018


On Thu, Oct 04, 2018 at 01:42:23PM -0400, Frediano Ziglio wrote:
> > -static inline void set_bit(int index, uint32_t *addr)
> > -{
> > -    uint32_t mask = 1 << index;
> > -    __sync_or_and_fetch(addr, mask);
> > -}
> > -
> > -static inline void clear_bit(int index, uint32_t *addr)
> > -{
> > -    uint32_t mask = ~(1 << index);
> > -    __sync_and_and_fetch(addr, mask);
> > -}
> > -
> > -static inline int test_bit(int index, uint32_t val)
> > -{
> > -    return val & (1u << index);
> > -}
> >  /* a generic safe for loop macro  */
> >  #define SAFE_FOREACH(link, next, cond, ring, data, get_data)            \
> >      for ((((link) = ((cond) ? ring_get_head(ring) : NULL)),             \
> 
> I prefer them in utils.h, they don't have something to do specifically
> with qxl interface.

That's true, on the other hand, these are not methods we want to use
outside of the QXL interface.

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20181005/bfb6f2f6/attachment.sig>


More information about the Spice-devel mailing list