public void CountBitsCleared() { Assert.AreEqual(32 - 0, BitMath.CountBitsCleared(0)); Assert.AreEqual(32 - 32, BitMath.CountBitsCleared(uint.MaxValue)); Assert.AreEqual(32 - 31, BitMath.CountBitsCleared(int.MaxValue)); Assert.AreEqual(32 - 1, BitMath.CountBitsCleared(short.MaxValue + 1)); Assert.AreEqual(32 - 10, BitMath.CountBitsCleared(0xF030207)); Assert.AreEqual(64 - 0, BitMath.CountBitsCleared((ulong)0)); Assert.AreEqual(64 - 32, BitMath.CountBitsCleared((ulong)uint.MaxValue)); Assert.AreEqual(64 - 31, BitMath.CountBitsCleared((ulong)int.MaxValue)); Assert.AreEqual(64 - 1, BitMath.CountBitsCleared((ulong)short.MaxValue + 1)); Assert.AreEqual(64 - 10, BitMath.CountBitsCleared((ulong)0xF030207)); int x = -1; Assert.AreEqual(64 - 64, BitMath.CountBitsCleared(ulong.MaxValue)); Assert.AreEqual(64 - 64, BitMath.CountBitsCleared((ulong)x)); }