Skip to contentSkip to conversation

radixtree: regulate tag get return value

minor fix Chuck Ebbert 1 participant 1 message Jun 5, 2006

lore
Share & tools
lore
#0 lore raw

In-Reply-To: <[email protected]>

Quoted 1 line · Andrew Morton

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.

Signature · 1 line
Chuck