In-Reply-To: <[email protected]>
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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]