2010-03-04 Rodrigo Kumpera <rkumpera@novell.com>
authorRodrigo Kumpera <kumpera@gmail.com>
Fri, 5 Mar 2010 02:41:50 +0000 (02:41 -0000)
committerRodrigo Kumpera <kumpera@gmail.com>
Fri, 5 Mar 2010 02:41:50 +0000 (02:41 -0000)
* BigInteger.cs: Equals.

svn path=/trunk/mcs/; revision=153066

mcs/class/System.Numerics/System.Numerics/BigInteger.cs
mcs/class/System.Numerics/System.Numerics/ChangeLog

index 9ae88e8a96d4f639c717263113ca55acc870428d..8cd5fed22802115b40ac9321657ce65b0683a900 100644 (file)
@@ -297,6 +297,23 @@ namespace System.Numerics {
                        return new BigInteger (value);
                }
 
+               public override bool Equals (object obj)
+               {
+                       if (!(obj is BigInteger))
+                               return false;
+                       BigInteger other = (BigInteger)obj;
+
+                       if (sign != other.sign)
+                               return false;
+                       if (data.Length != other.data.Length)
+                               return false;
+                       for (int i = 0; i < data.Length; ++i) {
+                               if (data [i] != other.data [i])
+                                       return false;
+                       }
+                       return true;
+               }
+
                static int TopByte (uint x)
                {
                        if ((x & 0xFFFF0000u) != 0) {
index 74c0de9a4c41a76df69510cdd9d30d2890d293bf..495b0277c2efebc2b99058b1026b0dd947960657 100644 (file)
@@ -1,3 +1,7 @@
+2010-03-04 Rodrigo Kumpera  <rkumpera@novell.com>
+
+       * BigInteger.cs: Equals.
+
 2010-03-04 Rodrigo Kumpera  <rkumpera@novell.com>
 
        * BigInteger.cs: Added implicit long operator.