Dumb python questions

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Tue Aug 21 18:05:26 EDT 2001


19 Aug 2001 12:12:35 -0700, Paul Rubin <phr-n2001 at nightsong.com> pisze:

> The main bottleneck in C is integer multiplication.  Most computers
> have an integer multiply instruction that multiplies two words and
> gives a doubleword result (32*32->64 bits), so in asm you just use it.
> There's not a good way to code that portably in C, so you end up using
> four 16*16->32 multiplications instead of one 32*32->64
> multiplication.

Gcc is smart enough to compile
    (long long) an_int * (long long) another_int
to one imul instruction.

-- 
 __("<  Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/
 \__/
  ^^                      SYGNATURA ZASTĘPCZA
QRCZAK



More information about the Python-list mailing list