Hello!

> > Huh, what should do endianity have in common with the choice of 
> > pre-/postincrement?
> 
> Because most archs that can deal with preinc. are big endian, the
> for loop is important too. Decrement and test for zero is basically free.

If GCC generates obviously suboptimal code on some platform, fix GCC or at
least file a bug report. Trying to outwit the compiler by re-arranging the
source code in various magical ways can work only with specific combinations
of compiler + version + platform, so your code will need constant monitoring
and updating as the compilers evolve, which is a maintenance disaster.

If this function is a real hot spot, let us code it in assembly for the
platforms on which GCC does not do a good job. But only if a profile shows
that the checksumming functions are a real hot spot. Otherwise let's keep
the code simple and straightforward.

So before suggesting more changes, please show us the profile.

Howgh.

                                Have a nice fortnight
-- 
Martin `MJ' Mares                          <m...@ucw.cz>   http://mj.ucw.cz/
Faculty of Math and Physics, Charles University, Prague, Czech Rep., Earth
MIPS: Meaningless Indicator of Processor Speed.

Reply via email to