]> www.ginac.de Git - cln.git/blobdiff - src/integer/ring/cl_I_ring.cc
Fix linking problems on some platforms caused by inline/non-inline versions
[cln.git] / src / integer / ring / cl_I_ring.cc
index 817715f63138a5514d658f9cef26abdd079312ab..f7dc09a4dfa846b5bec150de62b41904343a2530 100644 (file)
@@ -6,25 +6,29 @@
 CL_PROVIDE(cl_I_ring)
 
 // Specification.
-#include "cl_integer_ring.h"
+#include "cln/integer_ring.h"
 
 
 // Implementation.
 
-#include "cl_integer.h"
-#include "cl_integer_io.h"
+#include "cln/integer.h"
+#include "cln/integer_io.h"
+#define zerop zerop_inline
 #include "cl_I.h"
+#undef zerop
 
-static void I_fprint (cl_heap_ring* R, cl_ostream stream, const _cl_ring_element& x)
+namespace cln {
+
+static void I_fprint (cl_heap_ring* R, std::ostream& stream, const _cl_ring_element& x)
 {
        unused R;
        fprint(stream,The(cl_I)(x));
 }
 
-static cl_boolean I_equal (cl_heap_ring* R, const _cl_ring_element& x, const _cl_ring_element& y)
+static bool I_equal (cl_heap_ring* R, const _cl_ring_element& x, const _cl_ring_element& y)
 {
        unused R;
-       return cl_equal(The(cl_I)(x),The(cl_I)(y));
+       return equal(The(cl_I)(x),The(cl_I)(y));
 }
 
 static const _cl_ring_element I_zero (cl_heap_ring* R)
@@ -32,10 +36,10 @@ static const _cl_ring_element I_zero (cl_heap_ring* R)
        return _cl_ring_element(R, (cl_I)0);
 }
 
-static cl_boolean I_zerop (cl_heap_ring* R, const _cl_ring_element& x)
+static bool CL_FLATTEN I_zerop (cl_heap_ring* R, const _cl_ring_element& x)
 {
        unused R;
-       return zerop(The(cl_I)(x));
+       return zerop_inline(The(cl_I)(x));
 }
 
 static const _cl_ring_element I_plus (cl_heap_ring* R, const _cl_ring_element& x, const _cl_ring_element& y)
@@ -78,13 +82,11 @@ static const _cl_ring_element I_expt_pos (cl_heap_ring* R, const _cl_ring_elemen
        return _cl_ring_element(R, expt_pos(The(cl_I)(x),y));
 }
 
-static cl_boolean cl_I_p (const cl_number& x)
+static bool cl_I_p (const cl_number& x)
 {
-       return (cl_boolean)
-              (!x.pointer_p()
+       return (!x.pointer_p()
                ? x.nonpointer_tag() == cl_FN_tag
-               : x.pointer_type() == &cl_class_bignum
-              );
+               : x.pointer_type() == &cl_class_bignum);
 }
 
 static cl_ring_setops I_setops = {
@@ -108,7 +110,7 @@ static cl_ring_mulops I_mulops = {
 
 static cl_number_ring_ops<cl_I> I_ops = {
        cl_I_p,
-       cl_equal,
+       equal,
        zerop,
        operator+,
        operator-,
@@ -148,9 +150,12 @@ cl_class cl_class_integer_ring = {
 };
 
 // Constructor.
+template <>
 inline cl_integer_ring::cl_specialized_number_ring ()
        : cl_number_ring (new cl_heap_integer_ring()) {}
 
 const cl_integer_ring cl_I_ring;
 
+}  // namespace cln
+
 CL_PROVIDE_END(cl_I_ring)