Unsigned integer arithmetic
thomas.heller at ion-tof.com
Wed Apr 26 11:44:39 CEST 2000
> Hi all,
> I'm having a lot of trouble with arithmetic manipulation of numbers above
> 0x7fffffff. Whilst an integer is represented in a 32 bit word, as you'd
> expect, 0x80000000 - 0xffffffff are treated as negative numbers. However,
> want to treat a 32 bit number as an unsigned value, and be able to do i =
> + 1 for an integer number above 0x7fffffff without getting an overflow.
What about writing an Uint32 class? You could implement __add__, __hex__,
and so on...
More information about the Python-list