> From: Gabriel Bouvigne [mailto:[EMAIL PROTECTED]]
> 
> The following loop is faster than array, both on hppa 
> processors using g++,
> pentium, celeron and pIII using both egcs and msvc++:
> 
> for (i=len,  p=(array+i); i--; )
>     sum+=*--p;
> 
> Descending loops with pointer use have always shown to be faster than
> arrays. I use them a lot in image processing.

Indexing in reverse order is a separate issue. When I compare your version
with

  for (i = len; i--;)
    sum += array[i];

under both MSVC and gcc 2.95/i386, the array version is actually slightly
faster.

-- Mat.
--
MP3 ENCODER mailing list ( http://geek.rcc.se/mp3encoder/ )

Reply via email to