maths: remove gcd in favour of the std implementation
This commit is contained in:
parent
d00d724296
commit
d0f075108e
19
maths.hpp
19
maths.hpp
@ -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)
|
||||
{
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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 };
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user