public void TestInt64() { for (var n = 0; n < sizeof(Int64) * 8; n++) { Int64 i = (Int64)1 << n; Assert.True(i.IsBitSet(n), n.ToString()); } }
public static string ToBitString(this Int64 x, int length = 64) { return(string.Join("", Enumerable.Range(0, length).Select(bit => x.IsBitSet(bit) ? "1" : "0"))); }