Browse Source

+ added var_align/const_align routines

carl 23 years ago
parent
commit
fd24f60a1c
1 changed files with 25 additions and 1 deletions
  1. 25 1
      compiler/globals.pas

+ 25 - 1
compiler/globals.pas

@@ -287,6 +287,13 @@ interface
     procedure swap_qword(var q : qword);
     procedure swap_qword(var q : qword);
 
 
     function UpdateAlignmentStr(s:string;var a:talignmentinfo):boolean;
     function UpdateAlignmentStr(s:string;var a:talignmentinfo):boolean;
+    
+    {# Routine to get the required alignment for size of data, which will 
+       be placed in bss segment, according to the current alignment requirements }
+    function var_align(siz: longint): longint;
+    {# Routine to get the required alignment for size of data, which will 
+       be placed in data/const segment, according to the current alignment requirements }
+    function const_align(siz: longint): longint;
 
 
 
 
 implementation
 implementation
@@ -1321,6 +1328,20 @@ implementation
         until false;
         until false;
         UpdateAlignment(a,b);
         UpdateAlignment(a,b);
       end;
       end;
+      
+      
+    function var_align(siz: longint): longint;
+      begin
+        siz := size_2_align(siz);
+        var_align := used_align(siz,aktalignment.varalignmin,aktalignment.varalignmax);
+      end;
+      
+    function const_align(siz: longint): longint;
+      begin
+        siz := size_2_align(siz);
+        const_align := used_align(siz,aktalignment.constalignmin,aktalignment.constalignmax);
+      end;
+
 
 
 {****************************************************************************
 {****************************************************************************
                                     Init
                                     Init
@@ -1477,7 +1498,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.67  2002-10-16 19:01:43  peter
+  Revision 1.68  2002-11-09 15:38:39  carl
+    + added var_align/const_align routines
+
+  Revision 1.67  2002/10/16 19:01:43  peter
     + $IMPLICITEXCEPTIONS switch to turn on/off generation of the
     + $IMPLICITEXCEPTIONS switch to turn on/off generation of the
       implicit exception frames for procedures with initialized variables
       implicit exception frames for procedures with initialized variables
       and for constructors. The default is on for compatibility
       and for constructors. The default is on for compatibility