Mail Archives: djgpp/1998/09/09/04:25:54
On Tue, 8 Sep 1998, Endlisnis wrote:
> I looked at the asm code generated for the div function, it
> doesn't look too optimal, it might be faster to use "/" and "%"
> instead.
As far as I can see, that's exactly what `div' does, except that it
also handles the case of a negative divisor (in the usual case, where
it's positive, you only pay two comparisons, which isn't a lot).
> The div function is more than 40 instructions
What matters is not the total number of instructions, but the number
of instructions that are actually executed in the usual case, see
above.
> or does it check for div by zero or something?
See the sources (IMHO, anybody who is serious about DJGPP programming
should have djlsr201.zip on their machine).
- Raw text -