Cryptography Reference
In-Depth Information
int
mul_l (CLINT f1_l, CLINT f2_l, CLINT pp_l)
{
register clint *pptr_l, *bptr_l;
CLINT aa_l, bb_l;
CLINTD p_l;
clint *a_l, *b_l, *aptr_l, *csptr_l, *msdptra_l, *msdptrb_l;
USHORT av;
ULONG carry;
int OFL = E_CLINT_OK;
First the variables are declared; p_l will hold the result and thus is of double length.
The ULONG variable carry will hold the carry. In the first step the case is dealt with
in which one of the factors, and therefore the product, is zero. Then the factors are
copied into the workspaces aa_l and bb_l , and leading zeros are purged.
if (EQZ_L (f1_l) || EQZ_L (f2_l))
{
SETZERO_L (pp_l);
return E_CLINT_OK;
}
cpy_l (aa_l, f1_l);
cpy_l (bb_l, f2_l);
According to the declarations the pointers a_l and b_l are given the addresses of
aa_l and bb_l , where a logical transposition occurs if the number of digits of aa_l
is smaller than that of bb_l . The pointer a_l always points to the operand with the
larger number of digits.
if (DIGITS_L (aa_l) < DIGITS_L (bb_l))
{
a_l = bb_l;
b_l = aa_l;
}
else
{
a_l = aa_l;
b_l = bb_l;
}
msdptra_l = a_l + *a_l;
msdptrb_l = b_l + *b_l;
Search WWH ::




Custom Search