]> www.ginac.de Git - cln.git/blobdiff - src/integer/conv/cl_I_to_L.cc
Avoid some "suggest explicit braces to avoid ambiguous ‘else’" warnings.
[cln.git] / src / integer / conv / cl_I_to_L.cc
index dc337eb9b075b7b430afeba805e35fe010f6825f..d67e185083927bdc38cfb49060ea4924aa186cac 100644 (file)
@@ -1,7 +1,7 @@
 // cl_I_to_L().
 
 // General includes.
-#include "cl_sysdep.h"
+#include "base/cl_sysdep.h"
 
 // Specification.
 #include "cln/integer.h"
 // Implementation.
 
 #include "cln/number.h"
-#include "cl_I.h"
-#include "cl_DS.h"
+#include "integer/cl_I.h"
+#include "base/digitseq/cl_DS.h"
 #include "cln/io.h"
 #include "cln/integer_io.h"
-#include "cln/abort.h"
+#include "cln/exception.h"
+#include <sstream>
 
 namespace cln {
 
@@ -34,7 +35,7 @@ sint32 cl_I_to_L (const cl_I& obj)
                if ((sintD)mspref(arrayMSDptr(bn->data,len),0) >= 0) {
                        // Bignum > 0
                        #define IF_LENGTH(i)  \
-                         if (bn_minlength <= i) /* genau i Digits überhaupt möglich? */\
+                         if (bn_minlength <= i) /* genau i Digits überhaupt möglich? */\
                            if (len == i) /* genau i Digits? */                         \
                              /* 2^((i-1)*intDsize-1) <= obj < 2^(i*intDsize-1) */      \
                              if ( (i*intDsize > 32)                                    \
@@ -55,7 +56,7 @@ sint32 cl_I_to_L (const cl_I& obj)
                } else {
                        // Bignum < 0
                        #define IF_LENGTH(i)  \
-                         if (bn_minlength <= i) /* genau i Digits überhaupt möglich? */\
+                         if (bn_minlength <= i) /* genau i Digits überhaupt möglich? */\
                            if (len == i) /* genau i Digits? */                         \
                              /* - 2^(i*intDsize-1) <= obj < - 2^((i-1)*intDsize-1) */  \
                              if ( (i*intDsize > 32)                                    \
@@ -76,10 +77,10 @@ sint32 cl_I_to_L (const cl_I& obj)
                }
        }
        bad: // unpassendes Objekt
-       fprint(std::cerr, "Not a 32-bit integer: ");
-       fprint(std::cerr, obj);
-       fprint(std::cerr, "\n");
-       cl_abort();
+       std::ostringstream buf;
+       fprint(buf, "Not a 32-bit integer: ");
+       fprint(buf, obj);
+       throw runtime_exception(buf.str());
 }
 
 }  // namespace cln