Created
April 9, 2013 07:03
-
-
Save forcewake/5343594 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int length = strA.Length; | |
if (length != strB.Length) | |
return false; | |
fixed (char* chPtr1 = &strA.m_firstChar) | |
fixed (char* chPtr2 = &strB.m_firstChar) | |
{ | |
char* chPtr3 = chPtr1; | |
char* chPtr4 = chPtr2; | |
while (length >= 10) | |
{ | |
if (*(int*)chPtr3 != *(int*)chPtr4 || *(int*)(chPtr3 + 2) != *(int*)(chPtr4 + 2) || (*(int*)(chPtr3 + 4) != *(int*)(chPtr4 + 4) || *(int*)(chPtr3 + 6) != *(int*)(chPtr4 + 6)) || *(int*)(chPtr3 + 8) != *(int*)(chPtr4 + 8)) | |
return false; | |
chPtr3 += 10; | |
chPtr4 += 10; | |
length -= 10; | |
} | |
while (length > 0 && *(int*)chPtr3 == *(int*)chPtr4) | |
{ | |
chPtr3 += 2; | |
chPtr4 += 2; | |
length -= 2; | |
} | |
return length <= 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment