Procházet zdrojové kódy

* move aligntoptr() and aligntoqword() further up so they can be used by other code as well

git-svn-id: trunk@37415 -
svenbarth před 7 roky
rodič
revize
29eb742ded
1 změnil soubory, kde provedl 23 přidání a 24 odebrání
  1. 23 24
      packages/rtl-objpas/src/inc/rtti.pp

+ 23 - 24
packages/rtl-objpas/src/inc/rtti.pp

@@ -354,6 +354,29 @@ resourcestring
 
 implementation
 
+function aligntoptr(p : pointer) : pointer;inline;
+   begin
+{$ifdef FPC_REQUIRES_PROPER_ALIGNMENT}
+     result:=align(p,sizeof(p));
+{$else FPC_REQUIRES_PROPER_ALIGNMENT}
+     result:=p;
+{$endif FPC_REQUIRES_PROPER_ALIGNMENT}
+   end;
+
+function aligntoqword(p : pointer) : pointer;inline;
+  type
+    TAlignCheck = record
+      b : byte;
+      q : qword;
+    end;
+  begin
+{$ifdef FPC_REQUIRES_PROPER_ALIGNMENT}
+    result:=align(p,PtrInt(@TAlignCheck(nil^).q))
+{$else FPC_REQUIRES_PROPER_ALIGNMENT}
+    result:=p;
+{$endif FPC_REQUIRES_PROPER_ALIGNMENT}
+  end;
+
 type
 
   { TRttiPool }
@@ -1856,30 +1879,6 @@ begin
     FTypeData:=GetTypeData(ATypeInfo);
 end;
 
-function aligntoptr(p : pointer) : pointer;inline;
-   begin
-{$ifdef FPC_REQUIRES_PROPER_ALIGNMENT}
-     result:=align(p,sizeof(p));
-{$else FPC_REQUIRES_PROPER_ALIGNMENT}
-     result:=p;
-{$endif FPC_REQUIRES_PROPER_ALIGNMENT}
-   end;
-
-function aligntoqword(p : pointer) : pointer;inline;
-  type
-    TAlignCheck = record
-      b : byte;
-      q : qword;
-    end;
-  begin
-{$ifdef FPC_REQUIRES_PROPER_ALIGNMENT}
-    result:=align(p,PtrInt(@TAlignCheck(nil^).q))
-{$else FPC_REQUIRES_PROPER_ALIGNMENT}
-    result:=p;
-{$endif FPC_REQUIRES_PROPER_ALIGNMENT}
-  end;
-
-
 function TRttiType.GetProperties: specialize TArray<TRttiProperty>;
 type
   PPropData = ^TPropData;