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

Frediano Ziglio fziglio at redhat.com
Mon Oct 8 07:33:15 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
> 

I prefer them in utils.h.

Frediano


More information about the Spice-devel mailing list