Esempio n. 1
0
 public static ref T gather <T>(T src, T mask, ref T dst)
     where T : unmanaged
 {
     if (typeof(T) == typeof(sbyte))
     {
         Bits.gather(int8(src), int8(mask), ref int8(ref dst));
     }
     else if (typeof(T) == typeof(byte))
     {
         Bits.gather(uint8(src), uint8(mask), ref uint8(ref dst));
     }
     else if (typeof(T) == typeof(short))
     {
         Bits.gather(int16(src), int16(mask), ref int16(ref dst));
     }
     else if (typeof(T) == typeof(ushort))
     {
         Bits.gather(uint16(src), uint16(mask), ref uint16(ref dst));
     }
     else if (typeof(T) == typeof(int))
     {
         Bits.gather(int32(src), int32(mask), ref int32(ref dst));
     }
     else if (typeof(T) == typeof(uint))
     {
         Bits.gather(uint32(src), uint32(mask), ref uint32(ref dst));
     }
     else if (typeof(T) == typeof(long))
     {
         Bits.gather(int64(src), int64(mask), ref int64(ref dst));
     }
     else if (typeof(T) == typeof(ulong))
     {
         Bits.gather(uint64(src), uint64(mask), ref uint64(ref dst));
     }
     else
     {
         throw unsupported <T>();
     }
     return(ref dst);
 }
Esempio n. 2
0
 public static T gather <T>(T src, T mask)
     where T : unmanaged
 {
     if (typeof(T) == typeof(sbyte))
     {
         return(generic <T>(Bits.gather(int8(src), int8(mask))));
     }
     else if (typeof(T) == typeof(byte))
     {
         return(generic <T>(Bits.gather(uint8(src), uint8(mask))));
     }
     else if (typeof(T) == typeof(short))
     {
         return(generic <T>(Bits.gather(int16(src), int16(mask))));
     }
     else if (typeof(T) == typeof(ushort))
     {
         return(generic <T>(Bits.gather(uint16(src), uint16(mask))));
     }
     else if (typeof(T) == typeof(int))
     {
         return(generic <T>(Bits.gather(int32(src), int32(mask))));
     }
     else if (typeof(T) == typeof(uint))
     {
         return(generic <T>(Bits.gather(uint32(src), uint32(mask))));
     }
     else if (typeof(T) == typeof(long))
     {
         return(generic <T>(Bits.gather(int64(src), int64(mask))));
     }
     else if (typeof(T) == typeof(ulong))
     {
         return(generic <T>(Bits.gather(uint64(src), uint64(mask))));
     }
     else
     {
         throw unsupported <T>();
     }
 }
Esempio n. 3
0
 public static uint select(uint src, Part12x6 part)
 => Bits.gather(src, (uint)part);
Esempio n. 4
0
 public static byte select(uint src, Part6x1 part)
 => (byte)Bits.gather(src, (uint)part);