This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author josh.r
Recipients josh.r, mark.dickinson, vstinner
Date 2014-07-11.22:23:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1405117415.85.0.615063651451.issue21955@psf.upfronthosting.co.za>
In-reply-to
Content
On:  if (... a+b will not overflow ...) { 

Since you limited the optimization for addition to single digit numbers, at least for addition and subtraction, overflow is impossible. The signed twodigit you use for the result is guaranteed to be able to store far larger numbers than addition of single digits can produce. In fact, due to the extra wasted bit on large (30 bit) digits, if you used a fixed width 32 bit type for addition/subtraction, and a fixed width 64 bit type for multiplication, overflow would be impossible regardless of whether you used 15 or 30 bit digits.

On a related note: Presumably you should check if the abs(size) <= 1 like in longobject.c, not == 1, or you omit the fast path for 0. Doesn't come up much, not worth paying extra to optimize, but it costs nothing to handle it.
History
Date User Action Args
2014-07-11 22:23:35josh.rsetrecipients: + josh.r, mark.dickinson, vstinner
2014-07-11 22:23:35josh.rsetmessageid: <1405117415.85.0.615063651451.issue21955@psf.upfronthosting.co.za>
2014-07-11 22:23:35josh.rlinkissue21955 messages
2014-07-11 22:23:35josh.rcreate