2010-03-04 Rodrigo Kumpera <rkumpera@novell.com>
authorRodrigo Kumpera <kumpera@gmail.com>
Fri, 5 Mar 2010 23:42:07 +0000 (23:42 -0000)
committerRodrigo Kumpera <kumpera@gmail.com>
Fri, 5 Mar 2010 23:42:07 +0000 (23:42 -0000)
* BigInteger.cs: IComparable.

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

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

index ebce0b7e44320a4accb3786e104b9b62ea34dda1..d05bda110b93fedf365cbe84975255f8ee9bf546 100644 (file)
@@ -39,7 +39,7 @@ Optimization
        CoreAdd could avoid some resizes by checking for equal sized array that top overflow
 */\r
 namespace System.Numerics {\r
-       public struct BigInteger : IComparable<BigInteger>, IEquatable<BigInteger>
+       public struct BigInteger : IComparable, IComparable<BigInteger>, IEquatable<BigInteger>
        {
                //LSB on [0]
                readonly uint[] data;
@@ -546,6 +546,17 @@ namespace System.Numerics {
                        return left + right;
                }
 
+               public int CompareTo (object obj)
+               {
+                       if (obj == null)
+                               return 1;
+                       
+                       if (!(obj is BigInteger))
+                               return -1;
+
+                       return Compare (this, (BigInteger)obj);
+               }
+
                public int CompareTo (BigInteger other)
                {
                        return Compare (this, other);
index 013daf4936a8d1bdc5d0b639752beadd37741e2c..714d3ba679142a1d5a1a17e2d3ece1203b46fa9f 100644 (file)
@@ -1,3 +1,7 @@
+2010-03-04 Rodrigo Kumpera  <rkumpera@novell.com>
+
+       * BigInteger.cs: IComparable.
+
 2010-03-04 Rodrigo Kumpera  <rkumpera@novell.com>
 
        * BigInteger.cs: Relational ops for ulong with switched args.