mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-10-30 06:01:31 +01:00
LCL: added AlignToPtr and AlignToInt to fpcadds
git-svn-id: trunk@32573 -
This commit is contained in:
parent
f18dadf725
commit
8dc1234b17
@ -119,7 +119,8 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, // TStrings in Split method
|
Classes, // TStrings in Split method
|
||||||
SysUtils; // Exception
|
SysUtils,
|
||||||
|
FPCAdds; // Exception
|
||||||
|
|
||||||
type
|
type
|
||||||
{$IFDEF UniCode}
|
{$IFDEF UniCode}
|
||||||
@ -687,24 +688,6 @@ const
|
|||||||
XIgnoredChars = [' ', #9, #$d, #$a];
|
XIgnoredChars = [' ', #9, #$d, #$a];
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
function AlignToPtr(const p: Pointer): Pointer;
|
|
||||||
begin
|
|
||||||
{$IFDEF FPC_REQUIRES_PROPER_ALIGNMENT}
|
|
||||||
Result := Align(p, SizeOf(Pointer));
|
|
||||||
{$ELSE}
|
|
||||||
Result := p;
|
|
||||||
{$ENDIF}
|
|
||||||
end;
|
|
||||||
|
|
||||||
function AlignToInt(const p: Pointer): Pointer;
|
|
||||||
begin
|
|
||||||
{$IFDEF FPC_REQUIRES_PROPER_ALIGNMENT}
|
|
||||||
Result := Align(p, SizeOf(integer));
|
|
||||||
{$ELSE}
|
|
||||||
Result := p;
|
|
||||||
{$ENDIF}
|
|
||||||
end;
|
|
||||||
|
|
||||||
{=============================================================}
|
{=============================================================}
|
||||||
{=================== WideString functions ====================}
|
{=================== WideString functions ====================}
|
||||||
{=============================================================}
|
{=============================================================}
|
||||||
|
|||||||
@ -1689,17 +1689,6 @@ end;
|
|||||||
|
|
||||||
// -----------------------------------------------------------
|
// -----------------------------------------------------------
|
||||||
|
|
||||||
function AlignToPtr(const p: Pointer): Pointer;
|
|
||||||
begin
|
|
||||||
{$IFDEF FPC_REQUIRES_PROPER_ALIGNMENT}
|
|
||||||
Result := Align(p, SizeOf(Pointer));
|
|
||||||
{$ELSE}
|
|
||||||
Result := p;
|
|
||||||
{$ENDIF}
|
|
||||||
end;
|
|
||||||
|
|
||||||
// -----------------------------------------------------------
|
|
||||||
|
|
||||||
procedure WritePublishedProperties(Instance: TPersistent);
|
procedure WritePublishedProperties(Instance: TPersistent);
|
||||||
var
|
var
|
||||||
TypeInfo: PTypeInfo;
|
TypeInfo: PTypeInfo;
|
||||||
|
|||||||
@ -48,6 +48,9 @@ function CompareValue ( const A, B : Int64) : TValueRelationship; inline;
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
function StrToWord(const s: string): word;
|
function StrToWord(const s: string): word;
|
||||||
|
|
||||||
|
function AlignToPtr(const p: Pointer): Pointer;
|
||||||
|
function AlignToInt(const p: Pointer): Pointer;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
function StrToWord(const s: string): word;
|
function StrToWord(const s: string): word;
|
||||||
@ -62,6 +65,24 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function AlignToPtr(const p: Pointer): Pointer;
|
||||||
|
begin
|
||||||
|
{$IFDEF FPC_REQUIRES_PROPER_ALIGNMENT}
|
||||||
|
Result := Align(p, SizeOf(Pointer));
|
||||||
|
{$ELSE}
|
||||||
|
Result := p;
|
||||||
|
{$ENDIF}
|
||||||
|
end;
|
||||||
|
|
||||||
|
function AlignToInt(const p: Pointer): Pointer;
|
||||||
|
begin
|
||||||
|
{$IFDEF FPC_REQUIRES_PROPER_ALIGNMENT}
|
||||||
|
Result := Align(p, SizeOf(integer));
|
||||||
|
{$ELSE}
|
||||||
|
Result := p;
|
||||||
|
{$ENDIF}
|
||||||
|
end;
|
||||||
|
|
||||||
{$IFNDEF FPC_HAS_QWORDCOMPAREVALUE}
|
{$IFNDEF FPC_HAS_QWORDCOMPAREVALUE}
|
||||||
function CompareValue (const A, B : QWord) : TValueRelationship;
|
function CompareValue (const A, B : QWord) : TValueRelationship;
|
||||||
begin
|
begin
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user