source: trunk/Packages/TemplateGenerics/UGenericShared.pas

Last change on this file was 1, checked in by chronos, 8 years ago
  • Imported initial version.
File size: 858 bytes
Line 
1unit UGenericShared;
2
3{$mode Delphi}{$H+}
4
5interface
6
7uses
8 Classes, SysUtils;
9
10function FastCompareMem(P1, P2: Pointer; Length: cardinal): Boolean; inline;
11function FastCompareMem2(P1, P2: Pointer; Length: cardinal): Boolean; inline;
12
13implementation
14
15function FastCompareMem(P1, P2: Pointer; Length: cardinal): Boolean;
16var
17 i: cardinal;
18begin
19 Result:=True;
20 I:=0;
21 If (P1)<>(P2) then
22 While Result and (i<Length) do
23 begin
24 Result:=PByte(P1)^=PByte(P2)^;
25 Inc(I);
26 Inc(pchar(P1));
27 Inc(pchar(P2));
28 end;
29end;
30
31function FastCompareMem2(P1, P2: Pointer; Length: cardinal): Boolean;
32var
33 i: cardinal;
34begin
35 Result:=True;
36 I:=0;
37 If (P1)<>(P2) then
38 While Result and (i<Length) do
39 begin
40 Result:=PByte(P1)^=PByte(P2)^;
41 Inc(I);
42 Inc(pchar(P1));
43 Inc(pchar(P2));
44 end;
45end;
46
47
48end.
49
Note: See TracBrowser for help on using the repository browser.