#ifndef _CL_C_H
#define _CL_C_H
-#include "cl_number.h"
-#include "cl_complex.h"
-#include "cl_sfloat_class.h"
-#include "cl_ffloat_class.h"
-#include "cl_dfloat_class.h"
-#include "cl_lfloat_class.h"
-#include "cl_macros.h"
-#include "cl_malloc.h"
+#include "cln/number.h"
+#include "cln/complex.h"
+#include "cln/sfloat_class.h"
+#include "cln/ffloat_class.h"
+#include "cln/dfloat_class.h"
+#include "cln/lfloat_class.h"
+#include "base/cl_macros.h"
+#include "cln/malloc.h"
+
+namespace cln {
struct cl_heap_complex : cl_heap {
cl_R realpart;
inline cl_heap_complex* allocate_complex (const cl_R& real, const cl_R& imag)
{
- cl_heap_complex* p = (cl_heap_complex*) cl_malloc_hook(sizeof(cl_heap_complex));
+ cl_heap_complex* p = (cl_heap_complex*) malloc_hook(sizeof(cl_heap_complex));
p->refcount = 1;
p->type = &cl_class_complex;
p->realpart.pointer = real.pointer; cl_inc_refcount(real);
#endif
// Type tests
-inline cl_boolean realp (const cl_N& x)
+inline bool realp (const cl_N& x)
{
if (x.pointer_p())
if (x.heappointer->type == &cl_class_complex)
- return cl_false;
- return cl_true;
+ return false;
+ return true;
}
-inline cl_boolean complexp (const cl_N& x)
+inline bool complexp (const cl_N& x)
{
if (x.pointer_p())
if (x.heappointer->type == &cl_class_complex)
- return cl_true;
- return cl_false;
+ return true;
+ return false;
}
// Comparison with a fixnum.
-inline cl_boolean eq (const cl_N& x, sint32 y)
+inline bool eq (const cl_N& x, sint32 y)
{
- return (cl_boolean)(x.word == cl_combine(cl_FN_tag,y));
+ return x.word == cl_combine(cl_FN_tag,y);
}
-inline cl_boolean exact_zerop (const cl_N& x)
+inline bool exact_zerop (const cl_N& x)
{
return eq(x,0);
}
public:
};
-inline cl_boolean realp (const cl_C& x)
- { unused x; return cl_false; }
-inline cl_boolean complexp (const cl_C& x)
- { unused x; return cl_true; }
+inline bool realp (const cl_C& x)
+ { cl_unused x; return false; }
+inline bool complexp (const cl_C& x)
+ { cl_unused x; return true; }
// Liefert zu reellen Zahlen a und b /= Fixnum 0 die komplexe Zahl a+bi.
extern const cl_N complex_C (const cl_R& a, const cl_R& b);
// realpart(x) liefert den Realteil der Zahl x.
-// imagpart(x) liefert den Imaginärteil der Zahl x.
+// imagpart(x) liefert den Imaginärteil der Zahl x.
inline const cl_R& realpart (const cl_C& x)
{
return TheComplex(x)->realpart;
cl_C_R (const cl_R& re, const cl_R& im) : realpart(re), imagpart(im) {}
};
-// Hilfsfunktion für atanh und atan: u+iv := artanh(x+iy). Liefert cl_C_R(u,v).
+// Hilfsfunktion für atanh und atan: u+iv := artanh(x+iy). Liefert cl_C_R(u,v).
extern const cl_C_R atanh (const cl_R& x, const cl_R& y);
-// Hilfsfunktion für asinh und asin: u+iv := arsinh(x+iy). Liefert cl_C_R(u,v).
+// Hilfsfunktion für asinh und asin: u+iv := arsinh(x+iy). Liefert cl_C_R(u,v).
extern const cl_C_R asinh (const cl_R& x, const cl_R& y);
+} // namespace cln
#endif /* _CL_C_H */