Cryptography Reference
In-Depth Information
division of a CLINT type by a USHORT type
Function:
int udiv_l (CLINT dv_l, USHORT uds, CLINT q_l,
CLINT r_l);
Syntax:
dv_l (dividend), uds (divisor)
Input:
q_l (quotient), r_l (remainder)
Output:
E_CLINT_OK if all is ok
E_CLINT_DBZ if division by 0
Return:
We have already indicated that for a given calculation the quotient of a
division is not required, and only the remainder is of interest. This will not result
in a great savings of time, but in such cases, at least the passing of a pointer to
the storage location of the quotient is burdensome. It is therefore worthwhile to
create an independent function for computing remainders, or “residues.” The
mathematical background of the use of this function is discussed more fully in
Chapter 5.
Remainders (reduction modulo n )
Function:
int mod_l (CLINT d_l, CLINT n_l, CLINT r_l);
Syntax:
d_l (dividend), n_l (divisor or modulus)
Input:
r_l (remainder)
Output:
E_CLINT_OK if all is ok
E_CLINT_DBZ if division by 0
Return:
Simpler than the general case is the construction of the remainder modulo
apowerof 2 , namely 2 k , which is worth implementing in its own function. The
remainder of the dividend in a division by 2 k results from truncating its binary
digits after the k th bit, where counting begins with 0 . This truncation corresponds
to a bitwise joining of the dividend to 2 k
1 = (111111 ... 1) 2 ,thevalueof
k binary ones, by a logical AND (cf. Section 7.2). The operation is concentrated
on the digit of the dividend in its representation to base B that contains the k th
bit; all higher-valued dividend digits are irrelevant. For specifying the divisor the
following function mod_l() is passed only the exponent k .
 
Search WWH ::




Custom Search