DEFINITION - FUNCTION
diff& = CompareGPMem&(sAddr&, cAddr&, size&, flags&)
-- compare two memory blocks to each other
OPERATION
CompareGPMem& will perform a byte by byte compare of the source data
region with the compare data region. It can deal with any arbitrary
length and the pointers on arbitrary alignments. The result includes
the offset position of the first found difference plus the information
whether the source byte was less/greater than the compared byte.
ARGUMENTS
sAddr& -- a address pointer to the source data region
cAddr& -- a address pointer to the compare data region
size& -- the size (in bytes) to compare
flags& -- a bit field specifying further options
RESULT
diff& -- offset position and state of first difference or zero, if
both regions match exactly (see NOTES)
NOTES
1.) If the diff& result is zero, then both regions match exactly.
2.) In all other cases ABS(diff&)-1 is the byte offset of the first
found difference, and SGN(diff&) says whether the source byte was
less than the compared byte (negativ) or greater than (positive).
FLAGS
The flags& defined in the include file memory.bi are bit-coded values,
hence they can easily combined by ORing or adding them:
gpmF_Unsigned& -- If given, then the compare operation uses unsigned
math, otherwise signed math if omitted.
This information is required, because in signed math bytes with its MSB
set are in general less than bytes with a cleared MSB, but in unsigned
math it's the opposite case.
SEE ALSO
Support Functions
Back to Function Reference