Browse Source

+ added RegisterTinyHeapBlock_Simple_Prealigned procedure, which is the same as
RegisterTinyHeapBlock_Simple, but expects its address and size parameters to
be already aligned on a TinyHeapAllocGranularity boundary

git-svn-id: trunk@28651 -

nickysn 11 năm trước cách đây
mục cha
commit
bb07318386
1 tập tin đã thay đổi với 14 bổ sung0 xóa
  1. 14 0
      rtl/inc/tinyheap.inc

+ 14 - 0
rtl/inc/tinyheap.inc

@@ -316,6 +316,20 @@
         HeapEnd:=Pointer(TTinyHeapPointerArithmeticType(AAddress)+ASize);
       end;
 
+    { Strongly simplified version of RegisterTinyHeapBlock, which can be used when
+      the heap is only a single contiguous memory block and the address and size
+      are already aligned on a TinyHeapAllocGranularity boundary. }
+    procedure RegisterTinyHeapBlock_Simple_Prealigned(AAddress: Pointer; ASize: PtrUInt);
+      begin
+{$ifdef DEBUG_TINY_HEAP}
+        Writeln('RegisterTinyHeapBlock_Simple_Prealigned(', HexStr(AAddress), ',', ASize, ')');
+{$endif DEBUG_TINY_HEAP}
+        HeapOrg:=AAddress;
+        HeapPtr:=AAddress;
+        FreeList:=AAddress;
+        HeapEnd:=Pointer(TTinyHeapPointerArithmeticType(AAddress)+ASize);
+      end;
+
     procedure RegisterTinyHeapBlock(AAddress: pointer; ASize: ptruint);
       var
         alignment_inc: smallint;