python: unsigned 32 bit bitwise arithmetic
trying answer another post whose fortitude deals ip addresses netmasks, i got stranded plain bitwise arithmetic.
is there customary way, python, lift bitwise and, or, xor, operations presumption inputs "32 bit" (maybe negative) integers longs, outcome contingency enlarged operation [0, 2**32]?
in words, i need operative python reflection c bitwise operations between unsigned longs.
edit: specific emanate this:
>>> m = 0xffffff00 # netmask 255.255.255.0
>>> ~m
-4294967041l # wtf?! i wish 255
Comments
Post a Comment