Correct some straightforward analysis issues.

Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
Adrian Conlon
2019-07-01 00:15:25 +01:00
parent 21472154e0
commit 853b6e2b08
10 changed files with 243 additions and 228 deletions
+6 -6
View File
@@ -10,17 +10,17 @@ namespace EightBit
{
}
public static byte SetFlag(byte input, byte flag) => (byte)(input | flag);
public static byte SetBit(byte input, byte which) => (byte)(input | which);
public static byte SetFlag(byte input, byte flag, int condition) => SetFlag(input, flag, condition != 0);
public static byte SetBit(byte input, byte which, int condition) => SetBit(input, which, condition != 0);
public static byte SetFlag(byte input, byte flag, bool condition) => condition ? SetFlag(input, flag) : ClearFlag(input, flag);
public static byte SetBit(byte input, byte which, bool condition) => condition ? SetBit(input, which) : ClearBit(input, which);
public static byte ClearFlag(byte input, byte flag) => (byte)(input & (byte)~flag);
public static byte ClearBit(byte input, byte which) => (byte)(input & (byte)~which);
public static byte ClearFlag(byte input, byte flag, int condition) => ClearFlag(input, flag, condition != 0);
public static byte ClearBit(byte input, byte which, int condition) => ClearBit(input, which, condition != 0);
public static byte ClearFlag(byte input, byte flag, bool condition) => SetFlag(input, flag, !condition);
public static byte ClearBit(byte input, byte which, bool condition) => SetBit(input, which, !condition);
public static byte HighByte(int value) => (byte)(value >> 8);