Couple of small refactorings, based on repeated bit patterns

Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
Adrian Conlon
2019-08-07 13:27:03 +01:00
parent dedc340bf5
commit f54ef07057
3 changed files with 18 additions and 14 deletions
+3 -3
View File
@@ -347,9 +347,9 @@ namespace EightBit
private static byte AdjustOverflowSub(byte input, byte before, byte value, byte calculation) => AdjustOverflowSub(input, before & (byte)StatusBits.SF, value & (byte)StatusBits.SF, calculation & (byte)StatusBits.SF);
private static byte RES(int n, byte operand) => (byte)(operand & ~(1 << n));
private static byte RES(int n, byte operand) => ClearBit(operand, Bit(n));
private static byte SET(int n, byte operand) => (byte)(operand | (1 << n));
private static byte SET(int n, byte operand) => SetBit(operand, Bit(n));
private void DisableInterrupts() => this.IFF1 = this.IFF2 = false;
@@ -1724,7 +1724,7 @@ namespace EightBit
{
this.F = SetBit(this.F, StatusBits.HC);
this.F = ClearBit(this.F, StatusBits.NF);
var discarded = (byte)(operand & (1 << n));
var discarded = (byte)(operand & Bit(n));
this.F = AdjustSZ(this.F, discarded);
this.F = ClearBit(this.F, StatusBits.PF, discarded);
}