faster bcopy using duffs device

Steve Summit scs at hstbme.mit.edu
Sat Sep 9 15:20:22 AEST 1989


In article <14558 at haddock.ima.isc.com> karl at haddock.ima.isc.com (Karl Heuer) writes:
>In article <19473 at mimsy.UUCP> chris at mimsy.UUCP (Chris Torek) writes:
>>bcopy() should be written in assembly (on most processors), put in
>>a library, and forgotten about...
>
>Yes.  (And it should be called memcpy(), that being the standard name;

Actually, when ANSIifying code containing calls to bcopy, memmove
would be a safer replacement, unless or until you inspect the
code to see if the usage needs an overlap guarantee.  Under 4bsd,
at least (some versions, anyway), bcopy was guaranteed to work
correctly if the source and destination overlapped.  memmove has
this guarantee; memcpy does not.  (It seems it would have been
nice to add this guarantee to memcpy rather than cluttering the
library with another call...)

                                           Steve Summit



More information about the Comp.lang.c mailing list