Fast GCD

a guest Mar 7th, 2015 526 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. template<typename T>
  2. T gcd(T a, T b) {
  3.     while((a %= b) && (b %= a));
  4.     return a | b;
  5. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand