11 lines
297 B
C++
11 lines
297 B
C++
#include <stdint.h>
|
|
|
|
/**
|
|
* @brief Calculate the greatest common divisor (GCD)
|
|
*
|
|
* @param a First integer
|
|
* @param b Second integer
|
|
* @return greatest common divisor between a and b
|
|
*/
|
|
constexpr uint64_t gcd(const uint64_t a, const uint64_t b) noexcept { return a == 0 ? b : gcd(b % a, a); }
|