Hand optimized copying

Robert English renglish at hpisod1.HP.COM
Tue Oct 18 03:02:25 AEST 1988


/ g-rh at XAIT.Xerox.COM (Richard Harter) /  2:38 pm  Oct  7, 1988 /

> #define copy(dest,src,nb) {register char *a, *b; register int i;\
> a = dest; b = src;\
> for (i = (nb %7)+1; --i;) *a++ = *b++;\
> for (i = (nb>>3)+1; --i>0;) {\
> *a++ = *b++; *a++ = *b++; *a++ = *b++; *a++ = *b++;\
> *a++ = *b++; *a++ = *b++; *a++ = *b++; *a++ = *b++;\
> }}

Methinks that line 3 should read:

for (i = (nb & 07) + 1; --i;)...

( or " % 8" )

--bob--



More information about the Comp.lang.c mailing list