Re: [Python-Dev] Optionally using GMP to implement long if available

2008-11-10 Thread Nick Craig-Wood
Tim Peters <[EMAIL PROTECTED]> wrote: > > And for 32x32 -> 64, can't this simply be replaced by "(uint64_t)i * j", > > where uint64_t is as in C99? I'd hope that most compilers would > > manage to turn this into the appropriate 32x32-bit hardware multiply. > > 1. That's C99, not C89, and therefo

Re: [Python-Dev] Optionally using GMP to implement long if available

2008-11-10 Thread Mark Dickinson
On Mon, Nov 10, 2008 at 4:26 PM, Nick Craig-Wood <[EMAIL PROTECTED]> wrote: > > Looking at the assembler it produces (x86) > > mul: >pushl %ebp >xorl%edx, %edx >movl%esp, %ebp >movl12(%ebp), %eax >imull 8(%ebp), %eax >popl%ebp >

Re: [Python-Dev] Optionally using GMP to implement long if available

2008-11-10 Thread Mark Dickinson
Here's the test code I was using, modeled on the basic operation that longobject needs: multiply two digits together and extract high and low digits from the result. typedef uint32_t digit; typedef uint64_t twodigits; #define SHIFT 30 #define MASK (((digit)1 << SHIFT) - 1) /* multiply a and b,