EW>Herman, you wrote to Darin McBride:
HS> Since you obviously fail to comprehend this I shall demonstrate.
HS> Loop1 :-
HS> #define bSize(99999)
EW>There isn't anything to optimize. Macro parameters should be
EW>identifiers. ;-)
HS> Oh, but you being so proffessional and all, you probably
HS> implement loops that look like this..
HS> Loop2 :-
EW>I would use memcpy() since I know the arrays don't overlap. It is
EW>shorter, better readable and probably faster.
HS> Loop3 :-
EW>Why waste all that precious space, watch your cache and use Duff's
EW>device
I did use Duffs device. Look at the message again if you doubt.
EW>/* original code by Tom Duff, adapted from the Jargon File */
EW>/* I am not sure whether it is PD */
EW> int n = (bufSize+3)/4;
EW> char *to=buf1, *from=buf2;
EW> assert ( bufSize > 0 );
EW> switch ( bufSize % 4 )
EW> {
EW> case 0: do { *to++ = *from++;
EW> case 3: *to++ = *from++;
EW> case 2: *to++ = *from++;
EW> case 1: *to++ = *from++;
EW> } while ( n-- > 0 );
EW> }
EW>Bye,
EW> Erik
... I'm not dead, I'm metabolically challenged.
--- Ezycom V1.48g0 01fd016b
---------------
* Origin: Fox's Lair BBS Bris Aus +61-7-38033908 V34+ Node 2 (3:640/238)
|