a problem to solve

Scott David Daniels scott.daniels at acm.org
Mon Mar 27 17:46:51 CEST 2006

mensanator at aol.com wrote:

> And furthermore, having Python's bitwise operators
> is nice, but it's not nice enough. I need the bitwise
> functionality gmpy provides that's not available in
> Python: scan for position of least significant 1 or 0,
Cute tricks (artifact of two's complement notation):

     v & -v == isolated least significant bit of v

     math.log(v & -v, 2) == bit number of least significant bit.

--Scott David Daniels
scott.daniels at acm.org

More information about the Python-list mailing list