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

            Console.WriteLine("Testing BSF");

            var test_16u = (ushort)0x0001U;

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

            var test_32u = 0x00000001U;

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

            var test_64u = 0x0000000000000001U;

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

            var location = Intrinsincs.BSF(test);

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

            var location = Intrinsincs.BSF(test);

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