]> www.ginac.de Git - cln.git/blobdiff - src/integer/elem/cl_I_compare.cc
* */*: Convert encoding from ISO 8859-1 to UTF-8.
[cln.git] / src / integer / elem / cl_I_compare.cc
index f9b8adb9e1ce2e4a8c520c6eef207fd84066bd68..9bf7a4f67a986c50a9b5edcd80cc72e53c82a0ad 100644 (file)
@@ -1,10 +1,10 @@
-// cl_compare().
+// compare().
 
 // General includes.
 #include "cl_sysdep.h"
 
 // Specification.
-#include "cl_integer.h"
+#include "cln/integer.h"
 
 
 // Implementation.
@@ -12,7 +12,9 @@
 #include "cl_I.h"
 #include "cl_DS.h"
 
-cl_signean cl_compare (const cl_I& x, const cl_I& y)
+namespace cln {
+
+cl_signean compare (const cl_I& x, const cl_I& y)
 {
       // Methode:
       // x und y haben verschiedenes Vorzeichen ->
@@ -30,8 +32,8 @@ cl_signean cl_compare (const cl_I& x, const cl_I& y)
       //       x > 0 -> x > y
       //    y Bignum ->
       //       falls beide gleich lang -> wortweise vergleichen
-      //       x kürzer als y -> bei x,y > 0 : x < y, bei x,y < 0 : x > y
-      //       y kürzer als x -> bei x,y > 0 : x > y, bei x,y > 0 : x < y
+      //       x kürzer als y -> bei x,y > 0 : x < y, bei x,y < 0 : x > y
+      //       y kürzer als x -> bei x,y > 0 : x > y, bei x,y > 0 : x < y
       var uintC xlen;
       var uintC ylen;
       if (fixnump(x))
@@ -74,7 +76,7 @@ cl_signean cl_compare (const cl_I& x, const cl_I& y)
                   ylen = TheBignum(y)->length;
                   if (xlen==ylen)
                     samelength:
-                    // gleiche Länge -> digitweise vergleichen
+                    // gleiche Länge -> digitweise vergleichen
                     return compare_loop_msp(BN_MSDptr(x),BN_MSDptr(y),xlen);
                     else
                     return (xlen > ylen ? signean_plus : signean_minus);
@@ -95,9 +97,11 @@ cl_signean cl_compare (const cl_I& x, const cl_I& y)
                 { xlen = TheBignum(x)->length;
                   ylen = TheBignum(y)->length;
                   if (xlen==ylen)
-                    // gleiche Länge -> wortweise vergleichen
+                    // gleiche Länge -> wortweise vergleichen
                     goto samelength; // wie oben
                     else
                     return (xlen > ylen ? signean_minus : signean_plus);
                 }
 }
+
+}  // namespace cln