[Python-Dev] Memory size overflows
Tim Peters
tim.one@comcast.net
Thu, 17 Oct 2002 18:29:39 -0400
[Gerald S. Williams]
> Well, I was done tweaking, but then I decided to try out one more
> performance tweak. This is in desperate need of commenting, but
> it's finally faster than checking via division on my machine:
> ...
If you've actually got the energy to time these things <wink>, how about
adapting the int-mul overflow checking code in Python's intobject.c's
int_mul() function too? The CVS (ditto 2.2.2) version
+ does rely on floating point
+ doesn't use division
+ does work for signed integral types
+ doesn't assume that the number of mantissa bits in a double
is enough to hold a full-precision integral product
+ does assume that the largest integral product is within the
dynamic range of a double
It could be simplified a little if it were specialized to unsigned mult.