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

Re: [Xen-devel] question on the use of fs in evtchn.c

On Mon, Aug 09, 2004 at 10:40:10PM -0600, ron minnich wrote:
> The problem is that ffs will return -1 if l1 is 0. Yeah, I know, unlikely,
> but if it ever happens that l1 or l2 are 0, well, you're in for a fun
> time. In any event, the loop condition holds for both a valid result and 
> an error, which may not be what you really want to do. 

If you look at the definition of ffs in xen/include/asm-x86/bitops.h,
you'll see that we return 0 in the "error" case (i.e. input was 0).

> In the plan 9 port this is:
>        while ( (l1i = ffs(l1)) > 0 )

If your ffs indeed returns -1 if l1 is 0, shouldn't your test be >= 0?
Or does it never return 0?


SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
Xen-devel mailing list



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