mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-08 04:25:59 +02:00
* aligntoptr needs to use unsigned calculations, patch by Thomas
git-svn-id: trunk@1148 -
This commit is contained in:
parent
32fa578b58
commit
22a20e15e4
@ -308,13 +308,13 @@ type
|
|||||||
---------------------------------------------------------------------}
|
---------------------------------------------------------------------}
|
||||||
|
|
||||||
function aligntoptr(p : pointer) : pointer;
|
function aligntoptr(p : pointer) : pointer;
|
||||||
begin
|
begin
|
||||||
{$ifdef FPC_REQUIRES_PROPER_ALIGNMENT}
|
{$ifdef FPC_REQUIRES_PROPER_ALIGNMENT}
|
||||||
if (ptrint(p) mod sizeof(ptrint))<>0 then
|
if (ptruint(p) and (sizeof(ptruint)-1))<>0 then
|
||||||
inc(ptrint(p),sizeof(ptrint)-ptrint(p) mod sizeof(ptrint));
|
ptruint(p) := (ptruint(p) + sizeof(ptruint) - 1) and not (sizeof(ptruint) - 1);
|
||||||
{$endif FPC_REQUIRES_PROPER_ALIGNMENT}
|
{$endif FPC_REQUIRES_PROPER_ALIGNMENT}
|
||||||
result:=p;
|
aligntoptr:=p;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
Function GetEnumName(TypeInfo : PTypeInfo;Value : Integer) : string;
|
Function GetEnumName(TypeInfo : PTypeInfo;Value : Integer) : string;
|
||||||
|
Loading…
Reference in New Issue
Block a user