Challenge: Fastest way to compare 2 byte arrays

4 replies [Last post]
SX Retired
Joined: 2008/10/09

I've looked this up maybe 15 times in the past 3 months alone. I've personally implemented it 3 different ways but I'm not convinced they're fast enough. I'm curious what SX would say.

What's the fastest way to compare 2 byte arrays to determine if they're equal?

Basically - I want you to implement this interface:

int AreEqual (unsigned char * A, unsigned char * B);

return 1 if equal, 0 if not.