public void FromPoint(ProjectiveNielsPoint a)
 {
     Y_plus_X  = a.Y_plus_X;
     Y_minus_X = a.Y_minus_X;
     Z         = a.Z;
     T2d       = a.T2d;
 }
        public void ConditionalAssign(ProjectiveNielsPoint a, bool choice)
        {
            // if choice = 0, mask = (-0) = 0000...0000
            // if choice = 1, mask = (-1) = 1111...1111
            int mask = choice ? 0b1111_1111_1111_1111 : 0b0000_0000_0000_0000;

            //    *self ^= mask & (*self ^ *other);
            FromPoint(GetPoint().BitXor(BitXor(a).BitAnd((uint)mask)));
        }
 public ProjectiveNielsPoint BitXor(ProjectiveNielsPoint a)
 {
     return(new ProjectiveNielsPoint
     {
         Y_plus_X = Y_plus_X.BitXor(a.Y_plus_X),
         Y_minus_X = Y_minus_X.BitXor(a.Y_minus_X),
         Z = Z.BitXor(a.Z),
         T2d = T2d.BitXor(a.T2d),
     });
 }
Example #4
0
        public CompletedPoint Sub(ProjectiveNielsPoint other)
        {
            var Y_plus_X  = Y.Add(X);
            var Y_minus_X = Y.Sub(X);
            var PM        = Y_plus_X.Mul(other.Y_minus_X);
            var MP        = Y_minus_X.Mul(other.Y_plus_X);
            var TT2d      = T.Mul(other.T2d);
            var ZZ        = Z.Mul(other.Z);
            var ZZ2       = ZZ.Add(ZZ);

            return(new CompletedPoint
            {
                X = PM.Sub(MP),
                Y = PM.Add(MP),
                Z = ZZ2.Sub(TT2d),
                T = ZZ2.Add(TT2d)
            });
        }