Nibble math works better than parsing things manually

This commit is contained in:
Lani Aung
2021-10-08 22:17:09 -05:00
parent 3fc504a4f6
commit 5646b3451f
6 changed files with 135 additions and 79 deletions
+23
View File
@@ -0,0 +1,23 @@
using System.Collections;
namespace fxl.codes.kisekae.Utilities
{
public static class Extensions
{
public static bool[] ToBoolArray(this BitArray bitArray)
{
var data = new bool[bitArray.Length];
bitArray.CopyTo(data, 0);
return data;
}
public static int IntValue(this bool[] data)
{
var bits = new BitArray(data);
var value = new int[1];
bits.CopyTo(value, 0);
return value[0];
}
}
}