Compute the greatest common divisor of \a a and \a b
| 86 | |
| 87 | /// Compute the greatest common divisor of \a a and \a b |
| 88 | inline int |
| 89 | gcd(int a, int b) { |
| 90 | if (b > a) |
| 91 | std::swap(a,b); |
| 92 | while (b > 0) { |
| 93 | int t = b; b = a % b; a = t; |
| 94 | } |
| 95 | return a; |
| 96 | } |
| 97 | |
| 98 | |
| 99 |