quickly comparing blocks of ints



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.

.



Relevant Pages

  • Re: is operator
    ... ints are immutable, it doesn't matter. ... the developers clearly decided it was worth it at the time. ...
    (comp.lang.python)
  • Re: bitwise operators
    ... infobahn wrote: ... > Chris Williams wrote: ...
    (comp.lang.c)
  • Re: Performance of signed vs unsigned types
    ... Typo: doubleshould be y ... which probably isn't worth it. ... Unless the campaign for 64-bit ints also demands more bits for double ...
    (comp.lang.c)