In this algorithm source fields TEM and F are compared according to condition determined by parameter MODE. The result of operation is slice RES in which with set bits are marked field elements satisfying condition. Comparison performed by sequential comparison of slices from processed fields and putting results in RES slice. Comparison of slices is made with logical operations. When result of comparison for a given pair of elemetns is detected, corresponding bit of mask register sets to zero and then this result remains unchanged.
procedure COMPF( refer slice res, tem[ ], f[ ]; index cap, mode );
const
andf = 8, orf = 14,
equ = 9, great = 4, less = 2, { logical operations for bits comparison }
eqgreat = great + equ,
eqless = less + equ;
index
i, j, n;
begin
{
Search condition: tem[ ] <-mode-> f[ ]
if condition is true correspoding bit in res slice will be one.
}
SET( M );
if mode < equ then{ comparison for >, < : great, less }
begin
CLEAR( res );
for i := cap-1 downto 0 do
begin
MASKON;
LOGF( X, tem[ i ], f[ i ], mode );{ compare tem and f }
LOGF( res, res, X, orf );{ put result in res }
MASKOFF;
LOGF( X, tem[ i ], f[ i ], equ );{ clear mask bits }
LOGF( M, M, X, andf );
end
end
else{ comparison for =, >=, <= : equ, eqgreat, eqless }
begin
SET( res );
for i := cap-1 downto 0 do
begin
MASKON;
LOGF( X, tem[ i ], f[ i ], mode );
LOGF( res, res, X, andf );
MASKOFF;
LOGF( X, tem[ i ], f[ i ], equ );
LOGF( M, M, X, andf );
end
end
end;{ Конец COMPF }