Path: utzoo!utgpu!water!watmath!clyde!att-cb!osu-cis!tut.cis.ohio-state.edu!im4u!ut-sally!utah-cs!utah-gr!uplherc!sp7040!obie!wes From: wes@obie.UUCP (Barnacle Wes) Newsgroups: comp.lang.c Subject: Re: strcpy wars, jeez! A proposed resolution. Summary: strcpy on 80*86 is pretty easy to make fast... Message-ID: <151@obie.UUCP> Date: 13 Apr 88 14:40:28 GMT References: <7712@apple.Apple.Com> <7485@brl-smoke.ARPA> <10731@mimsy.UUCP> <858@cresswell.quintus.UUCP> Organization: the Well of Souls Lines: 18 In article <858@cresswell.quintus.UUCP>, ok@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