assembler optimized integer overflow detection

Felix von Delius Delius at
Mon Aug 23 05:28:06 EDT 1999

Hi there,

I wondered how Python detects integer overflows and searched the
corresponding code snippets in Python's source (Objects/intobject.c).
Because ANSI-C can't detect int overflow errors, there are very strange
workarounds for all the basic arithmetic.

I asked myself if it will be a big performance boost when someone will
re-code this routines in assembler, because an overflow can be detected very
simply by checking a processor-flag after performing the operation. Has
someone done this already? What speedup-factor would an optimization of this
kind have to the average Python code? Is it worth the work? (Let's say for
Linux/i386 machines). I'm not an Intel-assembly guy (only M68K experience),
but I think this wouldn't be too much efford for an Intel hacker, is it?

Dipl.-Ing. Felix von Delius		Fon: 0911/4244-110
Projektleiter-IT				Fax: 0911/4244-100
EBox GmbH - Agentur für neue Medien	Mobil: 0172/8261220
Vordere Cramergasse 11		Email: delius at
D-90425 Nuernberg			Web:

More information about the Python-list mailing list