Cryptography Reference
In-Depth Information
void
gcd_l (CLINT aa_l, CLINT bb_l, CLINT cc_l)
{
CLINT a_l, b_l, r_l, t_l;
unsigned intk=0;
int sign_of_t;
Step 1: If the arguments are unequal, the smaller argument is copied to b_l .If b_l
is equal to 0, then a_l is output as the greatest common divisor.
if (LT_L (aa_l, bb_l))
{
cpy_l (a_l, bb_l);
cpy_l (b_l, aa_l);
}
else
{
cpy_l (a_l, aa_l);
cpy_l (b_l, bb_l);
}
if (EQZ_L (b_l))
{
cpy_l (cc_l, a_l);
return;
}
The following division with remainder serves to scale the larger operand a_l .Then
the powers of two are removed from a_1 and b_1 .
(void) div_l (a_l, b_l, t_l, r_l);
cpy_l (a_l, b_l);
cpy_l (b_l, r_l);
if (EQZ_L (b_l))
{
cpy_l (cc_l, a_l);
return;
}
Search WWH ::




Custom Search