/// <summary> /// Multiplies two operands. /// </summary> /// <returns>Result of operation.</returns> public void Mul(Operand in1, Operand in2, Operand outOp) { if (in1.IsArray || !in1.Equals(in2) || !in1.Equals(outOp) || !outOp.IsWritable) { throw new IncompatibleOperandsException("Addition operation requires both formats to be the same."); } // We check if we can precache it, this is copy only op. if (in1.IsFixed && in2.IsFixed) { Operand tmp = CreateFixed(in1.Format, in1.ArraySize, Math.MathHelper.Mul(in1.Value, in2.Value)); // We must create a mem copy. compiler.Mov(tmp.Name, outOp.Name); return; } PinFormat dummy; // Special matrix-* or *-matrix multiplication. if (PinFormatHelper.IsMatrix(in1.Format, out dummy) || PinFormatHelper.IsMatrix(in2.Format, out dummy)) { compiler.MulEx(in1.Name, in2.Name, outOp.Name); } else { compiler.Mul(in1.Name, in2.Name, outOp.Name); } }