Esempio n. 1
0
 public Operand(OpcodeType parentType)
 {
     ParentType = parentType;
     Swizzles   = new[]
     {
         Operand4ComponentName.X,
         Operand4ComponentName.Y,
         Operand4ComponentName.Z,
         Operand4ComponentName.W
     };
     Indices = new OperandIndex[3];
 }
Esempio n. 2
0
		public Operand(OpcodeType parentType)
		{
			_parentType = parentType;
			Swizzles = new[]
			{
				Operand4ComponentName.X,
				Operand4ComponentName.Y,
				Operand4ComponentName.Z,
				Operand4ComponentName.W
			};
			Indices = new OperandIndex[3];
		}
        private static string GetRegisterIndex(OperandIndex index)
        {
            switch (index.Representation)
            {
				case OperandIndexRepresentation.Immediate32:
				case OperandIndexRepresentation.Immediate64:
		            return index.Value.ToString();
                case OperandIndexRepresentation.Immediate32PlusRelative:
                case OperandIndexRepresentation.Immediate64PlusRelative:
		            return string.Format("{0} + {1}",
			            GenerateGetOperandValue(index.Register, NumberType.Unknown, forUseInArrayIndex: true),
			            index.Value);
                case OperandIndexRepresentation.Relative:
		            return string.Format("{0}",
			            GenerateGetOperandValue(index.Register, NumberType.Unknown, forUseInArrayIndex: true));
				default :
					throw new ArgumentOutOfRangeException("index");
            }
        }
Esempio n. 4
0
		private static ushort EvaluateOperandIndex(ExecutionContext context, OperandIndex index)
		{
			var result = (ushort)index.Value;
			switch (index.Representation)
			{
				case OperandIndexRepresentation.Immediate32PlusRelative:
				case OperandIndexRepresentation.Immediate64PlusRelative:
				case OperandIndexRepresentation.Relative:
					var operandValue = GetOperandValue(context, index.Register, NumberType.UInt);
					switch (index.Register.SelectionMode)
					{
						case Operand4ComponentSelectionMode.Mask:
							result += (ushort) operandValue.GetMaskedNumber(index.Register.ComponentMask).UInt;
							break;
						case Operand4ComponentSelectionMode.Select1:
							result += (ushort) operandValue.GetSwizzledNumber(index.Register.Swizzles[0]).UInt;
							break;
						default :
							throw new ArgumentOutOfRangeException();
					}
					break;
			}
			return result;
		}