From 22a20e15e47ba15e1ff6c51ba47d1d33a4bd18db Mon Sep 17 00:00:00 2001 From: peter Date: Tue, 20 Sep 2005 13:53:54 +0000 Subject: [PATCH] * aligntoptr needs to use unsigned calculations, patch by Thomas git-svn-id: trunk@1148 - --- rtl/objpas/typinfo.pp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rtl/objpas/typinfo.pp b/rtl/objpas/typinfo.pp index 2161e8749d..080814137f 100644 --- a/rtl/objpas/typinfo.pp +++ b/rtl/objpas/typinfo.pp @@ -308,13 +308,13 @@ type ---------------------------------------------------------------------} function aligntoptr(p : pointer) : pointer; - begin + begin {$ifdef FPC_REQUIRES_PROPER_ALIGNMENT} - if (ptrint(p) mod sizeof(ptrint))<>0 then - inc(ptrint(p),sizeof(ptrint)-ptrint(p) mod sizeof(ptrint)); + if (ptruint(p) and (sizeof(ptruint)-1))<>0 then + ptruint(p) := (ptruint(p) + sizeof(ptruint) - 1) and not (sizeof(ptruint) - 1); {$endif FPC_REQUIRES_PROPER_ALIGNMENT} - result:=p; - end; + aligntoptr:=p; + end; Function GetEnumName(TypeInfo : PTypeInfo;Value : Integer) : string;