On Feb 2, 2006, at 7:11 PM, Bengt Richter wrote: > [1] To reduce all this eye-glazing discussion to a simple example, > how do people now > use hex notation to define an integer bit-mask constant with bits > 31 and 2 set?
That's easy: 0x80000004 That was broken in python < 2.4, though, so there you need to do: MASK = 2**32 - 1 0x80000004 & MASK > (assume 32-bit int for target platform, counting bit 0 as LSB and > bit 31 as sign). The 31st bit _isn't_ the sign bit in python and the bit-ness of the target platform doesn't matter. Python's integers are arbitrarily long. I'm not sure why you're trying to pretend as if python was C. James _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com