Zero-fill shift
Gary D. Duzan
gduzan at bbn.com
Wed May 5 12:43:32 EDT 2004
In article <mailman.273.1083771861.25742.python-list at python.org>,
Daniel Orner <cs993442 at cs.yorku.ca> wrote:
>
>
> Great, this works. 8-) Unfortunately, I've run into another problem. In
>the Java algorithm, two integers are added. This often results in an
>overflow and a negative number, which is the desired result. However, I
>can't seem to duplicate that in Python, as adding two integers that are
>too large just results in a long (and using the int() method doesn't
>work). I've tried various solutions, but haven't come up with something
>that duplicates this behavior exactly.
You could try scattering "(foo) % 2**32" around wherever there
could be an overflow.
Gary Duzan
BBN Technologies
More information about the Python-list
mailing list