From 0a40252c29437672f7d200e347ff6e9d805c3bcf Mon Sep 17 00:00:00 2001 From: Treeston Date: Mon, 12 Aug 2019 14:33:04 +0200 Subject: i am so done with compilers for today , WHY IS STD::SWAP NOT A CONSTEXPR ASDFOWQWDO (31b5632 7378bcb follow-up grml) --- src/common/Utilities/advstd.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/common') diff --git a/src/common/Utilities/advstd.h b/src/common/Utilities/advstd.h index d9776b02acb..9663bd91992 100644 --- a/src/common/Utilities/advstd.h +++ b/src/common/Utilities/advstd.h @@ -112,12 +112,13 @@ namespace advstd template constexpr std::enable_if_t && advstd::is_unsigned_v, std::common_type_t> gcd(T1 _m, T2 _n) { - std::common_type_t n = _n, m = _m; + using T = std::common_type_t; + T n=_n, m=_m, o; while (n) { - std::swap(m,n); - if (m <= n) - n %= m; + o = m; + m = n; + n = o%n; } return m; } -- cgit v1.2.3