Re: [minor fix] radixtree: regulate tag get return value

From: Chuck Ebbert
Date: Sun Jun 04 2006 - 23:11:12 EST


In-Reply-To: <20060604131824.e2d1c934.akpm@xxxxxxxx>

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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/