mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 18:29:18 +02:00
* handle collections with 0 or 1 element better
git-svn-id: trunk@4459 -
This commit is contained in:
parent
0d8b05c73e
commit
9766a9c14a
@ -2221,6 +2221,9 @@ BEGIN
|
|||||||
Search := False; { Preset failure }
|
Search := False; { Preset failure }
|
||||||
L := 0; { Start count }
|
L := 0; { Start count }
|
||||||
H := Count - 1; { End count }
|
H := Count - 1; { End count }
|
||||||
|
Index := 0;
|
||||||
|
if H<=0 then
|
||||||
|
exit;
|
||||||
While (L <= H) Do Begin
|
While (L <= H) Do Begin
|
||||||
I := (L + H) SHR 1; { Mid point }
|
I := (L + H) SHR 1; { Mid point }
|
||||||
C := Compare(KeyOf(Items^[I]), Key); { Compare with key }
|
C := Compare(KeyOf(Items^[I]), Key); { Compare with key }
|
||||||
|
Loading…
Reference in New Issue
Block a user