lkml.org 
[lkml]   [2006]   [Jun]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [minor fix] radixtree: regulate tag get return value
In-Reply-To: <20060604131824.e2d1c934.akpm@osdl.org>

On Sun, 4 Jun 2006 13:18:24 -0700, Andrew Morton wrote:

> test_bit() returns (1 & (expr)) - it _has_ to return 0 or 1.

On i386, test_bit(nr, addr) will return 0 or 1 only when nr is
a constant -- it uses (expr != 0).

If nr is a variable it will return either 0 or -1 because it uses:

__asm__ __volatile__(
"btl %2,%1\n\tsbbl %0,%0"
:"=r" (oldbit)
:"m" (*addr),"Ir" (nr));
return oldbit;

btl %2,%1 sets the carry flag if the selected bit is set.

sbbl %0,%0 subtracts a register from itself and then subtracts one
from the result if the carry flag is set.

--
Chuck

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-06-05 05:14    [W:0.022 / U:0.884 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site