Old snapshot `BigIntegerLibrary-2005.01.11.devel'; see the ChangeLog file.
[bigint/bigint.git] / BigUnsignedInABase.cc
index 7745adb..22fca51 100644 (file)
@@ -13,6 +13,7 @@
 */
 
 #include "BigUnsignedInABase.hh"
+#include <iostream>
 
 namespace {
        unsigned int bitLen(unsigned int x) {
@@ -27,7 +28,9 @@ namespace {
                return (a + b - 1) / b;
        }
 }
-
+       /*std::cout << "((( BigUnsigned ==> BigUnsignedInABase\n";
+       std::cout << "[ Parameter BigUnsigned @ " << (void *)(NumberlikeArray<BigUnsigned::Blk> *)(&x)
+               << ",\nresulting BigUnsignedInABase @ " << (void *)(NumberlikeArray<Digit> *)(this) << "]" << std::endl;*/
 BigUnsignedInABase::BigUnsignedInABase(const BigUnsigned &x, Base base) {
 
        // Check the base
@@ -59,6 +62,7 @@ BigUnsignedInABase::BigUnsignedInABase(const BigUnsigned &x, Base base) {
        
        // Save the actual length.
        len = digitNum;
+       /*std::cout << "BigUnsigned ==> BigUnsignedInABase )))\n";*/
 }
 
 BigUnsignedInABase::operator BigUnsigned() const {
@@ -80,9 +84,7 @@ BigUnsignedInABase::BigUnsignedInABase(const std::string &s, Base base) {
        // This pattern is seldom seen in C++, but the analogous ``this.'' is common in Java.
        this->base = base;
        
-       // `s.length()' is a `size_t', while `len' is a `NumberlikeArray::Index',
-       // also known as an `unsigned int'.  Some compilers warn without this cast.
-       len = Index(s.length());
+       len = s.length();
        allocate(len);
        
        Index digitNum, symbolNumInString;
@@ -102,6 +104,7 @@ BigUnsignedInABase::BigUnsignedInABase(const std::string &s, Base base) {
 }
 
 BigUnsignedInABase::operator std::string() const {
+       //std::cout << "((( BigUnsignedInABase ==> std::string\n";
        if (base > 36)
                throw "BigUnsignedInABase ==> std::string: The default string conversion routines use the symbol set 0-9, A-Z and therefore support only up to base 36.  You tried a conversion with a base over 36; write your own string conversion routine.";
        if (len == 0)
@@ -119,5 +122,6 @@ BigUnsignedInABase::operator std::string() const {
        }
        std::string s2(s);
        delete s;
+       //std::cout << "BigUnsignedInABase ==> std::string )))\n";
        return s2;
 }