public override ECFieldElement Add(ECFieldElement b)
 {
     uint[] z = Nat.Create(12);
     SecP384R1Field.Add(x, ((SecP384R1FieldElement)b).x, z);
     return(new SecP384R1FieldElement(z));
 }
    public override ECPoint Twice()
    {
        if (base.IsInfinity)
        {
            return(this);
        }
        ECCurve curve = Curve;
        SecP384R1FieldElement secP384R1FieldElement = (SecP384R1FieldElement)base.RawYCoord;

        if (secP384R1FieldElement.IsZero)
        {
            return(curve.Infinity);
        }
        SecP384R1FieldElement secP384R1FieldElement2 = (SecP384R1FieldElement)base.RawXCoord;
        SecP384R1FieldElement secP384R1FieldElement3 = (SecP384R1FieldElement)base.RawZCoords[0];

        uint[] array  = Nat.Create(12);
        uint[] array2 = Nat.Create(12);
        uint[] array3 = Nat.Create(12);
        SecP384R1Field.Square(secP384R1FieldElement.x, array3);
        uint[] array4 = Nat.Create(12);
        SecP384R1Field.Square(array3, array4);
        bool isOne = secP384R1FieldElement3.IsOne;

        uint[] array5 = secP384R1FieldElement3.x;
        if (!isOne)
        {
            array5 = array2;
            SecP384R1Field.Square(secP384R1FieldElement3.x, array5);
        }
        SecP384R1Field.Subtract(secP384R1FieldElement2.x, array5, array);
        uint[] array6 = array2;
        SecP384R1Field.Add(secP384R1FieldElement2.x, array5, array6);
        SecP384R1Field.Multiply(array6, array, array6);
        uint x = Nat.AddBothTo(12, array6, array6, array6);

        SecP384R1Field.Reduce32(x, array6);
        uint[] array7 = array3;
        SecP384R1Field.Multiply(array3, secP384R1FieldElement2.x, array7);
        x = Nat.ShiftUpBits(12, array7, 2, 0u);
        SecP384R1Field.Reduce32(x, array7);
        x = Nat.ShiftUpBits(12, array4, 3, 0u, array);
        SecP384R1Field.Reduce32(x, array);
        SecP384R1FieldElement secP384R1FieldElement4 = new SecP384R1FieldElement(array4);

        SecP384R1Field.Square(array6, secP384R1FieldElement4.x);
        SecP384R1Field.Subtract(secP384R1FieldElement4.x, array7, secP384R1FieldElement4.x);
        SecP384R1Field.Subtract(secP384R1FieldElement4.x, array7, secP384R1FieldElement4.x);
        SecP384R1FieldElement secP384R1FieldElement5 = new SecP384R1FieldElement(array7);

        SecP384R1Field.Subtract(array7, secP384R1FieldElement4.x, secP384R1FieldElement5.x);
        SecP384R1Field.Multiply(secP384R1FieldElement5.x, array6, secP384R1FieldElement5.x);
        SecP384R1Field.Subtract(secP384R1FieldElement5.x, array, secP384R1FieldElement5.x);
        SecP384R1FieldElement secP384R1FieldElement6 = new SecP384R1FieldElement(array6);

        SecP384R1Field.Twice(secP384R1FieldElement.x, secP384R1FieldElement6.x);
        if (!isOne)
        {
            SecP384R1Field.Multiply(secP384R1FieldElement6.x, secP384R1FieldElement3.x, secP384R1FieldElement6.x);
        }
        return(new SecP384R1Point(curve, secP384R1FieldElement4, secP384R1FieldElement5, new ECFieldElement[1]
        {
            secP384R1FieldElement6
        }, base.IsCompressed));
    }