mirror of
https://github.com/MoleskiCoder/EightBitNet.git
synced 2026-04-25 09:16:41 +00:00
Correct some stuff spotted by the .net analysis tools (where I agree with them!)
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
+6
-15
@@ -4,22 +4,13 @@
|
||||
{
|
||||
protected Chip() { }
|
||||
|
||||
public static void ClearFlag(ref byte f, byte flag) => f &= (byte)~flag;
|
||||
public static void SetFlag(ref byte f, byte flag) => f |= flag;
|
||||
public static byte SetFlag(byte input, byte flag) => (byte)(input | flag);
|
||||
public static byte SetFlag(byte input, byte flag, int condition) => SetFlag(input, flag, condition != 0);
|
||||
public static byte SetFlag(byte input, byte flag, bool condition) => condition ? SetFlag(input, flag) : ClearFlag(input, flag);
|
||||
|
||||
public static void SetFlag(ref byte f, byte flag, int condition) => SetFlag(ref f, flag, condition != 0);
|
||||
|
||||
public static void SetFlag(ref byte f, byte flag, bool condition)
|
||||
{
|
||||
if (condition)
|
||||
SetFlag(ref f, flag);
|
||||
else
|
||||
ClearFlag(ref f, flag);
|
||||
}
|
||||
|
||||
public static void ClearFlag(ref byte f, byte flag, int condition) => ClearFlag(ref f, flag, condition != 0);
|
||||
|
||||
public static void ClearFlag(ref byte f, byte flag, bool condition) => SetFlag(ref f, flag, !condition);
|
||||
public static byte ClearFlag(byte input, byte flag) => (byte)(input & (byte)~flag);
|
||||
public static byte ClearFlag(byte input, byte flag, int condition) => ClearFlag(input, flag, condition != 0);
|
||||
public static byte ClearFlag(byte input, byte flag, bool condition) => SetFlag(input, flag, !condition);
|
||||
|
||||
public static byte HighByte(int value) => (byte)(value >> 8);
|
||||
public static byte HighByte(ushort value) => HighByte((int)value);
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
|
||||
Reference in New Issue
Block a user