MCPcopy Create free account
hub / github.com/Gecode/gecode / gcd

Function gcd

gecode/int/linear/post.hpp:88–96  ·  view source on GitHub ↗

Compute the greatest common divisor of \a a and \a b

Source from the content-addressed store, hash-verified

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

Callers 1

normalizeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected