mirror of
https://github.com/MoleskiCoder/EightBitNet.git
synced 2026-10-24 14:05:42 +00:00
Small usage simplification with bus mapper
This commit is contained in:
1 parent
2ecc139d63
commit
7d99e8162f
2 files changed
+4
-4
No files matched your search
+1
-1
@@ -66,7 +66,7 @@ namespace EightBit
|
||||
protected ref byte Reference(ushort absolute)
|
||||
{
|
||||
var mapped = this.Mapping(absolute);
|
||||
var offset = (ushort)mapped.Offset(absolute);
|
||||
var offset = mapped.Offset(absolute);
|
||||
if (mapped.Access != AccessLevel.ReadOnly)
|
||||
{
|
||||
return ref mapped.Memory.Reference(offset);
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace EightBit
|
||||
{
|
||||
}
|
||||
|
||||
private readonly int[] _offsets = new int[ushort.MaxValue + 1];
|
||||
private readonly ushort[] _offsets = new ushort[ushort.MaxValue + 1];
|
||||
private readonly Memory _memory;
|
||||
private readonly ushort _begin;
|
||||
private readonly ushort _mask;
|
||||
@@ -39,8 +39,8 @@ namespace EightBit
|
||||
|
||||
public AccessLevel Access => this._access;
|
||||
|
||||
private int CalculateOffset(ushort absolute) => (absolute - this.Begin) & this.Mask;
|
||||
private ushort CalculateOffset(ushort absolute) => (ushort)((absolute - this.Begin) & this.Mask);
|
||||
|
||||
public int Offset(ushort absolute) => this._offsets[absolute];
|
||||
public ushort Offset(ushort absolute) => this._offsets[absolute];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user