[issue19915] int.bit_at(n) - Accessing a single bit in O(1)

anon report at bugs.python.org
Tue Jun 24 06:11:20 CEST 2014


anon added the comment:

I think the case where i is negative can be handled by

bits_at(i, pos, width) = bits_at(~i, pos, width) ^ ((1 << width) - 1)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19915>
_______________________________________


More information about the Python-bugs-list mailing list