source: branches/UltimatOS/UMemory.pas

Last change on this file was 34, checked in by chronos, 23 months ago
  • Modified: Execute instructions as array of instruction handlers.
  • Modified: Optimized some methods call with inline directive.
File size: 710 bytes
Line 
1unit UMemory;
2
3interface
4
5uses
6 Classes, SysUtils;
7
8type
9 { TMemory }
10
11 TMemory = class
12 private
13 FSize: Integer;
14 function GetSize: Integer;
15 procedure SetSize(AValue: Integer);
16 public
17 Data: PByte;
18 property Size: Integer read FSize write SetSize;
19 constructor Create;
20 destructor Destroy; override;
21 end;
22
23
24implementation
25
26{ TMemory }
27
28function TMemory.GetSize: Integer;
29begin
30 Result := MemSize(Data);
31end;
32
33procedure TMemory.SetSize(AValue: Integer);
34begin
35 if FSize = AValue then Exit;
36 FSize := AValue;
37 Data := ReAllocMem(Data, AValue);
38end;
39
40constructor TMemory.Create;
41begin
42 Data := nil;
43end;
44
45destructor TMemory.Destroy;
46begin
47 Size := 0;
48 inherited;
49end;
50
51end.
52
Note: See TracBrowser for help on using the repository browser.