mirror of
https://github.com/MoleskiCoder/EightBitNet.git
synced 2026-04-20 21:16:29 +00:00
Apply all analysis suggestions
This commit is contained in:
+3
-17
@@ -52,24 +52,10 @@ namespace EightBit
|
||||
|
||||
public static int DemoteNibble(byte value) => HighNibble(value);
|
||||
|
||||
public static int CountBits(uint value)
|
||||
{
|
||||
return System.Numerics.BitOperations.PopCount(value);
|
||||
}
|
||||
public static int CountBits(uint value) => System.Numerics.BitOperations.PopCount(value);
|
||||
|
||||
public static bool EvenParity(uint value)
|
||||
{
|
||||
return CountBits(value) % 2 == 0;
|
||||
}
|
||||
public static bool EvenParity(uint value) => CountBits(value) % 2 == 0;
|
||||
|
||||
public static int FindFirstSet(uint value)
|
||||
{
|
||||
if (value == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return System.Numerics.BitOperations.TrailingZeroCount(value) + 1;
|
||||
}
|
||||
public static int FindFirstSet(uint value) => value == 0 ? 0 : System.Numerics.BitOperations.TrailingZeroCount(value) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user