Ejemplo n.º 1
0
        public static Tryte operator *(Tryte t1, Tryte t2)
        {
            Tryte tryte = new Tryte();

            int  stop = t2.ToInt();
            bool neg  = false;

            if (stop < 0)
            {
                stop = -stop;
                neg  = true;
            }

            for (int i = 0; i < stop; i++)
            {
                tryte += t1;
            }

            return(neg ? -tryte : tryte);
        }
Ejemplo n.º 2
0
        public static Tryte operator %(Tryte t1, Tryte t2)
        {
            Tryte tmp = t1;

            if (t1 < 0)
            {
                while ((tmp += t2) <= t2)
                {
                    ;
                }
            }
            else
            {
                while ((tmp -= t2) >= t2)
                {
                    ;
                }
            }

            return(tmp);
        }
Ejemplo n.º 3
0
        public static Tryte operator /(Tryte t1, Tryte t2)
        {
            Tryte tmp = t1, val = new Tryte();

            if (t1 < 0)
            {
                while ((tmp += t2) <= 0)
                {
                    val--;
                }
            }
            else
            {
                while ((tmp -= t2) >= 0)
                {
                    val++;
                }
            }

            return(val);
        }
Ejemplo n.º 4
0
 public bool Equals(Tryte other)
 {
     return(this.SequenceEqual(other));
 }