maths: remove gcd in favour of the std implementation

This commit is contained in:
Danny Robson 2018-03-11 15:21:36 +11:00
parent d00d724296
commit d0f075108e
3 changed files with 2 additions and 21 deletions

View File

@ -416,25 +416,6 @@ namespace util {
///////////////////////////////////////////////////////////////////////////////
// factorisation
template <typename T>
constexpr T
gcd (T a, T b)
{
assert (a);
assert (b);
while (a != b) {
if (a > b)
a -= b;
else if (b > a)
b -= a;
}
return a;
}
//-----------------------------------------------------------------------------
template <typename T>
const T&
identity (const T& t)
{

View File

@ -28,7 +28,7 @@ bool is_coprime (T M, T C)
{
if (M == 0)
return true;
if (util::gcd (M, C) == 1u)
if (std::gcd (M, C) == 1u)
return true;
return false;
}

View File

@ -109,7 +109,7 @@ template <typename T>
rational<T>
rational<T>::reduced (void) const
{
auto x = gcd (abs (n), abs (d));
auto x = std::gcd (abs (n), abs (d));
return { n / x, d / x };
}