Changeset 217 for branches/CpuSingleSize/UMemory.pas
- Timestamp:
- Oct 14, 2020, 7:34:55 PM (4 years ago)
- Location:
- branches/CpuSingleSize
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/CpuSingleSize
-
Property svn:ignore
set to
heaptrclog.trc
lib
CpuSingleSize
CpuSingleSize.lps
CpuSingleSize.res
CpuSingleSize.dbg
-
Property svn:ignore
set to
-
branches/CpuSingleSize/UMemory.pas
r216 r217 25 25 Position: Integer; 26 26 procedure Write(Value: TInteger); 27 procedure WriteString(Value: string); 27 28 procedure WriteMemory(Memory: TMemory); 28 29 function Read: TInteger; … … 81 82 procedure TMemory.Write(Value: TInteger); 82 83 begin 83 if Position >=FSize then Size := Position + 1;84 if Position + 1 > FSize then Size := Position + 1; 84 85 Data[Position] := Value; 85 86 Inc(Position); 87 end; 88 89 procedure TMemory.WriteString(Value: string); 90 var 91 I: Integer; 92 begin 93 if Length(Value) > 0 then begin 94 if Position + Length(Value) > FSize then Size := Position + Length(Value); 95 for I := 0 to Length(Value) - 1 do 96 Data[Position + I] := Ord(Value[I + 1]); 97 Inc(Position, Length(Value)); 98 end; 86 99 end; 87 100 … … 91 104 if Position + Memory.Size > FSize then Size := Position + Memory.Size; 92 105 Move(Memory.Data[0], Data[Position], Memory.Size * SizeOf(TInteger)); 106 Inc(Position, Memory.Size); 93 107 end; 94 108 end;
Note:
See TracChangeset
for help on using the changeset viewer.