Possible Duplicate:
Problem in calculating checksum : casting int to signed int32
This should be a relatively easy answer, I just don't really know how to search for it...I got a few semi-relevant things, but nothing that fits what I'm trying to do.
>>> 1171855803 << 7
149997542784L # I want -326312576
In other words, treat the number as an integer and don't allow it to convert to a long. How would I do this?
I tried the solution in this question:
>>> x = 0xFFFFFFFF & (1171855803 << 7)
>>> if x > 0x7FFFFFFF: print -(~(x - 1) & 0xFFFFFFFF)
else: print x
-326312576L # yay!
It works!