strcpy wars, jeez! A proposed resolution.

Barnacle Wes wes at obie.UUCP
Thu Apr 14 00:40:28 AEST 1988


In article <858 at cresswell.quintus.UUCP>, ok at quintus.UUCP (Richard A. O'Keefe) writes:
> A lot of C programmers use 80*86s.  What about them?  Well, strict
> left-to-right copying has the advantage of not having to fiddle with
> the direction flag...

Actually, a left-to-right strcpy is pretty easy to do on the 286 and
386: you find the end of the string with REPNZ SCASB, subtract to find
the length which you put in CX, and do the move with REP MOVSB.  On
the 286, that limits you to 64K strings, and will puke going over
segment boundaries, but then you have lots of other limitations with
the 286 anyhow.  I'll still bet this is faster than the code generated
by MOST 286 compilers; I *know* it's faster than what is in
MicroPork's C library :-).
-- 
    /\              -  "Against Stupidity,  -    {backbones}!
   /\/\  .    /\    -  The Gods Themselves  -  utah-cs!utah-gr!
  /    \/ \/\/  \   -   Contend in Vain."   -  uplherc!sp7040!
 / U i n T e c h \  -       Schiller        -     obie!wes



More information about the Comp.lang.c mailing list