示例#1
0
 public static void Scale(ref Long4 m, long s, out Long4 result)
 {
     result.A = m.A * s;
     result.B = m.B * s;
     result.C = m.C * s;
     result.D = m.D * s;
 }
示例#2
0
        public static void Test()
        {
            {
                //Nested versus flattened tests
                var s8  = new OuterStruct8();
                var s16 = new OuterStruct16();
                var s   = 0f;
                OuterStruct8.Test(ref s8, s, out var result8);
                OuterStruct16.Test(ref s16, s, out var result16);

                var d = new DummyOuterStruct();
                DummyOuterStruct.Test(ref d, 0f, out var dResult);

                var f = new ScalarFlattenedStruct();
                ScalarFlattenedStruct.Test(ref f, s, out var flattenedResult);
            }

            {
                //Field count tests
                var i4  = new Int4();
                var i5  = new Int5();
                var l4  = new Long4();
                var l5  = new Long5();
                var vf4 = new VectorFloat4();
                var vf5 = new VectorFloat5();
                var s   = new Vector <float>();
                Int4.Test(ref i4, 0, out var i4result);
                Int5.Test(ref i5, 0, out var i5result);
                Long4.Test(ref l4, 0, out var l4result);
                Long5.Test(ref l5, 0, out var l5result);
                VectorFloat4.Test(ref vf4, ref s, out var vf4Result);
                VectorFloat5.Test(ref vf5, ref s, out var vf5Result);
            }

            {
                //Assignment-only tests
                var s16 = new DummyStruct16();
                var s32 = new DummyStruct32();
                var s48 = new DummyStruct48();
                var s64 = new DummyStruct64();
                var s80 = new DummyStruct80();
                DoDummies(ref s16, out var result16);
                DoDummies(ref s32, out var result32);
                DoDummies(ref s48, out var result48);
                DoDummies(ref s64, out var result64);
                DoDummies(ref s80, out var result80);
            }

            {
                TestScalarStruct();
                TestStruct();
                TestStructManuallyInlined();
                TestStructless();
            }
        }
示例#3
0
            private void _read()
            {
                _code = ((PythonPickle.Opcode)m_io.ReadU1());
                switch (Code)
                {
                case PythonPickle.Opcode.Ext4: {
                    _arg = m_io.ReadU4le();
                    break;
                }

                case PythonPickle.Opcode.Tuple1: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Setitem: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.ReadonlyBuffer: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Stop: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Ext2: {
                    _arg = m_io.ReadU2le();
                    break;
                }

                case PythonPickle.Opcode.EmptyTuple: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Newtrue: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Long: {
                    _arg = new DecimalnlLong(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Newobj: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Bytearray8: {
                    _arg = new Bytearray8(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Put: {
                    _arg = new DecimalnlShort(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.StackGlobal: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.PopMark: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Append: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Newfalse: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Binpersid: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Build: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.EmptyDict: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Tuple2: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Long4: {
                    _arg = new Long4(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.NextBuffer: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Appends: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Binbytes: {
                    _arg = new Bytes4(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Dup: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.List: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Proto: {
                    _arg = m_io.ReadU1();
                    break;
                }

                case PythonPickle.Opcode.Pop: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Frame: {
                    _arg = m_io.ReadU8le();
                    break;
                }

                case PythonPickle.Opcode.String: {
                    _arg = new Stringnl(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Binunicode: {
                    _arg = new Unicodestring4(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Float: {
                    _arg = new Floatnl(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Reduce: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.GlobalOpcode: {
                    _arg = new StringnlNoescapePair(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Binput: {
                    _arg = m_io.ReadU1();
                    break;
                }

                case PythonPickle.Opcode.Memoize: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Persid: {
                    _arg = new StringnlNoescape(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Ext1: {
                    _arg = m_io.ReadU1();
                    break;
                }

                case PythonPickle.Opcode.None: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.ShortBinunicode: {
                    _arg = new Unicodestring1(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Obj: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Binfloat: {
                    _arg = m_io.ReadF8be();
                    break;
                }

                case PythonPickle.Opcode.NewobjEx: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.EmptyList: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Tuple: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Binunicode8: {
                    _arg = new Unicodestring8(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Binget: {
                    _arg = m_io.ReadU1();
                    break;
                }

                case PythonPickle.Opcode.Dict: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Binstring: {
                    _arg = new String4(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Setitems: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Binint2: {
                    _arg = m_io.ReadU2le();
                    break;
                }

                case PythonPickle.Opcode.Binbytes8: {
                    _arg = new Bytes8(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Binint1: {
                    _arg = m_io.ReadU1();
                    break;
                }

                case PythonPickle.Opcode.Inst: {
                    _arg = new StringnlNoescapePair(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.LongBinget: {
                    _arg = m_io.ReadU4le();
                    break;
                }

                case PythonPickle.Opcode.LongBinput: {
                    _arg = m_io.ReadU4le();
                    break;
                }

                case PythonPickle.Opcode.Int: {
                    _arg = new DecimalnlShort(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Binint: {
                    _arg = m_io.ReadS4le();
                    break;
                }

                case PythonPickle.Opcode.Unicode: {
                    _arg = new Unicodestringnl(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Long1: {
                    _arg = new Long1(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.ShortBinstring: {
                    _arg = new String1(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Mark: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Frozenset: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Tuple3: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Additems: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Get: {
                    _arg = new DecimalnlShort(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.EmptySet: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.ShortBinbytes: {
                    _arg = new Bytes1(m_io, this, m_root);
                    break;
                }
                }
            }
示例#4
0
 public static void Test(ref Long4 m, long s, out Long4 result)
 {
     //no locals initialized
     Scale(ref m, s, out var temp);
     Scale(ref temp, s, out result);
 }