Ver código fonte

* removed 64bit evaluations when range checking is on

Jonas Maebe 24 anos atrás
pai
commit
0293387955
4 arquivos alterados com 33 adições e 17 exclusões
  1. 5 2
      rtl/go32v2/graph.pp
  2. 8 5
      rtl/go32v2/vesa.inc
  3. 11 4
      rtl/inc/heaptrc.pp
  4. 9 6
      rtl/objpas/dati.inc

+ 5 - 2
rtl/go32v2/graph.pp

@@ -78,7 +78,7 @@ Type
 {  3. Set base linear address    }
 const
 {$ifdef fpc}
-   VideoOfs : DWord = 0;   { Segment to draw to }
+   VideoOfs : longint = 0;   { Segment to draw to }
 {$else fpc}
    VideoOfs : word = 0;   { Segment to draw to }
 {$endif fpc}
@@ -2653,7 +2653,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.4  2000-11-11 15:57:54  jonas
+  Revision 1.5  2000-12-16 15:57:17  jonas
+    * removed 64bit evaluations when range checking is on
+
+  Revision 1.4  2000/11/11 15:57:54  jonas
     * fixed web bug 1166 (merged)
 
   Revision 1.3  2000/08/12 12:27:13  jonas

+ 8 - 5
rtl/go32v2/vesa.inc

@@ -1940,8 +1940,8 @@ Const
       { The base of ds can be changed
         we need to compute the address again PM }
       LFBPointer:=pointer(FrameBufferLinearAddress-get_segment_base_address(get_ds));
-      if dword(LFBPointer)+(VESAInfo.TotalMem shl 16)-1 > DsLimit then
-        set_segment_limit(get_ds,dword(LFBPointer)+(VESAInfo.TotalMem shl 16)-1);
+      if dword(LFBPointer)+dword(VESAInfo.TotalMem shl 16)-1 > DsLimit then
+        set_segment_limit(get_ds,dword(LFBPointer)+dword(VESAInfo.TotalMem shl 16)-1);
     end;
 
   procedure HookHeapError;
@@ -2025,8 +2025,8 @@ Const
        begin
          HookHeapError;
          LFBPointer:=pointer(FrameBufferLinearAddress-get_segment_base_address(get_ds));
-         if dword(LFBPointer)+(VESAInfo.TotalMem shl 16)-1 > get_segment_limit(get_ds) then
-           set_segment_limit(get_ds,dword(LFBPointer)+(VESAInfo.TotalMem shl 16)-1);
+         if dword(LFBPointer)+dword(VESAInfo.TotalMem shl 16)-1 > dword(get_segment_limit(get_ds)) then
+           set_segment_limit(get_ds,dword(LFBPointer)+dword(VESAInfo.TotalMem shl 16)-1);
        end
      else
        begin
@@ -2715,7 +2715,10 @@ Const
 
 {
   $Log$
-  Revision 1.5  2000-08-12 12:27:13  jonas
+  Revision 1.6  2000-12-16 15:57:17  jonas
+    * removed 64bit evaluations when range checking is on
+
+  Revision 1.5  2000/08/12 12:27:13  jonas
     + setallpalette hook
     + setallpalette implemented for standard vga and VESA 2.0+
 

+ 11 - 4
rtl/inc/heaptrc.pp

@@ -146,7 +146,11 @@ begin
      crc:=i;
      for n:=1 to 8 do
       if odd(crc) then
+{$ifdef Delphi}
        crc:=(crc shr 1) xor $edb88320
+{$else Delphi}
+       crc:=longint(cardinal(crc shr 1) xor $edb88320)
+{$endif Delphi}
       else
        crc:=crc shr 1;
      Crc32Tbl[i]:=crc;
@@ -751,8 +755,8 @@ begin
   while pp<>nil do
    begin
      { inside this block ! }
-     if (cardinal(p)>=cardinal(pp)+sizeof(theap_mem_info)+extra_info_size) and
-        (cardinal(p)<=cardinal(pp)+sizeof(theap_mem_info)+extra_info_size+pp^.size) then
+     if (cardinal(p)>=cardinal(pp)+sizeof(theap_mem_info)+cardinal(extra_info_size)) and
+        (cardinal(p)<=cardinal(pp)+sizeof(theap_mem_info)+cardinal(extra_info_size)+cardinal(pp^.size)) then
         { allocated block }
        if ((pp^.sig=longint($DEADBEEF)) and not usecrc) or
           ((pp^.sig=calculate_sig(pp)) and usecrc) then
@@ -992,7 +996,10 @@ finalization
 end.
 {
   $Log$
-  Revision 1.5  2000-12-07 17:19:47  jonas
+  Revision 1.6  2000-12-16 15:57:17  jonas
+    * removed 64bit evaluations when range checking is on
+
+  Revision 1.5  2000/12/07 17:19:47  jonas
     * new constant handling: from now on, hex constants >$7fffffff are
       parsed as unsigned constants (otherwise, $80000000 got sign extended
       and became $ffffffff80000000), all constants in the longint range
@@ -1014,5 +1021,5 @@ end.
 
   Revision 1.2  2000/07/13 11:33:44  michael
   + removed logs
- 
+
 }

+ 9 - 6
rtl/objpas/dati.inc

@@ -45,7 +45,7 @@ begin
       end;
      c:= Year DIV 100;
      ya:= Year - 100*c;
-     result := (146097*c) SHR 2 + (1461*ya) SHR 2 + (153*Month+2) DIV 5 + Day - 693900;
+     result := (146097*c) SHR 2 + (1461*ya) SHR 2 + (153*cardinal(Month)+2) DIV 5 + cardinal(Day) - 693900;
    end
   else
    result:=0;
@@ -123,13 +123,13 @@ var
 begin
   j := pred((Trunc(System.Int(Date)) + 693900) SHL 2);
   Year:= j DIV 146097;
-  j:= j - 146097 * Year;
+  j:= j - 146097 * cardinal(Year);
   Day := j SHR 2;
   j:=(Day SHL 2 + 3) DIV 1461;
-  Day:= (Day SHL 2 + 7 - 1461*j) SHR 2;
+  Day:= (cardinal(Day) SHL 2 + 7 - 1461*j) SHR 2;
   Month:=(5 * Day-3) DIV 153;
   Day:= (5 * Day +2 - 153*Month) DIV 5;
-  Year:= 100 * Year + j;
+  Year:= 100 * cardinal(Year) + j;
   if Month < 10 then
    inc(Month,3)
   else
@@ -673,7 +673,10 @@ end;
 
 {
   $Log$
-  Revision 1.2  2000-07-13 11:33:50  michael
+  Revision 1.3  2000-12-16 15:57:16  jonas
+    * removed 64bit evaluations when range checking is on
+
+  Revision 1.2  2000/07/13 11:33:50  michael
   + removed logs
- 
+
 }