示例#1
0
 public bool Equals(TestObject other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(TestBoolean.Equals(other.TestBoolean) && TestDouble.Equals(other.TestDouble) && TestInt == other.TestInt && TestIntVector.SequenceEqual(other.TestIntVector) &&
            TestLong == other.TestLong && string.Equals(TestString, other.TestString) && TestInt128 == other.TestInt128 && TestInt256 == other.TestInt256);
 }
示例#2
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = TestBoolean.GetHashCode();
         hashCode = (hashCode * 397) ^ TestDouble.GetHashCode();
         hashCode = (hashCode * 397) ^ TestInt;
         hashCode = (hashCode * 397) ^ (TestIntVector != null ? TestIntVector.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ TestLong.GetHashCode();
         hashCode = (hashCode * 397) ^ (TestString != null ? TestString.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ TestInt128.GetHashCode();
         hashCode = (hashCode * 397) ^ TestInt256.GetHashCode();
         return(hashCode);
     }
 }
示例#3
0
        public override string ToString()
        {
            string result = TypeDescription;

            if (Header.OpcodeType == OpcodeType.Sync)
            {
                result += SyncFlags.GetDescription();
            }

            if (ExtendedTypes.Contains(InstructionTokenExtendedType.SampleControls))
            {
                result += "_aoffimmi";
            }

            if (ExtendedTypes.Contains(InstructionTokenExtendedType.ResourceDim))
            {
                result += "_indexable";
            }

            if (ExtendedTypes.Contains(InstructionTokenExtendedType.SampleControls))
            {
                result += string.Format("({0},{1},{2})", SampleOffsets[0], SampleOffsets[1], SampleOffsets[2]);
            }

            if (ExtendedTypes.Contains(InstructionTokenExtendedType.ResourceDim))
            {
                result += string.Format("({0}", ResourceTarget.GetDescription());
                if (ResourceStride != 0)
                {
                    result += string.Format(", stride={0}", ResourceStride);
                }
                result += ")";
            }

            if (ExtendedTypes.Contains(InstructionTokenExtendedType.ResourceReturnType))
            {
                result += string.Format("({0},{1},{2},{3})",
                                        ResourceReturnTypes[0].GetDescription(),
                                        ResourceReturnTypes[1].GetDescription(),
                                        ResourceReturnTypes[2].GetDescription(),
                                        ResourceReturnTypes[3].GetDescription());
            }

            if (Header.OpcodeType == OpcodeType.Resinfo && ResInfoReturnType != ResInfoReturnType.Float)
            {
                result += string.Format("_{0}", ResInfoReturnType.GetDescription().ToLower());
            }

            if (Header.OpcodeType.IsConditionalInstruction())
            {
                result += "_" + TestBoolean.GetDescription();
            }

            if (Saturate)
            {
                result += "_sat";
            }
            result += " ";

            if (Header.OpcodeType == OpcodeType.InterfaceCall)
            {
                result += string.Format("fp{0}[{1}][{2}]",
                                        Operands[0].Indices[0].Value,
                                        Operands[0].Indices[1],
                                        FunctionIndex);
            }
            else
            {
                for (int i = 0; i < Operands.Count; i++)
                {
                    var operandString = Operands[i].ToString();
                    if (i > 0 && !string.IsNullOrEmpty(operandString))
                    {
                        result += ", ";
                    }
                    result += operandString;
                }
            }

            return(result);
        }