Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Off by one error #1001

Merged
merged 1 commit into from
Dec 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading