Browse Source

* folded a constant addition
* typecasted a subtraction's result to ptruint to avoid a needless
64 bit calculation on 32 bit platforms

git-svn-id: trunk@9673 -

Jonas Maebe 17 years ago
parent
commit
6dd8e51ee5
1 changed files with 2 additions and 2 deletions
  1. 2 2
      rtl/inc/heap.inc

+ 2 - 2
rtl/inc/heap.inc

@@ -1243,7 +1243,7 @@ begin
         2. For resizing to greater size first check if the size fits in the fixed block range to prevent
         2. For resizing to greater size first check if the size fits in the fixed block range to prevent
            "truncating" the size by the fixedsizemask }
            "truncating" the size by the fixedsizemask }
       if ((size <= (maxblocksize - sizeof(tmemchunk_fixed_hdr))) and
       if ((size <= (maxblocksize - sizeof(tmemchunk_fixed_hdr))) and
-          ((size+sizeof(tmemchunk_fixed_hdr)+(blocksize-1)) and sizemask <= currsize)) then
+          ((size+(sizeof(tmemchunk_fixed_hdr)+(blocksize-1))) and sizemask <= currsize)) then
         begin
         begin
           systryresizemem:=true;
           systryresizemem:=true;
           exit;
           exit;
@@ -1264,7 +1264,7 @@ begin
   size := (size+sizeof(tmemchunk_var_hdr)+(blocksize-1)) and sizemask;
   size := (size+sizeof(tmemchunk_var_hdr)+(blocksize-1)) and sizemask;
 
 
   { is the allocated block still correct? }
   { is the allocated block still correct? }
-  if (currsize>=size) and (size>(currsize-blocksize)) then
+  if (currsize>=size) and (size>ptruint(currsize-blocksize)) then
     begin
     begin
       SysTryResizeMem := true;
       SysTryResizeMem := true;
       exit;
       exit;