WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

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

To: ron minnich <rminnich@xxxxxxxx>
Subject: Re: [Xen-devel] question on the use of fs in evtchn.c
From: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx>
Date: Tue, 10 Aug 2004 09:41:01 +0100
Cc: xen-devel@xxxxxxxxxxxxxxxxxxxxx
Delivery-date: Tue, 10 Aug 2004 09:43:56 +0100
Envelope-to: steven.hand@xxxxxxxxxxxx
In-reply-to: <Pine.LNX.4.44.0408092235240.3107-100000@xxxxxxxxxxxxxxxxx>
List-archive: <http://sourceforge.net/mailarchive/forum.php?forum=xen-devel>
List-help: <mailto:xen-devel-request@lists.sourceforge.net?subject=help>
List-id: List for Xen developers <xen-devel.lists.sourceforge.net>
List-post: <mailto:xen-devel@lists.sourceforge.net>
List-subscribe: <https://lists.sourceforge.net/lists/listinfo/xen-devel>, <mailto:xen-devel-request@lists.sourceforge.net?subject=subscribe>
List-unsubscribe: <https://lists.sourceforge.net/lists/listinfo/xen-devel>, <mailto:xen-devel-request@lists.sourceforge.net?subject=unsubscribe>
References: <Pine.LNX.4.44.0408092235240.3107-100000@xxxxxxxxxxxxxxxxx>
Sender: xen-devel-admin@xxxxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.4i
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?

    christian



-------------------------------------------------------
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.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/xen-devel

<Prev in Thread] Current Thread [Next in Thread>