示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#4
0
 public bool Equals(Tryte other)
 {
     return(this.SequenceEqual(other));
 }