Beispiel #1
0
        public void BitScanReverseSimple()
        {
            int location;

            Console.WriteLine("Testing BSR");

            var test_16u = (ushort)0x0001U;

            for (var i = 0; i < 16; i++)
            {
                location = Intrinsincs.BSR(test_16u);
                Assert.That(location, Is.EqualTo(i));
                test_16u <<= 1;
            }

            var test_32u = 0x00000001U;

            for (var i = 0; i < 32; i++)
            {
                location = Intrinsincs.BSR(test_32u);
                Assert.That(location, Is.EqualTo(i));
                test_32u <<= 1;
            }

            var test_64u = 0x0000000000000001U;

            for (var i = 0; i < 32; i++)
            {
                location = Intrinsincs.BSR(test_64u);
                Assert.That(location, Is.EqualTo(i));
                test_64u <<= 1;
            }
        }
Beispiel #2
0
        private static void TestBSR64()
        {
            var test = 0x00000100U;

            var location = Intrinsincs.BSR(test);

            Console.WriteLine("BSR32 {0}", location);
        }
Beispiel #3
0
        private static void TestBSR16()
        {
            var test = (ushort)0x0100U;

            var location = Intrinsincs.BSR(test);

            Console.WriteLine("BSR16 {0}", location);
        }