From ce250e91fb8d16bc6b35be0add1896fc64f31ec1 Mon Sep 17 00:00:00 2001 From: Richard Kreckel Date: Fri, 18 Jan 2008 22:59:06 +0000 Subject: [PATCH] Fix linking problems on some platforms caused by inline/non-inline versions of same functions (obsoletes MAYBE_INLINE) [by Alexei Sheplyakov]. --- ChangeLog | 128 ++++++++++++++++++ src/base/cl_inline.h | 8 ++ src/base/cl_inline2.h | 8 ++ src/base/cl_macros.h | 5 +- src/base/cl_maybe_inline.h | 131 +++++++++++++++++++ src/base/string/cl_st_concat1.cc | 5 +- src/base/string/cl_st_concat2.cc | 5 +- src/base/string/cl_st_concat3.cc | 5 +- src/base/string/cl_st_make0.cc | 1 - src/complex/algebraic/cl_C_abs.cc | 5 +- src/complex/algebraic/cl_C_abs_aux.cc | 3 +- src/complex/algebraic/cl_C_signum.cc | 7 +- src/complex/algebraic/cl_DF_hypot.cc | 8 +- src/complex/algebraic/cl_FF_hypot.cc | 8 +- src/complex/algebraic/cl_LF_hypot.cc | 8 +- src/complex/algebraic/cl_SF_hypot.cc | 8 +- src/complex/transcendental/cl_C_acosh.cc | 6 +- src/complex/transcendental/cl_C_asinh_aux.cc | 10 +- src/complex/transcendental/cl_C_atanh_aux.cc | 10 +- src/float/dfloat/division/cl_DF_fceil.cc | 8 +- src/float/dfloat/elem/cl_DF_div.cc | 7 +- src/float/dfloat/elem/cl_DF_ffloor.cc | 7 +- src/float/dfloat/elem/cl_DF_minusp.cc | 3 +- src/float/dfloat/elem/cl_DF_mul.cc | 5 +- src/float/dfloat/elem/cl_DF_plusp.cc | 10 +- src/float/dfloat/elem/cl_DF_zerop.cc | 3 +- src/float/dfloat/misc/cl_DF_abs.cc | 5 +- src/float/dfloat/misc/cl_DF_digits.cc | 3 +- src/float/dfloat/misc/cl_DF_eqhashcode.cc | 3 +- src/float/dfloat/misc/cl_DF_exponent.cc | 3 +- src/float/dfloat/misc/cl_DF_idecode.cc | 3 +- src/float/dfloat/misc/cl_DF_precision.cc | 8 +- src/float/dfloat/misc/cl_DF_sign.cc | 8 +- src/float/dfloat/misc/cl_DF_signum.cc | 10 +- src/float/elem/cl_F_minusp.cc | 13 +- src/float/elem/cl_F_plusp.cc | 13 +- src/float/elem/cl_F_zerop.cc | 13 +- src/float/ffloat/division/cl_FF_fceil.cc | 7 +- src/float/ffloat/elem/cl_FF_div.cc | 7 +- src/float/ffloat/elem/cl_FF_ffloor.cc | 7 +- src/float/ffloat/elem/cl_FF_minusp.cc | 3 +- src/float/ffloat/elem/cl_FF_mul.cc | 5 +- src/float/ffloat/elem/cl_FF_plusp.cc | 10 +- src/float/ffloat/elem/cl_FF_zerop.cc | 3 +- src/float/ffloat/misc/cl_FF_abs.cc | 7 +- src/float/ffloat/misc/cl_FF_digits.cc | 3 +- src/float/ffloat/misc/cl_FF_eqhashcode.cc | 3 +- src/float/ffloat/misc/cl_FF_exponent.cc | 3 +- src/float/ffloat/misc/cl_FF_idecode.cc | 6 +- src/float/ffloat/misc/cl_FF_precision.cc | 8 +- src/float/ffloat/misc/cl_FF_sign.cc | 8 +- src/float/ffloat/misc/cl_FF_signum.cc | 10 +- src/float/lfloat/division/cl_LF_fceil.cc | 7 +- src/float/lfloat/elem/cl_LF_compare.cc | 9 +- src/float/lfloat/elem/cl_LF_ffloor.cc | 7 +- src/float/lfloat/elem/cl_LF_minusp.cc | 3 +- src/float/lfloat/elem/cl_LF_plusp.cc | 10 +- src/float/lfloat/elem/cl_LF_to_I.cc | 5 +- src/float/lfloat/elem/cl_LF_zerop.cc | 3 +- src/float/lfloat/misc/cl_LF_abs.cc | 7 +- src/float/lfloat/misc/cl_LF_digits.cc | 3 +- src/float/lfloat/misc/cl_LF_eqhashcode.cc | 3 +- src/float/lfloat/misc/cl_LF_exponent.cc | 3 +- src/float/lfloat/misc/cl_LF_idecode.cc | 3 +- src/float/lfloat/misc/cl_LF_precision.cc | 8 +- src/float/lfloat/misc/cl_LF_shortenrel.cc | 14 +- src/float/lfloat/misc/cl_LF_shortenwith.cc | 12 +- src/float/lfloat/misc/cl_LF_sign.cc | 6 +- src/float/lfloat/misc/cl_LF_signum.cc | 8 +- src/float/misc/cl_F_abs.cc | 13 +- src/float/misc/cl_F_digits.cc | 11 +- src/float/misc/cl_F_eqhashcode.cc | 13 +- src/float/misc/cl_F_exponent.cc | 13 +- src/float/misc/cl_F_idecode.cc | 13 +- src/float/misc/cl_F_precision.cc | 5 +- src/float/misc/cl_F_sign.cc | 13 +- src/float/misc/cl_F_signum.cc | 14 +- src/float/sfloat/division/cl_SF_fceil.cc | 8 +- src/float/sfloat/division/cl_SF_ffloor.cc | 8 +- src/float/sfloat/elem/cl_SF_compare.cc | 11 +- src/float/sfloat/elem/cl_SF_minus.cc | 6 +- src/float/sfloat/elem/cl_SF_minusp.cc | 3 +- src/float/sfloat/elem/cl_SF_plusp.cc | 11 +- src/float/sfloat/elem/cl_SF_uminus.cc | 5 +- src/float/sfloat/elem/cl_SF_zerop.cc | 3 +- src/float/sfloat/misc/cl_SF_abs.cc | 7 +- src/float/sfloat/misc/cl_SF_digits.cc | 3 +- src/float/sfloat/misc/cl_SF_eqhashcode.cc | 3 +- src/float/sfloat/misc/cl_SF_exponent.cc | 3 +- src/float/sfloat/misc/cl_SF_idecode.cc | 3 +- src/float/sfloat/misc/cl_SF_precision.cc | 8 +- src/float/sfloat/misc/cl_SF_sign.cc | 6 +- src/float/sfloat/misc/cl_SF_signum.cc | 11 +- src/float/transcendental/cl_F_atanhx.cc | 11 +- src/float/transcendental/cl_F_atanx.cc | 17 ++- src/float/transcendental/cl_F_exp.cc | 5 +- src/float/transcendental/cl_F_expx.cc | 7 +- src/float/transcendental/cl_F_lnx.cc | 9 +- src/float/transcendental/cl_F_sinhx.cc | 7 +- src/float/transcendental/cl_F_sinx.cc | 7 +- src/float/transcendental/cl_F_tan.cc | 3 +- src/float/transcendental/cl_F_tanh.cc | 3 +- src/integer/conv/cl_I_from_DS.cc | 8 +- src/integer/conv/cl_I_from_NDS.cc | 3 +- src/integer/conv/cl_I_from_NUDS.cc | 8 +- src/integer/conv/cl_I_from_UDS.cc | 8 +- src/integer/misc/cl_I_eqhashcode.cc | 7 +- src/integer/misc/cl_I_signum.cc | 3 +- src/integer/ring/cl_I_ring.cc | 6 +- src/rational/elem/cl_RA_minusp.cc | 6 +- src/rational/misc/Makeflags | 2 +- src/rational/misc/cl_RA_eqhashcode.cc | 10 +- src/rational/misc/cl_RA_signum.cc | 4 +- src/rational/ring/cl_RA_ring.cc | 6 +- src/real/algebraic/cl_RA_sqrt.cc | 3 +- src/real/algebraic/cl_R_sqrt.cc | 3 +- src/real/conv/cl_F_from_R_def.cc | 3 +- src/real/elem/cl_R_minusp.cc | 9 +- src/real/elem/cl_R_zerop.cc | 9 +- src/real/misc/cl_R_eqhashcode.cc | 10 +- src/real/misc/cl_R_signum.cc | 12 +- src/real/transcendental/cl_R_tan.cc | 3 +- src/real/transcendental/cl_R_tanh.cc | 3 +- 123 files changed, 621 insertions(+), 463 deletions(-) create mode 100644 src/base/cl_inline.h create mode 100644 src/base/cl_inline2.h create mode 100644 src/base/cl_maybe_inline.h diff --git a/ChangeLog b/ChangeLog index a2cf306..7637fbf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,131 @@ +2007-01-18 Alexei Sheplyakov + + 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 * doc/cln.texi: Renamed from doc/cln.tex. Add @node lines and @menu diff --git a/src/base/cl_inline.h b/src/base/cl_inline.h new file mode 100644 index 0000000..ffe5044 --- /dev/null +++ b/src/base/cl_inline.h @@ -0,0 +1,8 @@ +/* + * 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 diff --git a/src/base/cl_inline2.h b/src/base/cl_inline2.h new file mode 100644 index 0000000..c00bf57 --- /dev/null +++ b/src/base/cl_inline2.h @@ -0,0 +1,8 @@ +/* + * 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 diff --git a/src/base/cl_macros.h b/src/base/cl_macros.h index a041e77..60a39e9 100644 --- a/src/base/cl_macros.h +++ b/src/base/cl_macros.h @@ -265,9 +265,6 @@ public: \ // 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 */ diff --git a/src/base/cl_maybe_inline.h b/src/base/cl_maybe_inline.h new file mode 100644 index 0000000..316cc5b --- /dev/null +++ b/src/base/cl_maybe_inline.h @@ -0,0 +1,131 @@ +// 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 */ diff --git a/src/base/string/cl_st_concat1.cc b/src/base/string/cl_st_concat1.cc index 44d0e6d..ff3c19a 100644 --- a/src/base/string/cl_st_concat1.cc +++ b/src/base/string/cl_st_concat1.cc @@ -8,10 +8,7 @@ // Implementation. - -#undef MAYBE_INLINE -#define MAYBE_INLINE inline -#include "cl_st_make0.cc" +#include "cl_st_make0.h" namespace cln { diff --git a/src/base/string/cl_st_concat2.cc b/src/base/string/cl_st_concat2.cc index e14fdbe..165ea28 100644 --- a/src/base/string/cl_st_concat2.cc +++ b/src/base/string/cl_st_concat2.cc @@ -8,10 +8,7 @@ // Implementation. - -#undef MAYBE_INLINE -#define MAYBE_INLINE inline -#include "cl_st_make0.cc" +#include "cl_st_make0.h" namespace cln { diff --git a/src/base/string/cl_st_concat3.cc b/src/base/string/cl_st_concat3.cc index a27a753..262b481 100644 --- a/src/base/string/cl_st_concat3.cc +++ b/src/base/string/cl_st_concat3.cc @@ -8,10 +8,7 @@ // Implementation. - -#undef MAYBE_INLINE -#define MAYBE_INLINE inline -#include "cl_st_make0.cc" +#include "cl_st_make0.h" namespace cln { diff --git a/src/base/string/cl_st_make0.cc b/src/base/string/cl_st_make0.cc index 1628d42..8b29342 100644 --- a/src/base/string/cl_st_make0.cc +++ b/src/base/string/cl_st_make0.cc @@ -14,7 +14,6 @@ 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)); diff --git a/src/complex/algebraic/cl_C_abs.cc b/src/complex/algebraic/cl_C_abs.cc index c7c57f5..0e12551 100644 --- a/src/complex/algebraic/cl_C_abs.cc +++ b/src/complex/algebraic/cl_C_abs.cc @@ -12,8 +12,7 @@ #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 { @@ -28,7 +27,7 @@ const cl_R abs (const cl_N& x) return abs(x); } else { DeclareType(cl_C,x); - return abs(x); + return abs_inline(x); } } diff --git a/src/complex/algebraic/cl_C_abs_aux.cc b/src/complex/algebraic/cl_C_abs_aux.cc index adb83ad..8ea3d6f 100644 --- a/src/complex/algebraic/cl_C_abs_aux.cc +++ b/src/complex/algebraic/cl_C_abs_aux.cc @@ -13,8 +13,7 @@ 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); diff --git a/src/complex/algebraic/cl_C_signum.cc b/src/complex/algebraic/cl_C_signum.cc index d059f32..357d7db 100644 --- a/src/complex/algebraic/cl_C_signum.cc +++ b/src/complex/algebraic/cl_C_signum.cc @@ -12,13 +12,12 @@ #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. @@ -31,7 +30,7 @@ const cl_N signum (const cl_N& x) if (zerop(x)) return x; else - return x / abs(x); + return x / abs_inline(x); } } diff --git a/src/complex/algebraic/cl_DF_hypot.cc b/src/complex/algebraic/cl_DF_hypot.cc index 2c56951..09f0db5 100644 --- a/src/complex/algebraic/cl_DF_hypot.cc +++ b/src/complex/algebraic/cl_DF_hypot.cc @@ -12,8 +12,8 @@ #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 { @@ -37,7 +37,7 @@ const cl_DF cl_hypot (const cl_DF& a, const cl_DF& b) 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); } { @@ -45,7 +45,7 @@ const cl_DF cl_hypot (const cl_DF& a, const cl_DF& b) 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). diff --git a/src/complex/algebraic/cl_FF_hypot.cc b/src/complex/algebraic/cl_FF_hypot.cc index c6224ef..e66366c 100644 --- a/src/complex/algebraic/cl_FF_hypot.cc +++ b/src/complex/algebraic/cl_FF_hypot.cc @@ -12,8 +12,8 @@ #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 { @@ -37,7 +37,7 @@ const cl_FF cl_hypot (const cl_FF& a, const cl_FF& b) 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); } { @@ -45,7 +45,7 @@ const cl_FF cl_hypot (const cl_FF& a, const cl_FF& b) 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). diff --git a/src/complex/algebraic/cl_LF_hypot.cc b/src/complex/algebraic/cl_LF_hypot.cc index 1273488..4959e11 100644 --- a/src/complex/algebraic/cl_LF_hypot.cc +++ b/src/complex/algebraic/cl_LF_hypot.cc @@ -13,8 +13,8 @@ #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 { @@ -53,7 +53,7 @@ const cl_LF cl_hypot (const cl_LF& a, const cl_LF& b) 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); } { @@ -61,7 +61,7 @@ const cl_LF cl_hypot (const cl_LF& a, const cl_LF& b) 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). diff --git a/src/complex/algebraic/cl_SF_hypot.cc b/src/complex/algebraic/cl_SF_hypot.cc index bcf742f..88c3df7 100644 --- a/src/complex/algebraic/cl_SF_hypot.cc +++ b/src/complex/algebraic/cl_SF_hypot.cc @@ -12,8 +12,8 @@ #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 { @@ -37,7 +37,7 @@ const cl_SF cl_hypot (const cl_SF& a, const cl_SF& b) 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); } { @@ -45,7 +45,7 @@ const cl_SF cl_hypot (const cl_SF& a, const cl_SF& b) 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). diff --git a/src/complex/transcendental/cl_C_acosh.cc b/src/complex/transcendental/cl_C_acosh.cc index 2fb952f..32c204d 100644 --- a/src/complex/transcendental/cl_C_acosh.cc +++ b/src/complex/transcendental/cl_C_acosh.cc @@ -16,8 +16,8 @@ #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 { @@ -78,7 +78,7 @@ const cl_N acosh (const cl_N& z) } 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 diff --git a/src/complex/transcendental/cl_C_asinh_aux.cc b/src/complex/transcendental/cl_C_asinh_aux.cc index 623ab30..ffc43ef 100644 --- a/src/complex/transcendental/cl_C_asinh_aux.cc +++ b/src/complex/transcendental/cl_C_asinh_aux.cc @@ -16,8 +16,8 @@ #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 { @@ -89,7 +89,7 @@ const cl_C_R asinh (const cl_R& x, const cl_R& y) 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 @@ -99,7 +99,7 @@ const cl_C_R asinh (const cl_R& x, const cl_R& y) 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); @@ -135,7 +135,7 @@ const cl_C_R asinh (const cl_R& x, const cl_R& 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)) diff --git a/src/complex/transcendental/cl_C_atanh_aux.cc b/src/complex/transcendental/cl_C_atanh_aux.cc index 2435495..92d58f0 100644 --- a/src/complex/transcendental/cl_C_atanh_aux.cc +++ b/src/complex/transcendental/cl_C_atanh_aux.cc @@ -14,15 +14,15 @@ #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: @@ -56,7 +56,7 @@ const cl_C_R atanh (const cl_R& x, const cl_R& y) // 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)) @@ -92,7 +92,7 @@ const cl_C_R atanh (const cl_R& x, const cl_R& y) 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); diff --git a/src/float/dfloat/division/cl_DF_fceil.cc b/src/float/dfloat/division/cl_DF_fceil.cc index dfd577b..3e6116d 100644 --- a/src/float/dfloat/division/cl_DF_fceil.cc +++ b/src/float/dfloat/division/cl_DF_fceil.cc @@ -11,15 +11,15 @@ #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); diff --git a/src/float/dfloat/elem/cl_DF_div.cc b/src/float/dfloat/elem/cl_DF_div.cc index e1da684..c8211d4 100644 --- a/src/float/dfloat/elem/cl_DF_div.cc +++ b/src/float/dfloat/elem/cl_DF_div.cc @@ -16,8 +16,7 @@ #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 { @@ -47,9 +46,9 @@ const cl_DF operator/ (const cl_DF& x1, const cl_DF& x2) #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 diff --git a/src/float/dfloat/elem/cl_DF_ffloor.cc b/src/float/dfloat/elem/cl_DF_ffloor.cc index 18a508c..6dc3c08 100644 --- a/src/float/dfloat/elem/cl_DF_ffloor.cc +++ b/src/float/dfloat/elem/cl_DF_ffloor.cc @@ -11,15 +11,14 @@ #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); diff --git a/src/float/dfloat/elem/cl_DF_minusp.cc b/src/float/dfloat/elem/cl_DF_minusp.cc index 77f4ffa..0eff54e 100644 --- a/src/float/dfloat/elem/cl_DF_minusp.cc +++ b/src/float/dfloat/elem/cl_DF_minusp.cc @@ -13,8 +13,7 @@ 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; diff --git a/src/float/dfloat/elem/cl_DF_mul.cc b/src/float/dfloat/elem/cl_DF_mul.cc index efe1ecb..762b779 100644 --- a/src/float/dfloat/elem/cl_DF_mul.cc +++ b/src/float/dfloat/elem/cl_DF_mul.cc @@ -15,8 +15,7 @@ #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 { @@ -43,7 +42,7 @@ const cl_DF operator* (const cl_DF& x1, const cl_DF& x2) #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 ); diff --git a/src/float/dfloat/elem/cl_DF_plusp.cc b/src/float/dfloat/elem/cl_DF_plusp.cc index 78238ac..aab9369 100644 --- a/src/float/dfloat/elem/cl_DF_plusp.cc +++ b/src/float/dfloat/elem/cl_DF_plusp.cc @@ -11,19 +11,17 @@ #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. diff --git a/src/float/dfloat/elem/cl_DF_zerop.cc b/src/float/dfloat/elem/cl_DF_zerop.cc index 37bf62a..8af6b73 100644 --- a/src/float/dfloat/elem/cl_DF_zerop.cc +++ b/src/float/dfloat/elem/cl_DF_zerop.cc @@ -13,8 +13,7 @@ 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; diff --git a/src/float/dfloat/misc/cl_DF_abs.cc b/src/float/dfloat/misc/cl_DF_abs.cc index f29d596..8a2f725 100644 --- a/src/float/dfloat/misc/cl_DF_abs.cc +++ b/src/float/dfloat/misc/cl_DF_abs.cc @@ -9,13 +9,12 @@ // 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; diff --git a/src/float/dfloat/misc/cl_DF_digits.cc b/src/float/dfloat/misc/cl_DF_digits.cc index 97b9fed..a8457f3 100644 --- a/src/float/dfloat/misc/cl_DF_digits.cc +++ b/src/float/dfloat/misc/cl_DF_digits.cc @@ -13,8 +13,7 @@ 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 diff --git a/src/float/dfloat/misc/cl_DF_eqhashcode.cc b/src/float/dfloat/misc/cl_DF_eqhashcode.cc index c3907be..cef05b9 100644 --- a/src/float/dfloat/misc/cl_DF_eqhashcode.cc +++ b/src/float/dfloat/misc/cl_DF_eqhashcode.cc @@ -14,8 +14,7 @@ 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; diff --git a/src/float/dfloat/misc/cl_DF_exponent.cc b/src/float/dfloat/misc/cl_DF_exponent.cc index c4058e3..677bd19 100644 --- a/src/float/dfloat/misc/cl_DF_exponent.cc +++ b/src/float/dfloat/misc/cl_DF_exponent.cc @@ -13,8 +13,7 @@ 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; } diff --git a/src/float/dfloat/misc/cl_DF_idecode.cc b/src/float/dfloat/misc/cl_DF_idecode.cc index b69fc03..44b6b21 100644 --- a/src/float/dfloat/misc/cl_DF_idecode.cc +++ b/src/float/dfloat/misc/cl_DF_idecode.cc @@ -14,8 +14,7 @@ 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; diff --git a/src/float/dfloat/misc/cl_DF_precision.cc b/src/float/dfloat/misc/cl_DF_precision.cc index 0e6b289..46178a8 100644 --- a/src/float/dfloat/misc/cl_DF_precision.cc +++ b/src/float/dfloat/misc/cl_DF_precision.cc @@ -11,16 +11,14 @@ #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 } diff --git a/src/float/dfloat/misc/cl_DF_sign.cc b/src/float/dfloat/misc/cl_DF_sign.cc index 42847c4..5e2a13d 100644 --- a/src/float/dfloat/misc/cl_DF_sign.cc +++ b/src/float/dfloat/misc/cl_DF_sign.cc @@ -11,17 +11,15 @@ #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 diff --git a/src/float/dfloat/misc/cl_DF_signum.cc b/src/float/dfloat/misc/cl_DF_signum.cc index 3101a93..1850ccb 100644 --- a/src/float/dfloat/misc/cl_DF_signum.cc +++ b/src/float/dfloat/misc/cl_DF_signum.cc @@ -11,18 +11,16 @@ #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 } diff --git a/src/float/elem/cl_F_minusp.cc b/src/float/elem/cl_F_minusp.cc index 09b0cb7..c405f66 100644 --- a/src/float/elem/cl_F_minusp.cc +++ b/src/float/elem/cl_F_minusp.cc @@ -11,8 +11,7 @@ #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" @@ -20,13 +19,13 @@ 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); ); } diff --git a/src/float/elem/cl_F_plusp.cc b/src/float/elem/cl_F_plusp.cc index d76d2a5..23a4d92 100644 --- a/src/float/elem/cl_F_plusp.cc +++ b/src/float/elem/cl_F_plusp.cc @@ -11,8 +11,7 @@ #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" @@ -20,13 +19,13 @@ 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); ); } diff --git a/src/float/elem/cl_F_zerop.cc b/src/float/elem/cl_F_zerop.cc index 1cf5e22..0e21d28 100644 --- a/src/float/elem/cl_F_zerop.cc +++ b/src/float/elem/cl_F_zerop.cc @@ -11,8 +11,7 @@ #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" @@ -20,13 +19,13 @@ 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); ); } diff --git a/src/float/ffloat/division/cl_FF_fceil.cc b/src/float/ffloat/division/cl_FF_fceil.cc index c6a6667..97453d7 100644 --- a/src/float/ffloat/division/cl_FF_fceil.cc +++ b/src/float/ffloat/division/cl_FF_fceil.cc @@ -11,15 +11,14 @@ #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); diff --git a/src/float/ffloat/elem/cl_FF_div.cc b/src/float/ffloat/elem/cl_FF_div.cc index 1544eb7..2d90939 100644 --- a/src/float/ffloat/elem/cl_FF_div.cc +++ b/src/float/ffloat/elem/cl_FF_div.cc @@ -15,8 +15,7 @@ #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 { @@ -46,9 +45,9 @@ const cl_FF operator/ (const cl_FF& x1, const cl_FF& x2) #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 diff --git a/src/float/ffloat/elem/cl_FF_ffloor.cc b/src/float/ffloat/elem/cl_FF_ffloor.cc index a6ac0ba..5468664 100644 --- a/src/float/ffloat/elem/cl_FF_ffloor.cc +++ b/src/float/ffloat/elem/cl_FF_ffloor.cc @@ -11,15 +11,14 @@ #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); diff --git a/src/float/ffloat/elem/cl_FF_minusp.cc b/src/float/ffloat/elem/cl_FF_minusp.cc index 2f34de2..db9c0fd 100644 --- a/src/float/ffloat/elem/cl_FF_minusp.cc +++ b/src/float/ffloat/elem/cl_FF_minusp.cc @@ -13,8 +13,7 @@ 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; } diff --git a/src/float/ffloat/elem/cl_FF_mul.cc b/src/float/ffloat/elem/cl_FF_mul.cc index 8f8d14d..c258c71 100644 --- a/src/float/ffloat/elem/cl_FF_mul.cc +++ b/src/float/ffloat/elem/cl_FF_mul.cc @@ -14,8 +14,7 @@ #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 { @@ -42,7 +41,7 @@ const cl_FF operator* (const cl_FF& x1, const cl_FF& x2) #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 ); diff --git a/src/float/ffloat/elem/cl_FF_plusp.cc b/src/float/ffloat/elem/cl_FF_plusp.cc index 46d6a49..dff8cb7 100644 --- a/src/float/ffloat/elem/cl_FF_plusp.cc +++ b/src/float/ffloat/elem/cl_FF_plusp.cc @@ -11,19 +11,17 @@ #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. diff --git a/src/float/ffloat/elem/cl_FF_zerop.cc b/src/float/ffloat/elem/cl_FF_zerop.cc index 1e64d07..83b8837 100644 --- a/src/float/ffloat/elem/cl_FF_zerop.cc +++ b/src/float/ffloat/elem/cl_FF_zerop.cc @@ -13,8 +13,7 @@ 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; } diff --git a/src/float/ffloat/misc/cl_FF_abs.cc b/src/float/ffloat/misc/cl_FF_abs.cc index cb774c0..3b00afe 100644 --- a/src/float/ffloat/misc/cl_FF_abs.cc +++ b/src/float/ffloat/misc/cl_FF_abs.cc @@ -9,16 +9,15 @@ // 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 diff --git a/src/float/ffloat/misc/cl_FF_digits.cc b/src/float/ffloat/misc/cl_FF_digits.cc index 4d209ef..de7dff3 100644 --- a/src/float/ffloat/misc/cl_FF_digits.cc +++ b/src/float/ffloat/misc/cl_FF_digits.cc @@ -13,8 +13,7 @@ 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 diff --git a/src/float/ffloat/misc/cl_FF_eqhashcode.cc b/src/float/ffloat/misc/cl_FF_eqhashcode.cc index 3abbd99..dd6cf80 100644 --- a/src/float/ffloat/misc/cl_FF_eqhashcode.cc +++ b/src/float/ffloat/misc/cl_FF_eqhashcode.cc @@ -14,8 +14,7 @@ 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; diff --git a/src/float/ffloat/misc/cl_FF_exponent.cc b/src/float/ffloat/misc/cl_FF_exponent.cc index f9f6b67..4f60cea 100644 --- a/src/float/ffloat/misc/cl_FF_exponent.cc +++ b/src/float/ffloat/misc/cl_FF_exponent.cc @@ -13,8 +13,7 @@ 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; } diff --git a/src/float/ffloat/misc/cl_FF_idecode.cc b/src/float/ffloat/misc/cl_FF_idecode.cc index f4f7307..de76bea 100644 --- a/src/float/ffloat/misc/cl_FF_idecode.cc +++ b/src/float/ffloat/misc/cl_FF_idecode.cc @@ -21,8 +21,7 @@ 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), @@ -37,8 +36,7 @@ const cl_idecoded_float integer_decode_float (const cl_FF& x) 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; diff --git a/src/float/ffloat/misc/cl_FF_precision.cc b/src/float/ffloat/misc/cl_FF_precision.cc index e60defc..d3cc653 100644 --- a/src/float/ffloat/misc/cl_FF_precision.cc +++ b/src/float/ffloat/misc/cl_FF_precision.cc @@ -11,16 +11,14 @@ #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 } diff --git a/src/float/ffloat/misc/cl_FF_sign.cc b/src/float/ffloat/misc/cl_FF_sign.cc index 583b7fd..5f58a36 100644 --- a/src/float/ffloat/misc/cl_FF_sign.cc +++ b/src/float/ffloat/misc/cl_FF_sign.cc @@ -11,17 +11,15 @@ #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 diff --git a/src/float/ffloat/misc/cl_FF_signum.cc b/src/float/ffloat/misc/cl_FF_signum.cc index 69cb60e..92b2071 100644 --- a/src/float/ffloat/misc/cl_FF_signum.cc +++ b/src/float/ffloat/misc/cl_FF_signum.cc @@ -11,18 +11,16 @@ #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 } diff --git a/src/float/lfloat/division/cl_LF_fceil.cc b/src/float/lfloat/division/cl_LF_fceil.cc index 7e869f1..bddc210 100644 --- a/src/float/lfloat/division/cl_LF_fceil.cc +++ b/src/float/lfloat/division/cl_LF_fceil.cc @@ -11,15 +11,14 @@ #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); diff --git a/src/float/lfloat/elem/cl_LF_compare.cc b/src/float/lfloat/elem/cl_LF_compare.cc index 79e4ba5..5e3b621 100644 --- a/src/float/lfloat/elem/cl_LF_compare.cc +++ b/src/float/lfloat/elem/cl_LF_compare.cc @@ -12,8 +12,7 @@ #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 { @@ -27,9 +26,9 @@ cl_signean compare (const cl_LF& x, const cl_LF& y) // 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; @@ -66,7 +65,7 @@ cl_signean compare (const cl_LF& x, const cl_LF& y) { return signean_minus; } // x=0 { return signean_plus; } // x>y else diff --git a/src/float/lfloat/elem/cl_LF_ffloor.cc b/src/float/lfloat/elem/cl_LF_ffloor.cc index ffc4cbf..0aaa639 100644 --- a/src/float/lfloat/elem/cl_LF_ffloor.cc +++ b/src/float/lfloat/elem/cl_LF_ffloor.cc @@ -11,15 +11,14 @@ #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); diff --git a/src/float/lfloat/elem/cl_LF_minusp.cc b/src/float/lfloat/elem/cl_LF_minusp.cc index 55df504..3fd4ef8 100644 --- a/src/float/lfloat/elem/cl_LF_minusp.cc +++ b/src/float/lfloat/elem/cl_LF_minusp.cc @@ -13,8 +13,7 @@ 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; } diff --git a/src/float/lfloat/elem/cl_LF_plusp.cc b/src/float/lfloat/elem/cl_LF_plusp.cc index 6c02971..d3a1100 100644 --- a/src/float/lfloat/elem/cl_LF_plusp.cc +++ b/src/float/lfloat/elem/cl_LF_plusp.cc @@ -12,19 +12,17 @@ #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. diff --git a/src/float/lfloat/elem/cl_LF_to_I.cc b/src/float/lfloat/elem/cl_LF_to_I.cc index 35eccc1..3abe9b1 100644 --- a/src/float/lfloat/elem/cl_LF_to_I.cc +++ b/src/float/lfloat/elem/cl_LF_to_I.cc @@ -13,8 +13,7 @@ #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 { @@ -36,7 +35,7 @@ const cl_I cl_LF_to_I (const cl_LF& x) 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. diff --git a/src/float/lfloat/elem/cl_LF_zerop.cc b/src/float/lfloat/elem/cl_LF_zerop.cc index 35135c4..af83bed 100644 --- a/src/float/lfloat/elem/cl_LF_zerop.cc +++ b/src/float/lfloat/elem/cl_LF_zerop.cc @@ -13,8 +13,7 @@ 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; } diff --git a/src/float/lfloat/misc/cl_LF_abs.cc b/src/float/lfloat/misc/cl_LF_abs.cc index be8cb56..b46bdad 100644 --- a/src/float/lfloat/misc/cl_LF_abs.cc +++ b/src/float/lfloat/misc/cl_LF_abs.cc @@ -9,16 +9,15 @@ // 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 diff --git a/src/float/lfloat/misc/cl_LF_digits.cc b/src/float/lfloat/misc/cl_LF_digits.cc index d1e323a..fd9edef 100644 --- a/src/float/lfloat/misc/cl_LF_digits.cc +++ b/src/float/lfloat/misc/cl_LF_digits.cc @@ -13,8 +13,7 @@ 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); } diff --git a/src/float/lfloat/misc/cl_LF_eqhashcode.cc b/src/float/lfloat/misc/cl_LF_eqhashcode.cc index 0181c96..509daf7 100644 --- a/src/float/lfloat/misc/cl_LF_eqhashcode.cc +++ b/src/float/lfloat/misc/cl_LF_eqhashcode.cc @@ -15,8 +15,7 @@ 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; diff --git a/src/float/lfloat/misc/cl_LF_exponent.cc b/src/float/lfloat/misc/cl_LF_exponent.cc index d6f7346..e80c72e 100644 --- a/src/float/lfloat/misc/cl_LF_exponent.cc +++ b/src/float/lfloat/misc/cl_LF_exponent.cc @@ -13,8 +13,7 @@ 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; } diff --git a/src/float/lfloat/misc/cl_LF_idecode.cc b/src/float/lfloat/misc/cl_LF_idecode.cc index 8d547d3..5e490cf 100644 --- a/src/float/lfloat/misc/cl_LF_idecode.cc +++ b/src/float/lfloat/misc/cl_LF_idecode.cc @@ -15,8 +15,7 @@ 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; diff --git a/src/float/lfloat/misc/cl_LF_precision.cc b/src/float/lfloat/misc/cl_LF_precision.cc index 90c0247..66798a4 100644 --- a/src/float/lfloat/misc/cl_LF_precision.cc +++ b/src/float/lfloat/misc/cl_LF_precision.cc @@ -11,16 +11,14 @@ #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); } diff --git a/src/float/lfloat/misc/cl_LF_shortenrel.cc b/src/float/lfloat/misc/cl_LF_shortenrel.cc index dedf5ac..274bf5b 100644 --- a/src/float/lfloat/misc/cl_LF_shortenrel.cc +++ b/src/float/lfloat/misc/cl_LF_shortenrel.cc @@ -11,11 +11,9 @@ #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 { @@ -28,12 +26,12 @@ const cl_LF cl_LF_shortenrelative (const cl_LF& x, const cl_LF& y) // 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; diff --git a/src/float/lfloat/misc/cl_LF_shortenwith.cc b/src/float/lfloat/misc/cl_LF_shortenwith.cc index adc9ba7..0cb6e63 100644 --- a/src/float/lfloat/misc/cl_LF_shortenwith.cc +++ b/src/float/lfloat/misc/cl_LF_shortenwith.cc @@ -9,11 +9,9 @@ // 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 { @@ -25,9 +23,9 @@ const cl_LF cl_LF_shortenwith (const cl_LF& x, const cl_LF& y) // 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; diff --git a/src/float/lfloat/misc/cl_LF_sign.cc b/src/float/lfloat/misc/cl_LF_sign.cc index 5fa601a..9fd0708 100644 --- a/src/float/lfloat/misc/cl_LF_sign.cc +++ b/src/float/lfloat/misc/cl_LF_sign.cc @@ -12,14 +12,12 @@ #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); diff --git a/src/float/lfloat/misc/cl_LF_signum.cc b/src/float/lfloat/misc/cl_LF_signum.cc index eae4705..a658e18 100644 --- a/src/float/lfloat/misc/cl_LF_signum.cc +++ b/src/float/lfloat/misc/cl_LF_signum.cc @@ -12,17 +12,15 @@ #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); } } diff --git a/src/float/misc/cl_F_abs.cc b/src/float/misc/cl_F_abs.cc index 07df8c5..9fe43d2 100644 --- a/src/float/misc/cl_F_abs.cc +++ b/src/float/misc/cl_F_abs.cc @@ -15,8 +15,7 @@ #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" @@ -24,14 +23,14 @@ 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; ); } diff --git a/src/float/misc/cl_F_digits.cc b/src/float/misc/cl_F_digits.cc index 635063d..caf26d0 100644 --- a/src/float/misc/cl_F_digits.cc +++ b/src/float/misc/cl_F_digits.cc @@ -11,8 +11,7 @@ #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" @@ -23,10 +22,10 @@ namespace cln { 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); ); } diff --git a/src/float/misc/cl_F_eqhashcode.cc b/src/float/misc/cl_F_eqhashcode.cc index 6f107a1..5687ee3 100644 --- a/src/float/misc/cl_F_eqhashcode.cc +++ b/src/float/misc/cl_F_eqhashcode.cc @@ -12,8 +12,7 @@ #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" @@ -21,13 +20,13 @@ 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); ); } diff --git a/src/float/misc/cl_F_exponent.cc b/src/float/misc/cl_F_exponent.cc index 8f94561..55b1a58 100644 --- a/src/float/misc/cl_F_exponent.cc +++ b/src/float/misc/cl_F_exponent.cc @@ -11,8 +11,7 @@ #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" @@ -20,13 +19,13 @@ 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); ); } diff --git a/src/float/misc/cl_F_idecode.cc b/src/float/misc/cl_F_idecode.cc index d6b0bb7..0a55da0 100644 --- a/src/float/misc/cl_F_idecode.cc +++ b/src/float/misc/cl_F_idecode.cc @@ -11,8 +11,7 @@ #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" @@ -20,13 +19,13 @@ 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); ); } diff --git a/src/float/misc/cl_F_precision.cc b/src/float/misc/cl_F_precision.cc index ab4f215..1d9c770 100644 --- a/src/float/misc/cl_F_precision.cc +++ b/src/float/misc/cl_F_precision.cc @@ -11,8 +11,7 @@ #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" @@ -20,7 +19,7 @@ namespace cln { -uintC float_precision (const cl_F& x) +uintC CL_FLATTEN float_precision (const cl_F& x) { floatcase(x , return float_precision(x); diff --git a/src/float/misc/cl_F_sign.cc b/src/float/misc/cl_F_sign.cc index 0f96b66..03d8614 100644 --- a/src/float/misc/cl_F_sign.cc +++ b/src/float/misc/cl_F_sign.cc @@ -11,8 +11,7 @@ #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" @@ -20,14 +19,14 @@ 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); ); } diff --git a/src/float/misc/cl_F_signum.cc b/src/float/misc/cl_F_signum.cc index 0b51f9e..3e2af1a 100644 --- a/src/float/misc/cl_F_signum.cc +++ b/src/float/misc/cl_F_signum.cc @@ -11,8 +11,8 @@ #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" @@ -20,13 +20,13 @@ 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); ); } diff --git a/src/float/sfloat/division/cl_SF_fceil.cc b/src/float/sfloat/division/cl_SF_fceil.cc index 98b2498..53ae70e 100644 --- a/src/float/sfloat/division/cl_SF_fceil.cc +++ b/src/float/sfloat/division/cl_SF_fceil.cc @@ -11,15 +11,15 @@ #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); diff --git a/src/float/sfloat/division/cl_SF_ffloor.cc b/src/float/sfloat/division/cl_SF_ffloor.cc index 2f66751..af517cb 100644 --- a/src/float/sfloat/division/cl_SF_ffloor.cc +++ b/src/float/sfloat/division/cl_SF_ffloor.cc @@ -11,15 +11,15 @@ #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); diff --git a/src/float/sfloat/elem/cl_SF_compare.cc b/src/float/sfloat/elem/cl_SF_compare.cc index ba3bb35..c31e18c 100644 --- a/src/float/sfloat/elem/cl_SF_compare.cc +++ b/src/float/sfloat/elem/cl_SF_compare.cc @@ -9,13 +9,12 @@ // 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 -> @@ -24,9 +23,9 @@ cl_signean compare (const cl_SF& x, const cl_SF& y) // 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.word) return signean_plus; // x>y @@ -37,7 +36,7 @@ cl_signean compare (const cl_SF& x, const cl_SF& y) { return signean_minus; } // x=0 { return signean_plus; } // x>y else diff --git a/src/float/sfloat/elem/cl_SF_minus.cc b/src/float/sfloat/elem/cl_SF_minus.cc index 3496e63..5f6bfcf 100644 --- a/src/float/sfloat/elem/cl_SF_minus.cc +++ b/src/float/sfloat/elem/cl_SF_minus.cc @@ -11,8 +11,8 @@ #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 { @@ -21,7 +21,7 @@ const cl_SF operator- (const cl_SF& x1, const cl_SF& x2) { // 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)); diff --git a/src/float/sfloat/elem/cl_SF_minusp.cc b/src/float/sfloat/elem/cl_SF_minusp.cc index b9d2932..269c9f8 100644 --- a/src/float/sfloat/elem/cl_SF_minusp.cc +++ b/src/float/sfloat/elem/cl_SF_minusp.cc @@ -13,8 +13,7 @@ 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; } diff --git a/src/float/sfloat/elem/cl_SF_plusp.cc b/src/float/sfloat/elem/cl_SF_plusp.cc index 45e6798..e0e733b 100644 --- a/src/float/sfloat/elem/cl_SF_plusp.cc +++ b/src/float/sfloat/elem/cl_SF_plusp.cc @@ -11,19 +11,18 @@ #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. diff --git a/src/float/sfloat/elem/cl_SF_uminus.cc b/src/float/sfloat/elem/cl_SF_uminus.cc index 93f3b31..49b4129 100644 --- a/src/float/sfloat/elem/cl_SF_uminus.cc +++ b/src/float/sfloat/elem/cl_SF_uminus.cc @@ -11,8 +11,7 @@ #include "cl_SF.h" -#undef MAYBE_INLINE -#define MAYBE_INLINE inline +#include "cl_inline.h" #include "cl_SF_zerop.cc" namespace cln { @@ -21,7 +20,7 @@ const cl_SF operator- (const cl_SF& x) { // 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)); } diff --git a/src/float/sfloat/elem/cl_SF_zerop.cc b/src/float/sfloat/elem/cl_SF_zerop.cc index 9363458..e729318 100644 --- a/src/float/sfloat/elem/cl_SF_zerop.cc +++ b/src/float/sfloat/elem/cl_SF_zerop.cc @@ -13,8 +13,7 @@ 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); } diff --git a/src/float/sfloat/misc/cl_SF_abs.cc b/src/float/sfloat/misc/cl_SF_abs.cc index 4aeddde..bba1d61 100644 --- a/src/float/sfloat/misc/cl_SF_abs.cc +++ b/src/float/sfloat/misc/cl_SF_abs.cc @@ -9,16 +9,15 @@ // 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 diff --git a/src/float/sfloat/misc/cl_SF_digits.cc b/src/float/sfloat/misc/cl_SF_digits.cc index 378a287..146ed89 100644 --- a/src/float/sfloat/misc/cl_SF_digits.cc +++ b/src/float/sfloat/misc/cl_SF_digits.cc @@ -13,8 +13,7 @@ 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 diff --git a/src/float/sfloat/misc/cl_SF_eqhashcode.cc b/src/float/sfloat/misc/cl_SF_eqhashcode.cc index 948d70d..cb6c231 100644 --- a/src/float/sfloat/misc/cl_SF_eqhashcode.cc +++ b/src/float/sfloat/misc/cl_SF_eqhashcode.cc @@ -14,8 +14,7 @@ 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; diff --git a/src/float/sfloat/misc/cl_SF_exponent.cc b/src/float/sfloat/misc/cl_SF_exponent.cc index 54adfe5..37270c8 100644 --- a/src/float/sfloat/misc/cl_SF_exponent.cc +++ b/src/float/sfloat/misc/cl_SF_exponent.cc @@ -13,8 +13,7 @@ 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; } diff --git a/src/float/sfloat/misc/cl_SF_idecode.cc b/src/float/sfloat/misc/cl_SF_idecode.cc index 2fa34c1..d07949e 100644 --- a/src/float/sfloat/misc/cl_SF_idecode.cc +++ b/src/float/sfloat/misc/cl_SF_idecode.cc @@ -14,8 +14,7 @@ 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; diff --git a/src/float/sfloat/misc/cl_SF_precision.cc b/src/float/sfloat/misc/cl_SF_precision.cc index 5752264..f8bd982 100644 --- a/src/float/sfloat/misc/cl_SF_precision.cc +++ b/src/float/sfloat/misc/cl_SF_precision.cc @@ -11,16 +11,14 @@ #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 } diff --git a/src/float/sfloat/misc/cl_SF_sign.cc b/src/float/sfloat/misc/cl_SF_sign.cc index c780cc9..35f3d8f 100644 --- a/src/float/sfloat/misc/cl_SF_sign.cc +++ b/src/float/sfloat/misc/cl_SF_sign.cc @@ -11,14 +11,12 @@ #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)); diff --git a/src/float/sfloat/misc/cl_SF_signum.cc b/src/float/sfloat/misc/cl_SF_signum.cc index b1239da..ac75daa 100644 --- a/src/float/sfloat/misc/cl_SF_signum.cc +++ b/src/float/sfloat/misc/cl_SF_signum.cc @@ -11,18 +11,17 @@ #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 } diff --git a/src/float/transcendental/cl_F_atanhx.cc b/src/float/transcendental/cl_F_atanhx.cc index b3abe09..c2f0475 100644 --- a/src/float/transcendental/cl_F_atanhx.cc +++ b/src/float/transcendental/cl_F_atanhx.cc @@ -15,8 +15,7 @@ #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" @@ -49,11 +48,11 @@ namespace cln { 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) { @@ -77,13 +76,13 @@ const cl_LF atanhx (const cl_LF& x) // 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: diff --git a/src/float/transcendental/cl_F_atanx.cc b/src/float/transcendental/cl_F_atanx.cc index f17fd49..5319a4f 100644 --- a/src/float/transcendental/cl_F_atanx.cc +++ b/src/float/transcendental/cl_F_atanx.cc @@ -16,8 +16,7 @@ #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" @@ -47,11 +46,11 @@ namespace cln { 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 @@ -71,13 +70,13 @@ static const cl_LF atanx_naive (const cl_LF& x) // 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: @@ -184,13 +183,13 @@ static const cl_LF atanx_ratseries (const cl_LF& t) // 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 @@ -245,7 +244,7 @@ static const cl_LF atanx_ratseries (const cl_LF& t) // 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); diff --git a/src/float/transcendental/cl_F_exp.cc b/src/float/transcendental/cl_F_exp.cc index b2c084b..a07e338 100644 --- a/src/float/transcendental/cl_F_exp.cc +++ b/src/float/transcendental/cl_F_exp.cc @@ -15,8 +15,7 @@ #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" @@ -34,7 +33,7 @@ inline const cl_F_div_t cl_floor_ln2 (const cl_F& x) 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))); diff --git a/src/float/transcendental/cl_F_expx.cc b/src/float/transcendental/cl_F_expx.cc index 9250fad..19517cd 100644 --- a/src/float/transcendental/cl_F_expx.cc +++ b/src/float/transcendental/cl_F_expx.cc @@ -16,8 +16,7 @@ #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" @@ -44,11 +43,11 @@ const cl_LF expx_naive (const cl_LF& x) { // 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); diff --git a/src/float/transcendental/cl_F_lnx.cc b/src/float/transcendental/cl_F_lnx.cc index 6a64c6c..ffa1780 100644 --- a/src/float/transcendental/cl_F_lnx.cc +++ b/src/float/transcendental/cl_F_lnx.cc @@ -16,8 +16,7 @@ #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" @@ -45,11 +44,11 @@ namespace cln { 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); @@ -65,7 +64,7 @@ const cl_LF lnx_naive (const 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) { diff --git a/src/float/transcendental/cl_F_sinhx.cc b/src/float/transcendental/cl_F_sinhx.cc index deaf415..820049f 100644 --- a/src/float/transcendental/cl_F_sinhx.cc +++ b/src/float/transcendental/cl_F_sinhx.cc @@ -16,8 +16,7 @@ #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" @@ -112,11 +111,11 @@ const cl_LF sinhx_naive (const cl_LF& x) // 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); diff --git a/src/float/transcendental/cl_F_sinx.cc b/src/float/transcendental/cl_F_sinx.cc index e2d3f69..3f40c74 100644 --- a/src/float/transcendental/cl_F_sinx.cc +++ b/src/float/transcendental/cl_F_sinx.cc @@ -16,8 +16,7 @@ #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" @@ -121,11 +120,11 @@ const cl_LF sinx_naive (const cl_LF& x) // 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); diff --git a/src/float/transcendental/cl_F_tan.cc b/src/float/transcendental/cl_F_tan.cc index 9cc66a4..fb4c6c5 100644 --- a/src/float/transcendental/cl_F_tan.cc +++ b/src/float/transcendental/cl_F_tan.cc @@ -11,8 +11,7 @@ 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)) diff --git a/src/float/transcendental/cl_F_tanh.cc b/src/float/transcendental/cl_F_tanh.cc index 0059984..fe6a3b0 100644 --- a/src/float/transcendental/cl_F_tanh.cc +++ b/src/float/transcendental/cl_F_tanh.cc @@ -11,8 +11,7 @@ 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)) diff --git a/src/integer/conv/cl_I_from_DS.cc b/src/integer/conv/cl_I_from_DS.cc index df2204e..5cb054e 100644 --- a/src/integer/conv/cl_I_from_DS.cc +++ b/src/integer/conv/cl_I_from_DS.cc @@ -12,14 +12,12 @@ #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: @@ -39,7 +37,7 @@ const cl_I DS_to_I (const uintD* MSDptr, uintC len) } } // 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 diff --git a/src/integer/conv/cl_I_from_NDS.cc b/src/integer/conv/cl_I_from_NDS.cc index 05eca40..6a5abf4 100644 --- a/src/integer/conv/cl_I_from_NDS.cc +++ b/src/integer/conv/cl_I_from_NDS.cc @@ -14,8 +14,7 @@ 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. diff --git a/src/integer/conv/cl_I_from_NUDS.cc b/src/integer/conv/cl_I_from_NUDS.cc index 349cb93..07be62a 100644 --- a/src/integer/conv/cl_I_from_NUDS.cc +++ b/src/integer/conv/cl_I_from_NUDS.cc @@ -12,20 +12,18 @@ #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 diff --git a/src/integer/conv/cl_I_from_UDS.cc b/src/integer/conv/cl_I_from_UDS.cc index dcadfaf..35cf061 100644 --- a/src/integer/conv/cl_I_from_UDS.cc +++ b/src/integer/conv/cl_I_from_UDS.cc @@ -12,14 +12,12 @@ #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 @@ -28,7 +26,7 @@ const cl_I UDS_to_I (uintD* MSDptr, uintC len) // 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 diff --git a/src/integer/misc/cl_I_eqhashcode.cc b/src/integer/misc/cl_I_eqhashcode.cc index 113bcda..6d89ff6 100644 --- a/src/integer/misc/cl_I_eqhashcode.cc +++ b/src/integer/misc/cl_I_eqhashcode.cc @@ -14,7 +14,7 @@ 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 @@ -39,7 +39,7 @@ inline uint32 equal_hashcode (const cl_FN& x) 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; @@ -128,8 +128,7 @@ inline uint32 equal_hashcode (const cl_BN& x) #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); diff --git a/src/integer/misc/cl_I_signum.cc b/src/integer/misc/cl_I_signum.cc index bbd236a..581bc1a 100644 --- a/src/integer/misc/cl_I_signum.cc +++ b/src/integer/misc/cl_I_signum.cc @@ -13,8 +13,7 @@ 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 diff --git a/src/integer/ring/cl_I_ring.cc b/src/integer/ring/cl_I_ring.cc index 416738a..f7dc09a 100644 --- a/src/integer/ring/cl_I_ring.cc +++ b/src/integer/ring/cl_I_ring.cc @@ -13,7 +13,9 @@ CL_PROVIDE(cl_I_ring) #include "cln/integer.h" #include "cln/integer_io.h" +#define zerop zerop_inline #include "cl_I.h" +#undef zerop namespace cln { @@ -34,10 +36,10 @@ static const _cl_ring_element I_zero (cl_heap_ring* R) 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) diff --git a/src/rational/elem/cl_RA_minusp.cc b/src/rational/elem/cl_RA_minusp.cc index f7ed825..4f9019d 100644 --- a/src/rational/elem/cl_RA_minusp.cc +++ b/src/rational/elem/cl_RA_minusp.cc @@ -9,15 +9,15 @@ // 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 diff --git a/src/rational/misc/Makeflags b/src/rational/misc/Makeflags index 6ed2160..e3b8433 100644 --- a/src/rational/misc/Makeflags +++ b/src/rational/misc/Makeflags @@ -1,4 +1,4 @@ # This file contains additional flags for the main Makefile. include $(srcdir)/rational/Makeflags -SUBDIR_INCLUDES += +SUBDIR_INCLUDES += -I$(srcdir)/integer/misc diff --git a/src/rational/misc/cl_RA_eqhashcode.cc b/src/rational/misc/cl_RA_eqhashcode.cc index 8e54c85..1c481fb 100644 --- a/src/rational/misc/cl_RA_eqhashcode.cc +++ b/src/rational/misc/cl_RA_eqhashcode.cc @@ -11,21 +11,23 @@ #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; } } diff --git a/src/rational/misc/cl_RA_signum.cc b/src/rational/misc/cl_RA_signum.cc index 40f5380..bde4c26 100644 --- a/src/rational/misc/cl_RA_signum.cc +++ b/src/rational/misc/cl_RA_signum.cc @@ -12,10 +12,10 @@ #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 diff --git a/src/rational/ring/cl_RA_ring.cc b/src/rational/ring/cl_RA_ring.cc index e7d33f3..f23035f 100644 --- a/src/rational/ring/cl_RA_ring.cc +++ b/src/rational/ring/cl_RA_ring.cc @@ -13,7 +13,9 @@ CL_PROVIDE(cl_RA_ring) #include "cln/rational.h" #include "cln/rational_io.h" +#define zerop zerop_inline #include "cl_RA.h" +#undef zerop namespace cln { @@ -34,10 +36,10 @@ static const _cl_ring_element RA_zero (cl_heap_ring* R) 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) diff --git a/src/real/algebraic/cl_RA_sqrt.cc b/src/real/algebraic/cl_RA_sqrt.cc index 791c2d9..4b112eb 100644 --- a/src/real/algebraic/cl_RA_sqrt.cc +++ b/src/real/algebraic/cl_RA_sqrt.cc @@ -14,8 +14,7 @@ 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 diff --git a/src/real/algebraic/cl_R_sqrt.cc b/src/real/algebraic/cl_R_sqrt.cc index 0d98e4c..03bde6a 100644 --- a/src/real/algebraic/cl_R_sqrt.cc +++ b/src/real/algebraic/cl_R_sqrt.cc @@ -15,8 +15,7 @@ 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) diff --git a/src/real/conv/cl_F_from_R_def.cc b/src/real/conv/cl_F_from_R_def.cc index 3c8e852..63b502f 100644 --- a/src/real/conv/cl_F_from_R_def.cc +++ b/src/real/conv/cl_F_from_R_def.cc @@ -13,8 +13,7 @@ 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); diff --git a/src/real/elem/cl_R_minusp.cc b/src/real/elem/cl_R_minusp.cc index 6101486..9fe30bf 100644 --- a/src/real/elem/cl_R_minusp.cc +++ b/src/real/elem/cl_R_minusp.cc @@ -10,12 +10,13 @@ // 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" @@ -23,11 +24,11 @@ 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 diff --git a/src/real/elem/cl_R_zerop.cc b/src/real/elem/cl_R_zerop.cc index c3a30aa..c300b7e 100644 --- a/src/real/elem/cl_R_zerop.cc +++ b/src/real/elem/cl_R_zerop.cc @@ -9,13 +9,14 @@ // 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" @@ -23,11 +24,11 @@ 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 diff --git a/src/real/misc/cl_R_eqhashcode.cc b/src/real/misc/cl_R_eqhashcode.cc index 243695a..24dba5b 100644 --- a/src/real/misc/cl_R_eqhashcode.cc +++ b/src/real/misc/cl_R_eqhashcode.cc @@ -15,17 +15,17 @@ #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 diff --git a/src/real/misc/cl_R_signum.cc b/src/real/misc/cl_R_signum.cc index f151d6c..eb753c3 100644 --- a/src/real/misc/cl_R_signum.cc +++ b/src/real/misc/cl_R_signum.cc @@ -11,12 +11,12 @@ #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" @@ -24,7 +24,7 @@ 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 diff --git a/src/real/transcendental/cl_R_tan.cc b/src/real/transcendental/cl_R_tan.cc index 14faf89..5a5f606 100644 --- a/src/real/transcendental/cl_R_tan.cc +++ b/src/real/transcendental/cl_R_tan.cc @@ -11,8 +11,7 @@ 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)) diff --git a/src/real/transcendental/cl_R_tanh.cc b/src/real/transcendental/cl_R_tanh.cc index 2b6e984..4bca3b9 100644 --- a/src/real/transcendental/cl_R_tanh.cc +++ b/src/real/transcendental/cl_R_tanh.cc @@ -11,8 +11,7 @@ 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)) -- 2.45.2