Browse Source

+ introduce AlignToPtr, a copy of the one from the TypInfo unit (we should really come up with a better name here considering that it's redirecting to AlignTypeData on m68k...)

git-svn-id: trunk@42803 -
svenbarth 6 years ago
parent
commit
dad9260f93
1 changed files with 13 additions and 0 deletions
  1. 13 0
      packages/rtl-objpas/src/inc/rtti.pp

+ 13 - 0
packages/rtl-objpas/src/inc/rtti.pp

@@ -615,6 +615,19 @@ uses
 {$endif}
   fgl;
 
+function AlignToPtr(aPtr: Pointer): Pointer; inline;
+begin
+{$ifdef CPUM68K}
+  Result := AlignTypeData(aPtr);
+{$else}
+{$ifdef FPC_REQUIRES_PROPER_ALIGNMENT}
+  Result := Align(aPtr, SizeOf(Pointer));
+{$else}
+  Result := aPtr;
+{$endif}
+{$endif}
+end;
+
 type
 
   { TRttiPool }