of same functions (obsoletes MAYBE_INLINE) [by Alexei Sheplyakov].
+2007-01-18 Alexei Sheplyakov <varg@theor.jinr.ru>
+
+ Fix linking problems on some platforms caused by inline/non-inline
+ versions of same functions (obsoletes MAYBE_INLINE):
+ * src/base/cl_maybe_inline.h: New file.
+ * src/base/cl_inline2.h: New file.
+ * src/base/cl_inline.h: New file.
+ * src/base/cl_macros.h: Pull in cl_maybe_inline.h.
+ * src/base/string/cl_st_concat1.cc: Use new CL_INLINE macros and the
+ new *_inline functions.
+ * src/base/string/cl_st_concat2.cc: Likewise.
+ * src/base/string/cl_st_concat3.cc: Likewise.
+ * src/complex/algebraic/cl_C_abs.cc: Likewise.
+ * src/complex/algebraic/cl_C_abs_aux.cc: Likewise.
+ * src/complex/algebraic/cl_C_signum.cc: Likewise.
+ * src/complex/algebraic/cl_DF_hypot.cc: Likewise.
+ * src/complex/algebraic/cl_FF_hypot.cc: Likewise.
+ * src/complex/algebraic/cl_LF_hypot.cc: Likewise.
+ * src/complex/algebraic/cl_SF_hypot.cc: Likewise.
+ * src/complex/transcendental/cl_C_acosh.cc: Likewise.
+ * src/complex/transcendental/cl_C_asinh_aux.cc: Likewise.
+ * src/complex/transcendental/cl_C_atanh_aux.cc: Likewise.
+ * src/float/dfloat/division/cl_DF_fceil.cc: Likewise.
+ * src/float/dfloat/elem/cl_DF_div.cc: Likewise.
+ * src/float/dfloat/elem/cl_DF_ffloor.cc: Likewise.
+ * src/float/dfloat/elem/cl_DF_minusp.cc: Likewise.
+ * src/float/dfloat/elem/cl_DF_mul.cc: Likewise.
+ * src/float/dfloat/elem/cl_DF_plusp.cc: Likewise.
+ * src/float/dfloat/elem/cl_DF_zerop.cc: Likewise.
+ * src/float/dfloat/misc/cl_DF_abs.cc: Likewise.
+ * src/float/dfloat/misc/cl_DF_digits.cc: Likewise.
+ * src/float/dfloat/misc/cl_DF_eqhashcode.cc: Likewise.
+ * src/float/dfloat/misc/cl_DF_exponent.cc: Likewise.
+ * src/float/dfloat/misc/cl_DF_idecode.cc: Likewise.
+ * src/float/dfloat/misc/cl_DF_precision.cc: Likewise.
+ * src/float/dfloat/misc/cl_DF_sign.cc: Likewise.
+ * src/float/dfloat/misc/cl_DF_signum.cc: Likewise.
+ * src/float/elem/cl_F_minusp.cc: Likewise.
+ * src/float/elem/cl_F_plusp.cc: Likewise.
+ * src/float/elem/cl_F_zerop.cc: Likewise.
+ * src/float/ffloat/division/cl_FF_fceil.cc: Likewise.
+ * src/float/ffloat/elem/cl_FF_div.cc: Likewise.
+ * src/float/ffloat/elem/cl_FF_ffloor.cc: Likewise.
+ * src/float/ffloat/elem/cl_FF_minusp.cc: Likewise.
+ * src/float/ffloat/elem/cl_FF_mul.cc: Likewise.
+ * src/float/ffloat/elem/cl_FF_plusp.cc: Likewise.
+ * src/float/ffloat/elem/cl_FF_zerop.cc: Likewise.
+ * src/float/ffloat/misc/cl_FF_abs.cc: Likewise.
+ * src/float/ffloat/misc/cl_FF_digits.cc: Likewise.
+ * src/float/ffloat/misc/cl_FF_eqhashcode.cc: Likewise.
+ * src/float/ffloat/misc/cl_FF_exponent.cc: Likewise.
+ * src/float/ffloat/misc/cl_FF_idecode.cc: Likewise.
+ * src/float/ffloat/misc/cl_FF_precision.cc: Likewise.
+ * src/float/ffloat/misc/cl_FF_sign.cc: Likewise.
+ * src/float/ffloat/misc/cl_FF_signum.cc: Likewise.
+ * src/float/lfloat/division/cl_LF_fceil.cc: Likewise.
+ * src/float/lfloat/elem/cl_LF_compare.cc: Likewise.
+ * src/float/lfloat/elem/cl_LF_ffloor.cc: Likewise.
+ * src/float/lfloat/elem/cl_LF_minusp.cc: Likewise.
+ * src/float/lfloat/elem/cl_LF_plusp.cc: Likewise.
+ * src/float/lfloat/elem/cl_LF_to_I.cc: Likewise.
+ * src/float/lfloat/elem/cl_LF_zerop.cc: Likewise.
+ * src/float/lfloat/misc/cl_LF_abs.cc: Likewise.
+ * src/float/lfloat/misc/cl_LF_digits.cc: Likewise.
+ * src/float/lfloat/misc/cl_LF_eqhashcode.cc: Likewise.
+ * src/float/lfloat/misc/cl_LF_exponent.cc: Likewise.
+ * src/float/lfloat/misc/cl_LF_idecode.cc: Likewise.
+ * src/float/lfloat/misc/cl_LF_precision.cc: Likewise.
+ * src/float/lfloat/misc/cl_LF_shortenrel.cc: Likewise.
+ * src/float/lfloat/misc/cl_LF_shortenwith.cc: Likewise.
+ * src/float/lfloat/misc/cl_LF_sign.cc: Likewise.
+ * src/float/lfloat/misc/cl_LF_signum.cc: Likewise.
+ * src/float/misc/cl_F_abs.cc: Likewise.
+ * src/float/misc/cl_F_digits.cc: Likewise.
+ * src/float/misc/cl_F_eqhashcode.cc: Likewise.
+ * src/float/misc/cl_F_exponent.cc: Likewise.
+ * src/float/misc/cl_F_idecode.cc: Likewise.
+ * src/float/misc/cl_F_precision.cc: Likewise.
+ * src/float/misc/cl_F_sign.cc: Likewise.
+ * src/float/misc/cl_F_signum.cc: Likewise.
+ * src/float/sfloat/division/cl_SF_fceil.cc: Likewise.
+ * src/float/sfloat/division/cl_SF_ffloor.cc: Likewise.
+ * src/float/sfloat/elem/cl_SF_compare.cc: Likewise.
+ * src/float/sfloat/elem/cl_SF_minus.cc: Likewise.
+ * src/float/sfloat/elem/cl_SF_minusp.cc: Likewise.
+ * src/float/sfloat/elem/cl_SF_plusp.cc: Likewise.
+ * src/float/sfloat/elem/cl_SF_uminus.cc: Likewise.
+ * src/float/sfloat/elem/cl_SF_zerop.cc: Likewise.
+ * src/float/sfloat/misc/cl_SF_abs.cc: Likewise.
+ * src/float/sfloat/misc/cl_SF_digits.cc: Likewise.
+ * src/float/sfloat/misc/cl_SF_eqhashcode.cc: Likewise.
+ * src/float/sfloat/misc/cl_SF_exponent.cc: Likewise.
+ * src/float/sfloat/misc/cl_SF_idecode.cc: Likewise.
+ * src/float/sfloat/misc/cl_SF_precision.cc: Likewise.
+ * src/float/sfloat/misc/cl_SF_sign.cc: Likewise.
+ * src/float/sfloat/misc/cl_SF_signum.cc: Likewise.
+ * src/float/transcendental/cl_F_atanhx.cc: Likewise.
+ * src/float/transcendental/cl_F_atanx.cc: Likewise.
+ * src/float/transcendental/cl_F_exp.cc: Likewise.
+ * src/float/transcendental/cl_F_expx.cc: Likewise.
+ * src/float/transcendental/cl_F_lnx.cc: Likewise.
+ * src/float/transcendental/cl_F_sinhx.cc: Likewise.
+ * src/float/transcendental/cl_F_sinx.cc: Likewise.
+ * src/float/transcendental/cl_F_tan.cc: Likewise.
+ * src/float/transcendental/cl_F_tanh.cc: Likewise.
+ * src/integer/conv/cl_I_from_DS.cc: Likewise.
+ * src/integer/conv/cl_I_from_NDS.cc: Likewise.
+ * src/integer/conv/cl_I_from_NUDS.cc: Likewise.
+ * src/integer/conv/cl_I_from_UDS.cc: Likewise.
+ * src/integer/misc/cl_I_eqhashcode.cc: Likewise.
+ * src/integer/misc/cl_I_signum.cc: Likewise.
+ * src/integer/ring/cl_I_ring.cc: Likewise.
+ * src/rational/elem/cl_RA_minusp.cc: Likewise.
+ * src/rational/misc/cl_RA_eqhashcode.cc: Likewise.
+ * src/rational/misc/cl_RA_signum.cc: Likewise.
+ * src/rational/ring/cl_RA_ring.cc: Likewise.
+ * src/real/algebraic/cl_RA_sqrt.cc: Likewise.
+ * src/real/algebraic/cl_R_sqrt.cc: Likewise.
+ * src/real/conv/cl_F_from_R_def.cc: Likewise.
+ * src/real/elem/cl_R_minusp.cc: Likewise.
+ * src/real/elem/cl_R_zerop.cc: Likewise.
+ * src/real/misc/cl_R_eqhashcode.cc: Likewise.
+ * src/real/misc/cl_R_signum.cc: Likewise.
+ * src/real/transcendental/cl_R_tan.cc: Likewise.
+ * src/real/transcendental/cl_R_tanh.cc: Likewise.
+ * src/base/string/cl_st_make0.cc: Remove obsolete MAYBE_INLINE.
+ * src/rational/misc/Makeflags: Help compiler include cl_I_eqhashcode.cc.
+
2008-01-15 Bruno Haible <bruno@clisp.org>
* doc/cln.texi: Renamed from doc/cln.tex. Add @node lines and @menu
--- /dev/null
+/*
+ * Selectively inline a function in *some* translation units.
+ * See cl_maybe_inline.h file for the explanation.
+ */
+#undef CL_INLINE
+#undef CL_INLINE_DECL
+#define CL_INLINE static inline
+#define CL_INLINE_DECL(fcn) CL_INLINE_HINT fcn ## _inline
--- /dev/null
+/*
+ * Selectively inline a function in *some* translation units.
+ * See cl_maybe_inline.h file for the explanation.
+ */
+#undef CL_INLINE2
+#undef CL_INLINE2_DECL
+#define CL_INLINE2 static inline
+#define CL_INLINE2_DECL(fcn) CL_INLINE_HINT fcn ## _inline
// it's a shame!)
#define init1(type,lvalue) (void) new (&(lvalue)) type
-// MAYBE_INLINE normally expands to nothing.
-// Useful for including the implementation of some file inline into another.
- #define MAYBE_INLINE
- #define MAYBE_INLINE2
+#include "cl_maybe_inline.h"
#endif /* _CL_MACROS_H */
--- /dev/null
+// CLN internal inlining hints
+
+#ifndef _CL_MAYBE_INLINE_H
+#define _CL_MAYBE_INLINE_H
+
+/*
+ * Selectively inline a function in *some* translation units.
+ *
+ * The need to inline a function in some places and not in others came from
+ * three situations:
+ *
+ * 1) Some functions, like cl_SF_zerop or cl_FF_zerop, are just a single
+ * machine instruction when inlined. Putting their definitions into a public
+ * header would expose too many internals of the library, leading violation
+ * of abstraction and increased compilation times. Still, it would be nice
+ * to use the inline version of these functions in the library itself.
+ *
+ * 2) Some functions, like cl_{SF,FF,DF,LF}_idecode, are usually only
+ * invoked through a dispatcher cl_F_idecode that does nothing but dispatch
+ * the call to the right function. Here inlining is used, regardless of
+ * the size of the inlined functions, because it removes one function call
+ * from the chain of function calls. A compiler cannot know that this
+ * caller is the main caller for the 4 inlined functions.
+ *
+ * 3) Similarly, cl_I_from_NDS would be a bottleneck if not inlined: every
+ * creation of a new cl_I goes through this function. A compiler cannot
+ * know a priori the bottlenecks.
+ *
+ * Hence, there is a set of macros which help to create inline and
+ * non-inline versions of a function without duplicating the code.
+ *
+ * Usage:
+ *
+ * 1. In the public header, declare function as usual:
+ *
+ * extern cl_bar cl_foo(const cl_baz&);
+ *
+ * 2. Put the definition into a separate file, say, cl_foo.cc, in the
+ * following way:
+ *
+ * // cl_foo.cc
+ *
+ * #include "cl_macros.h"
+ * #include "whatever/you/need.h"
+ *
+ * CL_INLINE cl_bar CL_INLINE_DECL(cl_foo)(const cl_baz& x)
+ * {
+ * // the actual code goes here
+ * }
+ *
+ * This provides normal (non-inline) version of a function cl_foo.
+ *
+ * 3. In order to use the inline version, do
+ *
+ * // cl_blah.cc
+ *
+ * #include "cl_inline.h"
+ * #include "path/to/cl_foo.cc"
+ *
+ * This will declare and define function cl_foo_inline, which is an inline
+ * version of cl_foo.
+ *
+ * XXX:
+ * The name of the inline version *really* has to be different, since ISO C++
+ * demands (in 7.1.2.4)
+ *
+ * "If a function with external linkage is declared inline in one translation
+ * unit, it shall be declared inline in all translation units in which it
+ * appears; no diagnostic is required."
+ *
+ * Feel free to implement this functionality in a better *standard-compliant*
+ * way. Or submit a DR (defect report) to the standard committee.
+ */
+#define CL_INLINE
+#define CL_INLINE_DECL(fcn) fcn
+
+/*
+ * Use these macros to provide inline and non-inline versions of a function
+ * which uses an inline version of other function(s).
+ */
+#define CL_INLINE2
+#define CL_INLINE2_DECL(fcn) fcn
+
+/*
+ * Some functions (zerop, signum, etc) just dispatch the call to the
+ * appropriate type-specific functions. It would be nice to have these
+ * type-specific functions inlined. However, the compiler can not know that,
+ * unless one gives it a hint.
+ *
+ * Usage:
+ *
+ * const cl_foo CL_FLATTEN cl_bar(const cl_R& x)
+ * {
+ * // the actual code
+ * }
+ *
+ * Please note:
+ *
+ * 1. This is only a *hint*, it's always up to the compiler to NOT inline
+ * a function.
+ * 2. It's ignored if the optimization is switched off.
+ */
+#ifdef __GNUC__
+#define CL_FLATTEN __attribute__((flatten))
+#else
+#define CL_FLATTEN
+#endif
+
+/*
+ * Tell the compiler to inline a function more aggressively, i.e. even if the
+ * optimization is switched off.
+ *
+ * Usage:
+ *
+ * cl_blah CL_INLINE_HINT cl_foo(const cl_baz& x)
+ * {
+ * // the actual code
+ * }
+ *
+ * Notes:
+ * 1. This is only a hint, it does NOT guarantee the function will be
+ * actually always inlined.
+ * 2. CL_INLINE and CL_INLINE2 macros set this attribute automagically.
+ */
+#ifdef __GNUC__
+#define CL_INLINE_HINT __attribute__((always_inline))
+#else
+#define CL_INLINE_HINT
+#endif
+
+#endif /* _CL_MAYBE_INLINE_H */
// Implementation.
-
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
-#include "cl_st_make0.cc"
+#include "cl_st_make0.h"
namespace cln {
// Implementation.
-
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
-#include "cl_st_make0.cc"
+#include "cl_st_make0.h"
namespace cln {
// Implementation.
-
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
-#include "cl_st_make0.cc"
+#include "cl_st_make0.h"
namespace cln {
namespace cln {
-MAYBE_INLINE
cl_heap_string* cl_make_heap_string (unsigned long len)
{
var cl_heap_string* str = (cl_heap_string*) malloc_hook(offsetofa(cl_heap_string,data)+sizeof(char)*(len+1));
#include "cl_C.h"
#include "cln/real.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_C_abs_aux.cc"
namespace cln {
return abs(x);
} else {
DeclareType(cl_C,x);
- return abs(x);
+ return abs_inline(x);
}
}
namespace cln {
-MAYBE_INLINE
-const cl_R abs (const cl_C& x)
+CL_INLINE const cl_R CL_INLINE_DECL(abs) (const cl_C& x)
{
var const cl_R& a = realpart(x);
var const cl_R& b = imagpart(x);
#include "cl_C.h"
#include "cln/real.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_C_abs_aux.cc"
namespace cln {
-const cl_N signum (const cl_N& x)
+const cl_N CL_FLATTEN signum (const cl_N& x)
{
// Methode:
// x reell -> klar.
if (zerop(x))
return x;
else
- return x / abs(x);
+ return x / abs_inline(x);
}
}
#include "cln/dfloat.h"
#include "cl_DF.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+/* For inline version of minusp */
+#include "cl_inline.h"
#include "cl_DF_minusp.cc"
namespace cln {
var uintL uexp = DF_uexp(TheDfloat(a)->dfloat_value_semhi);
if (uexp == 0)
// a=0.0 -> liefere (abs b) :
- return (minusp(b) ? -b : b);
+ return (minusp_inline(b) ? -b : b);
a_exp = (sintL)(uexp - DF_exp_mid);
}
{
var uintL uexp = DF_uexp(TheDfloat(b)->dfloat_value_semhi);
if (uexp == 0)
// b=0.0 -> liefere (abs a) :
- return (minusp(a) ? -a : a);
+ return (minusp_inline(a) ? -a : a);
b_exp = (sintL)(uexp - DF_exp_mid);
}
// Nun a_exp = float_exponent(a), b_exp = float_exponent(b).
#include "cln/ffloat.h"
#include "cl_FF.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+/* For inline version of minusp */
+#include "cl_inline.h"
#include "cl_FF_minusp.cc"
namespace cln {
var uintL uexp = FF_uexp(cl_ffloat_value(a));
if (uexp == 0)
// a=0.0 -> liefere (abs b) :
- return (minusp(b) ? -b : b);
+ return (minusp_inline(b) ? -b : b);
a_exp = (sintL)(uexp - FF_exp_mid);
}
{
var uintL uexp = FF_uexp(cl_ffloat_value(b));
if (uexp == 0)
// b=0.0 -> liefere (abs a) :
- return (minusp(a) ? -a : a);
+ return (minusp_inline(a) ? -a : a);
b_exp = (sintL)(uexp - FF_exp_mid);
}
// Nun a_exp = float_exponent(a), b_exp = float_exponent(b).
#include "cl_LF.h"
#include "cl_LF_impl.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+/* For inline version of minusp */
+#include "cl_inline.h"
#include "cl_LF_minusp.cc"
namespace cln {
var uintE uexp = TheLfloat(a)->expo;
if (uexp == 0)
// a=0.0 -> liefere (abs b) :
- return (minusp(b) ? -b : b);
+ return (minusp_inline(b) ? -b : b);
a_exp = (sintE)(uexp - LF_exp_mid);
}
{
var uintE uexp = TheLfloat(b)->expo;
if (uexp == 0)
// b=0.0 -> liefere (abs a) :
- return (minusp(a) ? -a : a);
+ return (minusp_inline(a) ? -a : a);
b_exp = (sintE)(uexp - LF_exp_mid);
}
// Nun a_exp = float_exponent(a), b_exp = float_exponent(b).
#include "cln/sfloat.h"
#include "cl_SF.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+/* For inline copy of minusp */
+#include "cl_inline.h"
#include "cl_SF_minusp.cc"
namespace cln {
var uintL uexp = SF_uexp(a);
if (uexp == 0)
// a=0.0 -> liefere (abs b) :
- return (minusp(b) ? -b : b);
+ return (minusp_inline(b) ? -b : b);
a_exp = (sintL)(uexp - SF_exp_mid);
}
{
var uintL uexp = SF_uexp(b);
if (uexp == 0)
// b=0.0 -> liefere (abs a) :
- return (minusp(a) ? -a : a);
+ return (minusp_inline(a) ? -a : a);
b_exp = (sintL)(uexp - SF_exp_mid);
}
// Nun a_exp = float_exponent(a), b_exp = float_exponent(b).
#include "cl_RA.h"
#include "cln/float.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+/* Use inline version of cl_float -- cl_float_inline */
+#include "cl_inline.h"
#include "cl_F_from_R_def.cc"
namespace cln {
}
if (x < cl_I(-1)) {
// x < -1
- var cl_F xf = cl_float(x);
+ var cl_F xf = cl_float_inline(x);
var cl_F& x = xf;
// x Float <= -1
// log(sqrt(x^2-1)-x), ein Float >=0, Imaginärteil pi
#include "cl_RA.h"
#include "cln/float.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+/* Use the inline version of cl_float */
+#include "cl_inline.h"
#include "cl_F_from_R_def.cc"
namespace cln {
return cl_C_R(0,scale_float(pi(),-1));
if (eq(y,-1)) // x=0, y=-1 -> v = -pi/2
return cl_C_R(0,-scale_float(pi(),-1));
- yf = cl_float(y); // y in Float umwandeln
+ yf = cl_float_inline(y); // y in Float umwandeln
} else {
DeclareType(cl_RT,y);
// y Ratio
if (eq(numerator(y),-1)) // x=0, y=-1/2 -> v = -pi/6
return cl_C_R(0,-(pi()/6));
}
- yf = cl_float(y); // y in Float umwandeln
+ yf = cl_float_inline(y); // y in Float umwandeln
}
} else {
DeclareType(cl_F,y);
}
if (eq(y,0)) {
// y=0
- var cl_F xf = cl_float(x); // x in Float umwandeln
+ var cl_F xf = cl_float_inline(x); // x in Float umwandeln
var cl_F& x = xf;
// x Float
if (zerop(x))
#include "cl_F_tran.h"
#include "cl_R.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+/* Use the inline version of cl_float */
+#include "cl_inline.h"
#include "cl_F_from_R_def.cc"
namespace cln {
// Hilfsfunktion für atanh und atan: u+iv := artanh(x+iy). Liefert cl_C_R(u,v).
-const cl_C_R atanh (const cl_R& x, const cl_R& y)
+const cl_C_R CL_FLATTEN atanh (const cl_R& x, const cl_R& y)
{
// Methode:
// Wert und Branch Cuts nach der Formel CLTL2, S. 315:
// x=0 -> u=0, v=atan(X=1,Y=y) (Fall y=0 ist inbegriffen)
return cl_C_R(0, atan(1,y));
if (eq(y,0)) {
- var cl_F xf = cl_float(x); // (float x)
+ var cl_F xf = cl_float_inline(x); // (float x)
var cl_F& x = xf;
// x Float
if (zerop(x))
var cl_F yf;
if (rationalp(x)) {
DeclareType(cl_RA,x);
- yf = cl_float(y);
+ yf = cl_float_inline(y);
xf = cl_float(x,yf);
} else {
DeclareType(cl_F,x);
#include "cl_DF.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+/* For inline version of minusp */
+#include "cl_inline.h"
#include "cl_DF_minusp.cc"
namespace cln {
-const cl_DF fceiling (const cl_DF& x)
+const cl_DF CL_FLATTEN fceiling (const cl_DF& x)
{
- if (minusp(x))
+ if (minusp_inline(x))
return ftruncate(x);
else
return futruncate(x);
#include "cl_DS.h"
#include "cl_ieee.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_DF_zerop.cc"
namespace cln {
#if defined(FAST_DOUBLE) && !defined(__i386__)
double_to_DF(DF_to_double(x1) / DF_to_double(x2), return ,
TRUE, TRUE, // Overflow und subnormale Zahl abfangen
- !zerop(x1), // ein Ergebnis +/- 0.0
+ !zerop_inline(x1), // ein Ergebnis +/- 0.0
// ist genau dann in Wirklichkeit ein Underflow
- zerop(x2), // Division durch Null abfangen
+ zerop_inline(x2), // Division durch Null abfangen
FALSE // kein NaN als Ergebnis möglich
);
#else
#include "cl_DF.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_DF_minusp.cc"
namespace cln {
-const cl_DF ffloor (const cl_DF& x)
+const cl_DF CL_FLATTEN ffloor (const cl_DF& x)
{
- if (minusp(x))
+ if (minusp_inline(x))
return futruncate(x);
else
return ftruncate(x);
namespace cln {
-MAYBE_INLINE
-bool minusp (const cl_DF& x)
+CL_INLINE bool CL_INLINE_DECL(minusp) (const cl_DF& x)
{
#if (cl_word_size==64)
return (sint64)TheDfloat(x)->dfloat_value_semhi < 0;
#include "cl_DS.h"
#include "cl_ieee.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_DF_zerop.cc"
namespace cln {
#ifdef FAST_DOUBLE
double_to_DF(DF_to_double(x1) * DF_to_double(x2), return ,
TRUE, TRUE, // Overflow und subnormale Zahl abfangen
- !(zerop(x1) || zerop(x2)), // ein Ergebnis +/- 0.0
+ !(zerop_inline(x1) || zerop_inline(x2)), // ein Ergebnis +/- 0.0
// ist genau dann in Wirklichkeit ein Underflow
FALSE, FALSE // keine Singularität, kein NaN als Ergebnis möglich
);
#include "cl_DF.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_DF_minusp.cc"
#include "cl_DF_zerop.cc"
namespace cln {
-MAYBE_INLINE2
-bool plusp (const cl_DF& x)
+CL_INLINE2 bool CL_INLINE2_DECL(plusp) (const cl_DF& x)
{
- if (minusp(x))
+ if (minusp_inline(x))
return false; // x<0 -> nein
- elif (zerop(x))
+ elif (zerop_inline(x))
return false; // x=0 -> nein
else
return true; // sonst ist x>0.
namespace cln {
-MAYBE_INLINE
-bool zerop (const cl_DF& x)
+CL_INLINE bool CL_INLINE_DECL(zerop) (const cl_DF& x)
{
#if 0
return DF_uexp(TheDfloat(x)->dfloat_value_semhi) == 0;
// Implementation.
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_DF_minusp.cc"
namespace cln {
-const cl_DF abs (const cl_DF& x)
+const cl_DF CL_FLATTEN abs (const cl_DF& x)
{
// x<0 -> (- x), x>=0 -> x
if (minusp(x)) return -x; else return x;
namespace cln {
-MAYBE_INLINE
-uintC float_digits (const cl_DF& x)
+CL_INLINE uintC CL_INLINE_DECL(float_digits) (const cl_DF& x)
{
unused x;
return DF_mant_len+1; // 53
namespace cln {
-MAYBE_INLINE
-uint32 equal_hashcode (const cl_DF& x)
+CL_INLINE uint32 CL_INLINE_DECL(equal_hashcode) (const cl_DF& x)
{
var cl_signean sign;
var sintL exp;
namespace cln {
-MAYBE_INLINE
-sintE float_exponent (const cl_DF& x)
+CL_INLINE sintE CL_INLINE_DECL(float_exponent) (const cl_DF& x)
{
var uintL uexp = DF_uexp(TheDfloat(x)->dfloat_value_semhi);
if (uexp==0) { return 0; }
namespace cln {
-MAYBE_INLINE
-const cl_idecoded_float integer_decode_float (const cl_DF& x)
+CL_INLINE const cl_idecoded_float CL_INLINE_DECL(integer_decode_float) (const cl_DF& x)
{
// x entpacken:
var cl_signean sign;
#include "cl_DF.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_DF_zerop.cc"
namespace cln {
-MAYBE_INLINE2
-uintC float_precision (const cl_DF& x)
+CL_INLINE2 uintC CL_INLINE2_DECL(float_precision) (const cl_DF& x)
{
- if (zerop(x)) return 0;
+ if (zerop_inline(x)) return 0;
return DF_mant_len+1; // 53
}
#include "cl_DF.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_DF_minusp.cc"
namespace cln {
-MAYBE_INLINE2
-const cl_DF float_sign (const cl_DF& x)
+CL_INLINE2 const cl_DF CL_INLINE2_DECL(float_sign) (const cl_DF& x)
{
// Methode: x>=0 -> Ergebnis 1.0; x<0 -> Ergebnis -1.0
- return (!minusp(x) ? cl_DF_1 : cl_DF_minus1);
+ return (!minusp_inline(x) ? cl_DF_1 : cl_DF_minus1);
}
} // namespace cln
#include "cl_DF.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_DF_minusp.cc"
#include "cl_DF_zerop.cc"
namespace cln {
-MAYBE_INLINE2
-const cl_DF signum (const cl_DF& x)
+CL_INLINE2 const cl_DF CL_INLINE2_DECL(signum) (const cl_DF& x)
{
- if (minusp(x)) { return cl_DF_minus1; } // x<0 -> -1.0
- elif (zerop(x)) { return cl_DF_0; } // x=0 -> 0.0
+ if (minusp_inline(x)) { return cl_DF_minus1; } // x<0 -> -1.0
+ elif (zerop_inline(x)) { return cl_DF_0; } // x=0 -> 0.0
else { return cl_DF_1; } // x>0 -> +1.0
}
#include "cl_F.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_SF_minusp.cc"
#include "cl_FF_minusp.cc"
#include "cl_DF_minusp.cc"
namespace cln {
-bool minusp (const cl_F& x)
+bool CL_FLATTEN minusp (const cl_F& x)
{
floatcase(x
- , return minusp(x);
- , return minusp(x);
- , return minusp(x);
- , return minusp(x);
+ , return minusp_inline(x);
+ , return minusp_inline(x);
+ , return minusp_inline(x);
+ , return minusp_inline(x);
);
}
#include "cl_F.h"
-#undef MAYBE_INLINE2
-#define MAYBE_INLINE2 inline
+#include "cl_inline2.h"
#include "cl_SF_plusp.cc"
#include "cl_FF_plusp.cc"
#include "cl_DF_plusp.cc"
namespace cln {
-bool plusp (const cl_F& x)
+bool CL_FLATTEN plusp (const cl_F& x)
{
floatcase(x
- , return plusp(x);
- , return plusp(x);
- , return plusp(x);
- , return plusp(x);
+ , return plusp_inline(x);
+ , return plusp_inline(x);
+ , return plusp_inline(x);
+ , return plusp_inline(x);
);
}
#include "cl_F.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_SF_zerop.cc"
#include "cl_FF_zerop.cc"
#include "cl_DF_zerop.cc"
namespace cln {
-bool zerop (const cl_F& x)
+bool CL_FLATTEN zerop (const cl_F& x)
{
floatcase(x
- , return zerop(x);
- , return zerop(x);
- , return zerop(x);
- , return zerop(x);
+ , return zerop_inline(x);
+ , return zerop_inline(x);
+ , return zerop_inline(x);
+ , return zerop_inline(x);
);
}
#include "cl_FF.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_FF_minusp.cc"
namespace cln {
-const cl_FF fceiling (const cl_FF& x)
+const cl_FF CL_FLATTEN fceiling (const cl_FF& x)
{
- if (minusp(x))
+ if (minusp_inline(x))
return ftruncate(x);
else
return futruncate(x);
#include "cl_low.h"
#include "cl_ieee.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_FF_zerop.cc"
namespace cln {
#if defined(FAST_FLOAT) && !defined(__i386__)
float_to_FF(FF_to_float(x1) / FF_to_float(x2), return ,
TRUE, TRUE, // Overflow und subnormale Zahl abfangen
- !zerop(x1), // ein Ergebnis +/- 0.0
+ !zerop_inline(x1), // ein Ergebnis +/- 0.0
// ist genau dann in Wirklichkeit ein Underflow
- zerop(x2), // Division durch Null abfangen
+ zerop_inline(x2), // Division durch Null abfangen
FALSE // kein NaN als Ergebnis möglich
);
#else
#include "cl_FF.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_FF_minusp.cc"
namespace cln {
-const cl_FF ffloor (const cl_FF& x)
+const cl_FF CL_FLATTEN ffloor (const cl_FF& x)
{
- if (minusp(x))
+ if (minusp_inline(x))
return futruncate(x);
else
return ftruncate(x);
namespace cln {
-MAYBE_INLINE
-bool minusp (const cl_FF& x)
+CL_INLINE bool CL_INLINE_DECL(minusp) (const cl_FF& x)
{
return (sint32)cl_ffloat_value(x) < 0;
}
#include "cl_low.h"
#include "cl_ieee.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_FF_zerop.cc"
namespace cln {
#ifdef FAST_FLOAT
float_to_FF(FF_to_float(x1) * FF_to_float(x2), return ,
TRUE, TRUE, // Overflow und subnormale Zahl abfangen
- !(zerop(x1) || zerop(x2)), // ein Ergebnis +/- 0.0
+ !(zerop_inline(x1) || zerop_inline(x2)), // ein Ergebnis +/- 0.0
// ist genau dann in Wirklichkeit ein Underflow
FALSE, FALSE // keine Singularität, kein NaN als Ergebnis möglich
);
#include "cl_FF.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_FF_minusp.cc"
#include "cl_FF_zerop.cc"
namespace cln {
-MAYBE_INLINE2
-bool plusp (const cl_FF& x)
+CL_INLINE2 bool CL_INLINE2_DECL(plusp) (const cl_FF& x)
{
- if (minusp(x))
+ if (minusp_inline(x))
return false; // x<0 -> nein
- elif (zerop(x))
+ elif (zerop_inline(x))
return false; // x=0 -> nein
else
return true; // sonst ist x>0.
namespace cln {
-MAYBE_INLINE
-bool zerop (const cl_FF& x)
+CL_INLINE bool CL_INLINE_DECL(zerop) (const cl_FF& x)
{
return cl_ffloat_value(x) == 0;
}
// Implementation.
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_FF_minusp.cc"
namespace cln {
-const cl_FF abs (const cl_FF& x)
+const cl_FF CL_FLATTEN abs (const cl_FF& x)
{
// x<0 -> (- x), x>=0 -> x
- if (minusp(x)) return -x; else return x;
+ if (minusp_inline(x)) return -x; else return x;
}
} // namespace cln
namespace cln {
-MAYBE_INLINE
-uintC float_digits (const cl_FF& x)
+CL_INLINE uintC CL_INLINE_DECL(float_digits) (const cl_FF& x)
{
unused x;
return FF_mant_len+1; // 24
namespace cln {
-MAYBE_INLINE
-uint32 equal_hashcode (const cl_FF& x)
+CL_INLINE uint32 CL_INLINE_DECL(equal_hashcode) (const cl_FF& x)
{
var cl_signean sign;
var sintL exp;
namespace cln {
-MAYBE_INLINE
-sintE float_exponent (const cl_FF& x)
+CL_INLINE sintE CL_INLINE_DECL(float_exponent) (const cl_FF& x)
{
var uintL uexp = FF_uexp(cl_ffloat_value(x));
if (uexp==0) { return 0; }
namespace cln {
-MAYBE_INLINE
-const cl_idecoded_float integer_decode_float (const cl_FF& x)
+CL_INLINE const cl_idecoded_float CL_INLINE_DECL(integer_decode_float) (const cl_FF& x)
{
var cl_idecoded_float sem = integer_decode_float(cl_FF_to_DF(x));
return cl_idecoded_float(sem.mantissa >> (DF_mant_len-FF_mant_len),
namespace cln {
-MAYBE_INLINE
-const cl_idecoded_float integer_decode_float (const cl_FF& x)
+CL_INLINE const cl_idecoded_float CL_INLINE_DECL(integer_decode_float) (const cl_FF& x)
{
// x entpacken:
var cl_signean sign;
#include "cl_FF.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_FF_zerop.cc"
namespace cln {
-MAYBE_INLINE2
-uintC float_precision (const cl_FF& x)
+CL_INLINE2 uintC CL_INLINE2_DECL(float_precision) (const cl_FF& x)
{
- if (zerop(x)) return 0;
+ if (zerop_inline(x)) return 0;
return FF_mant_len+1; // 24
}
#include "cl_FF.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_FF_minusp.cc"
namespace cln {
-MAYBE_INLINE2
-const cl_FF float_sign (const cl_FF& x)
+CL_INLINE2 const cl_FF CL_INLINE2_DECL(float_sign) (const cl_FF& x)
{
// Methode: x>=0 -> Ergebnis 1.0; x<0 -> Ergebnis -1.0
- return (!minusp(x) ? cl_FF_1 : cl_FF_minus1);
+ return (!minusp_inline(x) ? cl_FF_1 : cl_FF_minus1);
}
} // namespace cln
#include "cl_FF.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_FF_minusp.cc"
#include "cl_FF_zerop.cc"
namespace cln {
-MAYBE_INLINE2
-const cl_FF signum (const cl_FF& x)
+CL_INLINE2 const cl_FF CL_INLINE2_DECL(signum) (const cl_FF& x)
{
- if (minusp(x)) { return cl_FF_minus1; } // x<0 -> -1.0
- elif (zerop(x)) { return cl_FF_0; } // x=0 -> 0.0
+ if (minusp_inline(x)) { return cl_FF_minus1; } // x<0 -> -1.0
+ elif (zerop_inline(x)) { return cl_FF_0; } // x=0 -> 0.0
else { return cl_FF_1; } // x>0 -> +1.0
}
#include "cl_LF.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_LF_minusp.cc"
namespace cln {
-const cl_LF fceiling (const cl_LF& x)
+CL_INLINE2 const cl_LF CL_INLINE2_DECL(fceiling) (const cl_LF& x)
{
- if (minusp(x))
+ if (minusp_inline(x))
return ftruncate(x);
else
return futruncate(x);
#include "cl_LF.h"
#include "cl_DS.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_LF_minusp.cc"
namespace cln {
// x und y haben gleiches Vorzeichen ->
// x >=0 -> vergleiche x und y (die rechten 24 Bits)
// x <0 -> vergleiche y und x (die rechten 24 Bits)
- if (!minusp(y))
+ if (!minusp_inline(y))
// y>=0
- { if (!minusp(x))
+ { if (!minusp_inline(x))
// y>=0, x>=0
{ // Vergleiche Exponenten und Mantissen:
{ var uintE x_uexp = TheLfloat(x)->expo;
{ return signean_minus; } // x<y
}
else
- { if (!minusp(x))
+ { if (!minusp_inline(x))
// y<0, x>=0
{ return signean_plus; } // x>y
else
#include "cl_LF.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_LF_minusp.cc"
namespace cln {
-const cl_LF ffloor (const cl_LF& x)
+CL_INLINE2 const cl_LF CL_INLINE2_DECL(ffloor) (const cl_LF& x)
{
- if (minusp(x))
+ if (minusp_inline(x))
return futruncate(x);
else
return ftruncate(x);
namespace cln {
-MAYBE_INLINE
-bool minusp (const cl_LF& x)
+CL_INLINE bool CL_INLINE_DECL(minusp) (const cl_LF& x)
{
return -TheLfloat(x)->sign;
}
#include "cl_LF.h"
#include "cl_LF_impl.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_LF_minusp.cc"
#include "cl_LF_zerop.cc"
namespace cln {
-MAYBE_INLINE2
-bool plusp (const cl_LF& x)
+CL_INLINE2 bool CL_INLINE2_DECL(plusp) (const cl_LF& x)
{
- if (minusp(x))
+ if (minusp_inline(x))
return false; // x<0 -> nein
- elif (zerop(x))
+ elif (zerop_inline(x))
return false; // x=0 -> nein
else
return true; // sonst ist x>0.
#include "cl_I.h"
#include "cl_DS.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_LF_minusp.cc"
namespace cln {
copy_loop_msp(arrayMSDptr(TheLfloat(x)->data,len),MSDptr mspop 1,len); // Mantisse kopieren
mspref(MSDptr,0) = 0; // und zusätzliches Nulldigit
// Mantisse ist die UDS MSDptr/len1/LSDptr.
- if (minusp(x))
+ if (minusp_inline(x))
// x<0 -> Mantisse negieren:
{ neg_loop_lsp(LSDptr,len1); }
// Vorzeichen*Mantisse ist die DS MSDptr/len1/LSDptr.
namespace cln {
-MAYBE_INLINE
-bool zerop (const cl_LF& x)
+CL_INLINE bool CL_INLINE_DECL(zerop) (const cl_LF& x)
{
return TheLfloat(x)->expo == 0;
}
// Implementation.
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_LF_minusp.cc"
namespace cln {
-const cl_LF abs (const cl_LF& x)
+const cl_LF CL_FLATTEN abs (const cl_LF& x)
{
// x<0 -> (- x), x>=0 -> x
- if (minusp(x)) return -x; else return x;
+ if (minusp_inline(x)) return -x; else return x;
}
} // namespace cln
namespace cln {
-MAYBE_INLINE
-uintC float_digits (const cl_LF& x)
+CL_INLINE uintC CL_INLINE_DECL(float_digits) (const cl_LF& x)
{
return intDsize*(uintC)(TheLfloat(x)->len);
}
namespace cln {
-MAYBE_INLINE
-uint32 equal_hashcode (const cl_LF& x)
+CL_INLINE uint32 CL_INLINE_DECL(equal_hashcode) (const cl_LF& x)
{
var cl_signean sign;
var sintL exp;
namespace cln {
-MAYBE_INLINE
-sintE float_exponent (const cl_LF& x)
+CL_INLINE sintE CL_INLINE_DECL(float_exponent) (const cl_LF& x)
{
var uintE uexp = TheLfloat(x)->expo;
if (uexp==0) { return 0; }
namespace cln {
-MAYBE_INLINE
-const cl_idecoded_float integer_decode_float (const cl_LF& x)
+CL_INLINE const cl_idecoded_float CL_INLINE_DECL(integer_decode_float) (const cl_LF& x)
{
// x entpacken:
var uintE uexp = TheLfloat(x)->expo;
#include "cl_LF.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_LF_zerop.cc"
namespace cln {
-MAYBE_INLINE2
-uintC float_precision (const cl_LF& x)
+CL_INLINE2 uintC CL_INLINE2_DECL(float_precision) (const cl_LF& x)
{
- if (zerop(x)) return 0;
+ if (zerop_inline(x)) return 0;
return intDsize*(uintC)(TheLfloat(x)->len);
}
#include "cln/exception.h"
-#undef MAYBE_INLINE2
-#define MAYBE_INLINE2 inline
+#include "cl_inline2.h"
#include "cl_LF_precision.cc"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_LF_exponent.cc"
namespace cln {
// dx := float_digits(x), dy := float_digits(y).
// 1 ulp(x) = 2^(ex-dx), 1 ulp(y) = 2^(ey-dy).
// Falls ex-dx < ey-dy, x von Precision dx auf dy-ey+ex verkürzen.
- var sintE ey = float_exponent(y);
- var sintC dy = float_precision(y);
+ var sintE ey = float_exponent_inline(y);
+ var sintC dy = float_precision_inline(y);
if (dy==0) // zerop(y) ?
throw runtime_exception();
- var sintE ex = float_exponent(x);
- var sintC dx = float_precision(x);
+ var sintE ex = float_exponent_inline(x);
+ var sintC dx = float_precision_inline(x);
if (dx==0) // zerop(x) ?
return x;
var sintE d = ex - ey;
// Implementation.
-#undef MAYBE_INLINE2
-#define MAYBE_INLINE2 inline
+#include "cl_inline2.h"
#include "cl_LF_precision.cc"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_LF_exponent.cc"
namespace cln {
// ex := float_exponent(x), dx := float_digits(x), 1 ulp(x) = 2^(ex-dx).
// ey := float_exponent(y).
// Falls ex-dx < ey, x von Precision dx auf ex-ey verkürzen.
- var sintE ey = float_exponent(y);
- var sintE ex = float_exponent(x);
- var uintC dx = float_precision(x);
+ var sintE ey = float_exponent_inline(y);
+ var sintE ex = float_exponent_inline(x);
+ var uintC dx = float_precision_inline(x);
if (dx==0) // zerop(x) ?
return x;
var sintE ulpx = ex - dx;
#include "cl_LF.h"
#include "cl_LF_impl.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_LF_minusp.cc"
namespace cln {
-MAYBE_INLINE2
-const cl_LF float_sign (const cl_LF& x)
+CL_INLINE2 const cl_LF CL_INLINE2_DECL(float_sign) (const cl_LF& x)
{
// Methode: x>=0 -> Ergebnis 1.0; x<0 -> Ergebnis -1.0
return encode_LF1s(TheLfloat(x)->sign,TheLfloat(x)->len);
#include "cl_LF.h"
#include "cl_LF_impl.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_LF_minusp.cc"
#include "cl_LF_zerop.cc"
namespace cln {
-MAYBE_INLINE2
-const cl_LF signum (const cl_LF& x)
+CL_INLINE2 const cl_LF CL_INLINE2_DECL(signum) (const cl_LF& x)
{
- if (zerop(x)) { return x; } // x=0 -> 0.0
+ if (zerop_inline(x)) { return x; } // x=0 -> 0.0
else // je nach Vorzeichen von x
{ return encode_LF1s(TheLfloat(x)->sign,TheLfloat(x)->len); }
}
#include "cln/dfloat.h"
#include "cln/lfloat.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_SF_minusp.cc"
#include "cl_FF_minusp.cc"
#include "cl_DF_minusp.cc"
namespace cln {
-const cl_F abs (const cl_F& x)
+const cl_F CL_FLATTEN abs (const cl_F& x)
{
// x<0 -> (- x), x>=0 -> x
floatcase(x
- , if (minusp(x)) return -x; else return x;
- , if (minusp(x)) return -x; else return x;
- , if (minusp(x)) return -x; else return x;
- , if (minusp(x)) return -x; else return x;
+ , if (minusp_inline(x)) return -x; else return x;
+ , if (minusp_inline(x)) return -x; else return x;
+ , if (minusp_inline(x)) return -x; else return x;
+ , if (minusp_inline(x)) return -x; else return x;
);
}
#include "cl_F.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_SF_digits.cc"
#include "cl_FF_digits.cc"
#include "cl_DF_digits.cc"
uintC float_digits (const cl_F& x)
{
floatcase(x
- , return float_digits(x);
- , return float_digits(x);
- , return float_digits(x);
- , return float_digits(x);
+ , return float_digits_inline(x);
+ , return float_digits_inline(x);
+ , return float_digits_inline(x);
+ , return float_digits_inline(x);
);
}
#include "cl_N.h"
#include "cl_F.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_SF_eqhashcode.cc"
#include "cl_FF_eqhashcode.cc"
#include "cl_DF_eqhashcode.cc"
namespace cln {
-uint32 equal_hashcode (const cl_F& x)
+uint32 CL_FLATTEN equal_hashcode (const cl_F& x)
{
floatcase(x
- , return equal_hashcode(x);
- , return equal_hashcode(x);
- , return equal_hashcode(x);
- , return equal_hashcode(x);
+ , return equal_hashcode_inline(x);
+ , return equal_hashcode_inline(x);
+ , return equal_hashcode_inline(x);
+ , return equal_hashcode_inline(x);
);
}
#include "cl_F.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_SF_exponent.cc"
#include "cl_FF_exponent.cc"
#include "cl_DF_exponent.cc"
namespace cln {
-sintE float_exponent (const cl_F& x)
+sintE CL_FLATTEN float_exponent (const cl_F& x)
{
floatcase(x
- , return float_exponent(x);
- , return float_exponent(x);
- , return float_exponent(x);
- , return float_exponent(x);
+ , return float_exponent_inline(x);
+ , return float_exponent_inline(x);
+ , return float_exponent_inline(x);
+ , return float_exponent_inline(x);
);
}
#include "cl_F.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_SF_idecode.cc"
#include "cl_FF_idecode.cc"
#include "cl_DF_idecode.cc"
namespace cln {
-const cl_idecoded_float integer_decode_float (const cl_F& x)
+const cl_idecoded_float CL_FLATTEN integer_decode_float (const cl_F& x)
{
floatcase(x
- , return integer_decode_float(x);
- , return integer_decode_float(x);
- , return integer_decode_float(x);
- , return integer_decode_float(x);
+ , return integer_decode_float_inline(x);
+ , return integer_decode_float_inline(x);
+ , return integer_decode_float_inline(x);
+ , return integer_decode_float_inline(x);
);
}
#include "cl_F.h"
-#undef MAYBE_INLINE2
-#define MAYBE_INLINE2 inline
+#include "cl_inline2.h"
#include "cl_SF_precision.cc"
#include "cl_FF_precision.cc"
#include "cl_DF_precision.cc"
namespace cln {
-uintC float_precision (const cl_F& x)
+uintC CL_FLATTEN float_precision (const cl_F& x)
{
floatcase(x
, return float_precision(x);
#include "cl_F.h"
-#undef MAYBE_INLINE2
-#define MAYBE_INLINE2 inline
+#include "cl_inline2.h"
#include "cl_SF_sign.cc"
#include "cl_FF_sign.cc"
#include "cl_DF_sign.cc"
namespace cln {
-const cl_F float_sign (const cl_F& x)
+const cl_F CL_FLATTEN float_sign (const cl_F& x)
{
// Methode: x>=0 -> Ergebnis 1.0; x<0 -> Ergebnis -1.0
floatcase(x
- , return float_sign(x);
- , return float_sign(x);
- , return float_sign(x);
- , return float_sign(x);
+ , return float_sign_inline(x);
+ , return float_sign_inline(x);
+ , return float_sign_inline(x);
+ , return float_sign_inline(x);
);
}
#include "cl_F.h"
-#undef MAYBE_INLINE2
-#define MAYBE_INLINE2 inline
+/* Use inline versions of signum(cl_{SF,FF,DF,LF}) functions */
+#include "cl_inline2.h"
#include "cl_SF_signum.cc"
#include "cl_FF_signum.cc"
#include "cl_DF_signum.cc"
namespace cln {
-const cl_F signum (const cl_F& x)
+const cl_F CL_FLATTEN signum (const cl_F& x)
{
floatcase(x
- , return signum(x);
- , return signum(x);
- , return signum(x);
- , return signum(x);
+ , return signum_inline(x);
+ , return signum_inline(x);
+ , return signum_inline(x);
+ , return signum_inline(x);
);
}
#include "cl_SF.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+/* For inline version of minusp */
+#include "cl_inline.h"
#include "cl_SF_minusp.cc"
namespace cln {
-const cl_SF fceiling (const cl_SF& x)
+const cl_SF CL_FLATTEN fceiling (const cl_SF& x)
{
- if (minusp(x))
+ if (minusp_inline(x))
return ftruncate(x);
else
return futruncate(x);
#include "cl_SF.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+/* For inline version of minusp */
+#include "cl_inline.h"
#include "cl_SF_minusp.cc"
namespace cln {
-const cl_SF ffloor (const cl_SF& x)
+const cl_SF CL_FLATTEN ffloor (const cl_SF& x)
{
- if (minusp(x))
+ if (minusp_inline(x))
return futruncate(x);
else
return ftruncate(x);
// Implementation.
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_SF_minusp.cc"
namespace cln {
-cl_signean compare (const cl_SF& x, const cl_SF& y)
+cl_signean CL_FLATTEN compare (const cl_SF& x, const cl_SF& y)
{
// Methode:
// x und y haben verschiedenes Vorzeichen ->
// x und y haben gleiches Vorzeichen ->
// x >=0 -> vergleiche x und y (die rechten 24 Bits)
// x <0 -> vergleiche y und x (die rechten 24 Bits)
- if (!minusp(y))
+ if (!minusp_inline(y))
// y>=0
- { if (!minusp(x))
+ { if (!minusp_inline(x))
// y>=0, x>=0
{ if (x.word < y.word) return signean_minus; // x<y
if (x.word > y.word) return signean_plus; // x>y
{ return signean_minus; } // x<y
}
else
- { if (!minusp(x))
+ { if (!minusp_inline(x))
// y<0, x>=0
{ return signean_plus; } // x>y
else
#include "cl_SF.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+/* Use inline version of zerop */
+#include "cl_inline.h"
#include "cl_SF_zerop.cc"
namespace cln {
{
// Methode:
// (- x1 x2) = (+ x1 (- x2))
- if (zerop(x2))
+ if (zerop_inline(x2))
return x1;
else
return x1 + cl_SF_from_word(x2.word ^ bit(SF_sign_shift));
namespace cln {
-MAYBE_INLINE
-bool minusp (const cl_SF& x)
+CL_INLINE bool CL_INLINE_DECL(minusp) (const cl_SF& x)
{
return (x.word & bit(SF_sign_shift)) != 0;
}
#include "cl_SF.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+/* For inline versions of minusp and zerop */
+#include "cl_inline.h"
#include "cl_SF_minusp.cc"
#include "cl_SF_zerop.cc"
namespace cln {
-MAYBE_INLINE2
-bool plusp (const cl_SF& x)
+CL_INLINE2 bool CL_INLINE2_DECL(plusp) (const cl_SF& x)
{
- if (minusp(x))
+ if (minusp_inline(x))
return false; // x<0 -> nein
- elif (zerop(x))
+ elif (zerop_inline(x))
return false; // x=0 -> nein
else
return true; // sonst ist x>0.
#include "cl_SF.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_SF_zerop.cc"
namespace cln {
{
// Methode:
// Falls x=0.0, fertig. Sonst Vorzeichenbit umdrehen.
- if (zerop(x))
+ if (zerop_inline(x))
return SF_0;
return cl_SF_from_word(x.word ^ ((cl_uint)1 << SF_sign_shift));
}
namespace cln {
-MAYBE_INLINE
-bool zerop (const cl_SF& x)
+CL_INLINE bool CL_INLINE_DECL(zerop) (const cl_SF& x)
{
return x.word == make_SF_word(0,0,0);
}
// Implementation.
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_SF_minusp.cc"
namespace cln {
-const cl_SF abs (const cl_SF& x)
+const cl_SF CL_FLATTEN abs (const cl_SF& x)
{
// x<0 -> (- x), x>=0 -> x
- if (minusp(x)) return -x; else return x;
+ if (minusp_inline(x)) return -x; else return x;
}
} // namespace cln
namespace cln {
-MAYBE_INLINE
-uintC float_digits (const cl_SF& x)
+CL_INLINE uintC CL_INLINE_DECL(float_digits) (const cl_SF& x)
{
unused x;
return SF_mant_len+1; // 17
namespace cln {
-MAYBE_INLINE
-uint32 equal_hashcode (const cl_SF& x)
+CL_INLINE uint32 CL_INLINE_DECL(equal_hashcode) (const cl_SF& x)
{
var cl_signean sign;
var sintL exp;
namespace cln {
-MAYBE_INLINE
-sintE float_exponent (const cl_SF& x)
+CL_INLINE sintE CL_INLINE_DECL(float_exponent) (const cl_SF& x)
{
var uintL uexp = SF_uexp(x);
if (uexp==0) { return 0; }
namespace cln {
-MAYBE_INLINE
-const cl_idecoded_float integer_decode_float (const cl_SF& x)
+CL_INLINE const cl_idecoded_float CL_INLINE_DECL(integer_decode_float) (const cl_SF& x)
{
// x entpacken:
var cl_signean sign;
#include "cl_SF.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_SF_zerop.cc"
namespace cln {
-MAYBE_INLINE2
-uintC float_precision (const cl_SF& x)
+CL_INLINE2 uintC CL_INLINE2_DECL(float_precision) (const cl_SF& x)
{
- if (zerop(x)) return 0;
+ if (zerop_inline(x)) return 0;
return SF_mant_len+1; // 17
}
#include "cl_SF.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_SF_minusp.cc"
namespace cln {
-MAYBE_INLINE2
-const cl_SF float_sign (const cl_SF& x)
+CL_INLINE2 const cl_SF CL_INLINE2_DECL(float_sign) (const cl_SF& x)
{
// Methode: x>=0 -> Ergebnis 1.0; x<0 -> Ergebnis -1.0
return encode_SF(SF_sign(x),1,bit(SF_mant_len));
#include "cl_SF.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+/* Use inline versions of minusp and zerop */
+#include "cl_inline.h"
#include "cl_SF_minusp.cc"
#include "cl_SF_zerop.cc"
namespace cln {
-MAYBE_INLINE2
-const cl_SF signum (const cl_SF& x)
+CL_INLINE2 const cl_SF CL_INLINE2_DECL(signum) (const cl_SF& x)
{
- if (minusp(x)) { return SF_minus1; } // x<0 -> -1.0
- elif (zerop(x)) { return SF_0; } // x=0 -> 0.0
+ if (minusp_inline(x)) { return SF_minus1; } // x<0 -> -1.0
+ elif (zerop_inline(x)) { return SF_0; } // x=0 -> 0.0
else { return SF_1; } // x>0 -> +1.0
}
#include "cln/float.h"
#include "cl_low.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_LF_zerop.cc"
#include "cl_LF_minusp.cc"
#include "cl_LF_exponent.cc"
const cl_LF atanhx (const cl_LF& x)
{
- if (zerop(x))
+ if (zerop_inline(x))
return x;
var uintC actuallen = TheLfloat(x)->len;
var uintC d = float_digits(x);
- var sintE e = float_exponent(x);
+ var sintE e = float_exponent_inline(x);
if (e <= (sintC)(-d)>>1) // e <= -d/2 <==> e <= -ceiling(d/2)
return x; // ja -> x als Ergebnis
if (actuallen >= 34) {
// nächstes x nach der Formel x := x+sqrt(x^2 - 1) berechnen:
xx = sqrt(square(xx) + cl_float(-1,xx)) + xx;
k = k+1;
- } until (float_exponent(xx) > e_limit);
+ } until (float_exponent_inline(xx) > e_limit);
// Schleifenende mit Exponent(x) > 1+limit_slope*floor(sqrt(d)),
// also x >= 2^(1+limit_slope*floor(sqrt(d))),
// also 1/x <= 2^(-1-limit_slope*floor(sqrt(d))).
// Nun kann die Potenzreihe auf 1/x angewandt werden.
xx = recip(xx);
- if (minusp(x))
+ if (minusp_inline(x))
xx = - xx; // Vorzeichen wieder rein
}
// Potenzreihe anwenden:
#include "cl_LF.h"
#include "cln/integer.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_LF_zerop.cc"
#include "cl_LF_minusp.cc"
#include "cl_LF_exponent.cc"
static const cl_LF atanx_naive (const cl_LF& x)
{
- if (zerop(x))
+ if (zerop_inline(x))
return x;
var uintC actuallen = TheLfloat(x)->len;
var uintC d = float_digits(x);
- var sintE e = float_exponent(x);
+ var sintE e = float_exponent_inline(x);
if (e <= (sintC)(-d)>>1) // e <= -d/2 <==> e <= -ceiling(d/2)
return x; // ja -> x als Ergebnis
var uintL k = 0; // Rekursionszähler k:=0
// nächstes x nach der Formel x := x+sqrt(x^2 + 1) berechnen:
xx = sqrt(square(xx) + cl_float(1,xx)) + xx;
k = k+1;
- } until (float_exponent(xx) > e_limit);
+ } until (float_exponent_inline(xx) > e_limit);
// Schleifenende mit Exponent(x) > 1+limit_slope*floor(sqrt(d)),
// also x >= 2^(1+limit_slope*floor(sqrt(d))),
// also 1/x <= 2^(-1-limit_slope*floor(sqrt(d))).
// Nun kann die Potenzreihe auf 1/x angewandt werden.
xx = recip(xx);
- if (minusp(x))
+ if (minusp_inline(x))
xx = - xx; // Vorzeichen wieder rein
}
// Potenzreihe anwenden:
// Set z := z + z' and x+i*y := (x+i*y)*exp(-i*z').
var uintC len = TheLfloat(t)->len;
var uintC d = intDsize*len;
- if (zerop(t) || (float_exponent(t) <= (sintC)(-d)>>1))
+ if (zerop_inline(t) || (float_exponent_inline(t) <= (sintC)(-d)>>1))
return t;
var cl_LF x = recip(sqrt(cl_I_to_LF(1,len) + square(t)));
var cl_LF y = t*x;
var cl_LF z = cl_I_to_LF(0,len);
loop {
- if (zerop(y) || (float_exponent(y) <= (sintC)(-d)>>1))
+ if (zerop_inline(y) || (float_exponent_inline(y) <= (sintC)(-d)>>1))
break;
var cl_idecoded_float y_ = integer_decode_float(y);
// y = (-1)^sign * 2^exponent * mantissa
// 1000 167 112 65
// ==> ratseries faster for N >= 325.
-const cl_F atanx (const cl_F& x)
+const cl_F CL_FLATTEN atanx (const cl_F& x)
{
if (longfloatp(x)) {
DeclareType(cl_LF,x);
#include "cln/lfloat.h"
#include "cl_LF.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_LF_minusp.cc"
#include "cl_LF_exponent.cc"
inline const cl_LF_div_t cl_floor_ln2 (const cl_LF& x)
{
// Bei 0<=x<1/2 kann man sofort q:=0 setzen.
- if (!minusp(x) && (float_exponent(x) < 0))
+ if (!minusp_inline(x) && (float_exponent_inline(x) < 0))
return cl_LF_div_t(0,x);
else
return floor2(x,The(cl_LF)(cl_ln2(x)));
#include "cl_LF.h"
#include "cln/integer.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_LF_zerop.cc"
#include "cl_LF_exponent.cc"
{
// Methode:
// wie oben, mit adaptiver Genauigkeit während der Potenzreihen-Summation.
- if (zerop(x))
+ if (zerop_inline(x))
return cl_float(1,x);
var uintC actuallen = TheLfloat(x)->len;
var uintC d = float_digits(x);
- var sintE e = float_exponent(x);
+ var sintE e = float_exponent_inline(x);
if (e < -(sintC)d) // e < -d ?
return cl_float(1,x); // ja -> 1.0 als Ergebnis
{ Mutable(cl_LF,x);
#include "cl_LF.h"
#include "cln/integer.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_LF_zerop.cc"
#include "cl_LF_minusp.cc"
#include "cl_LF_exponent.cc"
const cl_LF lnx_naive (const cl_LF& x)
{
var cl_LF y = x-cl_float(1,x);
- if (zerop(y)) // y=0.0 -> y als Ergebnis
+ if (zerop_inline(y)) // y=0.0 -> y als Ergebnis
return y;
var uintC actuallen = TheLfloat(x)->len;
var uintC d = float_digits(x);
- var sintE e = float_exponent(y);
+ var sintE e = float_exponent_inline(y);
if (e <= -(sintC)d) // e <= -d ?
return y; // ja -> y als Ergebnis
{ Mutable(cl_LF,x);
// e > -1-floor(sqrt(d)) -> muß |y| verkleinern.
x = sqrt(x); // x := (sqrt x)
y = x-cl_float(1,x); // y := (- x 1) und
- e = float_exponent(y); // e neu berechnen
+ e = float_exponent_inline(y); // e neu berechnen
k = k+1; // k:=k+1
}
if (0) {
#include "cl_LF.h"
#include "cln/integer.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_LF_zerop.cc"
#include "cl_LF_exponent.cc"
// grob j=sqrt(2d) und damit k=sqrt(d).]
// Aufwand: asymptotisch d^2.5 .
- if (zerop(x))
+ if (zerop_inline(x))
return x;
var uintC actuallen = TheLfloat(x)->len;
var uintC d = float_digits(x);
- var sintE e = float_exponent(x);
+ var sintE e = float_exponent_inline(x);
if (e <= (1-(sintC)d)>>1) // e <= (1-d)/2 <==> e <= -ceiling((d-1)/2) ?
return square(x); // ja -> x^2 als Ergebnis
{ Mutable(cl_LF,x);
#include "cl_LF.h"
#include "cln/integer.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_LF_zerop.cc"
#include "cl_LF_exponent.cc"
// grob j=sqrt(2d) und damit k=sqrt(d).]
// Aufwand: asymptotisch d^2.5 .
- if (zerop(x))
+ if (zerop_inline(x))
return x;
var uintC actuallen = TheLfloat(x)->len;
var uintC d = float_digits(x);
- var sintE e = float_exponent(x);
+ var sintE e = float_exponent_inline(x);
if (e <= (-(sintC)d)>>1) // e <= (-d)/2 <==> e <= -ceiling(d/2) ?
return square(x); // ja -> x^2 als Ergebnis
{ Mutable(cl_LF,x);
namespace cln {
-MAYBE_INLINE
-const cl_F tan (const cl_F& x)
+CL_INLINE const cl_F CL_INLINE_DECL(tan) (const cl_F& x)
{
// Methode:
// (/ (sin x) (cos x))
namespace cln {
-MAYBE_INLINE
-const cl_F tanh (const cl_F& x)
+CL_INLINE const cl_F CL_INLINE_DECL(tanh) (const cl_F& x)
{
// Methode:
// (/ (sinh x) (cosh x))
#include "cln/number.h"
#include "cl_DS.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_I_from_NDS.cc"
namespace cln {
-MAYBE_INLINE2
-const cl_I DS_to_I (const uintD* MSDptr, uintC len)
+CL_INLINE2 const cl_I CL_INLINE2_DECL(DS_to_I) (const uintD* MSDptr, uintC len)
{
// erst normalisieren.
// Dabei evtl. MSDptr erhöhen und len erniedrigen:
} }
// Eventuell ist jetzt noch bei der DS 0 ausnahmsweise len=1,
// aber NDS_to_I wird auch damit fertig.
- return NDS_to_I(MSDptr,len);
+ return NDS_to_I_inline(MSDptr,len);
}
} // namespace cln
namespace cln {
-MAYBE_INLINE
-const cl_I NDS_to_I (const uintD* MSDptr, uintC len)
+CL_INLINE const cl_I CL_INLINE_DECL(NDS_to_I) (const uintD* MSDptr, uintC len)
{
// Mehr als bn_minlength Digits -> Bignum.
// Weniger als bn_minlength Digits -> Fixnum.
#include "cln/number.h"
#include "cl_DS.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_I_from_NDS.cc"
namespace cln {
-MAYBE_INLINE2
-const cl_I NUDS_to_I (uintD* MSDptr, uintC len)
+CL_INLINE2 const cl_I CL_INLINE2_DECL(NUDS_to_I) (uintD* MSDptr, uintC len)
{
if ((!(len==0)) && ((sintD)mspref(MSDptr,0) < 0))
// Falls die Länge >0 und das Most significant Bit = 1 sind,
// die Digit Sequence um ein Nulldigit erweitern:
{ lsprefnext(MSDptr) = 0; len++; }
- return NDS_to_I(MSDptr,len);
+ return NDS_to_I_inline(MSDptr,len);
}
} // namespace cln
#include "cln/number.h"
#include "cl_DS.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_I_from_NDS.cc"
namespace cln {
-MAYBE_INLINE2
-const cl_I UDS_to_I (uintD* MSDptr, uintC len)
+CL_INLINE2 const cl_I CL_INLINE2_DECL(UDS_to_I) (uintD* MSDptr, uintC len)
{
while ( (!(len==0)) && (mspref(MSDptr,0)==0) ) // solange len>0 und MSD = 0,
{ msshrink(MSDptr); len--; } // Nulldigit streichen
// Falls die Länge >0 und das Most significant Bit = 1 sind,
// die Digit Sequence um ein Nulldigit erweitern:
{ lsprefnext(MSDptr) = 0; len++; }
- return NDS_to_I(MSDptr,len);
+ return NDS_to_I_inline(MSDptr,len);
}
} // namespace cln
namespace cln {
-inline uint32 equal_hashcode (const cl_FN& x)
+static inline uint32 equal_hashcode (const cl_FN& x)
{
var cl_signean sign;
var uintV x_ = FN_to_V(x); // x als intVsize-Bit-Zahl
return equal_hashcode_low(msd,exp,sign);
}
-inline uint32 equal_hashcode (const cl_BN& x)
+static inline uint32 equal_hashcode (const cl_BN& x)
{
var const uintD* MSDptr;
var uintC len;
#endif
}
-MAYBE_INLINE
-uint32 equal_hashcode (const cl_I& x)
+CL_INLINE uint32 CL_INLINE_DECL(equal_hashcode) (const cl_I& x)
{
if (fixnump(x)) {
DeclareType(cl_FN,x);
namespace cln {
-MAYBE_INLINE
-const cl_I signum (const cl_I& x)
+CL_INLINE const cl_I CL_INLINE_DECL(signum) (const cl_I& x)
{
if (minusp(x)) { return -1; } // x<0 -> -1
elif (zerop(x)) { return 0; } // x=0 -> 0
#include "cln/integer.h"
#include "cln/integer_io.h"
+#define zerop zerop_inline
#include "cl_I.h"
+#undef zerop
namespace cln {
return _cl_ring_element(R, (cl_I)0);
}
-static bool 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)
// Implementation.
-#define minusp inline_minusp
+#define minusp minusp_inline
#include "cl_RA.h"
#undef minusp
namespace cln {
-bool minusp (const cl_RA& x)
+bool CL_FLATTEN minusp (const cl_RA& x)
{
- return inline_minusp(x);
+ return minusp_inline(x);
}
} // namespace cln
# This file contains additional flags for the main Makefile.
include $(srcdir)/rational/Makeflags
-SUBDIR_INCLUDES +=
+SUBDIR_INCLUDES += -I$(srcdir)/integer/misc
#include "cl_N.h"
#include "cl_RA.h"
+#include "cl_inline.h"
+#include "cl_I_eqhashcode.cc"
namespace cln {
-uint32 equal_hashcode (const cl_RA& r)
+CL_INLINE2 uint32 CL_INLINE2_DECL(equal_hashcode) (const cl_RA& r)
{
if (integerp(r)) {
DeclareType(cl_I,r);
- return equal_hashcode(r);
+ return equal_hashcode_inline(r);
} else {
// Making sure that a float and its rational equivalent have
// the same hash code is tricky. This code depends on the fact
// that the equal_hashcode_low macro is linear in `exp'.
DeclareType(cl_RT,r);
- return equal_hashcode(numerator(r))
- - equal_hashcode(denominator(r))
+ return equal_hashcode_inline(numerator(r))
+ - equal_hashcode_inline(denominator(r))
+ equal_hashcode_one;
}
}
#include "cl_RA.h"
#include "cl_I.h"
+
namespace cln {
-MAYBE_INLINE
-const cl_RA signum (const cl_RA& x)
+CL_INLINE const cl_RA CL_INLINE_DECL(signum) (const cl_RA& x)
{
if (minusp(x)) { return -1; } // x<0 -> -1
elif (zerop(x)) { return 0; } // x=0 -> 0
#include "cln/rational.h"
#include "cln/rational_io.h"
+#define zerop zerop_inline
#include "cl_RA.h"
+#undef zerop
namespace cln {
return _cl_ring_element(R, (cl_RA)0);
}
-static bool RA_zerop (cl_heap_ring* R, const _cl_ring_element& x)
+static bool CL_FLATTEN RA_zerop (cl_heap_ring* R, const _cl_ring_element& x)
{
unused R;
- return zerop(The(cl_RA)(x));
+ return zerop_inline(The(cl_RA)(x));
}
static const _cl_ring_element RA_plus (cl_heap_ring* R, const _cl_ring_element& x, const _cl_ring_element& y)
namespace cln {
-MAYBE_INLINE
-const cl_R sqrt (const cl_RA& x)
+CL_INLINE const cl_R CL_INLINE_DECL(sqrt) (const cl_RA& x)
{
var cl_RA w;
if (sqrtp(x,&w)) // auf Quadrat testen
namespace cln {
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_RA_sqrt.cc"
const cl_R sqrt (const cl_R& x)
namespace cln {
-MAYBE_INLINE
-const cl_F cl_float (const cl_R& x)
+CL_INLINE const cl_F CL_INLINE_DECL(cl_float) (const cl_R& x)
{
if (rationalp(x)) {
DeclareType(cl_RA,x);
// Implementation.
#include "cl_R.h"
+#define minusp minusp_inline
#include "cl_RA.h"
#include "cl_I.h"
+#undef minusp
#include "cl_F.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_SF_minusp.cc"
#include "cl_FF_minusp.cc"
#include "cl_DF_minusp.cc"
namespace cln {
-bool minusp (const cl_R& x)
+bool CL_FLATTEN minusp (const cl_R& x)
#if 0
GEN_R_OP1_2(x, minusp, return)
#else // fully inlined, faster
-GEN_R_OP1_7(x, minusp, return)
+GEN_R_OP1_7(x, minusp_inline, return)
#endif
} // namespace cln
// Implementation.
+#define zerop zerop_inline
#include "cl_R.h"
#include "cl_RA.h"
#include "cl_I.h"
+#undef zerop
#include "cl_F.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+#include "cl_inline.h"
#include "cl_SF_zerop.cc"
#include "cl_FF_zerop.cc"
#include "cl_DF_zerop.cc"
namespace cln {
-bool zerop (const cl_R& x)
+bool CL_FLATTEN zerop (const cl_R& x)
#if 0
GEN_R_OP1_2(x, zerop, return)
#else // fully inlined, faster
-GEN_R_OP1_7(x, zerop, return)
+GEN_R_OP1_7(x, zerop_inline, return)
#endif
} // namespace cln
#include "cl_I.h"
#include "cl_F.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
-#include "cl_I_eqhashcode.cc"
+#include "cl_inline.h"
#include "cl_SF_eqhashcode.cc"
#include "cl_FF_eqhashcode.cc"
#include "cl_DF_eqhashcode.cc"
#include "cl_LF_eqhashcode.cc"
+#include "cl_inline2.h"
+#include "cl_RA_eqhashcode.cc"
namespace cln {
-uint32 equal_hashcode (const cl_R& x)
-GEN_R_OP1_7(x, equal_hashcode, return)
+uint32 CL_FLATTEN equal_hashcode (const cl_R& x)
+GEN_R_OP1_7(x, equal_hashcode_inline, return)
} // namespace cln
#include "cl_R.h"
-#undef MAYBE_INLINE
-#define MAYBE_INLINE inline
+/* use inline versions of zerop */
+#include "cl_inline.h"
#include "cl_I_signum.cc"
#include "cl_RA_signum.cc"
-#undef MAYBE_INLINE2
-#define MAYBE_INLINE2 inline
+/* use inline versions of signum */
+#include "cl_inline2.h"
#include "cl_SF_signum.cc"
#include "cl_FF_signum.cc"
#include "cl_DF_signum.cc"
namespace cln {
-const cl_R signum (const cl_R& x)
-GEN_R_OP1_7(x, signum, return)
+const cl_R CL_FLATTEN signum (const cl_R& x)
+GEN_R_OP1_7(x, signum_inline, return)
} // namespace cln
namespace cln {
-MAYBE_INLINE
-const cl_R tan (const cl_R& x)
+CL_INLINE const cl_R CL_INLINE_DECL(tan) (const cl_R& x)
{
// Methode:
// (/ (sin x) (cos x))
namespace cln {
-MAYBE_INLINE
-const cl_R tanh (const cl_R& x)
+CL_INLINE const cl_R CL_INLINE_DECL(tanh) (const cl_R& x)
{
// Methode:
// (/ (sinh x) (cosh x))