Re: Cost of calling a standard library function

From: C (blackmarlin_at_asean-mail.com)
Date: 03/03/04


Date: 3 Mar 2004 13:12:54 -0800


"Beth" <BethStone21@hotmail.NOSPICEDHAM.com> wrote in message news:<Itm1c.87$2F6.40@newsfep3-gui.server.ntli.net>...

> Why "sub ecx 1" rather than "dec ecx"? It would be shorter
> (just a single byte opcode :) and doesn't need the access
> for the immediate of "1" stored inside the instruction
> (stored as byte or dword? We'd know if we used Herbert's
> syntax or AT&T...not that it should matter too much

I do not know if this was HAW's reason, but the Intel
optimisation manual recommends 'SUB reg, byte 1' over
'DEC reg'. I covered the reasons for this in my
recent contribution to the "Best integer to string
routines" thread, no need to repeat myself here.

C
2004-03-03