Bladeren bron

+ added an unsigned counterpart to tpointerdef.pointer_arithmetic_it_type (needed by inc/dec)

git-svn-id: trunk@34653 -
nickysn 8 jaren geleden
bovenliggende
commit
35b0201002
2 gewijzigde bestanden met toevoegingen van 29 en 0 verwijderingen
  1. 21 0
      compiler/i8086/symcpu.pas
  2. 8 0
      compiler/symdef.pas

+ 21 - 0
compiler/i8086/symcpu.pas

@@ -59,6 +59,7 @@ type
     class function default_x86_data_pointer_type: tx86pointertyp; override;
     function alignment:shortint;override;
     function pointer_arithmetic_int_type:tdef; override;
+    function pointer_arithmetic_uint_type:tdef; override;
     function pointer_subtraction_result_type:tdef; override;
     function converted_pointer_to_array_range_type: tdef; override;
   end;
@@ -441,6 +442,26 @@ implementation
       end;
 
 
+    function tcpupointerdef.pointer_arithmetic_uint_type:tdef;
+      begin
+        case x86pointertyp of
+          x86pt_huge:
+            result:=u32inttype;
+          x86pt_far,
+          x86pt_near,
+          x86pt_near_cs,
+          x86pt_near_ds,
+          x86pt_near_ss,
+          x86pt_near_es,
+          x86pt_near_fs,
+          x86pt_near_gs:
+            result:=u16inttype;
+          else
+            internalerror(2016100403);
+        end;
+      end;
+
+
     function tcpupointerdef.pointer_subtraction_result_type:tdef;
       begin
         case x86pointertyp of

+ 8 - 0
compiler/symdef.pas

@@ -255,6 +255,8 @@ interface
              Normally, this is sinttype, except on i8086, where it takes into account the
              special i8086 pointer types (near, far, huge). }
           function pointer_arithmetic_int_type:tdef;virtual;
+          {# the unsigned version of pointer_arithmetic_int_type. Used with inc/dec. }
+          function pointer_arithmetic_uint_type:tdef;virtual;
           {# returns the int type produced when subtracting two pointers of the given type.
              Normally, this is sinttype, except on i8086, where it takes into account the
              special i8086 pointer types (near, far, huge). }
@@ -3376,6 +3378,12 @@ implementation
       end;
 
 
+    function tpointerdef.pointer_arithmetic_uint_type:tdef;
+      begin
+        result:=ptruinttype;
+      end;
+
+
     function tpointerdef.pointer_subtraction_result_type:tdef;
       begin
         result:=ptrsinttype;