Skip to content

Instantly share code, notes, and snippets.

@JayXon
Created January 17, 2015 09:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JayXon/cd78addc5ed8c0fafb87 to your computer and use it in GitHub Desktop.
Save JayXon/cd78addc5ed8c0fafb87 to your computer and use it in GitHub Desktop.
Greatest Common Divisor
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