Наследование: OtpErlangObject
Пример #1
0
        /**
         * Determine if two bitstrs are equal. Bitstrs are equal if they have the
         * same byte length and tail length, and the array of bytes is identical.
         *
         * @param o
         *                the bitstr to compare to.
         *
         * @return true if the bitstrs contain the same bits, false otherwise.
         */
        public override bool Equals(Object o)
        {
            if (!(o is OtpErlangBitstr))
            {
                return(false);
            }

            OtpErlangBitstr that = (OtpErlangBitstr)o;

            if (pad_bits != that.pad_bits)
            {
                return(false);
            }

            int len = bin.Length;

            if (len != that.bin.Length)
            {
                return(false);
            }

            for (int i = 0; i < len; i++)
            {
                if (bin[i] != that.bin[i])
                {
                    return(false); // early exit
                }
            }

            return(true);
        }
Пример #2
0
        public override Object Clone()
        {
            OtpErlangBitstr that = (OtpErlangBitstr)base.Clone();

            that.bin = new byte[bin.Length];
            Array.Copy(bin, 0, that.bin, 0, bin.Length);
            that.pad_bits = pad_bits;
            return(that);
        }