WPILibC++ 2023.4.3-108-ge5452e3
gcd.hpp File Reference

Go to the source code of this file.

Namespaces

namespace  internal
 

Functions

template<typename T >
constexpr T internal::gcd_recur (const T a, const T b) noexcept
 
template<typename T , typename std::enable_if< std::is_integral< T >::value >::type * = nullptr>
constexpr T internal::gcd_int_check (const T a, const T b) noexcept
 
template<typename T1 , typename T2 , typename TC = common_t<T1,T2>>
constexpr TC internal::gcd_type_check (const T1 a, const T2 b) noexcept
 
template<typename T1 , typename T2 >
constexpr common_t< T1, T2 > gcd (const T1 a, const T2 b) noexcept
 Compile-time greatest common divisor (GCD) function. More...
 

Function Documentation

◆ gcd()

template<typename T1 , typename T2 >
constexpr common_t< T1, T2 > gcd ( const T1  a,
const T2  b 
)
constexprnoexcept

Compile-time greatest common divisor (GCD) function.

Parameters
aintegral-valued input.
bintegral-valued input.
Returns
the greatest common divisor between integers a and b using a Euclidean algorithm.