public void TestCountSetBits32() { Assert.AreEqual(0, TestsHelper.CountSetBits(0x00U)); Assert.AreEqual(8, TestsHelper.CountSetBits(0xFFU)); Assert.AreEqual(16, TestsHelper.CountSetBits(0xFFFFU)); Assert.AreEqual(24, TestsHelper.CountSetBits(0xFFFFFFU)); Assert.AreEqual(32, TestsHelper.CountSetBits(0xFFFFFFFFU)); Assert.AreEqual(4, TestsHelper.CountSetBits(0x01010101U)); }
public void TestCountSetBits64() { Assert.AreEqual(0, TestsHelper.CountSetBits(0x00UL)); Assert.AreEqual(8, TestsHelper.CountSetBits(0xFFUL)); Assert.AreEqual(16, TestsHelper.CountSetBits(0xFFFFUL)); Assert.AreEqual(24, TestsHelper.CountSetBits(0xFFFFFFUL)); Assert.AreEqual(32, TestsHelper.CountSetBits(0xFFFFFFFFUL)); Assert.AreEqual(40, TestsHelper.CountSetBits(0xFFFFFFFFFFUL)); Assert.AreEqual(48, TestsHelper.CountSetBits(0xFFFFFFFFFFFFUL)); Assert.AreEqual(56, TestsHelper.CountSetBits(0xFFFFFFFFFFFFFFUL)); Assert.AreEqual(64, TestsHelper.CountSetBits(0xFFFFFFFFFFFFFFFFUL)); Assert.AreEqual(8, TestsHelper.CountSetBits(0x0101010101010101UL)); }