← Back to context

Comment by feelin_googley

9 years ago

"Note that in 32-bit code, memcpy is typically implemented by first copying blocks of 4 bytes using the movsd (move double word) instruction, while any remaining bytes are then copied using movsb (move byte)."

Some software authors do not use memcpy().

https://marc.info/?l=djbdns&m=96477313901746&w=2

http://cr.yp.to/lib/byte.html

   #include "byte.h"

   void byte_copy(to,n,from)
   register char *to;
   register unsigned int n;
   register char *from;
   {
     for (;;) {
       if (!n) return; *to++ = *from++; --n;
       if (!n) return; *to++ = *from++; --n;
       if (!n) return; *to++ = *from++; --n;
       if (!n) return; *to++ = *from++; --n;
     }
   }