Skip to content

Commit

Permalink
fix: Off by one error (#1001)
Browse files Browse the repository at this point in the history
Signed-off-by: Maximilien Noal <noal.maximilien@gmail.com>
  • Loading branch information
maximilien-noal authored Dec 29, 2024
1 parent 356bef5 commit 16db6e2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/Spice86/MemoryWrappers/DataMemoryDocument.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

using System;

/// <inheritdoc cref="IBinaryDocument" />
public sealed class DataMemoryDocument : IBinaryDocument {
private readonly IMemory _memory;
private readonly uint _startAddress;
Expand All @@ -17,7 +18,7 @@ public DataMemoryDocument(IMemory memory, uint startAddress, uint endAddress) {
_startAddress = startAddress;
_endAddress = endAddress;
_memory = memory;
ValidRanges = new MemoryReadOnlyBitRangeUnion(0, _endAddress + 1 - _startAddress);
ValidRanges = new MemoryReadOnlyBitRangeUnion(0, _endAddress - _startAddress);
}

public event Action<Exception>? MemoryReadInvalidOperation;
Expand Down
2 changes: 1 addition & 1 deletion src/Spice86/MemoryWrappers/MemoryReadOnlyBitRangeUnion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ internal class MemoryReadOnlyBitRangeUnion : IReadOnlyBitRangeUnion {
/// Initializes a new instance of the <see cref="MemoryReadOnlyBitRangeUnion"/> class.
/// </summary>
/// <param name="startAddress">The start address of tha range of memory.</param>
/// <param name="endAddress">The end address of the range of memory. This end address is not included in the range.</param>
/// <param name="endAddress">The end address of the range of memory.</param>
public MemoryReadOnlyBitRangeUnion(uint startAddress, uint endAddress) {
_startAddress = startAddress;
_endAddress = endAddress;
Expand Down

0 comments on commit 16db6e2

Please sign in to comment.