Re: quickly comparing blocks of ints



Faster way? Probably not.

Most modern compilers will optimize - and loops are quite fast.

--
---------------------------------------------------------------------
DataGet® & PocketLog® www.dataget.com
Data Collectors www.baxcode.com
--------------------------------------------------------------------



"Snis Pilbor" <snispilbor@xxxxxxxxx> wrote in message
news:1148680591.846291.311630@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hello,

In a time-intensive part of my code, I manually check if two
blocks of ints (of the same size) are identical. I do it in the
straightforward way...

bool compare_int_tables( int *intpointer1, int *intpointer2 )
{
int i;

for ( i = 0; i < size; i++ )
{
if ( intpointer1[i] != intpointer2[i] )
return FALSE;
}
return TRUE;
}


My question is, is there any faster way to do this? I am not very
familiar with what various chips various processors have, but is
checking blocks of generic data like this common enough that it's worth
using a special function from some .h file to do the above in hopes
that the compiler will relegate the work to some super-fast chip, or
something?

Thanks for help with this,
S.P.



.