The hunt for the fastest Hamming Distance C implementation [duplicate]
This question already has an answer here: Bit Operation For Finding String Difference 6 answers I want to find how many different characters two strings of equal length have. I have found that xoring algorithms are considered to be the fastest, but they return distance expressed in bits. I want the results expressed in characters. Suppose that "pet" and "pit" have distance 1 expressed in characters but 'e' and 'i' might have two different bits, so xoring returns 2. The function i wrote is: // na = length of both strings unsigned int HammingDistance(const char* a, unsigned int na, const char* b