public void Run() { BitReverse reverse = new BitReverse(); // ushort ui = 10; // ushort uj = reverse.Reverse(ui); // PrintBit(ui); // PrintBit(uj); // ui = 10010; // uj = reverse.Reverse(ui); // PrintBit(ui); // PrintBit(uj); // uint i = 10; // uint j = reverse.Reverse(i); // PrintBit(i); // PrintBit(j); // i = 10010; // j = reverse.Reverse(i); // PrintBit(i); // PrintBit(j); PerfRun(reverse); }
private void PerfRun(BitReverse reverse) { Stopwatch watch = Stopwatch.StartNew(); for (int i = 0; i < 1000 * 1000 * 100; i++) { reverse.Reverse(43261596); } System.Console.WriteLine(watch.Elapsed); watch = Stopwatch.StartNew(); for (int i = 0; i < 1000 * 1000 * 100; i++) { reverse.Reverse1(43261596); } System.Console.WriteLine(watch.Elapsed); watch = Stopwatch.StartNew(); for (int i = 0; i < 1000 * 1000 * 100; i++) { reverse.Reverse2(43261596); } System.Console.WriteLine(watch.Elapsed); }