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

Re: [Xen-devel] [PATCH 0/5] use mask operations instead of test_bit()



On Fri, 2015-10-02 at 11:10 +0200, Juergen Gross wrote:
> On 10/02/2015 11:03 AM, Dario Faggioli wrote:

> > That's a good idea, I think.
> 
> It's a fallout from a cleanup patch:
> 
> http://lists.xen.org/archives/html/xen-devel/2015-09/msg03184.html
> 

> > One question, can we introduce a __test_bit() macro/inline
> > function,
> > like Jan did with __set_bit?
> 
> In the thread mentioned above you'll find a discussion about exactly
> this idea between Jan and me.
> 
Ah, I see. Sorry, I missed it.

> > I've quickly-&-dirtily tested this:
> > 
> > #define __test_bit(nr, addr) ({  \
> >      unsigned _flags = 1 << nr;   \
> >      addr & _flags; \
> > })
> > 
> > and the result (I've checked a couple of cases) seems the same to
> > me.
> 
> The problem is the limited scope where this scheme is really working
> and
> is a better solution at the same time (nr must be a constant less
> than
> the numbers of bits of *addr).
> 
Right, so we could only use __test_bit() in a subset of the cases,
i.e., we won't gain that much more consistency... I see it now.

Regards,
Dario
-- 
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.