int(long(-sys.maxint-1)) fails on Linux

Tim Peters tim_one at email.msn.com
Sat Jul 24 00:23:32 EDT 1999


[Chad Netzer]
> ...
> Yeah, I noticed that the test seemed to be missing, and that lea
> probably shouldn't set any condition codes (and as you point out,
> it would be very bad if it did).  I am curious as to how the x<<1
> is computed be lea (I don't understand the
> 0x0(,%edx,2),%eax notation...

Well, the notation is awful, but about the best you can expect from a
brainless disassembler (the CISC Intel instructions have gazillions (give or
take a bundle) of variations, and a disassembler generally pumps out the
first template that matches the bits it's looking at -- regardless of
whether a *human* would write it that way).

Anyway, the lea is simply using a scaled-index addressing mode, with a 0
base, a 0 offset, and with %edx treated as a "scale by 2" (shift left by 1)
scaled index.

Check out this link:

http://www.comp.it.bton.ac.uk/burks/burks/language/asm/artofasm/artof001.htm

Arguably the best book on assembler programming ever written!  The chapters
on x86 addressing modes and LEA will chase the dark clouds away.

to-be-replaced-by-deep-depression-but-them's-the-breaks-ly y'rs  - tim






More information about the Python-list mailing list