mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-14 09:20:23 +02:00
lazutils: some optimizations from Alexey
git-svn-id: trunk@59358 -
This commit is contained in:
parent
b9e28c2c9b
commit
054150bb42
@ -25,24 +25,21 @@ type
|
||||
|
||||
function StrToWord(const s: string): word;
|
||||
|
||||
function AlignToPtr(const p: Pointer): Pointer;
|
||||
function AlignToInt(const p: Pointer): Pointer;
|
||||
function AlignToPtr(const p: Pointer): Pointer; inline;
|
||||
function AlignToInt(const p: Pointer): Pointer; inline;
|
||||
|
||||
implementation
|
||||
|
||||
function StrToWord(const s: string): word;
|
||||
var
|
||||
p: Integer;
|
||||
i: Integer;
|
||||
begin
|
||||
Result:=0;
|
||||
p:=1;
|
||||
while (p<=length(s)) do begin
|
||||
Result:=Result*10+ord(s[p])-ord('0');
|
||||
inc(p);
|
||||
end;
|
||||
for i:=1 to Length(s) do
|
||||
Result:=Result*10+ord(s[i])-ord('0');
|
||||
end;
|
||||
|
||||
function AlignToPtr(const p: Pointer): Pointer;
|
||||
function AlignToPtr(const p: Pointer): Pointer; inline;
|
||||
begin
|
||||
{$IFDEF FPC_REQUIRES_PROPER_ALIGNMENT}
|
||||
Result := Align(p, SizeOf(Pointer));
|
||||
@ -51,7 +48,7 @@ begin
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
function AlignToInt(const p: Pointer): Pointer;
|
||||
function AlignToInt(const p: Pointer): Pointer; inline;
|
||||
begin
|
||||
{$IFDEF FPC_REQUIRES_PROPER_ALIGNMENT}
|
||||
Result := Align(p, SizeOf(integer));
|
||||
|
Loading…
Reference in New Issue
Block a user