d = a * u + b * v
Header | Description |
---|---|
#include <gcd.h> | The default header. This header will, in turn, include one of the two headers below. As shipped, this would be <gcdEuclid.h>, but this may be changed when the package is installed. |
#include <gcdEuclid.h> | This header implements the usual Euclidean algorithm for EGCD [1]. |
#include <gcdRSB.h> | Implements EGCD using the Right Shift Binary algorithm. While this can be much faster than the Euclidean algorithm, it has a worst case runtime that is much worse [2]. |
Name | Type | Description |
---|---|---|
a, b | T | The numbers for which the EGCD is calculated. |
u, v | T * | Pointers to the variables to hold the values of u and v, as described above. |
#include <nttl/gcd.h> ... long u, v; long d = ExtendedGCD( 125, 62735, &u, &v ); |