Beispiel #1
0
        public int CompareTo(object obj)
        {
            BV that = obj as BV;

            if (that == null)
            {
                return(1);
            }
            else if (this.more.Length != that.more.Length)
            {
                return(this.more.Length.CompareTo(that.more.Length));
            }
            else
            {
                int k = this.more.Length;
                if (k > 0)
                {
                    int i = k - 1;
                    while (i >= 0)
                    {
                        var comp = this.more[i].CompareTo(that.more[i]);
                        if (comp == 0)
                        {
                            i = i - 1;
                        }
                        else
                        {
                            return(comp);
                        }
                    }
                }
                return(this.first.CompareTo(that.first));
            }
        }
Beispiel #2
0
        public override bool Equals(object obj)
        {
            BV that = obj as BV;

            if (that == null)
            {
                return(false);
            }
            if (this == that)
            {
                return(true);
            }
            if (this.first != that.first)
            {
                return(false);
            }
            if (that.more.Length != this.more.Length)
            {
                return(false);
            }
            for (int i = 0; i < more.Length; i++)
            {
                if (more[i] != that.more[i])
                {
                    return(false);
                }
            }
            return(true);
        }
Beispiel #3
0
        /// <summary>
        /// Bitwise NOT
        /// </summary>
        public static BV operator ~(BV x)
        {
            var first_compl = ~x.first;
            var more_compl  = Array.ConvertAll(x.more, n => ~n);
            var compl       = new BV(first_compl, more_compl);

            return(compl);
        }