Path: utzoo!attcan!uunet!husc6!xait!g-rh From: g-rh@XAIT.Xerox.COM (Richard Harter) Newsgroups: comp.lang.c Subject: Re: Hand optimized copying Message-ID: <35210@XAIT.Xerox.COM> Date: 18 Oct 88 15:41:42 GMT References: <34421@XAIT.Xerox.COM> <10130002@hpisod1.HP.COM> Reply-To: g-rh@XAIT.Xerox.COM (Richard Harter) Organization: Xerox Corporation, Cambridge, Massachusetts Lines: 25 In article <10130002@hpisod1.HP.COM> renglish@hpisod1.HP.COM (Robert English) writes: ]/ g-rh@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" ) You are correct -- it should read &7 rather than %7. %8 is slightly more expensive. The "%" is a typo. Also as noted previously, the variable a, b, and i should by replaced names specific to the macro, and dest, src, and nb should be in parenthesis. -- In the fields of Hell where the grass grows high Are the graves of dreams allowed to die. Richard Harter, SMDS Inc.