[Python-Dev] 64 bit units in PyLong

2017-07-02 Thread Siyuan Ren
The current PyLong implementation represents arbitrary precision integers in units of 15 or 30 bits. I presume the purpose is to avoid overflow in addition , subtraction and multiplication. But compilers these days offer intrinsics that allow one to access the overflow flag, and to obtain the resul

Re: [Python-Dev] 64 bit units in PyLong

2017-07-03 Thread Victor Stinner
2017-07-03 6:52 GMT+02:00 Siyuan Ren : > The current PyLong implementation represents arbitrary precision integers in > units of 15 or 30 bits. I presume the purpose is to avoid overflow in > addition , subtraction and multiplication. But compilers these days offer > intrinsics that allow one to ac

Re: [Python-Dev] 64 bit units in PyLong

2017-07-05 Thread Mark Dickinson
On Mon, Jul 3, 2017 at 5:52 AM, Siyuan Ren wrote: > The current PyLong implementation represents arbitrary precision integers in > units of 15 or 30 bits. I presume the purpose is to avoid overflow in > addition , subtraction and multiplication. But compilers these days offer > intrinsics that all

Re: [Python-Dev] 64 bit units in PyLong

2017-07-05 Thread Mark Lawrence via Python-Dev
On 05/07/2017 20:05, Mark Dickinson wrote: Oh, and you'd have to rewrite the power algorithm, which currently depends on the size of a limb in bytes being a multiple of 5. :-) What is a limb, as my search foo has let me down? -- My fellow Pythonistas, ask not what our language can do for you

Re: [Python-Dev] 64 bit units in PyLong

2017-07-05 Thread Chris Angelico
On Thu, Jul 6, 2017 at 5:33 AM, Mark Lawrence via Python-Dev wrote: > On 05/07/2017 20:05, Mark Dickinson wrote: > >> Oh, and you'd have to rewrite the power algorithm, which currently >> depends on the size of a limb in bytes being a multiple of 5. :-) >> > > What is a limb, as my search foo has

Re: [Python-Dev] 64 bit units in PyLong

2017-07-05 Thread Gregory P. Smith
On Wed, Jul 5, 2017 at 12:05 PM Mark Dickinson wrote: > On Mon, Jul 3, 2017 at 5:52 AM, Siyuan Ren wrote: > > The current PyLong implementation represents arbitrary precision > integers in > > units of 15 or 30 bits. I presume the purpose is to avoid overflow in > > addition , subtraction and mu