[corlib] Make primitive types smaller than int compare result compatible
[mono.git] / mcs / class / corlib / System / SByte.cs
index a58af2cd19f84167111c4d8cd18161c4bc36928a..65ed874d772566b5faac61a4a11928035e79e620 100644 (file)
@@ -49,13 +49,7 @@ namespace System
                        if (!(obj is System.SByte))
                                throw new ArgumentException (Locale.GetText ("Value is not a System.SByte."));
 
-                       sbyte xv = (sbyte) obj;
-                       if (m_value == xv)
-                               return 0;
-                       if (m_value > xv)
-                               return 1;
-                       else
-                               return -1;
+                       return CompareTo ((sbyte) obj);
                }
 
                public override bool Equals (object obj)
@@ -73,12 +67,7 @@ namespace System
 
                public int CompareTo (sbyte value)
                {
-                       if (m_value == value)
-                               return 0;
-                       if (m_value > value)
-                               return 1;
-                       else
-                               return -1;
+                       return m_value - value;
                }
 
                public bool Equals (sbyte obj)