Created
January 17, 2015 09:57
-
-
Save JayXon/cd78addc5ed8c0fafb87 to your computer and use it in GitHub Desktop.
Greatest Common Divisor
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
uint64_t gcd(uint64_t n1, uint64_t n2) | |
{ | |
while (n2) | |
swap(n1 %= n2, n2); | |
return n1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment