Cryptography Reference
In-Depth Information
int
clearbit_l (CLINT a_l, unsigned int pos)
{
int res = 0;
USHORT shorts = (USHORT)(pos >> LDBITPERDGT);
USHORT bitpos = (USHORT)(pos & (BITPERDGT - 1));
USHORTm=1U<<bitpos;
if (shorts < DIGITS_L (a_l))
{
If
a_l
has enough digits, then the digit of
a_l
that contains the specified bit posi-
tion is tested by means of the mask prepared in m, and then the bit position is set
to
0
by an AND of the corresponding digit with the complement of
m
. The previous
status of the bit position is returned at the termination of the function.
if (a_l[shorts + 1] & m)
{
res=1;
}
a_l[shorts + 1] &= (USHORT)(˜m);
RMLDZRS_L (a_l);
}
return res;
}
7.4 Comparison Operators
Every program requires the ability to make assertions about the equality or
inequality or the size relationship of arithmetic variables, and this holds as well
for our dealings with
CLINT
objects. Here, too, the principle is obeyed that the
programmer does not need knowledge of the internal structure of the
CLINT
type,
and the determination of how two
CLINT
objects are related to each other is left to
functions designed for such purposes.
The primary function that accomplishes these tasks is the function
cmp_l()
.
It determines which of the relations
a_l
<
b_l
,
a_l == b_l
,or
a_l
>
b_l
holds
for two
CLINT
values
a_l
and
b_l
.Tothisend,firstthenumbersofdigitsofthe
CLINT
objects, which have been liberated from any leading zeros, are compared. If
the number of digits of the operands is the same, then the process begins with a
comparison of the most-significant digits; as soon as a difference is detected, the
comparison is terminated.