Пример #1
0
        public void blsi_64_bench_ref()
        {
            var opname  = $"blsi_{bitsize<ulong>()}_ref";
            var opcount = CycleCount * RoundCount;
            var sw      = stopwatch(false);
            var last    = 0ul;

            for (var i = 0; i < opcount; i++)
            {
                var x = Random.Next <ulong>();
                sw.Start();
                last = Bits.blsi(x);
                sw.Stop();
            }
            Collect((opcount, sw, opname));
        }
Пример #2
0
 public static T blsi <T>(T src)
     where T : struct
 {
     if (typeof(T) == typeof(byte))
     {
         return(generic <T>(Bits.blsi(uint8(src))));
     }
     else if (typeof(T) == typeof(ushort))
     {
         return(generic <T>(Bits.blsi(uint16(src))));
     }
     else if (typeof(T) == typeof(uint))
     {
         return(generic <T>(Bits.blsi(uint32(src))));
     }
     else if (typeof(T) == typeof(ulong))
     {
         return(generic <T>(Bits.blsi(uint64(src))));
     }
     else
     {
         throw unsupported <T>();
     }
 }