Created
August 9, 2016 01:44
-
-
Save zhenlinyang/2fab34b8520b2996fedd89fc5be7c2ec to your computer and use it in GitHub Desktop.
Data Matrix Matching Check
This file contains hidden or 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
/// <summary> | |
/// Data Matrix Matching Check | |
/// </summary> | |
/// <param name="u1"></param> | |
/// <param name="u2"></param> | |
/// <param name="num">Maxdiff</param> | |
public static bool Match(ulong u1, ulong u2, byte num) | |
{ | |
for (u1 ^= u2; 0 != u1 && 0 != num; num--) | |
{ | |
u1 &= (u1 - 1); | |
} | |
return 0 == u1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment