Jay Michael
2012-09-03 05:11:04 UTC
The procedures MoveLeft and MoveRight start with a test for whether special case code will be useful/possible.
procedure MoveLeft (const Source; var Dest; Count: SizeType);
if (Count >= SizeOf (LongestCard))
and not (pDst - pSrc in [0 .. 2 * SizeOf (TWord) - 1]) then
procedure MoveRight (const Source; var Dest; Count: SizeType);
if (Count >= SizeOf (LongestCard))
and not (pSrc - pDst in [0 .. 2 * SizeOf (TWord) - 1]) then
Procedure Move calls MoveRight when the address of the source is less than the source of the destination, so the difference will always be negative (except when source and destination are the same address), so the difference will never be in the range [0..2*SizeOf(TWord)-1].
Shouldn't those differences be reversed?
Shouldn't the threshold be either SizeOf(LongestCard) in both clauses, or 2*SizeOf(TWord) in both clauses?
procedure MoveLeft (const Source; var Dest; Count: SizeType);
if (Count >= SizeOf (LongestCard))
and not (pDst - pSrc in [0 .. 2 * SizeOf (TWord) - 1]) then
procedure MoveRight (const Source; var Dest; Count: SizeType);
if (Count >= SizeOf (LongestCard))
and not (pSrc - pDst in [0 .. 2 * SizeOf (TWord) - 1]) then
Procedure Move calls MoveRight when the address of the source is less than the source of the destination, so the difference will always be negative (except when source and destination are the same address), so the difference will never be in the range [0..2*SizeOf(TWord)-1].
Shouldn't those differences be reversed?
Shouldn't the threshold be either SizeOf(LongestCard) in both clauses, or 2*SizeOf(TWord) in both clauses?