Bitwise 'AND' error?

Rich J crj003 at yahoo.com
Thu Jun 21 17:40:08 EDT 2001


Could someone please explain to me why this is giving these results.
This is taken directly from the python interpreter.

>>> long = 0x2964619C7L
>>> mask = 0xFFFFFFFF
>>> ling = long & mask
>>> print 'new number = %#x' % ling
new number = 0x2964619c7
>>> ling
11111111111L
>>> long
11111111111L
>>> 

Why would 'anding' with this mask give back the same number? It should
have given back 0x964619C7, right? Or am I losing my mind?



More information about the Python-list mailing list