From af3ef65b14b4b81a640fec0902630e8e0be3efe6 Mon Sep 17 00:00:00 2001 From: Maximilien Noal Date: Sun, 29 Dec 2024 16:09:10 +0100 Subject: [PATCH] fix: Off by one error Signed-off-by: Maximilien Noal --- src/Spice86/MemoryWrappers/DataMemoryDocument.cs | 3 ++- src/Spice86/MemoryWrappers/MemoryReadOnlyBitRangeUnion.cs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Spice86/MemoryWrappers/DataMemoryDocument.cs b/src/Spice86/MemoryWrappers/DataMemoryDocument.cs index 5a7463624..d835d68a0 100644 --- a/src/Spice86/MemoryWrappers/DataMemoryDocument.cs +++ b/src/Spice86/MemoryWrappers/DataMemoryDocument.cs @@ -5,6 +5,7 @@ using System; +/// public sealed class DataMemoryDocument : IBinaryDocument { private readonly IMemory _memory; private readonly uint _startAddress; @@ -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? MemoryReadInvalidOperation; diff --git a/src/Spice86/MemoryWrappers/MemoryReadOnlyBitRangeUnion.cs b/src/Spice86/MemoryWrappers/MemoryReadOnlyBitRangeUnion.cs index 5d785d32f..21f3adf21 100644 --- a/src/Spice86/MemoryWrappers/MemoryReadOnlyBitRangeUnion.cs +++ b/src/Spice86/MemoryWrappers/MemoryReadOnlyBitRangeUnion.cs @@ -17,7 +17,7 @@ internal class MemoryReadOnlyBitRangeUnion : IReadOnlyBitRangeUnion { /// Initializes a new instance of the class. /// /// The start address of tha range of memory. - /// The end address of the range of memory. This end address is not included in the range. + /// The end address of the range of memory. public MemoryReadOnlyBitRangeUnion(uint startAddress, uint endAddress) { _startAddress = startAddress; _endAddress = endAddress;