Esempio n. 1
0
        public void BitManipulationPairwiseSwap2ClearAndShiftCompleteTest2()
        {
            var expected = Convert.ToInt32("1101", 2);
            var actual   = BitManipulationPairwiseSwap2ClearAndShiftComplete.SwapOddEvenBits(Convert.ToInt32("1110", 2));

            Assert.AreEqual(expected, actual);
        }
Esempio n. 2
0
        public void BitManipulationPairwiseSwap2ClearAndShiftCompleteTest3()
        {
            var original = Convert.ToInt32("10101010101010101010101010101010", 2);
            var expected = Convert.ToInt32("01010101010101010101010101010101", 2);

            // Swap
            var actual = BitManipulationPairwiseSwap2ClearAndShiftComplete.SwapOddEvenBits(original);

            Assert.AreEqual(expected, actual);

            // Swap back.
            var actual2 = BitManipulationPairwiseSwap2ClearAndShiftComplete.SwapOddEvenBits(actual);

            Assert.AreEqual(actual2, original);
        }