Cryptography Reference
In-Depth Information
= ”, be set up as a member function that for the reasons given above returns a
reference to the result:
const LINT& LINT::operator*= (const LINT& ln)
{
int error;
if (status == E_LINT_INV)
panic (E_LINT_VAL, "*=", 0, __LINE__);
if (ln.(status == E_LINT_INV)
panic (E_LINT_VAL, "*=", 1, __LINE__);
if (&ln == this)
error = sqr_l (n_l, n_l);
else
error = mul_l (n_l, ln.n_l, n_l);
switch (error)
{
case 0:
status = E_LINT_OK;
break;
case E_CLINT_OFL:
status = E_LINT_OFL;
break;
default:
panic (E_LINT_ERR, "*=", error, __LINE__);
}
return *this;
}
As our last example of a LINT operator we shall describe the function “ == ”,
which tests for the equality of two LINT objects: As result the value 1 is returned
in the case of equality, and otherwise 0 . The operator == also illustrates the
implementation of other logical operators.
const int operator == (const LINT& lm, const LINT& ln)
{
if (lm.(status == E_LINT_INV)
LINT::panic (E_LINT_VAL, "==", 1, __LINE__);
if (ln.(status == E_LINT_INV)
LINT::panic (E_LINT_VAL, "==", 2, __LINE__);
if (&ln == &lm)
return 1;
else
return equ_l (lm.n_l, ln.n_l);
}
Search WWH ::




Custom Search