diff options
Diffstat (limited to 'src/lib/util/coretmpl.h')
-rw-r--r-- | src/lib/util/coretmpl.h | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/src/lib/util/coretmpl.h b/src/lib/util/coretmpl.h index a06c4fb8a46..e2e221e7374 100644 --- a/src/lib/util/coretmpl.h +++ b/src/lib/util/coretmpl.h @@ -25,6 +25,7 @@ #include <list> #include <map> #include <memory> +#include <numeric> #include <set> #include <stdexcept> #include <tuple> @@ -1050,18 +1051,11 @@ constexpr std::enable_if_t<std::is_signed<T>::value, T> iabs(T v) noexcept } -// returns greatest common divisor of a and b using the Euclidean algorithm -template <typename M, typename N> -constexpr std::common_type_t<M, N> euclid_gcd(M a, N b) -{ - return b ? euclid_gcd(b, a % b) : a; -} - // reduce a fraction template <typename M, typename N> inline void reduce_fraction(M &num, N &den) { - auto const div(euclid_gcd(num, den)); + auto const div(std::gcd(num, den)); if (div) { num /= div; @@ -1069,6 +1063,6 @@ inline void reduce_fraction(M &num, N &den) } } -}; // namespace util +} // namespace util #endif // MAME_UTIL_CORETMPL_H |