mirror of
https://github.com/TomHarte/CLK.git
synced 2024-07-22 15:28:56 +00:00
Mildly simplified syntax.
This commit is contained in:
parent
70af075012
commit
9e975a46a2
@ -9,15 +9,15 @@
|
|||||||
#ifndef Factors_hpp
|
#ifndef Factors_hpp
|
||||||
#define Factors_hpp
|
#define Factors_hpp
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
namespace NumberTheory {
|
namespace NumberTheory {
|
||||||
/*!
|
/*!
|
||||||
@returns The greatest common divisor of @c a and @c b as computed by Euclid's algorithm.
|
@returns The greatest common divisor of @c a and @c b as computed by Euclid's algorithm.
|
||||||
*/
|
*/
|
||||||
template<class T> T greatest_common_divisor(T a, T b) {
|
template<class T> T greatest_common_divisor(T a, T b) {
|
||||||
if(a < b) {
|
if(a < b) {
|
||||||
T swap = b;
|
std::swap(a, b);
|
||||||
b = a;
|
|
||||||
a = swap;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
|
Loading…
Reference in New Issue
Block a user