コード例 #1
0
        public static unsafe Vector8s ShuffleLow(Vector8s va, ShuffleSel sel)
        {
            short *ptr = ((short *)&va);
            int    idx = (int)sel;

            return(new Vector8s(*(ptr + ((idx >> 0) & 0x3)), *(ptr + ((idx >> 2) & 0x3)), *(ptr + ((idx >> 4) & 0x3)), *(ptr + ((idx >> 6) & 0x3)), va.v4, va.v5, va.v6, va.v7));
        }
コード例 #2
0
        public static unsafe Vector8s ShuffleHigh(Vector8s va, ShuffleSel sel)
        {
            short *ptr = ((short *)&va) + 4;
            int    idx = (int)sel;

            return(new Vector8s(va.v0, va.v1, va.v2, va.v3, *(ptr + ((idx >> 0) & 0x3)), *(ptr + ((idx >> 2) & 0x3)), *(ptr + ((idx >> 4) & 0x3)), *(ptr + ((idx >> 6) & 0x3))));
        }
コード例 #3
0
ファイル: Vector8s.cs プロジェクト: kasertim/sentience
		public static unsafe Vector8s operator * (Vector8s va, Vector8s vb)
		{
			Vector8s res = new Vector8s ();
			short *a = &va.v0;
			short *b = &vb.v0;
			short *c = &res.v0;
			for (int i = 0; i < 8; ++i)
				*c++ = (short)(*a++ * (*b++));
			return res;
		}
コード例 #4
0
        public static unsafe int ExtractByteMask(Vector8s va)
        {
            int   res = 0;
            byte *a   = (byte *)&va;

            for (int i = 0; i < 16; ++i)
            {
                res |= (*a++ & 0x80) >> 7 << i;
            }
            return(res);
        }
コード例 #5
0
 public static void SetVectorAligned(this short[] array, Vector8s val, int offset)
 {
     array [offset + 0] = val.V0;
     array [offset + 1] = val.V1;
     array [offset + 2] = val.V2;
     array [offset + 3] = val.V3;
     array [offset + 4] = val.V4;
     array [offset + 5] = val.V5;
     array [offset + 6] = val.V6;
     array [offset + 7] = val.V7;
 }
コード例 #6
0
        public static unsafe Vector8s ShiftRightLogic(Vector8s va, int amount)
        {
            Vector8s res = new Vector8s();
            short *  a   = &va.v0;
            short *  b   = &res.v0;

            for (int i = 0; i < 8; ++i)
            {
                *b++ = (short)((ushort)(*a++) >> amount);
            }
            return(res);
        }
コード例 #7
0
ファイル: Vector8s.cs プロジェクト: samcf111/unityMono5.5.0
        public static unsafe Vector8s operator <<(Vector8s va, int amount)
        {
            Vector8s res = new Vector8s();
            short *  a   = &va.v0;
            short *  b   = &res.v0;

            for (int i = 0; i < 8; ++i)
            {
                *b++ = (short)(*a++ << amount);
            }
            return(res);
        }
コード例 #8
0
        public static unsafe Vector8s Min(Vector8s va, Vector8s vb)
        {
            Vector8s res = new Vector8s();
            short *  a   = &va.v0;
            short *  b   = &vb.v0;
            short *  c   = &res.v0;

            for (int i = 0; i < 8; ++i)
            {
                *c++ = (short)System.Math.Min(*a++, *b++);
            }
            return(res);
        }
コード例 #9
0
        public static unsafe Vector8s AddWithSaturation(Vector8s va, Vector8s vb)
        {
            Vector8s res = new Vector8s();
            short *  a   = &va.v0;
            short *  b   = &vb.v0;
            short *  c   = &res.v0;

            for (int i = 0; i < 8; ++i)
            {
                *c++ = (short)System.Math.Max(System.Math.Min(*a++ + *b++, short.MaxValue), short.MinValue);
            }
            return(res);
        }
コード例 #10
0
ファイル: Vector8s.cs プロジェクト: samcf111/unityMono5.5.0
        public static unsafe Vector8s operator ^(Vector8s va, Vector8s vb)
        {
            Vector8s res = new Vector8s();
            uint *   a   = (uint *)&va.v0;
            uint *   b   = (uint *)&vb.v0;
            uint *   c   = (uint *)&res.v0;

            *c++ = *a++ ^ *b++;
            *c++ = *a++ ^ *b++;
            *c++ = *a++ ^ *b++;
            *c   = *a ^ *b;
            return(res);
        }
コード例 #11
0
        public static unsafe Vector8s CompareGreaterThan(Vector8s va, Vector8s vb)
        {
            Vector8s res = new Vector8s();
            short *  a   = &va.v0;
            short *  b   = &vb.v0;
            short *  c   = &res.v0;

            for (int i = 0; i < 8; ++i)
            {
                *c++ = (short)(*a++ > *b++ ? -1 : 0);
            }
            return(res);
        }
コード例 #12
0
        public static unsafe Vector8s MultiplyStoreHigh(Vector8s va, Vector8s vb)
        {
            Vector8s res = new Vector8s();
            short *  a   = &va.v0;
            short *  b   = &vb.v0;
            short *  c   = &res.v0;

            for (int i = 0; i < 8; ++i)
            {
                *c++ = (short)((int)*a++ *(int)*b++ >> 16);
            }
            return(res);
        }
コード例 #13
0
ファイル: Vector8s.cs プロジェクト: samcf111/unityMono5.5.0
        public static unsafe Vector8s operator *(Vector8s va, Vector8s vb)
        {
            Vector8s res = new Vector8s();
            short *  a   = &va.v0;
            short *  b   = &vb.v0;
            short *  c   = &res.v0;

            for (int i = 0; i < 8; ++i)
            {
                *c++ = (short)(*a++ *(*b++));
            }
            return(res);
        }
コード例 #14
0
        public static unsafe Vector16sb PackWithSignedSaturation(Vector8s va, Vector8s vb)
        {
            Vector16sb res = new Vector16sb();
            short *    a   = (short *)&va;
            short *    b   = (short *)&vb;
            sbyte *    c   = (sbyte *)&res;

            for (int i = 0; i < 8; ++i)
            {
                *c++ = (sbyte)System.Math.Max(System.Math.Min((int)*a++, sbyte.MaxValue), sbyte.MinValue);
            }
            for (int i = 0; i < 8; ++i)
            {
                *c++ = (sbyte)System.Math.Max(System.Math.Min((int)*b++, sbyte.MaxValue), sbyte.MinValue);
            }
            return(res);
        }
コード例 #15
0
        public static unsafe Vector16b PackWithUnsignedSaturation(this Vector8s va, Vector8s vb)
        {
            Vector16b res = new Vector16b();
            short *   a   = (short *)&va;
            short *   b   = (short *)&vb;
            byte *    c   = (byte *)&res;

            for (int i = 0; i < 8; ++i)
            {
                *c++ = (byte)System.Math.Max(0, System.Math.Min((int)*a++, byte.MaxValue));
            }
            for (int i = 0; i < 8; ++i)
            {
                *c++ = (byte)System.Math.Max(0, System.Math.Min((int)*b++, byte.MaxValue));
            }
            return(res);
        }
コード例 #16
0
ファイル: Vector4ui.cs プロジェクト: williammc/sentience
        public static unsafe Vector8s SignedPackWithSignedSaturation(Vector4ui va, Vector4ui vb)
        {
            Vector8s res = new Vector8s();
            int *    a   = (int *)&va;
            int *    b   = (int *)&vb;
            short *  c   = (short *)&res;

            for (int i = 0; i < 4; ++i)
            {
                *c++ = (short)System.Math.Max(System.Math.Min((int)*a++, short.MaxValue), short.MinValue);
            }
            for (int i = 0; i < 4; ++i)
            {
                *c++ = (short)System.Math.Max(System.Math.Min((int)*b++, short.MaxValue), short.MinValue);
            }
            return(res);
        }
コード例 #17
0
ファイル: basic-simd.cs プロジェクト: Zman0169/mono
	public static int test_0_sse41_vector8s_min () {
		Vector8s v = new Vector8s(2);
		Vector8s v2 = new Vector8s(1);
		v = v.Min(v2);
		if (v.V0 != 1 || v.V1 != 1 || v.V2 != 1 || v.V3 != 1 || v.V4 != 1 || v.V5 != 1 || v.V6 != 1 || v.V7 != 1)
			return 1;
		return 0;
	}
コード例 #18
0
 public static unsafe void StoreAligned(Vector8s *res, Vector8s val)
 {
     *res = val;
 }
コード例 #19
0
ファイル: VectorOperations.cs プロジェクト: REALTOBIZ/mono
		public static unsafe Vector8s SubtractWithSaturation (this Vector8s va, Vector8s vb) {
			Vector8s res = new Vector8s ();
			short *a = &va.v0;
			short *b = &vb.v0;
			short *c = &res.v0;
			for (int i = 0; i < 8; ++i)
				*c++ = (short) System.Math.Max (System.Math.Min (*a++ - *b++, short.MaxValue), short.MinValue); ;
			return res;
		}
コード例 #20
0
ファイル: VectorOperations.cs プロジェクト: REALTOBIZ/mono
		public static unsafe Vector16sb PackWithSignedSaturation (this Vector8s va, Vector8s vb) {
			Vector16sb res = new Vector16sb ();
			short *a = (short*)&va;
			short *b = (short*)&vb;
			sbyte *c = (sbyte*)&res;
			for (int i = 0; i < 8; ++i)
				*c++ = (sbyte)System.Math.Max (System.Math.Min ((int)*a++, sbyte.MaxValue), sbyte.MinValue);
			for (int i = 0; i < 8; ++i)
				*c++ = (sbyte)System.Math.Max (System.Math.Min ((int)*b++, sbyte.MaxValue), sbyte.MinValue);
			return res;
		}
コード例 #21
0
ファイル: Vector8s.cs プロジェクト: kasertim/sentience
		public static unsafe Vector8s operator >> (Vector8s va, int amount)
		{
			Vector8s res = new Vector8s ();
			short *a = &va.v0;
			short *b = &res.v0;
			for (int i = 0; i < 8; ++i)
				*b++ = (short)(*a++ >> amount);
			return res;
		}
コード例 #22
0
ファイル: Vector8s.cs プロジェクト: kasertim/sentience
		public static unsafe void PrefetchNonTemporal (Vector8s *res)
		{
		}
コード例 #23
0
ファイル: Vector8s.cs プロジェクト: kasertim/sentience
		public static unsafe void PrefetchTemporalAllCacheLevels (Vector8s *res)
		{
		}
コード例 #24
0
ファイル: Vector8s.cs プロジェクト: kasertim/sentience
		public static unsafe Vector8s ShuffleHigh (Vector8s va, ShuffleSel sel)
		{
			short *ptr = ((short*)&va) + 4;
			int idx = (int)sel;
			return new Vector8s (va.v0, va.v1, va.v2, va.v3, *(ptr + ((idx >> 0) & 0x3)), *(ptr + ((idx >> 2) & 0x3)), *(ptr + ((idx >> 4) & 0x3)), *(ptr + ((idx >> 6) & 0x3)));
		}
コード例 #25
0
ファイル: Vector8s.cs プロジェクト: kasertim/sentience
		public static unsafe int ExtractByteMask (Vector8s va) {
			int res = 0;
			byte *a = (byte*)&va;
			for (int i = 0; i < 16; ++i)
				res |= (*a++ & 0x80) >> 7 << i;
			return res;
		}
コード例 #26
0
 public static void PrefetchNonTemporal(ref Vector8s res)
 {
 }
コード例 #27
0
 public static void PrefetchTemporal2ndLevelCache(ref Vector8s res)
 {
 }
コード例 #28
0
 public static void PrefetchTemporalAllCacheLevels(ref Vector8s res)
 {
 }
コード例 #29
0
ファイル: Vector8s.cs プロジェクト: d3x0r/Voxelarium
		public static unsafe Vector8s operator ^ (Vector8s va, Vector8s vb)
		{
			Vector8s res = new Vector8s ();
			uint *a = (uint*) &va.v0;
			uint *b = (uint*) &vb.v0;
			uint *c = (uint*) &res.v0;
			*c++ = *a++ ^ *b++;
			*c++ = *a++ ^ *b++;
			*c++ = *a++ ^ *b++;
			*c = *a ^ *b;
			return res;
		}
コード例 #30
0
ファイル: Vector8s.cs プロジェクト: kasertim/sentience
		public static unsafe Vector8s ShuffleLow (Vector8s va, ShuffleSel sel)
		{
			short *ptr = ((short*)&va);
			int idx = (int)sel;
			return new Vector8s (*(ptr + ((idx >> 0) & 0x3)), *(ptr + ((idx >> 2) & 0x3)), *(ptr + ((idx >> 4) & 0x3)), *(ptr + ((idx >> 6) & 0x3)), va.v4, va.v5, va.v6, va.v7);
		}
コード例 #31
0
 public static Vector8s LoadAligned(ref Vector8s v)
 {
     return(v);
 }
コード例 #32
0
ファイル: Vector8s.cs プロジェクト: kasertim/sentience
		public static unsafe Vector16b PackWithUnsignedSaturation (Vector8s va, Vector8s vb) {
			Vector16b res = new Vector16b ();
			short *a = (short*)&va;
			short *b = (short*)&vb;
			byte *c = (byte*)&res;
			for (int i = 0; i < 8; ++i)
				*c++ = (byte)System.Math.Max (0, System.Math.Min ((int)*a++, byte.MaxValue));
			for (int i = 0; i < 8; ++i)
				*c++ = (byte)System.Math.Max (0, System.Math.Min ((int)*b++, byte.MaxValue));
			return res;
		}
コード例 #33
0
ファイル: Vector8s.cs プロジェクト: kasertim/sentience
		public static unsafe void PrefetchTemporal2ndLevelCache (Vector8s *res)
		{
		}
コード例 #34
0
ファイル: Vector8s.cs プロジェクト: kasertim/sentience
		public static Vector8s LoadAligned (ref Vector8s v)
		{
			return v;
		}
コード例 #35
0
 public static unsafe Vector8s UnpackLow(Vector8s va, Vector8s vb)
 {
     return(new Vector8s(va.v0, vb.v0, va.v1, vb.v1, va.v2, vb.v2, va.v3, vb.v3));
 }
コード例 #36
0
ファイル: VectorOperations.cs プロジェクト: REALTOBIZ/mono
		public static unsafe Vector8s Min (this Vector8s va, Vector8s vb) {
			Vector8s res = new Vector8s ();
			short *a = &va.v0;
			short *b = &vb.v0;
			short *c = &res.v0;
			for (int i = 0; i < 8; ++i)
				*c++ = (short) System.Math.Min (*a++, *b++);
			return res;
		}
コード例 #37
0
ファイル: VectorOperations.cs プロジェクト: REALTOBIZ/mono
		public static unsafe Vector8s LogicalRightShift (this Vector8s va, int amount)
		{
			Vector8s res = new Vector8s ();
			short *a = &va.v0;
			short *b = &res.v0;
			for (int i = 0; i < 8; ++i)
				*b++ = (short)((ushort)(*a++) >> amount);
			return res;
		}
コード例 #38
0
ファイル: VectorOperations.cs プロジェクト: REALTOBIZ/mono
		public static unsafe Vector8s UnpackLow (this Vector8s va, Vector8s vb)
		{
			return new Vector8s (va.v0, vb.v0, va.v1, vb.v1, va.v2, vb.v2, va.v3, vb.v3);
		}
コード例 #39
0
ファイル: VectorOperations.cs プロジェクト: REALTOBIZ/mono
		public static unsafe Vector8s SignedPackWithSignedSaturation (this Vector4ui va, Vector4ui vb) {
			Vector8s res = new Vector8s ();
			int *a = (int*)&va;
			int *b = (int*)&vb;
			short *c = (short*)&res;
			for (int i = 0; i < 4; ++i)
				*c++ = (short)System.Math.Max (System.Math.Min ((int)*a++, short.MaxValue), short.MinValue);
			for (int i = 0; i < 4; ++i)
				*c++ = (short)System.Math.Max (System.Math.Min ((int)*b++, short.MaxValue), short.MinValue);
			return res;
		}
コード例 #40
0
ファイル: basic-simd.cs プロジェクト: Zman0169/mono
	public static unsafe int test_0_vector8s_pack_signed_sat () {
		Vector8s a = new Vector8s (-200, 200, 3, 0, 5, 6, 5, 4);
		Vector8s b = new Vector8s (9, 2, 1, 2, 3, 6, 5, 6);

		Vector16sb c = a.PackWithSignedSaturation (b);

		if (c.V0 != -128)
			return 1;
		if (c.V1 != 127)
			return 2;

		return 0;
	}
コード例 #41
0
ファイル: VectorOperations.cs プロジェクト: REALTOBIZ/mono
		public static unsafe Vector8s MultiplyStoreHigh (this Vector8s va, Vector8s vb) {
			Vector8s res = new Vector8s ();
			short *a = &va.v0;
			short *b = &vb.v0;
			short *c = &res.v0;
			for (int i = 0; i < 8; ++i)
				*c++ = (short)((int)*a++ * (int)*b++ >> 16);
			return res;
		}
コード例 #42
0
 public static void StoreAligned(ref Vector8s res, Vector8s val)
 {
     res = val;
 }
コード例 #43
0
ファイル: VectorOperations.cs プロジェクト: REALTOBIZ/mono
		public static unsafe Vector8s CompareGreaterThan (this Vector8s va, Vector8s vb) {
			Vector8s res = new Vector8s ();
			short *a = &va.v0;
			short *b = &vb.v0;
			short *c = &res.v0;
			for (int i = 0; i < 8; ++i)
				*c++ = (short) (*a++ > *b++ ? -1 : 0);
			return res;
		}
コード例 #44
0
ファイル: Vector8s.cs プロジェクト: kasertim/sentience
		public static unsafe Vector8s LoadAligned (Vector8s *v)
		{
			return *v;
		}
コード例 #45
0
ファイル: VectorOperations.cs プロジェクト: REALTOBIZ/mono
		public static unsafe Vector8s UnpackHigh (this Vector8s va, Vector8s vb)
		{
			return new Vector8s (va.v4, vb.v4, va.v5, vb.v5, va.v6, vb.v6, va.v7, vb.v7);
		}
コード例 #46
0
ファイル: Vector8s.cs プロジェクト: kasertim/sentience
		public static unsafe void StoreAligned (Vector8s *res, Vector8s val)
		{
			*res = val;
		}
コード例 #47
0
ファイル: basic-simd.cs プロジェクト: Zman0169/mono
	static int test_0_vector8s_one_element_ctor () {
		Vector8s a = new Vector8s (99);

		if (a.V0 != 99)
			return 1;
		if (a.V1 != 99)
			return 2;
		if (a.V2 != 99)
			return 3;
		if (a.V3 != 99)
			return 4;
		if (a.V4 != 99)
			return 5;
		if (a.V5 != 99)
			return 6;
		if (a.V6 != 99)
			return 7;
		if (a.V7 != 99)
			return 8;
		return 0;
	}
コード例 #48
0
ファイル: Vector8s.cs プロジェクト: kasertim/sentience
		public static void PrefetchTemporalAllCacheLevels (ref Vector8s res)
		{
		}
コード例 #49
0
ファイル: Vector8s.cs プロジェクト: kasertim/sentience
		public static void PrefetchTemporal2ndLevelCache (ref Vector8s res)
		{
		}
コード例 #50
0
ファイル: Vector8s.cs プロジェクト: kasertim/sentience
		public static void PrefetchNonTemporal (ref Vector8s res)
		{
		}
コード例 #51
0
ファイル: Vector8s.cs プロジェクト: kasertim/sentience
		public static void StoreAligned (ref Vector8s res, Vector8s val)
		{
			res = val;
		}
コード例 #52
0
 public static unsafe Vector8s UnpackHigh(Vector8s va, Vector8s vb)
 {
     return(new Vector8s(va.v4, vb.v4, va.v5, vb.v5, va.v6, vb.v6, va.v7, vb.v7));
 }