]> www.ginac.de Git - cln.git/blobdiff - src/integer/conv/cl_I_to_digits.cc
Avoid some "suggest explicit braces to avoid ambiguous ‘else’" warnings.
[cln.git] / src / integer / conv / cl_I_to_digits.cc
index d661b81145f46f5708bdd535ba3aca553220218b..8774682ef9d43b761675e5ebb04dd602962c1fae 100644 (file)
@@ -1,20 +1,20 @@
 // UDS_to_digits().
 
 // General includes.
-#include "cl_sysdep.h"
+#include "base/cl_sysdep.h"
 
 // Specification.
-#include "cl_I.h"
+#include "integer/cl_I.h"
 
 
 // Implementation.
 
-#include "cl_DS.h"
-#include "cl_I_cached_power.h"
+#include "base/digitseq/cl_DS.h"
+#include "integer/conv/cl_I_cached_power.h"
 
 namespace cln {
 
-// Timing für Dezimal-Umwandlung einer Zahl mit N Digits = (N*32) Bits,
+// Timing für Dezimal-Umwandlung einer Zahl mit N Digits = (N*32) Bits,
 // auf einem i486 33 MHz unter Linux:
 //    N      standard  dnq(div)  dnq(mul)  combined
 //     10     0.00031   0.00043   0.00059   0.00031
@@ -69,32 +69,32 @@ void I_to_digits (const cl_I& X, uintD base, cl_digits* erg)
 // Falls X>0:
 //   Dividiere X durch das Wort b^k,
 //   (Single-Precision-Division, vgl. UDS_DIVIDE mit n=1:
-//     r:=0, j:=m=Länge(X),
+//     r:=0, j:=m=Länge(X),
 //     while j>0 do
 //       j:=j-1, r:=r*beta+X[j], X[j]:=floor(r/b^k), r:=r-b^k*q[j].
 //     r=Rest.)
 //   zerlege den Rest (mit k-1 Divisionen durch b) in k Ziffern, wandle diese
 //   Ziffern einzeln in Ascii um und lege sie an die DIGITS an.
-//   Teste auf Speicherüberlauf.
+//   Teste auf Speicherüberlauf.
 //   X := Quotient.
 //   Mache aus X wieder eine NUDS (maximal 1 Nulldigit streichen).
 //   Dies solange bis X=0.
-//   Streiche die führenden Nullen.
+//   Streiche die führenden Nullen.
       // Aufsuchen von k-1 und b^k aus der Tabelle:
       var const power_table_entry* tableptr = &power_table[base-2];
       var uintC k = tableptr->k;
       var uintD b_hoch_k = tableptr->b_to_the_k; // b^k
       var uintB* erg_ptr = erg->LSBptr;
       #define next_digit(d)  { *--erg_ptr = (d<10 ? '0'+d : 'A'-10+d); }
-      // Spezialfälle:
+      // Spezialfälle:
       if (zerop(X))
         { next_digit(0); goto fertig; } // 0 -> eine Ziffer '0'
       else if ((base & (base-1)) == 0)
-        { // Schneller Algorithmus für Zweierpotenzen
+        { // Schneller Algorithmus für Zweierpotenzen
           var const uintD* MSDptr;
           var uintC len;
           var const uintD* LSDptr;
-          I_to_NDS_nocopy(X, MSDptr=,len=,LSDptr=,cl_false,);
+          I_to_NDS_nocopy(X, MSDptr=,len=,LSDptr=,false,);
           var int b = (base==2 ? 1 : base==4 ? 2 : base==8 ? 3 : base==16 ? 4 : /*base==32*/ 5);
           var uintD carry = 0;
           var int carrybits = 0;
@@ -138,7 +138,7 @@ void I_to_digits (const cl_I& X, uintD base, cl_digits* erg)
              if (fixnump(X) && count>cl_value_len-1)
                  count = cl_value_len-1;
               if ((intDsize>=11) || (count>0))
-                // (Bei intDsize>=11 ist wegen b<=36 zwangsläufig
+                // (Bei intDsize>=11 ist wegen b<=36 zwangsläufig
                 // k = ceiling(intDsize*log(2)/log(b))-1 >= 2, also count = k-1 > 0.)
                 do { var uintD d;
                      #if HAVE_DD
@@ -191,7 +191,7 @@ void I_to_digits (const cl_I& X, uintD base, cl_digits* erg)
           #endif
           var const cl_I& X1 = q;
           var const cl_I& X0 = r;
-          var uintL B_baselen = (uintL)(k)<<i;
+          var uintC B_baselen = (uintC)(k)<<i;
           I_to_digits_noshrink(X0,base,B_baselen,erg);
           erg->LSBptr -= B_baselen;
           I_to_digits(X1,base,erg);
@@ -199,7 +199,7 @@ void I_to_digits (const cl_I& X, uintD base, cl_digits* erg)
           erg_ptr = erg->MSBptr;
         }
       #undef next_digit
-      // Streiche führende Nullen:
+      // Streiche führende Nullen:
       while (*erg_ptr == '0') { erg_ptr++; }
       fertig:
       erg->MSBptr = erg_ptr;