From 5370ad8054201cf23d4f94a52f4d3f7f9f3cd511 Mon Sep 17 00:00:00 2001 From: Richard Kreckel Date: Wed, 1 Aug 2007 22:07:36 +0000 Subject: [PATCH] * */*: Remove cl_boolean, cl_true, and cl_false in favor of built-in C++ bool, true, and false. --- ChangeLog | 5 ++ NEWS | 1 + doc/cln.tex | 52 +++++++------- include/cln/complex.h | 4 +- include/cln/dfloat.h | 6 +- include/cln/dfloat_class.h | 4 +- include/cln/ffloat.h | 6 +- include/cln/ffloat_class.h | 6 +- include/cln/float.h | 8 +-- include/cln/input.h | 2 +- include/cln/integer.h | 38 +++++------ include/cln/lfloat.h | 6 +- include/cln/lfloat_class.h | 4 +- include/cln/modinteger.h | 14 ++-- include/cln/numtheory.h | 2 +- include/cln/object.h | 20 +++--- include/cln/output.h | 12 ++-- include/cln/rational.h | 26 +++---- include/cln/real.h | 8 +-- include/cln/ring.h | 22 +++--- include/cln/sfloat.h | 6 +- include/cln/sfloat_class.h | 4 +- include/cln/types.h | 10 --- include/cln/univpoly.h | 18 ++--- include/cln/univpoly_complex.h | 4 +- include/cln/univpoly_integer.h | 4 +- include/cln/univpoly_modint.h | 4 +- include/cln/univpoly_rational.h | 4 +- include/cln/univpoly_real.h | 4 +- src/base/digitseq/cl_2DS_div.cc | 16 ++--- src/base/digitseq/cl_DS.h | 40 +++++------ src/base/digitseq/cl_DS_div.cc | 16 ++--- src/base/digitseq/cl_DS_mul.cc | 12 ++-- src/base/digitseq/cl_DS_mul_kara.h | 4 +- src/base/digitseq/cl_DS_sqrt.cc | 22 +++--- src/base/hash/cl_hash.h | 4 +- src/base/hash/cl_hash1weak.h | 18 ++--- src/base/hash/cl_hash2weak.h | 18 ++--- src/base/hash/cl_hashuniqweak.h | 14 ++-- .../hash/cl_rcpointer2_hashweak_rcpointer.cc | 2 +- .../hash/cl_rcpointer2_hashweak_rcpointer.h | 2 +- .../hash/cl_rcpointer_hashweak_rcpointer.cc | 2 +- .../hash/cl_rcpointer_hashweak_rcpointer.h | 2 +- src/base/output/cl_prin_globals.cc | 6 +- src/base/ring/cl_no_ring.cc | 4 +- src/complex/cl_C.h | 26 +++---- src/complex/elem/cl_C_equal.cc | 12 ++-- src/complex/elem/cl_C_zerop.cc | 6 +- src/complex/input/cl_N_from_string.cc | 2 +- src/complex/input/cl_N_read.cc | 10 +-- src/complex/input/cl_N_read_stream.cc | 10 +-- src/complex/misc/cl_C_expt_I.cc | 2 +- src/complex/misc/cl_N_as.cc | 10 +-- src/complex/ring/cl_C_ring.cc | 12 ++-- src/complex/transcendental/cl_C_expt_C.cc | 2 +- src/float/base/cl_F_globals.cc | 2 +- src/float/cl_F.h | 6 +- src/float/dfloat/algebraic/cl_DF_sqrt.cc | 4 +- src/float/dfloat/conv/cl_I_to_double.cc | 2 +- src/float/dfloat/elem/cl_DF_from_I.cc | 2 +- src/float/dfloat/elem/cl_DF_minusp.cc | 6 +- src/float/dfloat/elem/cl_DF_plusp.cc | 8 +-- src/float/dfloat/elem/cl_DF_zerop.cc | 6 +- src/float/dfloat/input/cl_DF_from_string.cc | 2 +- src/float/dfloat/misc/cl_DF_as.cc | 6 +- src/float/elem/cl_F_minusp.cc | 2 +- src/float/elem/cl_F_plusp.cc | 2 +- src/float/elem/cl_F_zerop.cc | 2 +- src/float/ffloat/conv/cl_I_to_float.cc | 2 +- src/float/ffloat/elem/cl_FF_from_I.cc | 2 +- src/float/ffloat/elem/cl_FF_minusp.cc | 4 +- src/float/ffloat/elem/cl_FF_plusp.cc | 8 +-- src/float/ffloat/elem/cl_FF_zerop.cc | 4 +- src/float/ffloat/input/cl_FF_from_string.cc | 2 +- src/float/ffloat/misc/cl_FF_as.cc | 8 +-- src/float/input/cl_F_from_string.cc | 2 +- src/float/input/cl_F_read.cc | 10 +-- src/float/input/cl_F_read_stream.cc | 10 +-- src/float/lfloat/algebraic/cl_LF_sqrt.cc | 2 +- src/float/lfloat/elem/cl_LF_I_div.cc | 2 +- src/float/lfloat/elem/cl_LF_I_mul.cc | 2 +- src/float/lfloat/elem/cl_LF_from_I.cc | 2 +- src/float/lfloat/elem/cl_LF_minusp.cc | 4 +- src/float/lfloat/elem/cl_LF_plusp.cc | 8 +-- src/float/lfloat/elem/cl_LF_zerop.cc | 4 +- src/float/lfloat/input/cl_LF_from_string.cc | 2 +- src/float/lfloat/misc/cl_LF_as.cc | 6 +- src/float/misc/cl_F_as.cc | 8 +-- src/float/output/cl_F_dprint.cc | 4 +- src/float/sfloat/elem/cl_SF_from_I.cc | 2 +- src/float/sfloat/elem/cl_SF_minusp.cc | 4 +- src/float/sfloat/elem/cl_SF_plusp.cc | 8 +-- src/float/sfloat/elem/cl_SF_zerop.cc | 4 +- src/float/sfloat/input/cl_SF_from_string.cc | 2 +- src/float/sfloat/misc/cl_SF_as.cc | 6 +- src/float/transcendental/cl_F_atanx.cc | 4 +- src/float/transcendental/cl_F_expx.cc | 4 +- src/float/transcendental/cl_F_lnx.cc | 4 +- src/float/transcendental/cl_LF_coshsinh.cc | 4 +- src/float/transcendental/cl_LF_cossin.cc | 4 +- .../cl_LF_ratsumseries_pqcd_aux.cc | 4 +- .../cl_LF_ratsumseries_pqd_aux.cc | 4 +- src/float/transcendental/cl_LF_tran.h | 4 +- src/integer/algebraic/cl_I_rootp.cc | 6 +- src/integer/algebraic/cl_I_rootp_I.cc | 6 +- src/integer/algebraic/cl_I_rootp_aux.cc | 16 ++--- src/integer/algebraic/cl_I_sqrt.cc | 6 +- src/integer/algebraic/cl_I_sqrtp.cc | 14 ++-- src/integer/bitwise/cl_I_ash.cc | 2 +- src/integer/bitwise/cl_I_ash_I.cc | 2 +- src/integer/bitwise/cl_I_byte.h | 4 +- src/integer/bitwise/cl_I_ldbtest.cc | 10 +-- src/integer/bitwise/cl_I_ldbx.cc | 2 +- src/integer/bitwise/cl_I_ldbxtest.cc | 14 ++-- src/integer/bitwise/cl_I_logbitp.cc | 12 ++-- src/integer/bitwise/cl_I_logbitp_I.cc | 12 ++-- src/integer/bitwise/cl_I_logtest.cc | 26 +++---- src/integer/bitwise/cl_I_mkfx.cc | 2 +- src/integer/cl_I.h | 68 +++++++++---------- src/integer/conv/cl_I_to_digits.cc | 2 +- src/integer/elem/cl_I_div.cc | 2 +- src/integer/elem/cl_I_equal.cc | 14 ++-- src/integer/elem/cl_I_minusp.cc | 2 +- src/integer/elem/cl_I_mul.cc | 4 +- src/integer/elem/cl_I_plusp.cc | 8 +-- src/integer/elem/cl_I_square.cc | 2 +- src/integer/elem/cl_I_zerop.cc | 2 +- src/integer/gcd/cl_I_gcd.cc | 4 +- src/integer/gcd/cl_I_xgcd.cc | 4 +- src/integer/hash/cl_I_hashweak_rcpointer.cc | 2 +- src/integer/hash/cl_I_hashweak_rcpointer.h | 2 +- src/integer/input/cl_I_from_string.cc | 2 +- src/integer/input/cl_I_read_stream.cc | 10 +-- src/integer/misc/cl_I_as.cc | 10 +-- src/integer/misc/cl_I_oddp.cc | 10 +-- src/integer/output/cl_I_print_string.cc | 4 +- src/integer/random/cl_I_random.cc | 2 +- src/integer/random/cl_I_trandom.cc | 4 +- src/integer/ring/cl_0_ring.cc | 8 +-- src/integer/ring/cl_I_ring.cc | 12 ++-- src/modinteger/cl_MI.cc | 8 +-- src/modinteger/cl_MI_int.h | 2 +- src/modinteger/cl_MI_montgom.h | 8 +-- src/modinteger/cl_MI_pow2m1.h | 2 +- src/modinteger/cl_MI_std.h | 4 +- src/numtheory/cl_IF.h | 2 +- src/numtheory/cl_IF_millerrabin.cc | 8 +-- src/numtheory/cl_IF_trialdiv.cc | 2 +- src/numtheory/cl_nt_isprobprime.cc | 12 ++-- src/polynomial/elem/cl_UP_GF2.h | 8 +-- src/polynomial/elem/cl_UP_MI.h | 14 ++-- src/polynomial/elem/cl_UP_gen.h | 14 ++-- src/polynomial/elem/cl_UP_named.cc | 6 +- src/polynomial/elem/cl_UP_no_ring.cc | 4 +- src/polynomial/elem/cl_UP_number.h | 14 ++-- src/polynomial/elem/cl_UP_unnamed.cc | 6 +- src/rational/algebraic/cl_RA_rootp.cc | 8 +-- src/rational/algebraic/cl_RA_rootp_I.cc | 8 +-- src/rational/algebraic/cl_RA_sqrtp.cc | 8 +-- src/rational/cl_RA.h | 44 ++++++------ src/rational/elem/cl_RA_equal.cc | 12 ++-- src/rational/elem/cl_RA_minusp.cc | 2 +- src/rational/elem/cl_RA_plusp.cc | 8 +-- src/rational/elem/cl_RA_zerop.cc | 2 +- src/rational/input/cl_RA_from_string.cc | 2 +- src/rational/input/cl_RA_read_stream.cc | 10 +-- src/rational/misc/cl_RA_as.cc | 10 +-- src/rational/ring/cl_RA_ring.cc | 12 ++-- src/rational/transcendental/cl_I_logp.cc | 6 +- src/rational/transcendental/cl_RA_logp.cc | 26 +++---- src/real/cl_R.h | 30 ++++---- src/real/elem/cl_R_equal.cc | 14 ++-- src/real/elem/cl_R_minusp.cc | 2 +- src/real/elem/cl_R_plusp.cc | 8 +-- src/real/elem/cl_R_zerop.cc | 2 +- src/real/format-output/cl_fmt_cardinal.cc | 4 +- src/real/format-output/cl_fmt_floatstring.cc | 18 ++--- src/real/format-output/cl_fmt_integer.cc | 8 +-- src/real/format-output/cl_fmt_paddedstring.cc | 2 +- src/real/format-output/cl_format.h | 10 +-- src/real/input/cl_R_from_string.cc | 2 +- src/real/input/cl_R_read.cc | 10 +-- src/real/input/cl_R_read_stream.cc | 10 +-- src/real/misc/cl_R_as.cc | 10 +-- src/real/misc/cl_R_expt_I.cc | 2 +- src/real/ring/cl_R_ring.cc | 12 ++-- tests/main.cc | 2 +- tests/test_I_isqrt.cc | 2 +- tests/test_I_sqrtp.cc | 4 +- 189 files changed, 753 insertions(+), 765 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1efc991..b0613b6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-08-01 Richard B. Kreckel + + * */*: Remove cl_boolean, cl_true, and cl_false in favor of built-in + C++ bool, true, and false. + 2007-07-28 Richard B. Kreckel Remove exception hooks in favor of real C++ exceptions: diff --git a/NEWS b/NEWS index 7732c2d..faef15a 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,7 @@ Implementation changes * Added support for huge numbers... * CLN now uses C++ exceptions for error handling. +* Removed cl_boolean. Use built-in C++ bool instead. * Dropped the cln-config script. Please use pkg-config instead. diff --git a/doc/cln.tex b/doc/cln.tex index 8e42b1e..f2f3495 100644 --- a/doc/cln.tex +++ b/doc/cln.tex @@ -968,7 +968,7 @@ Returns a 32-bit hash code that is the same for any two numbers which are the same according to @code{==}. This hash code depends on the number's value, not its type or precision. -@item cl_boolean zerop (const @var{type}& x) +@item bool zerop (const @var{type}& x) @cindex @code{zerop ()} Compare against zero: @code{x == 0} @end table @@ -993,11 +993,11 @@ Compares @code{x} and @code{y}. Returns +1 if @code{x}>@code{y}, @cindex @code{operator > ()} Comparison, as in C and C++. -@item cl_boolean minusp (const @var{type}& x) +@item bool minusp (const @var{type}& x) @cindex @code{minusp ()} Compare against zero: @code{x < 0} -@item cl_boolean plusp (const @var{type}& x) +@item bool plusp (const @var{type}& x) @cindex @code{plusp ()} Compare against zero: @code{x > 0} @@ -1255,7 +1255,7 @@ floating-point approximation. The classes @code{cl_RA}, @code{cl_I} define the following operation: @table @code -@item cl_boolean sqrtp (const @var{type}& x, @var{type}* root) +@item bool sqrtp (const @var{type}& x, @var{type}* root) @cindex @code{sqrtp ()} This tests whether @code{x} is a perfect square. If so, it returns true and the exact square root in @code{*root}, else it returns false. @@ -1264,7 +1264,7 @@ and the exact square root in @code{*root}, else it returns false. Furthermore, for integers, similarly: @table @code -@item cl_boolean isqrt (const @var{type}& x, @var{type}* root) +@item bool isqrt (const @var{type}& x, @var{type}* root) @cindex @code{isqrt ()} @code{x} should be >= 0. This function sets @code{*root} to @code{floor(sqrt(x))} and returns the same value as @code{sqrtp}: @@ -1275,7 +1275,7 @@ For @code{n}th roots, the classes @code{cl_RA}, @code{cl_I} define the following operation: @table @code -@item cl_boolean rootp (const @var{type}& x, const cl_I& n, @var{type}* root) +@item bool rootp (const @var{type}& x, const cl_I& n, @var{type}* root) @cindex @code{rootp ()} @code{x} must be >= 0. @code{n} must be > 0. This tests whether @code{x} is an @code{n}th power of a rational number. @@ -1778,12 +1778,12 @@ which combines two bits into one bit): @code{boole_clr}, @code{boole_set}, Other functions that view integers as bit strings: @table @code -@item cl_boolean logtest (const cl_I& x, const cl_I& y) +@item bool logtest (const cl_I& x, const cl_I& y) @cindex @code{logtest ()} Returns true if some bit is set in both @code{x} and @code{y}, i.e. if @code{logand(x,y) != 0}. -@item cl_boolean logbitp (const cl_I& n, const cl_I& x) +@item bool logbitp (const cl_I& n, const cl_I& x) @cindex @code{logbitp ()} Returns true if the @code{n}th bit (from the right) of @code{x} is set. Bit 0 is the least significant bit. @@ -1810,7 +1810,7 @@ The constructor @code{cl_byte(size,position)} constructs a @code{cl_byte}. extracts the bits of @code{n} described by the bit interval @code{b} and returns them as a nonnegative integer with @code{b.size} bits. -@item cl_boolean ldb_test (const cl_I& n, const cl_byte& b) +@item bool ldb_test (const cl_I& n, const cl_byte& b) @cindex @code{ldb_test ()} Returns true if some bit described by the bit interval @code{b} is set in @code{n}. @@ -1852,12 +1852,12 @@ The following operations on integers as bit strings are efficient shortcuts for common arithmetic operations: @table @code -@item cl_boolean oddp (const cl_I& x) +@item bool oddp (const cl_I& x) @cindex @code{oddp ()} Returns true if the least significant bit of @code{x} is 1. Equivalent to @code{mod(x,2) != 0}. -@item cl_boolean evenp (const cl_I& x) +@item bool evenp (const cl_I& x) @cindex @code{evenp ()} Returns true if the least significant bit of @code{x} is 0. Equivalent to @code{mod(x,2) == 0}. @@ -1925,9 +1925,9 @@ value, in the following sense: If @code{a} and @code{b} are non-zero, and This function returns the least common multiple of @code{a} and @code{b}, normalized to be >= 0. -@item cl_boolean logp (const cl_I& a, const cl_I& b, cl_RA* l) +@item bool logp (const cl_I& a, const cl_I& b, cl_RA* l) @cindex @code{logp ()} -@itemx cl_boolean logp (const cl_RA& a, const cl_RA& b, cl_RA* l) +@itemx bool logp (const cl_RA& a, const cl_RA& b, cl_RA* l) @code{a} must be > 0. @code{b} must be >0 and != 1. If log(a,b) is rational number, this function returns true and sets *l = log(a,b), else it returns false. @@ -1945,7 +1945,7 @@ $\left({a\over b}\right)$, @code{a,b} must be integers, @code{b>0} and odd. The result is 0 iff gcd(a,b)>1. -@item cl_boolean isprobprime (const cl_I& n) +@item bool isprobprime (const cl_I& n) @cindex prime @cindex @code{isprobprime()} Returns true if @code{n} is a small prime or passes the Miller-Rabin @@ -2485,7 +2485,7 @@ The float format used when reading floats with exponent marker @samp{e}. @item float_format_t float_flags.default_lfloat_format The float format used when reading floats with exponent marker @samp{l}. -@item cl_boolean float_flags.mantissa_dependent_float_format +@item bool float_flags.mantissa_dependent_float_format When this flag is true, floats specified with more digits than corresponding to the exponent marker they contain, but without @var{_nnn} suffix, will get a precision corresponding to their number of significant digits. @@ -2557,12 +2557,12 @@ The structure type @code{cl_print_flags} contains the following fields: @item unsigned int rational_base The base in which rational numbers are printed. Default is @code{10}. -@item cl_boolean rational_readably +@item bool rational_readably If this flag is true, rational numbers are printed with radix specifiers in Common Lisp syntax (@code{#@var{n}R} or @code{#b} or @code{#o} or @code{#x} prefixes, trailing dot). Default is false. -@item cl_boolean float_readably +@item bool float_readably If this flag is true, type specific exponent markers have precedence over 'E'. Default is false. @@ -2570,7 +2570,7 @@ Default is false. Floating point numbers of this format will be printed using the 'E' exponent marker. Default is @code{float_format_ffloat}. -@item cl_boolean complex_readably +@item bool complex_readably If this flag is true, complex numbers will be printed using the Common Lisp syntax @code{#C(@var{realpart} @var{imagpart})}. Default is false. @@ -2606,11 +2606,11 @@ Given a ring @code{R}, the following members can be used. @table @code @item void R->fprint (std::ostream& stream, const cl_ring_element& x) @cindex @code{fprint ()} -@itemx cl_boolean R->equal (const cl_ring_element& x, const cl_ring_element& y) +@itemx bool R->equal (const cl_ring_element& x, const cl_ring_element& y) @cindex @code{equal ()} @itemx cl_ring_element R->zero () @cindex @code{zero ()} -@itemx cl_boolean R->zerop (const cl_ring_element& x) +@itemx bool R->zerop (const cl_ring_element& x) @cindex @code{zerop ()} @itemx cl_ring_element R->plus (const cl_ring_element& x, const cl_ring_element& y) @cindex @code{plus ()} @@ -2653,7 +2653,7 @@ Type tests can be performed for any of @code{cl_C_ring}, @code{cl_R_ring}, @code{cl_RA_ring}, @code{cl_I_ring}: @table @code -@item cl_boolean instanceof (const cl_number& x, const cl_number_ring& R) +@item bool instanceof (const cl_number& x, const cl_number_ring& R) @cindex @code{instanceof ()} Tests whether the given number is an element of the number ring R. @end table @@ -2817,7 +2817,7 @@ or an error message is issued. Compares two modular integers, belonging to the same modular integer ring, for equality. -@item cl_boolean zerop (const cl_MI& x) +@item bool zerop (const cl_MI& x) @cindex @code{zerop ()} Returns true if @code{x} is @code{0 mod N}. @end table @@ -3120,7 +3120,7 @@ Returns the square of a univariate polynomial. Compares two univariate polynomials, belonging to the same univariate polynomial ring, for equality. -@item cl_boolean zerop (const cl_UP& x) +@item bool zerop (const cl_UP& x) @cindex @code{zerop ()} Returns true if @code{x} is @code{0 in R}. @@ -3697,11 +3697,11 @@ exception @code{floating_point_underflow_exception} (subclass of @code{floating_point_exception}) to be thrown. If you set the global variable @example -cl_boolean cl_inhibit_floating_point_underflow +bool cl_inhibit_floating_point_underflow @end example -to @code{cl_true}, the exception will be inhibited, and a floating-point +to @code{true}, the exception will be inhibited, and a floating-point zero will be generated instead. The default value of -@code{cl_inhibit_floating_point_underflow} is @code{cl_false}. +@code{cl_inhibit_floating_point_underflow} is @code{false}. @section Customizing I/O diff --git a/include/cln/complex.h b/include/cln/complex.h index 6820e18..18868a9 100644 --- a/include/cln/complex.h +++ b/include/cln/complex.h @@ -14,7 +14,7 @@ CL_DEFINE_AS_CONVERSION(cl_N) // zerop(x) testet, ob (= x 0). -extern cl_boolean zerop (const cl_N& x); +extern bool zerop (const cl_N& x); // Liefert zu reellen Zahlen a und b die komplexe Zahl a+bi. @@ -68,7 +68,7 @@ extern const cl_N signum (const cl_N& x); extern const cl_N sqrt (const cl_N& x); // equal(x,y) vergleicht zwei Zahlen x und y auf Gleichheit. -extern cl_boolean equal (const cl_N& x, const cl_N& y); +extern bool equal (const cl_N& x, const cl_N& y); // equal_hashcode(x) liefert einen equal-invarianten Hashcode für x. extern uint32 equal_hashcode (const cl_N& x); diff --git a/include/cln/dfloat.h b/include/cln/dfloat.h index 30534b5..023261b 100644 --- a/include/cln/dfloat.h +++ b/include/cln/dfloat.h @@ -37,13 +37,13 @@ inline bool operator> (const cl_DF& x, const cl_DF& y) { return compare(x,y)>0; } // minusp(x) == (< x 0) -extern cl_boolean minusp (const cl_DF& x); +extern bool minusp (const cl_DF& x); // zerop(x) stellt fest, ob ein Double-Float x = 0.0 ist. -extern cl_boolean zerop (const cl_DF& x); +extern bool zerop (const cl_DF& x); // plusp(x) == (> x 0) -extern cl_boolean plusp (const cl_DF& x); +extern bool plusp (const cl_DF& x); // Liefert zu zwei Double-Float x und y : (+ x y), ein DF. extern const cl_DF operator+ (const cl_DF& x, const cl_DF& y); diff --git a/include/cln/dfloat_class.h b/include/cln/dfloat_class.h index 515fb37..c189f39 100644 --- a/include/cln/dfloat_class.h +++ b/include/cln/dfloat_class.h @@ -15,8 +15,8 @@ public: // Assignment operators. cl_DF& operator= (const cl_DF&); // Optimization of method pointer_p(). - cl_boolean pointer_p() const - { return cl_true; } + bool pointer_p() const + { return true; } // Faster pointer_p() gives a faster copy constructor (but not destructor!!!). cl_DF (const cl_DF& x); // Constructors and assignment operators from C numeric types. diff --git a/include/cln/ffloat.h b/include/cln/ffloat.h index a9ade1c..d85cdbb 100644 --- a/include/cln/ffloat.h +++ b/include/cln/ffloat.h @@ -37,13 +37,13 @@ inline bool operator> (const cl_FF& x, const cl_FF& y) { return compare(x,y)>0; } // minusp(x) == (< x 0) -extern cl_boolean minusp (const cl_FF& x); +extern bool minusp (const cl_FF& x); // zerop(x) stellt fest, ob ein Single-Float x = 0.0 ist. -extern cl_boolean zerop (const cl_FF& x); +extern bool zerop (const cl_FF& x); // plusp(x) == (> x 0) -extern cl_boolean plusp (const cl_FF& x); +extern bool plusp (const cl_FF& x); // Liefert zu zwei Single-Float x und y : (+ x y), ein FF. extern const cl_FF operator+ (const cl_FF& x, const cl_FF& y); diff --git a/include/cln/ffloat_class.h b/include/cln/ffloat_class.h index 94cbfd8..f53b7fd 100644 --- a/include/cln/ffloat_class.h +++ b/include/cln/ffloat_class.h @@ -15,11 +15,11 @@ public: // Assignment operators. cl_FF& operator= (const cl_FF&); // Optimization of method pointer_p(). - cl_boolean pointer_p() const + bool pointer_p() const #if defined(CL_WIDE_POINTERS) - { return cl_false; } + { return false; } #else - { return cl_true; } + { return true; } #endif // Faster pointer_p() gives a faster copy constructor (but not destructor!!!). cl_FF (const cl_FF& x); diff --git a/include/cln/float.h b/include/cln/float.h index 383f1f2..1c981ed 100644 --- a/include/cln/float.h +++ b/include/cln/float.h @@ -31,13 +31,13 @@ struct cl_idecoded_float { // zerop(x) testet, ob (= x 0). -extern cl_boolean zerop (const cl_F& x); +extern bool zerop (const cl_F& x); // minusp(x) testet, ob (< x 0). -extern cl_boolean minusp (const cl_F& x); +extern bool minusp (const cl_F& x); // plusp(x) testet, ob (> x 0). -extern cl_boolean plusp (const cl_F& x); +extern bool plusp (const cl_F& x); // cl_F_to_SF(x) wandelt ein Float x in ein Short-Float um und rundet dabei. @@ -764,7 +764,7 @@ CL_REQUIRE(cl_ieee) // If this is true, floating point underflow returns zero instead of throwing an exception. -extern cl_boolean cl_inhibit_floating_point_underflow; +extern bool cl_inhibit_floating_point_underflow; } // namespace cln diff --git a/include/cln/input.h b/include/cln/input.h index 5df0ab9..71fb90a 100644 --- a/include/cln/input.h +++ b/include/cln/input.h @@ -17,7 +17,7 @@ struct cl_read_float_flags { // Flag whether floats specified with more digits than corresponding // to the exponent marker they contain, but without _nnn suffix, will // get a precision corresponding to their number of significant digits. - cl_boolean mantissa_dependent_float_format; + bool mantissa_dependent_float_format; }; // Specifies the possible results of a read operation. diff --git a/include/cln/integer.h b/include/cln/integer.h index f470442..bf72106 100644 --- a/include/cln/integer.h +++ b/include/cln/integer.h @@ -146,21 +146,21 @@ extern const cl_I boole (cl_boole op, const cl_I& x, const cl_I& y); // Prüft, ob (LOGTEST x y), wo x und y Integers sind. // (LOGTEST x y) = (NOT (ZEROP (LOGAND x y))). // < ergebnis: /=0, falls ja; =0, falls nein. -extern cl_boolean logtest (const cl_I& x, const cl_I& y); +extern bool logtest (const cl_I& x, const cl_I& y); // Prüft, ob (LOGBITP x y), wo x und y Integers sind. // Ergebnis: /=0, wenn ja; =0, wenn nein. -extern cl_boolean logbitp (uintC x, const cl_I& y); -extern cl_boolean logbitp (const cl_I& x, const cl_I& y); +extern bool logbitp (uintC x, const cl_I& y); +extern bool logbitp (const cl_I& x, const cl_I& y); // Prüft, ob (ODDP x), wo x ein Integer ist. // Ergebnis: /=0, falls ja; =0, falls nein. -extern cl_boolean oddp (const cl_I& x); +extern bool oddp (const cl_I& x); // Prüft, ob (EVENP x), wo x ein Integer ist. // Ergebnis: /=0, falls ja; =0, falls nein. -inline cl_boolean evenp (const cl_I& x) - { return (cl_boolean) (!oddp(x)); } +inline bool evenp (const cl_I& x) + { return !oddp(x); } // (ASH x y), wo x und y Integers sind. Ergebnis Integer. extern const cl_I ash (const cl_I& x, sintC y); @@ -293,7 +293,7 @@ inline const cl_I operator>> (const cl_I& x, const cl_I& y) // assume y >= 0 // Vergleich von Integers // equal(x,y) vergleicht zwei Integers x und y auf Gleichheit. -extern cl_boolean equal (const cl_I& x, const cl_I& y); +extern bool equal (const cl_I& x, const cl_I& y); // equal_hashcode(x) liefert einen equal-invarianten Hashcode für x. extern uint32 equal_hashcode (const cl_I& x); @@ -315,13 +315,13 @@ inline bool operator> (const cl_I& x, const cl_I& y) { return compare(x,y)>0; } // minusp(x) == (< x 0) -extern cl_boolean minusp (const cl_I& x); +extern bool minusp (const cl_I& x); // plusp(x) == (> x 0) -extern cl_boolean plusp (const cl_I& x); +extern bool plusp (const cl_I& x); // zerop(x) stellt fest, ob ein Integer = 0 ist. -extern cl_boolean zerop (const cl_I& x); +extern bool zerop (const cl_I& x); // BYTE-Operationen auf Integers @@ -337,8 +337,8 @@ struct cl_byte { extern const cl_I ldb (const cl_I& n, const cl_byte& b); // ldb_test(n,byte) führt (LDB-TEST byte n) aus, wobei n ein Integer ist. -// Ergebnis: cl_false wenn nein (also alle fraglichen Bits =0), cl_true wenn ja. -extern cl_boolean ldb_test (const cl_I& n, const cl_byte& b); +// Ergebnis: false wenn nein (also alle fraglichen Bits =0), true wenn ja. +extern bool ldb_test (const cl_I& n, const cl_byte& b); // (MASK-FIELD byte n), wo n ein Integer ist. extern const cl_I mask_field (const cl_I& n, const cl_byte& b); @@ -529,8 +529,8 @@ public: // isqrt(x,&w) // > x: Integer (sollte >=0 sein) // < w: (isqrt x) -// < ergebnis: cl_true falls x Quadratzahl, cl_false sonst - extern cl_boolean isqrt (const cl_I& x, cl_I* w); +// < ergebnis: true falls x Quadratzahl, false sonst + extern bool isqrt (const cl_I& x, cl_I* w); // Wenn das boolesche Ergebnis uninteressant ist: inline const cl_I isqrt (const cl_I& x) { cl_I w; isqrt(x,&w); return w; } @@ -538,17 +538,17 @@ public: // sqrtp(x,&w) // > x: ein Integer >=0 // < w: Integer (sqrt x) falls x Quadratzahl -// < ergebnis: cl_true ..................., cl_false sonst - extern cl_boolean sqrtp (const cl_I& x, cl_I* w); +// < ergebnis: true ..................., false sonst + extern bool sqrtp (const cl_I& x, cl_I* w); // Stellt fest, ob ein Integer >=0 eine n-te Potenz ist. // rootp(x,n,&w) // > x: ein Integer >=0 // > n: ein Integer >0 // < w: Integer (expt x (/ n)) falls x eine n-te Potenz -// < ergebnis: cl_true ........................, cl_false sonst - extern cl_boolean rootp (const cl_I& x, uintL n, cl_I* w); - extern cl_boolean rootp (const cl_I& x, const cl_I& n, cl_I* w); +// < ergebnis: true ........................, false sonst + extern bool rootp (const cl_I& x, uintL n, cl_I* w); + extern bool rootp (const cl_I& x, const cl_I& n, cl_I* w); // max(x,y) liefert (max x y), wo x und y ganze Zahlen sind. diff --git a/include/cln/lfloat.h b/include/cln/lfloat.h index 58d1e89..e09dc7c 100644 --- a/include/cln/lfloat.h +++ b/include/cln/lfloat.h @@ -37,13 +37,13 @@ inline bool operator> (const cl_LF& x, const cl_LF& y) { return compare(x,y)>0; } // minusp(x) == (< x 0) -extern cl_boolean minusp (const cl_LF& x); +extern bool minusp (const cl_LF& x); // zerop(x) stellt fest, ob ein Long-Float x = 0.0 ist. -extern cl_boolean zerop (const cl_LF& x); +extern bool zerop (const cl_LF& x); // plusp(x) == (> x 0) -extern cl_boolean plusp (const cl_LF& x); +extern bool plusp (const cl_LF& x); // Liefert zu zwei Long-Float x und y : (+ x y), ein LF. extern const cl_LF operator+ (const cl_LF& x, const cl_LF& y); diff --git a/include/cln/lfloat_class.h b/include/cln/lfloat_class.h index e73f0a1..cd34668 100644 --- a/include/cln/lfloat_class.h +++ b/include/cln/lfloat_class.h @@ -15,8 +15,8 @@ public: // Assignment operators. cl_LF& operator= (const cl_LF&); // Optimization of method pointer_p(). - cl_boolean pointer_p() const - { return cl_true; } + bool pointer_p() const + { return true; } // Faster pointer_p() gives a faster copy constructor (but not destructor!!!). cl_LF (const cl_LF& x); // Other constructors. diff --git a/include/cln/modinteger.h b/include/cln/modinteger.h index ade02d8..877e7e9 100644 --- a/include/cln/modinteger.h +++ b/include/cln/modinteger.h @@ -153,14 +153,14 @@ struct _cl_modint_setops /* cf. _cl_ring_setops */ { // print void (* fprint) (cl_heap_modint_ring* R, std::ostream& stream, const _cl_MI& x); // equality - cl_boolean (* equal) (cl_heap_modint_ring* R, const _cl_MI& x, const _cl_MI& y); + bool (* equal) (cl_heap_modint_ring* R, const _cl_MI& x, const _cl_MI& y); // random number const _cl_MI (* random) (cl_heap_modint_ring* R, random_state& randomstate); }; struct _cl_modint_addops /* cf. _cl_ring_addops */ { // 0 const _cl_MI (* zero) (cl_heap_modint_ring* R); - cl_boolean (* zerop) (cl_heap_modint_ring* R, const _cl_MI& x); + bool (* zerop) (cl_heap_modint_ring* R, const _cl_MI& x); // x+y const _cl_MI (* plus) (cl_heap_modint_ring* R, const _cl_MI& x, const _cl_MI& y); // x-y @@ -216,13 +216,13 @@ public: // Low-level operations. void _fprint (std::ostream& stream, const _cl_MI& x) { setops->fprint(this,stream,x); } - cl_boolean _equal (const _cl_MI& x, const _cl_MI& y) + bool _equal (const _cl_MI& x, const _cl_MI& y) { return setops->equal(this,x,y); } const _cl_MI _random (random_state& randomstate) { return setops->random(this,randomstate); } const _cl_MI _zero () { return addops->zero(this); } - cl_boolean _zerop (const _cl_MI& x) + bool _zerop (const _cl_MI& x) { return addops->zerop(this,x); } const _cl_MI _plus (const _cl_MI& x, const _cl_MI& y) { return addops->plus(this,x,y); } @@ -256,7 +256,7 @@ public: if (!(x.ring() == this)) throw runtime_exception(); _fprint(stream,x); } - cl_boolean equal (const cl_MI& x, const cl_MI& y) + bool equal (const cl_MI& x, const cl_MI& y) { if (!(x.ring() == this)) throw runtime_exception(); if (!(y.ring() == this)) throw runtime_exception(); @@ -270,7 +270,7 @@ public: { return cl_MI(this,_zero()); } - cl_boolean zerop (const cl_MI& x) + bool zerop (const cl_MI& x) { if (!(x.ring() == this)) throw runtime_exception(); return _zerop(x); @@ -407,7 +407,7 @@ inline bool operator!= (const cl_I& x, const cl_MI& y) { return !y.ring()->equal(y.ring()->canonhom(x),y); } // Compare against 0. -inline cl_boolean zerop (const cl_MI& x) +inline bool zerop (const cl_MI& x) { return x.ring()->zerop(x); } // Multiply. diff --git a/include/cln/numtheory.h b/include/cln/numtheory.h index 8ae3ac8..86b8324 100644 --- a/include/cln/numtheory.h +++ b/include/cln/numtheory.h @@ -21,7 +21,7 @@ namespace cln { // isprobprime(n), n integer > 0, // returns true when n is probably prime. // This is pretty quick, but no caching is done. - extern cl_boolean isprobprime (const cl_I& n); + extern bool isprobprime (const cl_I& n); // nextprobprime(x) returns the smallest probable prime >= x. extern const cl_I nextprobprime (const cl_R& x); diff --git a/include/cln/object.h b/include/cln/object.h index 52f72ef..bb5a242 100644 --- a/include/cln/object.h +++ b/include/cln/object.h @@ -71,13 +71,13 @@ typedef uintP cl_uint; // This ought to be called `cl_word'. #endif // Distinguish immediate data from pointers. -inline cl_boolean cl_pointer_p (cl_uint word) +inline bool cl_pointer_p (cl_uint word) { - return (cl_boolean)((word & (cl_word_alignment-1)) == 0); + return (word & (cl_word_alignment-1)) == 0; } -inline cl_boolean cl_immediate_p (cl_uint word) +inline bool cl_immediate_p (cl_uint word) { - return (cl_boolean)((word & (cl_word_alignment-1)) != 0); + return (word & (cl_word_alignment-1)) != 0; } // Immediate data: Fixnum, Short Float, maybe Single Float. @@ -310,7 +310,7 @@ public: // Assignment operator. cl_gcobject& operator= (const cl_gcobject&); // Distinguish immediate data from pointer. - cl_boolean pointer_p() const + bool pointer_p() const { return cl_pointer_p(word); } // Reference counting. void inc_pointer_refcount () const @@ -360,8 +360,8 @@ public: // Assignment operator. cl_gcpointer& operator= (const cl_gcpointer&); // Distinguish immediate data from pointer. - cl_boolean pointer_p() const - { return cl_true; } + bool pointer_p() const + { return true; } // Reference counting. void inc_pointer_refcount () const { cl_inc_pointer_refcount(heappointer); } @@ -410,7 +410,7 @@ public: // Assignment operator. cl_rcobject& operator= (const cl_rcobject&); // Distinguish immediate data from pointer. - cl_boolean pointer_p() const + bool pointer_p() const { return cl_pointer_p(word); } // Reference counting. void inc_pointer_refcount () const @@ -460,8 +460,8 @@ public: // Assignment operator. cl_rcpointer& operator= (const cl_rcpointer&); // Distinguish immediate data from pointer. - cl_boolean pointer_p() const - { return cl_true; } + bool pointer_p() const + { return true; } // Reference counting. void inc_pointer_refcount () const { cl_inc_pointer_refcount(heappointer); } diff --git a/include/cln/output.h b/include/cln/output.h index 907f47f..ff65988 100644 --- a/include/cln/output.h +++ b/include/cln/output.h @@ -15,21 +15,21 @@ struct cl_print_rational_flags { unsigned int rational_base; // Flag whether to print radix specifiers in Common Lisp syntax for // rational numbers (#nR or #b or #o or #x prefixes, trailing dot). - cl_boolean rational_readably; + bool rational_readably; // Constructor. cl_print_rational_flags () : rational_base (10), - rational_readably (cl_false) {} + rational_readably (false) {} }; struct cl_print_float_flags { // Flag whether to prefer type specific exponent markers over 'E'. - cl_boolean float_readably; + bool float_readably; // If !float_readably, the format which earns the 'E' exponent marker. float_format_t default_float_format; // Constructor. cl_print_float_flags () : - float_readably (cl_false), + float_readably (false), default_float_format (float_format_ffloat) {} }; @@ -37,10 +37,10 @@ struct cl_print_real_flags : cl_print_rational_flags, cl_print_float_flags {}; struct cl_print_complex_flags { // Flag whether to use the Common Lisp #C(realpart imagpart) syntax, - cl_boolean complex_readably; + bool complex_readably; // Constructor. cl_print_complex_flags () : - complex_readably (cl_false) {} + complex_readably (false) {} }; struct cl_print_number_flags : cl_print_real_flags, cl_print_complex_flags {}; diff --git a/include/cln/rational.h b/include/cln/rational.h index bccce7f..b09962d 100644 --- a/include/cln/rational.h +++ b/include/cln/rational.h @@ -97,7 +97,7 @@ extern const cl_RA minus1 (const cl_RA& r); extern const cl_RA abs (const cl_RA& r); // equal(r,s) vergleicht zwei rationale Zahlen r und s auf Gleichheit. -extern cl_boolean equal (const cl_RA& r, const cl_RA& s); +extern bool equal (const cl_RA& r, const cl_RA& s); // equal_hashcode(r) liefert einen equal-invarianten Hashcode für r. extern uint32 equal_hashcode (const cl_RA& r); @@ -119,13 +119,13 @@ inline bool operator> (const cl_RA& x, const cl_RA& y) { return compare(x,y)>0; } // minusp(x) == (< x 0) -extern cl_boolean minusp (const cl_RA& x); +extern bool minusp (const cl_RA& x); // zerop(x) stellt fest, ob eine rationale Zahl = 0 ist. -extern cl_boolean zerop (const cl_RA& x); +extern bool zerop (const cl_RA& x); // plusp(x) == (> x 0) -extern cl_boolean plusp (const cl_RA& x); +extern bool plusp (const cl_RA& x); // Kehrwert (/ r), wo r eine rationale Zahl ist. extern const cl_RA recip (const cl_RA& r); @@ -277,8 +277,8 @@ extern const cl_RA expt (const cl_RA& x, const cl_I& y); // sqrtp(x,&w) // > x: eine rationale Zahl >=0 // < w: rationale Zahl (sqrt x) falls x Quadratzahl -// < ergebnis: cl_true ..................., cl_false sonst - extern cl_boolean sqrtp (const cl_RA& x, cl_RA* w); +// < ergebnis: true ..................., false sonst + extern bool sqrtp (const cl_RA& x, cl_RA* w); // Stellt fest, ob eine rationale Zahl >=0 die n-te Potenz einer rationalen Zahl // ist. @@ -286,9 +286,9 @@ extern const cl_RA expt (const cl_RA& x, const cl_I& y); // > x: eine rationale Zahl >=0 // > n: ein Integer >0 // < w: exakte n-te Wurzel (expt x (/ n)) falls x eine n-te Potenz -// < ergebnis: cl_true ........................, cl_false sonst - extern cl_boolean rootp (const cl_RA& x, uintL n, cl_RA* w); - extern cl_boolean rootp (const cl_RA& x, const cl_I& n, cl_RA* w); +// < ergebnis: true ........................, false sonst + extern bool rootp (const cl_RA& x, uintL n, cl_RA* w); + extern bool rootp (const cl_RA& x, const cl_I& n, cl_RA* w); // Liefert zu Integers a>0, b>1 den Logarithmus log(a,b), // falls er eine rationale Zahl ist. @@ -296,8 +296,8 @@ extern const cl_RA expt (const cl_RA& x, const cl_I& y); // > a: ein Integer >0 // > b: ein Integer >1 // < l: log(a,b) falls er eine exakte rationale Zahl ist -// < ergebnis: cl_true ......................................., cl_false sonst - extern cl_boolean logp (const cl_I& a, const cl_I& b, cl_RA* l); +// < ergebnis: true ......................................., false sonst + extern bool logp (const cl_I& a, const cl_I& b, cl_RA* l); // Liefert zu rationalen Zahlen a>0, b>0 den Logarithmus log(a,b), // falls er eine rationale Zahl ist. @@ -305,8 +305,8 @@ extern const cl_RA expt (const cl_RA& x, const cl_I& y); // > a: eine rationale Zahl >0 // > b: eine rationale Zahl >0, /=1 // < l: log(a,b) falls er eine exakte rationale Zahl ist -// < ergebnis: cl_true ......................................., cl_false sonst - extern cl_boolean logp (const cl_RA& a, const cl_RA& b, cl_RA* l); +// < ergebnis: true ......................................., false sonst + extern bool logp (const cl_RA& a, const cl_RA& b, cl_RA* l); // Konversion zu einem C "float". extern float float_approx (const cl_RA& x); diff --git a/include/cln/real.h b/include/cln/real.h index d89cfef..e2637f2 100644 --- a/include/cln/real.h +++ b/include/cln/real.h @@ -17,13 +17,13 @@ CL_DEFINE_AS_CONVERSION(cl_R) // zerop(x) testet, ob (= x 0). -extern cl_boolean zerop (const cl_R& x); +extern bool zerop (const cl_R& x); // minusp(x) testet, ob (< x 0). -extern cl_boolean minusp (const cl_R& x); +extern bool minusp (const cl_R& x); // plusp(x) testet, ob (> x 0). -extern cl_boolean plusp (const cl_R& x); +extern bool plusp (const cl_R& x); // R_to_SF(x) wandelt eine reelle Zahl x in ein Short-Float um. @@ -361,7 +361,7 @@ inline const cl_RA rational (const cl_RA& x) { return x; } // equal(x,y) vergleicht zwei reelle Zahlen x und y auf Gleichheit. -extern cl_boolean equal (const cl_R& x, const cl_R& y); +extern bool equal (const cl_R& x, const cl_R& y); // equal_hashcode(x) liefert einen equal-invarianten Hashcode für x. extern uint32 equal_hashcode (const cl_R& x); diff --git a/include/cln/ring.h b/include/cln/ring.h index 8c7fbbb..fcdcac9 100644 --- a/include/cln/ring.h +++ b/include/cln/ring.h @@ -158,13 +158,13 @@ struct _cl_ring_setops { // print void (* fprint) (cl_heap_ring* R, std::ostream& stream, const _cl_ring_element& x); // equality - cl_boolean (* equal) (cl_heap_ring* R, const _cl_ring_element& x, const _cl_ring_element& y); + bool (* equal) (cl_heap_ring* R, const _cl_ring_element& x, const _cl_ring_element& y); // ... }; struct _cl_ring_addops { // 0 const _cl_ring_element (* zero) (cl_heap_ring* R); - cl_boolean (* zerop) (cl_heap_ring* R, const _cl_ring_element& x); + bool (* zerop) (cl_heap_ring* R, const _cl_ring_element& x); // x+y const _cl_ring_element (* plus) (cl_heap_ring* R, const _cl_ring_element& x, const _cl_ring_element& y); // x-y @@ -211,11 +211,11 @@ public: // Low-level operations. void _fprint (std::ostream& stream, const _cl_ring_element& x) { setops->fprint(this,stream,x); } - cl_boolean _equal (const _cl_ring_element& x, const _cl_ring_element& y) + bool _equal (const _cl_ring_element& x, const _cl_ring_element& y) { return setops->equal(this,x,y); } const _cl_ring_element _zero () { return addops->zero(this); } - cl_boolean _zerop (const _cl_ring_element& x) + bool _zerop (const _cl_ring_element& x) { return addops->zerop(this,x); } const _cl_ring_element _plus (const _cl_ring_element& x, const _cl_ring_element& y) { return addops->plus(this,x,y); } @@ -239,7 +239,7 @@ public: if (!(x.ring() == this)) throw runtime_exception(); _fprint(stream,x); } - cl_boolean equal (const cl_ring_element& x, const cl_ring_element& y) + bool equal (const cl_ring_element& x, const cl_ring_element& y) { if (!(x.ring() == this)) throw runtime_exception(); if (!(y.ring() == this)) throw runtime_exception(); @@ -249,7 +249,7 @@ public: { return cl_ring_element(this,_zero()); } - cl_boolean zerop (const cl_ring_element& x) + bool zerop (const cl_ring_element& x) { if (!(x.ring() == this)) throw runtime_exception(); return _zerop(x); @@ -338,7 +338,7 @@ inline bool operator!= (const cl_ring_element& x, const cl_ring_element& y) { return !x.ring()->equal(x,y); } // Compare against 0. -inline cl_boolean zerop (const cl_ring_element& x) +inline bool zerop (const cl_ring_element& x) { return x.ring()->zerop(x); } // Multiply. @@ -396,9 +396,9 @@ inline cl_ring_element::cl_ring_element () template struct cl_number_ring_ops { - cl_boolean (* contains) (const cl_number&); - cl_boolean (* equal) (const T&, const T&); - cl_boolean (* zerop) (const T&); + bool (* contains) (const cl_number&); + bool (* equal) (const T&, const T&); + bool (* zerop) (const T&); const T (* plus) (const T&, const T&); const T (* minus) (const T&, const T&); const T (* uminus) (const T&); @@ -427,7 +427,7 @@ public: }; // Type test. -inline cl_boolean instanceof (const cl_number& x, const cl_number_ring& R) +inline bool instanceof (const cl_number& x, const cl_number_ring& R) { return ((cl_heap_number_ring*) R.heappointer)->ops->contains(x); } diff --git a/include/cln/sfloat.h b/include/cln/sfloat.h index 4ca1bf6..a77fc01 100644 --- a/include/cln/sfloat.h +++ b/include/cln/sfloat.h @@ -37,13 +37,13 @@ inline bool operator> (const cl_SF& x, const cl_SF& y) { return compare(x,y)>0; } // minusp(x) == (< x 0) -extern cl_boolean minusp (const cl_SF& x); +extern bool minusp (const cl_SF& x); // zerop(x) stellt fest, ob ein Short-Float x = 0.0 ist. -extern cl_boolean zerop (const cl_SF& x); +extern bool zerop (const cl_SF& x); // plusp(x) == (> x 0) -extern cl_boolean plusp (const cl_SF& x); +extern bool plusp (const cl_SF& x); // Liefert zu zwei Short-Float x und y : (+ x y), ein SF. extern const cl_SF operator+ (const cl_SF& x, const cl_SF& y); diff --git a/include/cln/sfloat_class.h b/include/cln/sfloat_class.h index 57266fc..1801ac7 100644 --- a/include/cln/sfloat_class.h +++ b/include/cln/sfloat_class.h @@ -15,8 +15,8 @@ public: // Assignment operators. cl_SF& operator= (const cl_SF&); // Optimization of method pointer_p(). - cl_boolean pointer_p() const - { return cl_false; } + bool pointer_p() const + { return false; } // Faster pointer_p() gives a faster copy constructor (but not destructor!!!). cl_SF (const cl_SF& x); // Other constructors. diff --git a/include/cln/types.h b/include/cln/types.h index 067411e..a64a426 100644 --- a/include/cln/types.h +++ b/include/cln/types.h @@ -68,16 +68,6 @@ typedef uint64 uintQ; #endif -// Boolean type. -#if 1 - typedef enum { cl_false = 0, cl_true = 1 } - cl_boolean; -#else - typedef bool cl_boolean; - #define cl_false 0 - #define cl_true 1 -#endif - // Type for three values (0, +1, -1). typedef int cl_signean; #define signean_plus 1 diff --git a/include/cln/univpoly.h b/include/cln/univpoly.h index 95d2ea1..0116827 100644 --- a/include/cln/univpoly.h +++ b/include/cln/univpoly.h @@ -115,12 +115,12 @@ struct _cl_univpoly_setops /* cf. _cl_ring_setops */ { // equality // (Be careful: This is not well-defined for polynomials with // floating-point coefficients.) - cl_boolean (* equal) (cl_heap_univpoly_ring* R, const _cl_UP& x, const _cl_UP& y); + bool (* equal) (cl_heap_univpoly_ring* R, const _cl_UP& x, const _cl_UP& y); }; struct _cl_univpoly_addops /* cf. _cl_ring_addops */ { // 0 const _cl_UP (* zero) (cl_heap_univpoly_ring* R); - cl_boolean (* zerop) (cl_heap_univpoly_ring* R, const _cl_UP& x); + bool (* zerop) (cl_heap_univpoly_ring* R, const _cl_UP& x); // x+y const _cl_UP (* plus) (cl_heap_univpoly_ring* R, const _cl_UP& x, const _cl_UP& y); // x-y @@ -188,11 +188,11 @@ public: // Low-level operations. void _fprint (std::ostream& stream, const _cl_UP& x) { setops->fprint(this,stream,x); } - cl_boolean _equal (const _cl_UP& x, const _cl_UP& y) + bool _equal (const _cl_UP& x, const _cl_UP& y) { return setops->equal(this,x,y); } const _cl_UP _zero () { return addops->zero(this); } - cl_boolean _zerop (const _cl_UP& x) + bool _zerop (const _cl_UP& x) { return addops->zerop(this,x); } const _cl_UP _plus (const _cl_UP& x, const _cl_UP& y) { return addops->plus(this,x,y); } @@ -234,7 +234,7 @@ public: if (!(x.ring() == this)) throw runtime_exception(); _fprint(stream,x); } - cl_boolean equal (const cl_UP& x, const cl_UP& y) + bool equal (const cl_UP& x, const cl_UP& y) { if (!(x.ring() == this)) throw runtime_exception(); if (!(y.ring() == this)) throw runtime_exception(); @@ -244,7 +244,7 @@ public: { return cl_UP(this,_zero()); } - cl_boolean zerop (const cl_UP& x) + bool zerop (const cl_UP& x) { if (!(x.ring() == this)) throw runtime_exception(); return _zerop(x); @@ -383,7 +383,7 @@ inline bool operator!= (const cl_UP& x, const cl_UP& y) { return !x.ring()->equal(x,y); } // Compare against 0. -inline cl_boolean zerop (const cl_UP& x) +inline bool zerop (const cl_UP& x) { return x.ring()->zerop(x); } // Multiply. @@ -540,7 +540,7 @@ class cl_heap_univpoly_specialized_ring : public cl_heap_univpoly_ring { { cl_heap_univpoly_ring::fprint(stream,x); } - cl_boolean equal (const cl_UP_specialized& x, const cl_UP_specialized& y) + bool equal (const cl_UP_specialized& x, const cl_UP_specialized& y) { return cl_heap_univpoly_ring::equal(x,y); } @@ -548,7 +548,7 @@ class cl_heap_univpoly_specialized_ring : public cl_heap_univpoly_ring { { return The2(cl_UP_specialized)(cl_heap_univpoly_ring::zero()); } - cl_boolean zerop (const cl_UP_specialized& x) + bool zerop (const cl_UP_specialized& x) { return cl_heap_univpoly_ring::zerop(x); } diff --git a/include/cln/univpoly_complex.h b/include/cln/univpoly_complex.h index 6b8355b..3970d9d 100644 --- a/include/cln/univpoly_complex.h +++ b/include/cln/univpoly_complex.h @@ -64,7 +64,7 @@ class cl_heap_univpoly_complex_ring : public cl_heap_univpoly_ring { { cl_heap_univpoly_ring::fprint(stream,x); } - cl_boolean equal (const cl_UP_N& x, const cl_UP_N& y) + bool equal (const cl_UP_N& x, const cl_UP_N& y) { return cl_heap_univpoly_ring::equal(x,y); } @@ -72,7 +72,7 @@ class cl_heap_univpoly_complex_ring : public cl_heap_univpoly_ring { { return The2(cl_UP_N)(cl_heap_univpoly_ring::zero()); } - cl_boolean zerop (const cl_UP_N& x) + bool zerop (const cl_UP_N& x) { return cl_heap_univpoly_ring::zerop(x); } diff --git a/include/cln/univpoly_integer.h b/include/cln/univpoly_integer.h index ae9db0e..08b14b5 100644 --- a/include/cln/univpoly_integer.h +++ b/include/cln/univpoly_integer.h @@ -63,7 +63,7 @@ class cl_heap_univpoly_integer_ring : public cl_heap_univpoly_ring { { cl_heap_univpoly_ring::fprint(stream,x); } - cl_boolean equal (const cl_UP_I& x, const cl_UP_I& y) + bool equal (const cl_UP_I& x, const cl_UP_I& y) { return cl_heap_univpoly_ring::equal(x,y); } @@ -71,7 +71,7 @@ class cl_heap_univpoly_integer_ring : public cl_heap_univpoly_ring { { return The2(cl_UP_I)(cl_heap_univpoly_ring::zero()); } - cl_boolean zerop (const cl_UP_I& x) + bool zerop (const cl_UP_I& x) { return cl_heap_univpoly_ring::zerop(x); } diff --git a/include/cln/univpoly_modint.h b/include/cln/univpoly_modint.h index e312f06..5df4630 100644 --- a/include/cln/univpoly_modint.h +++ b/include/cln/univpoly_modint.h @@ -55,7 +55,7 @@ class cl_heap_univpoly_modint_ring : public cl_heap_univpoly_ring { { cl_heap_univpoly_ring::fprint(stream,x); } - cl_boolean equal (const cl_UP_MI& x, const cl_UP_MI& y) + bool equal (const cl_UP_MI& x, const cl_UP_MI& y) { return cl_heap_univpoly_ring::equal(x,y); } @@ -63,7 +63,7 @@ class cl_heap_univpoly_modint_ring : public cl_heap_univpoly_ring { { return The2(cl_UP_MI)(cl_heap_univpoly_ring::zero()); } - cl_boolean zerop (const cl_UP_MI& x) + bool zerop (const cl_UP_MI& x) { return cl_heap_univpoly_ring::zerop(x); } diff --git a/include/cln/univpoly_rational.h b/include/cln/univpoly_rational.h index 1eb1a24..a1a6283 100644 --- a/include/cln/univpoly_rational.h +++ b/include/cln/univpoly_rational.h @@ -64,7 +64,7 @@ class cl_heap_univpoly_rational_ring : public cl_heap_univpoly_ring { { cl_heap_univpoly_ring::fprint(stream,x); } - cl_boolean equal (const cl_UP_RA& x, const cl_UP_RA& y) + bool equal (const cl_UP_RA& x, const cl_UP_RA& y) { return cl_heap_univpoly_ring::equal(x,y); } @@ -72,7 +72,7 @@ class cl_heap_univpoly_rational_ring : public cl_heap_univpoly_ring { { return The2(cl_UP_RA)(cl_heap_univpoly_ring::zero()); } - cl_boolean zerop (const cl_UP_RA& x) + bool zerop (const cl_UP_RA& x) { return cl_heap_univpoly_ring::zerop(x); } diff --git a/include/cln/univpoly_real.h b/include/cln/univpoly_real.h index 8954e0e..59d302c 100644 --- a/include/cln/univpoly_real.h +++ b/include/cln/univpoly_real.h @@ -64,7 +64,7 @@ class cl_heap_univpoly_real_ring : public cl_heap_univpoly_ring { { cl_heap_univpoly_ring::fprint(stream,x); } - cl_boolean equal (const cl_UP_R& x, const cl_UP_R& y) + bool equal (const cl_UP_R& x, const cl_UP_R& y) { return cl_heap_univpoly_ring::equal(x,y); } @@ -72,7 +72,7 @@ class cl_heap_univpoly_real_ring : public cl_heap_univpoly_ring { { return The2(cl_UP_R)(cl_heap_univpoly_ring::zero()); } - cl_boolean zerop (const cl_UP_R& x) + bool zerop (const cl_UP_R& x) { return cl_heap_univpoly_ring::zerop(x); } diff --git a/src/base/digitseq/cl_2DS_div.cc b/src/base/digitseq/cl_2DS_div.cc index 997e396..4b9d8cf 100644 --- a/src/base/digitseq/cl_2DS_div.cc +++ b/src/base/digitseq/cl_2DS_div.cc @@ -55,15 +55,15 @@ namespace cln { // // Break-even-point. When in doubt, prefer to choose the standard algorithm. #if CL_USE_GMP - static inline cl_boolean cl_recip_suitable (uintC m, uintC n) // n <= m + static inline bool cl_recip_suitable (uintC m, uintC n) // n <= m { if (n < 2000) - return cl_false; + return false; else // when n >= 4400/(m/n)^2, i.e. (m/66)^2 > n { var uintC mq = floor(m,66); if ((mq >= bit(intCsize/2)) || (mq*mq > n)) - return cl_true; + return true; else - return cl_false; + return false; } } #else @@ -93,15 +93,15 @@ namespace cln { // 1.8*N / N : Newton for N >= 500 // 1.9*N / N : Newton for N >= 500 // 2.0*N / N : Newton for N >= 500 - static inline cl_boolean cl_recip_suitable (uintC m, uintC n) // n <= m + static inline bool cl_recip_suitable (uintC m, uintC n) // n <= m { if (n < 500) - return cl_false; + return false; else // when n >= 2100/(m/n)^2, i.e. (m/46)^2 > n { var uintC mq = floor(m,46); if ((mq >= bit(intCsize/2)) || (mq*mq > n)) - return cl_true; + return true; else - return cl_false; + return false; } } #endif diff --git a/src/base/digitseq/cl_DS.h b/src/base/digitseq/cl_DS.h index 76fbad3..a36e1ee 100644 --- a/src/base/digitseq/cl_DS.h +++ b/src/base/digitseq/cl_DS.h @@ -137,9 +137,9 @@ extern uintD* clear_loop_down (uintD* destptr, uintC count); #ifdef TEST_LOOPS -extern cl_boolean test_loop_up (const uintD* ptr, uintC count); +extern bool test_loop_up (const uintD* ptr, uintC count); -extern cl_boolean test_loop_down (const uintD* ptr, uintC count); +extern bool test_loop_down (const uintD* ptr, uintC count); #endif @@ -169,7 +169,7 @@ extern void not_loop_up (uintD* xptr, uintC count); #ifdef TEST_LOOPS -extern cl_boolean and_test_loop_up (const uintD* xptr, const uintD* yptr, uintC count); +extern bool and_test_loop_up (const uintD* xptr, const uintD* yptr, uintC count); extern cl_signean compare_loop_up (const uintD* xptr, const uintD* yptr, uintC count); @@ -259,7 +259,7 @@ extern void not_loop_down (uintD* xptr, uintC count); #ifdef TEST_LOOPS -extern cl_boolean and_test_loop_down (const uintD* xptr, const uintD* yptr, uintC count); +extern bool and_test_loop_down (const uintD* xptr, const uintD* yptr, uintC count); extern cl_signean compare_loop_down (const uintD* xptr, const uintD* yptr, uintC count); @@ -628,18 +628,18 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des // test_loop_up(ptr,count) // testet count (uintC>=0) Digits aufwärts ab ptr, ob darunter eines /=0 ist. // Ergebnis /=0, falls ja. - inline cl_boolean test_loop_up (const uintD* ptr, uintC count) - { dotimesC(count,count, { if (*ptr++) return cl_true; } ); - return cl_false; + inline bool test_loop_up (const uintD* ptr, uintC count) + { dotimesC(count,count, { if (*ptr++) return true; } ); + return false; } // Test-Schleife: // test_loop_down(ptr,count) // testet count (uintC>=0) Digits abwärts ab ptr, ob darunter eines /=0 ist. // Ergebnis /=0, falls ja. - inline cl_boolean test_loop_down (const uintD* ptr, uintC count) - { dotimesC(count,count, { if (*--ptr) return cl_true; } ); - return cl_false; + inline bool test_loop_down (const uintD* ptr, uintC count) + { dotimesC(count,count, { if (*--ptr) return true; } ); + return false; } #endif @@ -730,10 +730,10 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des // AND-Test-Schleife: // and_test_loop_up(xptr,yptr,count); // verknüpft count (uintC>=0) Digits aufwärts ab xptr und ab yptr durch AND -// und testet, ob sich dabei ein Digit /=0 ergibt. Ergebnis cl_true, falls ja. - inline cl_boolean and_test_loop_up (const uintD* xptr, const uintD* yptr, uintC count) - { dotimesC(count,count, { if (*xptr++ & *yptr++) return cl_true; } ); - return cl_false; +// und testet, ob sich dabei ein Digit /=0 ergibt. Ergebnis true, falls ja. + inline bool and_test_loop_up (const uintD* xptr, const uintD* yptr, uintC count) + { dotimesC(count,count, { if (*xptr++ & *yptr++) return true; } ); + return false; } // Vergleichsschleife: @@ -1444,10 +1444,10 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des // AND-Test-Schleife: // and_test_loop_down(xptr,yptr,count); // verknüpft count (uintC>=0) Digits abwärts ab xptr und ab yptr durch AND -// und testet, ob sich dabei ein Digit /=0 ergibt. Ergebnis cl_true, falls ja. - inline cl_boolean and_test_loop_down (const uintD* xptr, const uintD* yptr, uintC count) - { dotimesC(count,count, { if (*--xptr & *--yptr) return cl_true; } ); - return cl_false; +// und testet, ob sich dabei ein Digit /=0 ergibt. Ergebnis true, falls ja. + inline bool and_test_loop_down (const uintD* xptr, const uintD* yptr, uintC count) + { dotimesC(count,count, { if (*--xptr & *--yptr) return true; } ); + return false; } // Vergleichsschleife: @@ -2661,7 +2661,7 @@ extern void cl_UDS_mul_square (const uintD* sourceptr, uintC len, // UDS_sqrt(a_MSDptr,a_len,a_LSDptr, &b, squarep=) // > a_MSDptr/a_len/a_LSDptr: eine UDS // < NUDS b: Gaußklammer der Wurzel aus a -// < squarep: cl_true falls a = b^2, cl_false falls b^2 < a < (b+1)^2. +// < squarep: true falls a = b^2, false falls b^2 < a < (b+1)^2. // a wird nicht modifiziert. // Vorzeichenerweiterung von b ist erlaubt. // num_stack wird erniedrigt. @@ -2671,7 +2671,7 @@ extern void cl_UDS_mul_square (const uintD* sourceptr, uintC len, num_stack_alloc_1(ceiling(_a_len,2),(b_)->MSDptr=,); \ squarep_zuweisung cl_UDS_sqrt(a_MSDptr,_a_len,a_LSDptr,b_); \ } - extern cl_boolean cl_UDS_sqrt (const uintD* a_MSDptr, uintC a_len, const uintD* a_LSDptr, DS* b_); + extern bool cl_UDS_sqrt (const uintD* a_MSDptr, uintC a_len, const uintD* a_LSDptr, DS* b_); // Auxiliary function for approximately computing 1/x diff --git a/src/base/digitseq/cl_DS_div.cc b/src/base/digitseq/cl_DS_div.cc index 9de5fe1..a64519f 100644 --- a/src/base/digitseq/cl_DS_div.cc +++ b/src/base/digitseq/cl_DS_div.cc @@ -58,14 +58,14 @@ namespace cln { // Break-even-point, should be acceptable for both architectures. // When in doubt, prefer to choose the standard algorithm. #if CL_USE_GMP - static inline cl_boolean cl_recip_suitable (uintL m, uintL n) // m > n + static inline bool cl_recip_suitable (uintL m, uintL n) // m > n { if (n < 900) - return cl_false; + return false; else if (n < 2200) - return (cl_boolean)((m >= n+50) && (m < 2*n-600)); + return (m >= n+50) && (m < 2*n-600); else - return (cl_boolean)(m >= n+30); + return m >= n+30; } #else // Use the old default values from CLN version <= 1.0.3 as a crude estimate. @@ -95,14 +95,14 @@ namespace cln { // n = 2000: Newton faster for m >= 2020 // n = 2500: Newton faster for m >= 2520 // n = 5000: Newton faster for m >= 5020 - static inline cl_boolean cl_recip_suitable (uintL m, uintL n) // m > n + static inline bool cl_recip_suitable (uintL m, uintL n) // m > n { if (n < 500) - return cl_false; + return false; else if (n < 1000) - return (cl_boolean)((m >= n+30) && (m < 3*n-600)); + return (m >= n+30) && (m < 3*n-600); else - return (cl_boolean)(m >= n+20); + return m >= n+20; } #endif diff --git a/src/base/digitseq/cl_DS_mul.cc b/src/base/digitseq/cl_DS_mul.cc index 76be717..314e4cb 100644 --- a/src/base/digitseq/cl_DS_mul.cc +++ b/src/base/digitseq/cl_DS_mul.cc @@ -354,23 +354,23 @@ namespace cln { const unsigned int cl_fftm_threshold2 = 2*cl_fftm_threshold; // len1 > cl_fftm_threshold1 && len2 > cl_fftm_threshold2 // && len1 >= cl_fftm_threshold1 + cl_fftm_threshold/(len2-cl_fftm_threshold1)*(cl_fftm_threshold-cl_fftm_threshold1). - static inline cl_boolean cl_fftm_suitable (uintC len1, uintC len2) + static inline bool cl_fftm_suitable (uintC len1, uintC len2) { if (len1 >= cl_fftm_threshold) - return cl_true; + return true; if (len1 > cl_fftm_threshold1) if (len2 > cl_fftm_threshold2) { const unsigned int prod_threshold = cl_fftm_threshold*(cl_fftm_threshold-cl_fftm_threshold1); if (len1-cl_fftm_threshold1 >= prod_threshold) - return cl_true; + return true; if (len2-cl_fftm_threshold1 >= prod_threshold) - return cl_true; + return true; var uint32 hi; var uint32 lo; mulu32(len1-cl_fftm_threshold1,len2-cl_fftm_threshold1, hi=,lo=); if (hi > 0 || lo >= prod_threshold) - return cl_true; + return true; } - return cl_false; + return false; } #if 0 // Doesn't seem to be worth the effort diff --git a/src/base/digitseq/cl_DS_mul_kara.h b/src/base/digitseq/cl_DS_mul_kara.h index 27704d4..8531b5b 100644 --- a/src/base/digitseq/cl_DS_mul_kara.h +++ b/src/base/digitseq/cl_DS_mul_kara.h @@ -44,7 +44,7 @@ if (sourceptr1 == sourceptr2) if (len1 == len2) { mulu_karatsuba_square(sourceptr1,len1,destptr); return; } - var cl_boolean first_part = cl_true; // Flag, ob jetzt das erste Teilprodukt berechnet wird + var bool first_part = true; // Flag, ob jetzt das erste Teilprodukt berechnet wird if (len2 >= 2*len1) { CL_SMALL_ALLOCA_STACK; // Teilprodukte von jeweils len1 mal len1 Digits bilden: @@ -130,7 +130,7 @@ if (first_part) { copy_loop_lsp(prod_LSDptr,destptr,2*len1); destptr = destptr lspop len1; - first_part = cl_false; + first_part = false; } else { var uintD carry = diff --git a/src/base/digitseq/cl_DS_sqrt.cc b/src/base/digitseq/cl_DS_sqrt.cc index d3afef7..9b0f99c 100644 --- a/src/base/digitseq/cl_DS_sqrt.cc +++ b/src/base/digitseq/cl_DS_sqrt.cc @@ -29,8 +29,8 @@ namespace cln { // Newton faster for 3200= 3200); } + static inline bool cl_recipsqrt_suitable (uintC n) + { return n >= 3200; } #else // Use the old default values from CLN version <= 1.0.3 as a crude estimate. // Time for square root of a_len = 2*N by b_len = N digits, @@ -47,8 +47,8 @@ namespace cln { // 5000 24.1 10.7 // 10000 98 23.2 // -----> Newton faster for 1570 <= N <= 1790 and for N >= 2100. - static inline cl_boolean cl_recipsqrt_suitable (uintC n) - { return (cl_boolean)(n >= 2100); } + static inline bool cl_recipsqrt_suitable (uintC n) + { return n >= 2100; } #endif // Bildet zu einer Unsigned Digit sequence a die Wurzel @@ -56,7 +56,7 @@ namespace cln { // squarep = cl_UDS_sqrt(a_MSDptr,a_len,a_LSDptr, &b); // > a_MSDptr/a_len/a_LSDptr: eine UDS // < NUDS b: Gaußklammer der Wurzel aus a -// < squarep: cl_true falls a = b^2, cl_false falls b^2 < a < (b+1)^2. +// < squarep: true falls a = b^2, false falls b^2 < a < (b+1)^2. // Methode: // erst A normalisieren. A=0 --> B=0, fertig. // Wähle n so, daß beta^(2n-2) <= A < beta^(2n). @@ -102,12 +102,12 @@ namespace cln { // Ergebnis ist [b[n-1],...,b[0]] * 2^(-s), schiebe also im Speicher // [b[n],...,b[0]] um s+1 Bits nach rechts. // Das Ergebnis ist eine NUDS der Länge n. -cl_boolean cl_UDS_sqrt (const uintD* a_MSDptr, uintC a_len, const uintD* a_LSDptr, DS* b_) +bool cl_UDS_sqrt (const uintD* a_MSDptr, uintC a_len, const uintD* a_LSDptr, DS* b_) { // A normalisieren: while ((a_len>0) && (mspref(a_MSDptr,0)==0)) { msshrink(a_MSDptr); a_len--; } if (a_len==0) // A=0 -> B := NUDS 0 - { b_->LSDptr = b_->MSDptr; b_->len = 0; return cl_true; } + { b_->LSDptr = b_->MSDptr; b_->len = 0; return true; } CL_ALLOCA_STACK; // n und s bestimmen: var uintC n = ceiling(a_len,2); // a_len = 2n oder 2n-1, n>0. @@ -195,9 +195,9 @@ cl_boolean cl_UDS_sqrt (const uintD* a_MSDptr, uintC a_len, const uintD* a_LSDpt shiftright_loop_msp(b_->MSDptr,n,s); // Teste, ob alle a[n],...,a[0]=0 sind: if (test_loop_msp(a_MSDptr mspop (n-1),n+1)) - return cl_false; + return false; else - return cl_true; // ja -> Wurzel exakt + return true; // ja -> Wurzel exakt } // Platz für B belegen: { var uintD* b_MSDptr = b_->MSDptr mspop -1; // ab hier n+1 Digits Platz @@ -354,9 +354,9 @@ cl_boolean cl_UDS_sqrt (const uintD* a_MSDptr, uintC a_len, const uintD* a_LSDpt b_->MSDptr = b_MSDptr; b_->len = n; b_->LSDptr = b_ptr; // Teste, ob alle a[n],...,a[0]=0 sind: if (test_loop_msp(a_mptr,n+1)) - { return cl_false; } + { return false; } else - { return cl_true; } // ja -> Wurzel exakt + { return true; } // ja -> Wurzel exakt }} } // Bit complexity (N := a_len): O(M(N)). diff --git a/src/base/hash/cl_hash.h b/src/base/hash/cl_hash.h index 92576f3..92fbe8b 100644 --- a/src/base/hash/cl_hash.h +++ b/src/base/hash/cl_hash.h @@ -33,7 +33,7 @@ protected: long * _slots; // vector of length _modulus htxentry * _entries; // vector of length _size void* _total_vector; - cl_boolean (*_garcol_fun) (cl_heap*); // Function to make room in the table. + bool (*_garcol_fun) (cl_heap*); // Function to make room in the table. // Putting some intelligent function here turns // a normal hash table into a "weak" hash table. public: @@ -144,7 +144,7 @@ protected: } private: // Default function to make room in a hash table. - static cl_boolean no_garcol (cl_heap* ht) { unused ht; return cl_false; } + static bool no_garcol (cl_heap* ht) { unused ht; return false; } }; template diff --git a/src/base/hash/cl_hash1weak.h b/src/base/hash/cl_hash1weak.h index 071cf85..5766dd9 100644 --- a/src/base/hash/cl_hash1weak.h +++ b/src/base/hash/cl_hash1weak.h @@ -27,9 +27,9 @@ struct cl_heap_weak_hashtable_1 : public cl_heap_hashtable_1 &); + bool (* const _maygc_htentry) (const cl_htentry1&); // Constructor. - cl_heap_weak_hashtable_1 (cl_boolean (*maygc_htentry) (const cl_htentry1&)) + cl_heap_weak_hashtable_1 (bool (*maygc_htentry) (const cl_htentry1&)) : cl_heap_hashtable_1 (), _maygc_htentry (maygc_htentry) { @@ -39,14 +39,14 @@ private: // Garbage collection. // Before growing the table, we check whether we can remove unused // entries. - static cl_boolean garcol (cl_heap* _ht) + static bool garcol (cl_heap* _ht) { var cl_heap_weak_hashtable_1* ht = (cl_heap_weak_hashtable_1*)_ht; // Now ht->_garcol_fun = garcol. // It is not worth doing a garbage collection if the table // is small, say, has fewer than 100 entries. if (ht->_count < 100) - return cl_false; + return false; // Do a garbage collection. var long removed = 0; for (long i = 0; i < ht->_size; i++) @@ -71,24 +71,24 @@ private: } if (removed == 0) // Unsuccessful. Let the table grow immediately. - return cl_false; + return false; else if (2*removed < ht->_count) { // Table shrank by less than a factor of 1/1.5. // Don't expand the table now, but expand it next time. ht->_garcol_fun = cl_heap_weak_hashtable_1::garcol_nexttime; - return cl_true; + return true; } else { // Table shrank much. Don't expand the table now, // and try a GC next time. - return cl_true; + return true; } } - static cl_boolean garcol_nexttime (cl_heap* _ht) + static bool garcol_nexttime (cl_heap* _ht) { var cl_heap_weak_hashtable_1* ht = (cl_heap_weak_hashtable_1*)_ht; // Now ht->_garcol_fun = garcol_nexttime. ht->_garcol_fun = cl_heap_weak_hashtable_1::garcol; - return cl_false; + return false; } }; diff --git a/src/base/hash/cl_hash2weak.h b/src/base/hash/cl_hash2weak.h index f14d585..5a2db45 100644 --- a/src/base/hash/cl_hash2weak.h +++ b/src/base/hash/cl_hash2weak.h @@ -27,9 +27,9 @@ struct cl_heap_weak_hashtable_2 : public cl_heap_hashtable_2 &); + bool (* const _maygc_htentry) (const cl_htentry2&); // Constructor. - cl_heap_weak_hashtable_2 (cl_boolean (*maygc_htentry) (const cl_htentry2&)) + cl_heap_weak_hashtable_2 (bool (*maygc_htentry) (const cl_htentry2&)) : cl_heap_hashtable_2 (), _maygc_htentry (maygc_htentry) { @@ -39,14 +39,14 @@ private: // Garbage collection. // Before growing the table, we check whether we can remove unused // entries. - static cl_boolean garcol (cl_heap* _ht) + static bool garcol (cl_heap* _ht) { var cl_heap_weak_hashtable_2* ht = (cl_heap_weak_hashtable_2*)_ht; // Now ht->_garcol_fun = garcol. // It is not worth doing a garbage collection if the table // is small, say, has fewer than 100 entries. if (ht->_count < 100) - return cl_false; + return false; // Do a garbage collection. var long removed = 0; for (long i = 0; i < ht->_size; i++) @@ -71,24 +71,24 @@ private: } if (removed == 0) // Unsuccessful. Let the table grow immediately. - return cl_false; + return false; else if (2*removed < ht->_count) { // Table shrank by less than a factor of 1/1.5. // Don't expand the table now, but expand it next time. ht->_garcol_fun = garcol_nexttime; - return cl_true; + return true; } else { // Table shrank much. Don't expand the table now, // and try a GC next time. - return cl_true; + return true; } } - static cl_boolean garcol_nexttime (cl_heap* _ht) + static bool garcol_nexttime (cl_heap* _ht) { var cl_heap_weak_hashtable_2* ht = (cl_heap_weak_hashtable_2*)_ht; // Now ht->_garcol_fun = garcol_nexttime. ht->_garcol_fun = cl_heap_weak_hashtable_2::garcol; - return cl_false; + return false; } }; diff --git a/src/base/hash/cl_hashuniqweak.h b/src/base/hash/cl_hashuniqweak.h index fd1793f..79d6cc4 100644 --- a/src/base/hash/cl_hashuniqweak.h +++ b/src/base/hash/cl_hashuniqweak.h @@ -38,14 +38,14 @@ private: // Garbage collection. // Before growing the table, we check whether we can remove unused // entries. - static cl_boolean garcol (cl_heap* _ht) + static bool garcol (cl_heap* _ht) { var cl_heap_weak_hashtable_uniq* ht = (cl_heap_weak_hashtable_uniq*)_ht; // Now ht->_garcol_fun = garcol. // It is not worth doing a garbage collection if the table // is small, say, has fewer than 100 entries. if (ht->_count < 100) - return cl_false; + return false; // Do a garbage collection. var long removed = 0; for (long i = 0; i < ht->_size; i++) @@ -71,24 +71,24 @@ private: } if (removed == 0) // Unsuccessful. Let the table grow immediately. - return cl_false; + return false; else if (2*removed < ht->_count) { // Table shrank by less than a factor of 1/1.5. // Don't expand the table now, but expand it next time. ht->_garcol_fun = garcol_nexttime; - return cl_true; + return true; } else { // Table shrank much. Don't expand the table now, // and try a GC next time. - return cl_true; + return true; } } - static cl_boolean garcol_nexttime (cl_heap* _ht) + static bool garcol_nexttime (cl_heap* _ht) { var cl_heap_weak_hashtable_uniq* ht = (cl_heap_weak_hashtable_uniq*)_ht; // Now ht->_garcol_fun = garcol_nexttime. ht->_garcol_fun = garcol; - return cl_false; + return false; } }; diff --git a/src/base/hash/cl_rcpointer2_hashweak_rcpointer.cc b/src/base/hash/cl_rcpointer2_hashweak_rcpointer.cc index cd3ef24..392cd4f 100644 --- a/src/base/hash/cl_rcpointer2_hashweak_rcpointer.cc +++ b/src/base/hash/cl_rcpointer2_hashweak_rcpointer.cc @@ -29,7 +29,7 @@ cl_class cl_class_weak_hashtable_from_rcpointer2_to_rcpointer = { // These are not inline, because they tend to duplicate a lot of template code. -cl_wht_from_rcpointer2_to_rcpointer::cl_wht_from_rcpointer2_to_rcpointer (cl_boolean (*maygc_htentry) (const cl_htentry_from_rcpointer2_to_rcpointer&)) +cl_wht_from_rcpointer2_to_rcpointer::cl_wht_from_rcpointer2_to_rcpointer (bool (*maygc_htentry) (const cl_htentry_from_rcpointer2_to_rcpointer&)) { var cl_heap_weak_hashtable_from_rcpointer2_to_rcpointer* ht = new cl_heap_weak_hashtable_from_rcpointer2_to_rcpointer (maygc_htentry); ht->refcount = 1; diff --git a/src/base/hash/cl_rcpointer2_hashweak_rcpointer.h b/src/base/hash/cl_rcpointer2_hashweak_rcpointer.h index 434dae5..3fcd0c1 100644 --- a/src/base/hash/cl_rcpointer2_hashweak_rcpointer.h +++ b/src/base/hash/cl_rcpointer2_hashweak_rcpointer.h @@ -30,7 +30,7 @@ typedef _cl_hashtable_iterator cl_hasht struct cl_wht_from_rcpointer2_to_rcpointer : public cl_rcpointer { // Constructors. - cl_wht_from_rcpointer2_to_rcpointer (cl_boolean (*maygc_htentry) (const cl_htentry_from_rcpointer2_to_rcpointer&)); + cl_wht_from_rcpointer2_to_rcpointer (bool (*maygc_htentry) (const cl_htentry_from_rcpointer2_to_rcpointer&)); cl_wht_from_rcpointer2_to_rcpointer (const cl_wht_from_rcpointer2_to_rcpointer&); // Assignment operators. cl_wht_from_rcpointer2_to_rcpointer& operator= (const cl_wht_from_rcpointer2_to_rcpointer&); diff --git a/src/base/hash/cl_rcpointer_hashweak_rcpointer.cc b/src/base/hash/cl_rcpointer_hashweak_rcpointer.cc index 6d134a5..c711d7e 100644 --- a/src/base/hash/cl_rcpointer_hashweak_rcpointer.cc +++ b/src/base/hash/cl_rcpointer_hashweak_rcpointer.cc @@ -29,7 +29,7 @@ cl_class cl_class_weak_hashtable_from_rcpointer_to_rcpointer = { // These are not inline, because they tend to duplicate a lot of template code. -cl_wht_from_rcpointer_to_rcpointer::cl_wht_from_rcpointer_to_rcpointer (cl_boolean (*maygc_htentry) (const cl_htentry_from_rcpointer_to_rcpointer&)) +cl_wht_from_rcpointer_to_rcpointer::cl_wht_from_rcpointer_to_rcpointer (bool (*maygc_htentry) (const cl_htentry_from_rcpointer_to_rcpointer&)) { var cl_heap_weak_hashtable_from_rcpointer_to_rcpointer* ht = new cl_heap_weak_hashtable_from_rcpointer_to_rcpointer (maygc_htentry); ht->refcount = 1; diff --git a/src/base/hash/cl_rcpointer_hashweak_rcpointer.h b/src/base/hash/cl_rcpointer_hashweak_rcpointer.h index cda04e8..6616307 100644 --- a/src/base/hash/cl_rcpointer_hashweak_rcpointer.h +++ b/src/base/hash/cl_rcpointer_hashweak_rcpointer.h @@ -25,7 +25,7 @@ typedef _cl_hashtable_iterator cl_hashta struct cl_wht_from_rcpointer_to_rcpointer : public cl_rcpointer { // Constructors. - cl_wht_from_rcpointer_to_rcpointer (cl_boolean (*maygc_htentry) (const cl_htentry_from_rcpointer_to_rcpointer&)); + cl_wht_from_rcpointer_to_rcpointer (bool (*maygc_htentry) (const cl_htentry_from_rcpointer_to_rcpointer&)); cl_wht_from_rcpointer_to_rcpointer (const cl_wht_from_rcpointer_to_rcpointer&); // Assignment operators. cl_wht_from_rcpointer_to_rcpointer& operator= (const cl_wht_from_rcpointer_to_rcpointer&); diff --git a/src/base/output/cl_prin_globals.cc b/src/base/output/cl_prin_globals.cc index fcfea5f..543c865 100644 --- a/src/base/output/cl_prin_globals.cc +++ b/src/base/output/cl_prin_globals.cc @@ -18,10 +18,10 @@ cl_print_flags default_print_flags; AT_INITIALIZATION(default_print_flags) { default_print_flags.rational_base = 10; - default_print_flags.rational_readably = cl_false; - default_print_flags.float_readably = cl_false; + default_print_flags.rational_readably = false; + default_print_flags.float_readably = false; default_print_flags.default_float_format = float_format_ffloat; - default_print_flags.complex_readably = cl_false; + default_print_flags.complex_readably = false; default_print_flags.vector_syntax = vsyntax_pretty; default_print_flags.univpoly_varname = "x"; } diff --git a/src/base/ring/cl_no_ring.cc b/src/base/ring/cl_no_ring.cc index 6c4f7a0..5904864 100644 --- a/src/base/ring/cl_no_ring.cc +++ b/src/base/ring/cl_no_ring.cc @@ -79,14 +79,14 @@ static void dummy_fprint (cl_heap_ring* R, std::ostream& stream, const _cl_ring_ unused stream; throw uninitialized_exception(x); } -static cl_boolean dummy_equal (cl_heap_ring* R, const _cl_ring_element& x, const _cl_ring_element& y) +static bool dummy_equal (cl_heap_ring* R, const _cl_ring_element& x, const _cl_ring_element& y) { unused R; throw uninitialized_exception(x, y); } #define dummy_zero dummy_op0 -static cl_boolean dummy_zerop (cl_heap_ring* R, const _cl_ring_element& x) +static bool dummy_zerop (cl_heap_ring* R, const _cl_ring_element& x) { unused R; throw uninitialized_exception(x); diff --git a/src/complex/cl_C.h b/src/complex/cl_C.h index 8e96f14..4089808 100644 --- a/src/complex/cl_C.h +++ b/src/complex/cl_C.h @@ -48,28 +48,28 @@ inline cl_N::cl_N (cl_heap_complex* ptr) #endif // Type tests -inline cl_boolean realp (const cl_N& x) +inline bool realp (const cl_N& x) { if (x.pointer_p()) if (x.heappointer->type == &cl_class_complex) - return cl_false; - return cl_true; + return false; + return true; } -inline cl_boolean complexp (const cl_N& x) +inline bool complexp (const cl_N& x) { if (x.pointer_p()) if (x.heappointer->type == &cl_class_complex) - return cl_true; - return cl_false; + return true; + return false; } // Comparison with a fixnum. -inline cl_boolean eq (const cl_N& x, sint32 y) +inline bool eq (const cl_N& x, sint32 y) { - return (cl_boolean)(x.word == cl_combine(cl_FN_tag,y)); + return x.word == cl_combine(cl_FN_tag,y); } -inline cl_boolean exact_zerop (const cl_N& x) +inline bool exact_zerop (const cl_N& x) { return eq(x,0); } @@ -82,10 +82,10 @@ class cl_C : public cl_N { public: }; -inline cl_boolean realp (const cl_C& x) - { unused x; return cl_false; } -inline cl_boolean complexp (const cl_C& x) - { unused x; return cl_true; } +inline bool realp (const cl_C& x) + { unused x; return false; } +inline bool complexp (const cl_C& x) + { unused x; return true; } // Liefert zu reellen Zahlen a und b /= Fixnum 0 die komplexe Zahl a+bi. diff --git a/src/complex/elem/cl_C_equal.cc b/src/complex/elem/cl_C_equal.cc index b028106..813b8c4 100644 --- a/src/complex/elem/cl_C_equal.cc +++ b/src/complex/elem/cl_C_equal.cc @@ -14,7 +14,7 @@ namespace cln { -cl_boolean equal (const cl_N& x, const cl_N& y) +bool equal (const cl_N& x, const cl_N& y) { // Methode: // Falls beide reell, klar. @@ -31,7 +31,7 @@ cl_boolean equal (const cl_N& x, const cl_N& y) DeclareType(cl_C,y); // x reell, y komplex if (!zerop(imagpart(y))) - return cl_false; + return false; return equal(x,realpart(y)); } } else { @@ -40,16 +40,16 @@ cl_boolean equal (const cl_N& x, const cl_N& y) DeclareType(cl_R,y); // x komplex, y reell if (!zerop(imagpart(x))) - return cl_false; + return false; return equal(realpart(x),y); } else { DeclareType(cl_C,y); // x,y beide komplex if (!equal(realpart(x),realpart(y))) - return cl_false; + return false; if (!equal(imagpart(x),imagpart(y))) - return cl_false; - return cl_true; + return false; + return true; } } } diff --git a/src/complex/elem/cl_C_zerop.cc b/src/complex/elem/cl_C_zerop.cc index 50450d1..3dd6c7c 100644 --- a/src/complex/elem/cl_C_zerop.cc +++ b/src/complex/elem/cl_C_zerop.cc @@ -14,7 +14,7 @@ namespace cln { -cl_boolean zerop (const cl_N& x) +bool zerop (const cl_N& x) { if (realp(x)) { DeclareType(cl_R,x); @@ -26,8 +26,8 @@ cl_boolean zerop (const cl_N& x) var const cl_R& b = imagpart(x); if (zerop(a)) if (zerop(b)) - return cl_true; - return cl_false; + return true; + return false; } } diff --git a/src/complex/input/cl_N_from_string.cc b/src/complex/input/cl_N_from_string.cc index 8b9de6f..32fee76 100644 --- a/src/complex/input/cl_N_from_string.cc +++ b/src/complex/input/cl_N_from_string.cc @@ -18,7 +18,7 @@ cl_read_flags cl_N_read_flags = { syntax_number, lsyntax_all, 10, - { float_format_ffloat, float_format_lfloat_min, cl_true } + { float_format_ffloat, float_format_lfloat_min, true } }; cl_N::cl_N (const char * string) diff --git a/src/complex/input/cl_N_read.cc b/src/complex/input/cl_N_read.cc index 76fabe2..cc9a043 100644 --- a/src/complex/input/cl_N_read.cc +++ b/src/complex/input/cl_N_read.cc @@ -164,29 +164,29 @@ not_rational_syntax: } var const char * ptr_after_sign = ptr; var const char * ptr_after_intpart = skip_digits(ptr_after_sign,string_limit,float_base); - var cl_boolean have_dot = cl_false; + var bool have_dot = false; var const char * ptr_before_fracpart = ptr_after_intpart; var const char * ptr_after_fracpart = ptr_after_intpart; ptr = ptr_after_intpart; if (ptr != string_limit) if (*ptr == '.') { - have_dot = cl_true; + have_dot = true; ptr_before_fracpart = ptr+1; ptr_after_fracpart = skip_digits(ptr_before_fracpart,string_limit,float_base); } ptr = ptr_after_fracpart; var char exponent_marker; - var cl_boolean have_exponent; + var bool have_exponent; var const char * ptr_in_exponent = ptr; var const char * ptr_after_exponent = ptr; if ((ptr == string_limit) || !(((*ptr >= '0') && (*ptr <= '9')) || ((*ptr >= 'A') && (*ptr <= 'Z') && (*ptr != 'I')) || ((*ptr >= 'a') && (*ptr <= 'z') && (*ptr != 'i')) || (*ptr == '.') || (*ptr == '/'))) { // No exponent. - have_exponent = cl_false; + have_exponent = false; // Must have at least one fractional part digit. if (ptr_after_fracpart == ptr_before_fracpart) goto not_float_syntax; exponent_marker = 'E'; } else { - have_exponent = cl_true; + have_exponent = true; // Must have at least one digit. if (ptr_after_sign == ptr_after_intpart) if (ptr_after_fracpart == ptr_before_fracpart) diff --git a/src/complex/input/cl_N_read_stream.cc b/src/complex/input/cl_N_read_stream.cc index 3f119c4..330f068 100644 --- a/src/complex/input/cl_N_read_stream.cc +++ b/src/complex/input/cl_N_read_stream.cc @@ -24,17 +24,17 @@ public: char* end_pointer (void) { return buffer+index; } }; -static cl_boolean number_char_p (char c) +static bool number_char_p (char c) { if ((c >= '0') && (c <= '9')) - return cl_true; + return true; if (((c >= 'A') && (c <= 'Z')) || ((c >= 'a') && (c <= 'z'))) - return cl_true; + return true; switch (c) { case '+': case '-': case '.': case '_': case '/': - return cl_true; + return true; default: - return cl_false; + return false; } } diff --git a/src/complex/misc/cl_C_expt_I.cc b/src/complex/misc/cl_C_expt_I.cc index 64e1da0..1143dea 100644 --- a/src/complex/misc/cl_C_expt_I.cc +++ b/src/complex/misc/cl_C_expt_I.cc @@ -49,7 +49,7 @@ const cl_N expt (const cl_N& x, const cl_I& y) return expt(x,y); } if (eq(y,0)) { return 1; } // y=0 -> Ergebnis 1 - var cl_boolean y_negative = minusp(y); + var bool y_negative = minusp(y); var cl_I abs_y = (y_negative ? -y : y); // Betrag von y nehmen var cl_N z = expt_pos(x,abs_y); // (expt x (abs y)) return (y_negative ? recip(z) : z); // evtl. noch Kehrwert nehmen diff --git a/src/complex/misc/cl_N_as.cc b/src/complex/misc/cl_N_as.cc index 15cccfd..003b6c3 100644 --- a/src/complex/misc/cl_N_as.cc +++ b/src/complex/misc/cl_N_as.cc @@ -16,9 +16,9 @@ namespace cln { // Cf. cl_N_p in cl_C_ring.cc. // But here, for better inlining in g++, it is preferrable to finish every -// alternative with either "return cl_true;" or "return cl_false;". +// alternative with either "return true;" or "return false;". -inline cl_boolean cl_N_p (const cl_number& x) +inline bool cl_N_p (const cl_number& x) { if (!x.pointer_p()) switch (x.nonpointer_tag()) { @@ -27,12 +27,12 @@ inline cl_boolean cl_N_p (const cl_number& x) #if defined(CL_WIDE_POINTERS) case cl_FF_tag: #endif - return cl_true; + return true; } else if (x.pointer_type()->flags & cl_class_flags_subclass_complex) - return cl_true; - return cl_false; + return true; + return false; } const cl_N& cl_N_As (const cl_number& x, const char * filename, int line) diff --git a/src/complex/ring/cl_C_ring.cc b/src/complex/ring/cl_C_ring.cc index 5a576ec..296971a 100644 --- a/src/complex/ring/cl_C_ring.cc +++ b/src/complex/ring/cl_C_ring.cc @@ -23,7 +23,7 @@ static void N_fprint (cl_heap_ring* R, std::ostream& stream, const _cl_ring_elem fprint(stream,The(cl_N)(x)); } -static cl_boolean N_equal (cl_heap_ring* R, const _cl_ring_element& x, const _cl_ring_element& y) +static bool N_equal (cl_heap_ring* R, const _cl_ring_element& x, const _cl_ring_element& y) { unused R; return equal(The(cl_N)(x),The(cl_N)(y)); @@ -34,7 +34,7 @@ static const _cl_ring_element N_zero (cl_heap_ring* R) return _cl_ring_element(R, (cl_N)0); } -static cl_boolean N_zerop (cl_heap_ring* R, const _cl_ring_element& x) +static bool N_zerop (cl_heap_ring* R, const _cl_ring_element& x) { unused R; // Here we return true only if x is the *exact* zero. Because we @@ -84,12 +84,10 @@ static const _cl_ring_element N_expt_pos (cl_heap_ring* R, const _cl_ring_elemen return _cl_ring_element(R, expt(The(cl_N)(x),y)); } -static cl_boolean cl_N_p (const cl_number& x) +static bool cl_N_p (const cl_number& x) { - return (cl_boolean) - (!x.pointer_p() - || (x.pointer_type()->flags & cl_class_flags_subclass_complex) != 0 - ); + return (!x.pointer_p() + || (x.pointer_type()->flags & cl_class_flags_subclass_complex) != 0); } static cl_ring_setops N_setops = { diff --git a/src/complex/transcendental/cl_C_expt_C.cc b/src/complex/transcendental/cl_C_expt_C.cc index 5e042c9..16d6d83 100644 --- a/src/complex/transcendental/cl_C_expt_C.cc +++ b/src/complex/transcendental/cl_C_expt_C.cc @@ -152,7 +152,7 @@ const cl_N expt (const cl_N& x, const cl_N& y) if (rationalp(realpart(x)) && rationalp(imagpart(x))) goto complex_rational; } - if (cl_false) { + if (false) { complex_rational: // x in Q(i) var uintC k = power2p(n); diff --git a/src/float/base/cl_F_globals.cc b/src/float/base/cl_F_globals.cc index 573d525..a7c5678 100644 --- a/src/float/base/cl_F_globals.cc +++ b/src/float/base/cl_F_globals.cc @@ -11,7 +11,7 @@ namespace cln { -cl_boolean cl_inhibit_floating_point_underflow = cl_false; +bool cl_inhibit_floating_point_underflow = false; float_format_t default_float_format = float_format_ffloat; diff --git a/src/float/cl_F.h b/src/float/cl_F.h index a62329d..900b01f 100644 --- a/src/float/cl_F.h +++ b/src/float/cl_F.h @@ -75,12 +75,12 @@ extern cl_class cl_class_dfloat; extern cl_class cl_class_lfloat; // Type test. -inline cl_boolean longfloatp (const cl_F& x) +inline bool longfloatp (const cl_F& x) { if (x.pointer_p()) if (x.pointer_type() == &cl_class_lfloat) - return cl_true; - return cl_false; + return true; + return false; } // Macro: verteilt je nach Float-Typ eines Floats x auf 4 Statements. diff --git a/src/float/dfloat/algebraic/cl_DF_sqrt.cc b/src/float/dfloat/algebraic/cl_DF_sqrt.cc index 201e2e3..42af650 100644 --- a/src/float/dfloat/algebraic/cl_DF_sqrt.cc +++ b/src/float/dfloat/algebraic/cl_DF_sqrt.cc @@ -59,7 +59,7 @@ const cl_DF sqrt (const cl_DF& x) #endif {CL_ALLOCA_STACK; var DS wurzel; - var cl_boolean exactp; + var bool exactp; UDS_sqrt(arrayMSDptr(mant,128/intDsize),128/intDsize,arrayLSDptr(mant,128/intDsize), &wurzel, exactp=); // wurzel = isqrt(2^74_75 * mant), eine 64-Bit-Zahl. mantx = get_64_Dptr(wurzel.MSDptr); @@ -117,7 +117,7 @@ const cl_DF sqrt (const cl_DF& x) #endif {CL_ALLOCA_STACK; var DS wurzel; - var cl_boolean exactp; + var bool exactp; UDS_sqrt(arrayMSDptr(mant,128/intDsize),128/intDsize,arrayLSDptr(mant,128/intDsize), &wurzel, exactp=); // wurzel = isqrt(2^74_75 * mant), eine 64-Bit-Zahl. {var uintD* ptr = wurzel.MSDptr; diff --git a/src/float/dfloat/conv/cl_I_to_double.cc b/src/float/dfloat/conv/cl_I_to_double.cc index 8cb841e..285e189 100644 --- a/src/float/dfloat/conv/cl_I_to_double.cc +++ b/src/float/dfloat/conv/cl_I_to_double.cc @@ -26,7 +26,7 @@ double double_approx (const cl_I& x) // NDS zu |x|>0 bilden: var const uintD* MSDptr; var uintC len; - I_to_NDS_nocopy(abs_x, MSDptr=,len=,,cl_false,); + I_to_NDS_nocopy(abs_x, MSDptr=,len=,,false,); // MSDptr/len/LSDptr ist die NDS zu x, len>0. // Führende Digits holen: Brauche DF_mant_len+1 Bits, dazu intDsize // Bits (die NDS kann mit bis zu intDsize Nullbits anfangen). diff --git a/src/float/dfloat/elem/cl_DF_from_I.cc b/src/float/dfloat/elem/cl_DF_from_I.cc index d07225b..e07071a 100644 --- a/src/float/dfloat/elem/cl_DF_from_I.cc +++ b/src/float/dfloat/elem/cl_DF_from_I.cc @@ -38,7 +38,7 @@ const cl_DF cl_I_to_DF (const cl_I& x) // NDS zu |x|>0 bilden: var const uintD* MSDptr; var uintC len; - I_to_NDS_nocopy(abs_x, MSDptr=,len=,,cl_false,); + I_to_NDS_nocopy(abs_x, MSDptr=,len=,,false,); // MSDptr/len/LSDptr ist die NDS zu x, len>0. // Führende Digits holen: Brauche DF_mant_len+1 Bits, dazu intDsize // Bits (die NDS kann mit bis zu intDsize Nullbits anfangen). diff --git a/src/float/dfloat/elem/cl_DF_minusp.cc b/src/float/dfloat/elem/cl_DF_minusp.cc index e708a8e..77f4ffa 100644 --- a/src/float/dfloat/elem/cl_DF_minusp.cc +++ b/src/float/dfloat/elem/cl_DF_minusp.cc @@ -14,12 +14,12 @@ namespace cln { MAYBE_INLINE -cl_boolean minusp (const cl_DF& x) +bool minusp (const cl_DF& x) { #if (cl_word_size==64) - return (cl_boolean) ((sint64)TheDfloat(x)->dfloat_value_semhi < 0); + return (sint64)TheDfloat(x)->dfloat_value_semhi < 0; #else - return (cl_boolean) ((sint32)TheDfloat(x)->dfloat_value_semhi < 0); + return (sint32)TheDfloat(x)->dfloat_value_semhi < 0; #endif } diff --git a/src/float/dfloat/elem/cl_DF_plusp.cc b/src/float/dfloat/elem/cl_DF_plusp.cc index e67b497..78238ac 100644 --- a/src/float/dfloat/elem/cl_DF_plusp.cc +++ b/src/float/dfloat/elem/cl_DF_plusp.cc @@ -19,14 +19,14 @@ namespace cln { MAYBE_INLINE2 -cl_boolean plusp (const cl_DF& x) +bool plusp (const cl_DF& x) { if (minusp(x)) - return cl_false; // x<0 -> nein + return false; // x<0 -> nein elif (zerop(x)) - return cl_false; // x=0 -> nein + return false; // x=0 -> nein else - return cl_true; // sonst ist x>0. + return true; // sonst ist x>0. } } // namespace cln diff --git a/src/float/dfloat/elem/cl_DF_zerop.cc b/src/float/dfloat/elem/cl_DF_zerop.cc index 7f72d81..37bf62a 100644 --- a/src/float/dfloat/elem/cl_DF_zerop.cc +++ b/src/float/dfloat/elem/cl_DF_zerop.cc @@ -14,12 +14,12 @@ namespace cln { MAYBE_INLINE -cl_boolean zerop (const cl_DF& x) +bool zerop (const cl_DF& x) { #if 0 - return (cl_boolean) (DF_uexp(TheDfloat(x)->dfloat_value_semhi) == 0); + return DF_uexp(TheDfloat(x)->dfloat_value_semhi) == 0; #else // this is faster - return (cl_boolean) (TheDfloat(x)->dfloat_value_semhi == 0); + return TheDfloat(x)->dfloat_value_semhi == 0; #endif } diff --git a/src/float/dfloat/input/cl_DF_from_string.cc b/src/float/dfloat/input/cl_DF_from_string.cc index 973a8c3..c1069d2 100644 --- a/src/float/dfloat/input/cl_DF_from_string.cc +++ b/src/float/dfloat/input/cl_DF_from_string.cc @@ -19,7 +19,7 @@ cl_read_flags cl_DF_read_flags = { syntax_dfloat, lsyntax_all, 10, - { float_format_dfloat, float_format_lfloat_min, cl_false } + { float_format_dfloat, float_format_lfloat_min, false } }; cl_DF::cl_DF (const char * string) diff --git a/src/float/dfloat/misc/cl_DF_as.cc b/src/float/dfloat/misc/cl_DF_as.cc index f378170..ac091e9 100644 --- a/src/float/dfloat/misc/cl_DF_as.cc +++ b/src/float/dfloat/misc/cl_DF_as.cc @@ -13,12 +13,12 @@ namespace cln { -inline cl_boolean cl_DF_p (const cl_number& x) +inline bool cl_DF_p (const cl_number& x) { if (x.pointer_p()) if (x.heappointer->type == &cl_class_dfloat) - return cl_true; - return cl_false; + return true; + return false; } const cl_DF& cl_DF_As (const cl_number& x, const char * filename, int line) diff --git a/src/float/elem/cl_F_minusp.cc b/src/float/elem/cl_F_minusp.cc index e2bba66..09b0cb7 100644 --- a/src/float/elem/cl_F_minusp.cc +++ b/src/float/elem/cl_F_minusp.cc @@ -20,7 +20,7 @@ namespace cln { -cl_boolean minusp (const cl_F& x) +bool minusp (const cl_F& x) { floatcase(x , return minusp(x); diff --git a/src/float/elem/cl_F_plusp.cc b/src/float/elem/cl_F_plusp.cc index 229164f..d76d2a5 100644 --- a/src/float/elem/cl_F_plusp.cc +++ b/src/float/elem/cl_F_plusp.cc @@ -20,7 +20,7 @@ namespace cln { -cl_boolean plusp (const cl_F& x) +bool plusp (const cl_F& x) { floatcase(x , return plusp(x); diff --git a/src/float/elem/cl_F_zerop.cc b/src/float/elem/cl_F_zerop.cc index 3126d46..1cf5e22 100644 --- a/src/float/elem/cl_F_zerop.cc +++ b/src/float/elem/cl_F_zerop.cc @@ -20,7 +20,7 @@ namespace cln { -cl_boolean zerop (const cl_F& x) +bool zerop (const cl_F& x) { floatcase(x , return zerop(x); diff --git a/src/float/ffloat/conv/cl_I_to_float.cc b/src/float/ffloat/conv/cl_I_to_float.cc index 8b0b56e..043c118 100644 --- a/src/float/ffloat/conv/cl_I_to_float.cc +++ b/src/float/ffloat/conv/cl_I_to_float.cc @@ -26,7 +26,7 @@ float float_approx (const cl_I& x) // NDS zu |x|>0 bilden: var const uintD* MSDptr; var uintC len; - I_to_NDS_nocopy(abs_x, MSDptr=,len=,,cl_false,); + I_to_NDS_nocopy(abs_x, MSDptr=,len=,,false,); // MSDptr/len/LSDptr ist die NDS zu x, len>0. // Führende Digits holen: Brauche FF_mant_len+1 Bits, dazu intDsize // Bits (die NDS kann mit bis zu intDsize Nullbits anfangen). diff --git a/src/float/ffloat/elem/cl_FF_from_I.cc b/src/float/ffloat/elem/cl_FF_from_I.cc index edf5e45..9e44d16 100644 --- a/src/float/ffloat/elem/cl_FF_from_I.cc +++ b/src/float/ffloat/elem/cl_FF_from_I.cc @@ -38,7 +38,7 @@ const cl_FF cl_I_to_FF (const cl_I& x) // NDS zu |x|>0 bilden: var const uintD* MSDptr; var uintC len; - I_to_NDS_nocopy(abs_x, MSDptr=,len=,,cl_false,); + I_to_NDS_nocopy(abs_x, MSDptr=,len=,,false,); // MSDptr/len/LSDptr ist die NDS zu x, len>0. // Führende Digits holen: Brauche FF_mant_len+1 Bits, dazu intDsize // Bits (die NDS kann mit bis zu intDsize Nullbits anfangen). diff --git a/src/float/ffloat/elem/cl_FF_minusp.cc b/src/float/ffloat/elem/cl_FF_minusp.cc index 666b97f..2f34de2 100644 --- a/src/float/ffloat/elem/cl_FF_minusp.cc +++ b/src/float/ffloat/elem/cl_FF_minusp.cc @@ -14,9 +14,9 @@ namespace cln { MAYBE_INLINE -cl_boolean minusp (const cl_FF& x) +bool minusp (const cl_FF& x) { - return (cl_boolean) ((sint32)cl_ffloat_value(x) < 0); + return (sint32)cl_ffloat_value(x) < 0; } } // namespace cln diff --git a/src/float/ffloat/elem/cl_FF_plusp.cc b/src/float/ffloat/elem/cl_FF_plusp.cc index 93aa87b..46d6a49 100644 --- a/src/float/ffloat/elem/cl_FF_plusp.cc +++ b/src/float/ffloat/elem/cl_FF_plusp.cc @@ -19,14 +19,14 @@ namespace cln { MAYBE_INLINE2 -cl_boolean plusp (const cl_FF& x) +bool plusp (const cl_FF& x) { if (minusp(x)) - return cl_false; // x<0 -> nein + return false; // x<0 -> nein elif (zerop(x)) - return cl_false; // x=0 -> nein + return false; // x=0 -> nein else - return cl_true; // sonst ist x>0. + return true; // sonst ist x>0. } } // namespace cln diff --git a/src/float/ffloat/elem/cl_FF_zerop.cc b/src/float/ffloat/elem/cl_FF_zerop.cc index bec6869..1e64d07 100644 --- a/src/float/ffloat/elem/cl_FF_zerop.cc +++ b/src/float/ffloat/elem/cl_FF_zerop.cc @@ -14,9 +14,9 @@ namespace cln { MAYBE_INLINE -cl_boolean zerop (const cl_FF& x) +bool zerop (const cl_FF& x) { - return (cl_boolean) (cl_ffloat_value(x) == 0); + return cl_ffloat_value(x) == 0; } } // namespace cln diff --git a/src/float/ffloat/input/cl_FF_from_string.cc b/src/float/ffloat/input/cl_FF_from_string.cc index e842af8..8fd62a4 100644 --- a/src/float/ffloat/input/cl_FF_from_string.cc +++ b/src/float/ffloat/input/cl_FF_from_string.cc @@ -19,7 +19,7 @@ cl_read_flags cl_FF_read_flags = { syntax_ffloat, lsyntax_all, 10, - { float_format_ffloat, float_format_lfloat_min, cl_false } + { float_format_ffloat, float_format_lfloat_min, false } }; cl_FF::cl_FF (const char * string) diff --git a/src/float/ffloat/misc/cl_FF_as.cc b/src/float/ffloat/misc/cl_FF_as.cc index e9bbfef..fac89fe 100644 --- a/src/float/ffloat/misc/cl_FF_as.cc +++ b/src/float/ffloat/misc/cl_FF_as.cc @@ -13,18 +13,18 @@ namespace cln { -inline cl_boolean cl_FF_p (const cl_number& x) +inline bool cl_FF_p (const cl_number& x) { #if defined(CL_WIDE_POINTERS) if (!x.pointer_p()) if (cl_tag((x).word) == cl_FF_tag) - return cl_true; + return true; #else if (x.pointer_p()) if (x.heappointer->type == &cl_class_ffloat) - return cl_true; + return true; #endif - return cl_false; + return false; } const cl_FF& cl_FF_As (const cl_number& x, const char * filename, int line) diff --git a/src/float/input/cl_F_from_string.cc b/src/float/input/cl_F_from_string.cc index ad07636..f58be3c 100644 --- a/src/float/input/cl_F_from_string.cc +++ b/src/float/input/cl_F_from_string.cc @@ -19,7 +19,7 @@ cl_read_flags cl_F_read_flags = { syntax_float, lsyntax_all, 10, - { float_format_ffloat, float_format_lfloat_min, cl_true } + { float_format_ffloat, float_format_lfloat_min, true } }; cl_F::cl_F (const char * string) diff --git a/src/float/input/cl_F_read.cc b/src/float/input/cl_F_read.cc index 52b3e2b..6856d8c 100644 --- a/src/float/input/cl_F_read.cc +++ b/src/float/input/cl_F_read.cc @@ -75,29 +75,29 @@ const cl_F read_float (const cl_read_flags& flags, const char * string, const ch } var const char * ptr_after_sign = ptr; var const char * ptr_after_intpart = skip_digits(ptr_after_sign,string_limit,float_base); - var cl_boolean have_dot = cl_false; + var bool have_dot = false; var const char * ptr_before_fracpart = ptr_after_intpart; var const char * ptr_after_fracpart = ptr_after_intpart; ptr = ptr_after_intpart; if (ptr != string_limit) if (*ptr == '.') { - have_dot = cl_true; + have_dot = true; ptr_before_fracpart = ptr+1; ptr_after_fracpart = skip_digits(ptr_before_fracpart,string_limit,float_base); } ptr = ptr_after_fracpart; var char exponent_marker; - var cl_boolean have_exponent; + var bool have_exponent; var const char * ptr_in_exponent = ptr; var const char * ptr_after_exponent = ptr; if ((ptr == string_limit) || !(((*ptr >= '0') && (*ptr <= '9')) || ((*ptr >= 'A') && (*ptr <= 'Z') && (*ptr != 'I')) || ((*ptr >= 'a') && (*ptr <= 'z') && (*ptr != 'i')) || (*ptr == '.') || (*ptr == '/'))) { // No exponent. - have_exponent = cl_false; + have_exponent = false; // Must have at least one fractional part digit. if (ptr_after_fracpart == ptr_before_fracpart) goto not_float_syntax; exponent_marker = 'E'; } else { - have_exponent = cl_true; + have_exponent = true; // Must have at least one digit. if (ptr_after_sign == ptr_after_intpart) if (ptr_after_fracpart == ptr_before_fracpart) diff --git a/src/float/input/cl_F_read_stream.cc b/src/float/input/cl_F_read_stream.cc index d7a4eef..83fafea 100644 --- a/src/float/input/cl_F_read_stream.cc +++ b/src/float/input/cl_F_read_stream.cc @@ -26,17 +26,17 @@ public: char* end_pointer (void) { return buffer+index; } }; -static cl_boolean number_char_p (char c) +static bool number_char_p (char c) { if ((c >= '0') && (c <= '9')) - return cl_true; + return true; if (((c >= 'A') && (c <= 'Z')) || ((c >= 'a') && (c <= 'z'))) - return cl_true; + return true; switch (c) { case '+': case '-': case '.': case '_': case '/': - return cl_true; + return true; default: - return cl_false; + return false; } } diff --git a/src/float/lfloat/algebraic/cl_LF_sqrt.cc b/src/float/lfloat/algebraic/cl_LF_sqrt.cc index ae07194..1acb1ba 100644 --- a/src/float/lfloat/algebraic/cl_LF_sqrt.cc +++ b/src/float/lfloat/algebraic/cl_LF_sqrt.cc @@ -107,7 +107,7 @@ const cl_LF sqrt (const cl_LF& x) } #endif var DS w; - var cl_boolean exactp; + var bool exactp; UDS_sqrt(r_MSDptr,r_len,r_LSDptr, &w, exactp=); // w ist die Ganzzahl-Wurzel, eine n+1-Digit-Zahl. copy_loop_msp(w.MSDptr,y_mantMSDptr,len); // NUDS nach y kopieren diff --git a/src/float/lfloat/elem/cl_LF_I_div.cc b/src/float/lfloat/elem/cl_LF_I_div.cc index 8f3772f..fbfa52c 100644 --- a/src/float/lfloat/elem/cl_LF_I_div.cc +++ b/src/float/lfloat/elem/cl_LF_I_div.cc @@ -44,7 +44,7 @@ const cl_LF cl_LF_I_div (const cl_LF& x, const cl_I& y) var const uintD* y_MSDptr; var uintC y_len; var const uintD* y_LSDptr; - I_to_NDS_nocopy(abs_y, y_MSDptr=,y_len=,y_LSDptr=,cl_false,); // NDS zu y bilden, y_len>0 + I_to_NDS_nocopy(abs_y, y_MSDptr=,y_len=,y_LSDptr=,false,); // NDS zu y bilden, y_len>0 // y nicht zu einer NUDS normalisieren! (Damit ein Bit Spielraum ist.) // Zähler bilden: x * 2^(intDsize*y_len) var uintD* z_MSDptr; diff --git a/src/float/lfloat/elem/cl_LF_I_mul.cc b/src/float/lfloat/elem/cl_LF_I_mul.cc index ebcf481..f6992a0 100644 --- a/src/float/lfloat/elem/cl_LF_I_mul.cc +++ b/src/float/lfloat/elem/cl_LF_I_mul.cc @@ -39,7 +39,7 @@ const cl_R cl_LF_I_mul (const cl_LF& x, const cl_I& y) var const uintD* y_MSDptr; var uintC y_len; var const uintD* y_LSDptr; - I_to_NDS_nocopy(abs_y, y_MSDptr=,y_len=,y_LSDptr=,cl_false,); // NDS zu y bilden, y_len>0 + I_to_NDS_nocopy(abs_y, y_MSDptr=,y_len=,y_LSDptr=,false,); // NDS zu y bilden, y_len>0 if (mspref(y_MSDptr,0)==0) y_len--; // NUDS zu y bilden, y_len>0 // Multiplizieren. var uintD* prodMSDptr; diff --git a/src/float/lfloat/elem/cl_LF_from_I.cc b/src/float/lfloat/elem/cl_LF_from_I.cc index 9601436..4d919c4 100644 --- a/src/float/lfloat/elem/cl_LF_from_I.cc +++ b/src/float/lfloat/elem/cl_LF_from_I.cc @@ -49,7 +49,7 @@ const cl_LF cl_I_to_LF (const cl_I& x, uintC len) var uintD* y_mantMSDptr = arrayMSDptr(TheLfloat(y)->data,len); var const uintD* x_MSDptr; var uintC x_len; - I_to_NDS_nocopy(abs_x, x_MSDptr=,x_len=,,cl_false,); // NDS zu x bilden, x_len>0 + I_to_NDS_nocopy(abs_x, x_MSDptr=,x_len=,,false,); // NDS zu x bilden, x_len>0 // x_MSDptr/x_len/.. um (exp mod 16) Bits nach rechts shiften und in // y einfüllen (genauer: nur maximal len Digits davon): {var uintL shiftcount = exp % intDsize; diff --git a/src/float/lfloat/elem/cl_LF_minusp.cc b/src/float/lfloat/elem/cl_LF_minusp.cc index 882bd77..55df504 100644 --- a/src/float/lfloat/elem/cl_LF_minusp.cc +++ b/src/float/lfloat/elem/cl_LF_minusp.cc @@ -14,9 +14,9 @@ namespace cln { MAYBE_INLINE -cl_boolean minusp (const cl_LF& x) +bool minusp (const cl_LF& x) { - return (cl_boolean) (- TheLfloat(x)->sign); + return -TheLfloat(x)->sign; } } // namespace cln diff --git a/src/float/lfloat/elem/cl_LF_plusp.cc b/src/float/lfloat/elem/cl_LF_plusp.cc index 24df977..6c02971 100644 --- a/src/float/lfloat/elem/cl_LF_plusp.cc +++ b/src/float/lfloat/elem/cl_LF_plusp.cc @@ -20,14 +20,14 @@ namespace cln { MAYBE_INLINE2 -cl_boolean plusp (const cl_LF& x) +bool plusp (const cl_LF& x) { if (minusp(x)) - return cl_false; // x<0 -> nein + return false; // x<0 -> nein elif (zerop(x)) - return cl_false; // x=0 -> nein + return false; // x=0 -> nein else - return cl_true; // sonst ist x>0. + return true; // sonst ist x>0. } } // namespace cln diff --git a/src/float/lfloat/elem/cl_LF_zerop.cc b/src/float/lfloat/elem/cl_LF_zerop.cc index bbfbb0e..35135c4 100644 --- a/src/float/lfloat/elem/cl_LF_zerop.cc +++ b/src/float/lfloat/elem/cl_LF_zerop.cc @@ -14,9 +14,9 @@ namespace cln { MAYBE_INLINE -cl_boolean zerop (const cl_LF& x) +bool zerop (const cl_LF& x) { - return (cl_boolean) (TheLfloat(x)->expo == 0); + return TheLfloat(x)->expo == 0; } } // namespace cln diff --git a/src/float/lfloat/input/cl_LF_from_string.cc b/src/float/lfloat/input/cl_LF_from_string.cc index 591119e..107020f 100644 --- a/src/float/lfloat/input/cl_LF_from_string.cc +++ b/src/float/lfloat/input/cl_LF_from_string.cc @@ -19,7 +19,7 @@ cl_read_flags cl_LF_read_flags = { syntax_lfloat, lsyntax_all, 10, - { float_format_lfloat_min, float_format_lfloat_min, cl_false } + { float_format_lfloat_min, float_format_lfloat_min, false } }; cl_LF::cl_LF (const char * string) diff --git a/src/float/lfloat/misc/cl_LF_as.cc b/src/float/lfloat/misc/cl_LF_as.cc index ef6f527..47312db 100644 --- a/src/float/lfloat/misc/cl_LF_as.cc +++ b/src/float/lfloat/misc/cl_LF_as.cc @@ -13,12 +13,12 @@ namespace cln { -inline cl_boolean cl_LF_p (const cl_number& x) +inline bool cl_LF_p (const cl_number& x) { if (x.pointer_p()) if (x.heappointer->type == &cl_class_lfloat) - return cl_true; - return cl_false; + return true; + return false; } const cl_LF& cl_LF_As (const cl_number& x, const char * filename, int line) diff --git a/src/float/misc/cl_F_as.cc b/src/float/misc/cl_F_as.cc index cd122dc..4677bb4 100644 --- a/src/float/misc/cl_F_as.cc +++ b/src/float/misc/cl_F_as.cc @@ -13,7 +13,7 @@ namespace cln { -inline cl_boolean cl_F_p (const cl_number& x) +inline bool cl_F_p (const cl_number& x) { if (!x.pointer_p()) switch (cl_tag((x).word)) { @@ -21,12 +21,12 @@ inline cl_boolean cl_F_p (const cl_number& x) #if defined(CL_WIDE_POINTERS) case cl_FF_tag: #endif - return cl_true; + return true; } else if (x.heappointer->type->flags & cl_class_flags_subclass_float) - return cl_true; - return cl_false; + return true; + return false; } const cl_F& cl_F_As (const cl_number& x, const char * filename, int line) diff --git a/src/float/output/cl_F_dprint.cc b/src/float/output/cl_F_dprint.cc index 9f871a0..602872c 100644 --- a/src/float/output/cl_F_dprint.cc +++ b/src/float/output/cl_F_dprint.cc @@ -335,14 +335,14 @@ static const cl_decimal_decoded_float decode_float_decimal (const cl_F& x) // wird er gewählt, die anderen vergessen. // 3. Sonst wird unter allen noch möglichen Werten der zu x // nächstgelegene gewählt. - var cl_boolean d_shift = cl_false; // Flag, ob im 1. Schritt d incrementiert wurde + var bool d_shift = false; // Flag, ob im 1. Schritt d incrementiert wurde var cl_I a; // das ausgewählte a // 1. { var cl_I b1 = ceiling1(a1,10); var cl_I b2 = floor1(a2,10); if (b1 <= b2) // noch eine durch 10 teilbare Zahl a ? - { a1 = b1; a2 = b2; d = d+1; d_shift = cl_true; } + { a1 = b1; a2 = b2; d = d+1; d_shift = true; } else goto keine_10_mehr; } diff --git a/src/float/sfloat/elem/cl_SF_from_I.cc b/src/float/sfloat/elem/cl_SF_from_I.cc index e3f0029..21f337b 100644 --- a/src/float/sfloat/elem/cl_SF_from_I.cc +++ b/src/float/sfloat/elem/cl_SF_from_I.cc @@ -37,7 +37,7 @@ const cl_SF cl_I_to_SF (const cl_I& x) // NDS zu |x|>0 bilden: var const uintD* MSDptr; var uintC len; - I_to_NDS_nocopy(abs_x, MSDptr=,len=,,cl_false,); + I_to_NDS_nocopy(abs_x, MSDptr=,len=,,false,); // MSDptr/len/LSDptr ist die NDS zu x, len>0. // Führende Digits holen: Brauche SF_mant_len+1 Bits, dazu intDsize // Bits (die NDS kann mit bis zu intDsize Nullbits anfangen). diff --git a/src/float/sfloat/elem/cl_SF_minusp.cc b/src/float/sfloat/elem/cl_SF_minusp.cc index 6e63159..b9d2932 100644 --- a/src/float/sfloat/elem/cl_SF_minusp.cc +++ b/src/float/sfloat/elem/cl_SF_minusp.cc @@ -14,9 +14,9 @@ namespace cln { MAYBE_INLINE -cl_boolean minusp (const cl_SF& x) +bool minusp (const cl_SF& x) { - return (cl_boolean) ((x.word & bit(SF_sign_shift)) != 0); + return (x.word & bit(SF_sign_shift)) != 0; } } // namespace cln diff --git a/src/float/sfloat/elem/cl_SF_plusp.cc b/src/float/sfloat/elem/cl_SF_plusp.cc index abc59e0..45e6798 100644 --- a/src/float/sfloat/elem/cl_SF_plusp.cc +++ b/src/float/sfloat/elem/cl_SF_plusp.cc @@ -19,14 +19,14 @@ namespace cln { MAYBE_INLINE2 -cl_boolean plusp (const cl_SF& x) +bool plusp (const cl_SF& x) { if (minusp(x)) - return cl_false; // x<0 -> nein + return false; // x<0 -> nein elif (zerop(x)) - return cl_false; // x=0 -> nein + return false; // x=0 -> nein else - return cl_true; // sonst ist x>0. + return true; // sonst ist x>0. } } // namespace cln diff --git a/src/float/sfloat/elem/cl_SF_zerop.cc b/src/float/sfloat/elem/cl_SF_zerop.cc index 9404d0a..9363458 100644 --- a/src/float/sfloat/elem/cl_SF_zerop.cc +++ b/src/float/sfloat/elem/cl_SF_zerop.cc @@ -14,9 +14,9 @@ namespace cln { MAYBE_INLINE -cl_boolean zerop (const cl_SF& x) +bool zerop (const cl_SF& x) { - return (cl_boolean) (x.word == make_SF_word(0,0,0)); + return x.word == make_SF_word(0,0,0); } } // namespace cln diff --git a/src/float/sfloat/input/cl_SF_from_string.cc b/src/float/sfloat/input/cl_SF_from_string.cc index 063708e..e223b4c 100644 --- a/src/float/sfloat/input/cl_SF_from_string.cc +++ b/src/float/sfloat/input/cl_SF_from_string.cc @@ -19,7 +19,7 @@ cl_read_flags cl_SF_read_flags = { syntax_sfloat, lsyntax_all, 10, - { float_format_sfloat, float_format_lfloat_min, cl_false } + { float_format_sfloat, float_format_lfloat_min, false } }; cl_SF::cl_SF (const char * string) diff --git a/src/float/sfloat/misc/cl_SF_as.cc b/src/float/sfloat/misc/cl_SF_as.cc index d5a32ff..2976ddb 100644 --- a/src/float/sfloat/misc/cl_SF_as.cc +++ b/src/float/sfloat/misc/cl_SF_as.cc @@ -13,12 +13,12 @@ namespace cln { -inline cl_boolean cl_SF_p (const cl_number& x) +inline bool cl_SF_p (const cl_number& x) { if (!x.pointer_p()) if (cl_tag((x).word) == cl_SF_tag) - return cl_true; - return cl_false; + return true; + return false; } const cl_SF& cl_SF_As (const cl_number& x, const char * filename, int line) diff --git a/src/float/transcendental/cl_F_atanx.cc b/src/float/transcendental/cl_F_atanx.cc index 38fd109..ee51130 100644 --- a/src/float/transcendental/cl_F_atanx.cc +++ b/src/float/transcendental/cl_F_atanx.cc @@ -198,7 +198,7 @@ static const cl_LF atanx_ratseries (const cl_LF& t) var uintE me = cl_I_to_UE(- y_.exponent); var cl_I p; var uintE lq; - var cl_boolean last_step = cl_false; + var bool last_step = false; if (lm >= me) { // |y| >= 1/2 ? p = y_.sign; // 1 or -1 lq = 1; @@ -219,7 +219,7 @@ static const cl_LF atanx_ratseries (const cl_LF& t) // after the next big multiplication. This saves one // big multiplication at the end. if (2*n >= lm) - last_step = cl_true; + last_step = true; } z = z + scale_float(cl_I_to_LF(p,len),-(sintE)lq); if (last_step) diff --git a/src/float/transcendental/cl_F_expx.cc b/src/float/transcendental/cl_F_expx.cc index 3f3dfec..a42effd 100644 --- a/src/float/transcendental/cl_F_expx.cc +++ b/src/float/transcendental/cl_F_expx.cc @@ -151,7 +151,7 @@ const cl_LF expx_ratseries (const cl_LF& x) // (b) 311 317 305 312 295 291 286 293 291 284 295 284 293 287 288 305 // (a): N=300, time in 0.01 sec. (b): N=1000, time in 0.1 sec. // Values 2.5 <= c <= 3.2 seem best. Let's choose c = 2.875. - var cl_boolean first_factor = cl_true; + var bool first_factor = true; var cl_LF product; var uintE b1; var uintE b2; @@ -166,7 +166,7 @@ const cl_LF expx_ratseries (const cl_LF& x) var cl_LF factor = cl_exp_aux(pk,lqk,len); if (first_factor) { product = factor; - first_factor = cl_false; + first_factor = false; } else product = product * factor; } diff --git a/src/float/transcendental/cl_F_lnx.cc b/src/float/transcendental/cl_F_lnx.cc index b00a5d1..d09b8da 100644 --- a/src/float/transcendental/cl_F_lnx.cc +++ b/src/float/transcendental/cl_F_lnx.cc @@ -204,7 +204,7 @@ const cl_LF lnx_ratseries (const cl_LF& x) var uintE me = cl_I_to_UE(- x1_.exponent); var cl_I p; var uintE lq; - var cl_boolean last_step = cl_false; + var bool last_step = false; if (lm >= me) { // |x'| >= 1/2 ? p = x1_.sign; // 1 or -1 lq = 1; @@ -225,7 +225,7 @@ const cl_LF lnx_ratseries (const cl_LF& x) // after the next big multiplication. This saves one // big multiplication at the end. if (2*n >= lm) - last_step = cl_true; + last_step = true; } y = y + scale_float(cl_I_to_LF(p,len),-(sintE)lq); if (last_step) diff --git a/src/float/transcendental/cl_LF_coshsinh.cc b/src/float/transcendental/cl_LF_coshsinh.cc index 7a926b7..9d8c489 100644 --- a/src/float/transcendental/cl_LF_coshsinh.cc +++ b/src/float/transcendental/cl_LF_coshsinh.cc @@ -29,7 +29,7 @@ const cl_LF_cosh_sinh_t cl_coshsinh_ratseries (const cl_LF& x) var uintE lq = cl_I_to_UE(- x_.exponent); var const cl_I& p = x_.mantissa; // Compute sinh(p/2^lq) and cosh(p/2^lq) by splitting into pieces. - var cl_boolean first_factor = cl_true; + var bool first_factor = true; var cl_LF_cosh_sinh_t product; var uintE b1; var uintE b2; @@ -44,7 +44,7 @@ const cl_LF_cosh_sinh_t cl_coshsinh_ratseries (const cl_LF& x) var cl_LF_cosh_sinh_t factor = cl_coshsinh_aux(pk,lqk,len); if (first_factor) { product = factor; - first_factor = cl_false; + first_factor = false; } else product = product * factor; } diff --git a/src/float/transcendental/cl_LF_cossin.cc b/src/float/transcendental/cl_LF_cossin.cc index 15d5a81..2c4244c 100644 --- a/src/float/transcendental/cl_LF_cossin.cc +++ b/src/float/transcendental/cl_LF_cossin.cc @@ -29,7 +29,7 @@ const cl_LF_cos_sin_t cl_cossin_ratseries (const cl_LF& x) var uintE lq = cl_I_to_UE(- x_.exponent); var const cl_I& p = x_.mantissa; // Compute sin(p/2^lq) and cos(p/2^lq) by splitting into pieces. - var cl_boolean first_factor = cl_true; + var bool first_factor = true; var cl_LF_cos_sin_t product; var uintE b1; var uintE b2; @@ -44,7 +44,7 @@ const cl_LF_cos_sin_t cl_cossin_ratseries (const cl_LF& x) var cl_LF_cos_sin_t factor = cl_cossin_aux(pk,lqk,len); if (first_factor) { product = factor; - first_factor = cl_false; + first_factor = false; } else product = product * factor; } diff --git a/src/float/transcendental/cl_LF_ratsumseries_pqcd_aux.cc b/src/float/transcendental/cl_LF_ratsumseries_pqcd_aux.cc index 0e023ac..97cc535 100644 --- a/src/float/transcendental/cl_LF_ratsumseries_pqcd_aux.cc +++ b/src/float/transcendental/cl_LF_ratsumseries_pqcd_aux.cc @@ -14,7 +14,7 @@ namespace cln { -void eval_pqcd_series_aux (uintC N, cl_pqcd_series_term* args, cl_pqcd_series_result& Z, cl_boolean rightmost) +void eval_pqcd_series_aux (uintC N, cl_pqcd_series_term* args, cl_pqcd_series_result& Z, bool rightmost) { // N = N2-N1 switch (N) { @@ -60,7 +60,7 @@ void eval_pqcd_series_aux (uintC N, cl_pqcd_series_term* args, cl_pqcd_series_re var uintC Nm = N/2; // midpoint // Compute left part. var cl_pqcd_series_result L; - eval_pqcd_series_aux(Nm,args+0,L,cl_false); + eval_pqcd_series_aux(Nm,args+0,L,false); // Compute right part. var cl_pqcd_series_result R; eval_pqcd_series_aux(N-Nm,args+Nm,R,rightmost); diff --git a/src/float/transcendental/cl_LF_ratsumseries_pqd_aux.cc b/src/float/transcendental/cl_LF_ratsumseries_pqd_aux.cc index f6886bd..3373fbc 100644 --- a/src/float/transcendental/cl_LF_ratsumseries_pqd_aux.cc +++ b/src/float/transcendental/cl_LF_ratsumseries_pqd_aux.cc @@ -14,7 +14,7 @@ namespace cln { -void eval_pqd_series_aux (uintC N, cl_pqd_series_term* args, cl_pqd_series_result& Z, cl_boolean rightmost) +void eval_pqd_series_aux (uintC N, cl_pqd_series_term* args, cl_pqd_series_result& Z, bool rightmost) { // N = N2-N1 switch (N) { @@ -56,7 +56,7 @@ void eval_pqd_series_aux (uintC N, cl_pqd_series_term* args, cl_pqd_series_resul var uintC Nm = N/2; // midpoint // Compute left part. var cl_pqd_series_result L; - eval_pqd_series_aux(Nm,args+0,L,cl_false); + eval_pqd_series_aux(Nm,args+0,L,false); // Compute right part. var cl_pqd_series_result R; eval_pqd_series_aux(N-Nm,args+Nm,R,rightmost); diff --git a/src/float/transcendental/cl_LF_tran.h b/src/float/transcendental/cl_LF_tran.h index 3dedf50..9a32a13 100644 --- a/src/float/transcendental/cl_LF_tran.h +++ b/src/float/transcendental/cl_LF_tran.h @@ -227,7 +227,7 @@ struct cl_pqcd_series_result { cl_I D; cl_I V; }; -extern void eval_pqcd_series_aux (uintC N, cl_pqcd_series_term* args, cl_pqcd_series_result& Z, cl_boolean rightmost = cl_true); +extern void eval_pqcd_series_aux (uintC N, cl_pqcd_series_term* args, cl_pqcd_series_result& Z, bool rightmost = true); // Ditto, but returns U/S. extern const cl_LF eval_pqcd_series (uintC N, cl_pqcd_series_term* args, uintC len); @@ -255,7 +255,7 @@ struct cl_pqd_series_result { cl_I D; cl_I V; }; -extern void eval_pqd_series_aux (uintC N, cl_pqd_series_term* args, cl_pqd_series_result& Z, cl_boolean rightmost = cl_true); +extern void eval_pqd_series_aux (uintC N, cl_pqd_series_term* args, cl_pqd_series_result& Z, bool rightmost = true); // Ditto, but returns U/S. extern const cl_LF eval_pqd_series (uintC N, cl_pqd_series_term* args, uintC len); diff --git a/src/integer/algebraic/cl_I_rootp.cc b/src/integer/algebraic/cl_I_rootp.cc index e3b2d68..0286c04 100644 --- a/src/integer/algebraic/cl_I_rootp.cc +++ b/src/integer/algebraic/cl_I_rootp.cc @@ -19,12 +19,12 @@ namespace cln { // Falls n >= integer_length(x): NEIN. (Da y>=2, müßte x>=2^n gelten.) // Hier also n>0 klein... -cl_boolean rootp (const cl_I& x, uintL n, cl_I* w) +bool rootp (const cl_I& x, uintL n, cl_I* w) { if (eq(x,0) || eq(x,1)) // x=0 oder x=1 ? - { *w = x; return cl_true; } // ja -> x als Ergebnis + { *w = x; return true; } // ja -> x als Ergebnis if (n >= integer_length(x)) - { return cl_false; } + { return false; } return cl_rootp_aux(x,n,w); } diff --git a/src/integer/algebraic/cl_I_rootp_I.cc b/src/integer/algebraic/cl_I_rootp_I.cc index 678a314..88468de 100644 --- a/src/integer/algebraic/cl_I_rootp_I.cc +++ b/src/integer/algebraic/cl_I_rootp_I.cc @@ -19,12 +19,12 @@ namespace cln { // Falls n >= integer_length(x): NEIN. (Da y>=2, müßte x>=2^n gelten.) // Hier also n>0 klein... -cl_boolean rootp (const cl_I& x, const cl_I& n, cl_I* w) +bool rootp (const cl_I& x, const cl_I& n, cl_I* w) { if (eq(x,0) || eq(x,1)) // x=0 oder x=1 ? - { *w = x; return cl_true; } // ja -> x als Ergebnis + { *w = x; return true; } // ja -> x als Ergebnis if (n >= (cl_I)(unsigned long)integer_length(x)) - { return cl_false; } + { return false; } // Nun ist n < (integer-length x). Also paßt n in ein uintC. return cl_rootp_aux(x,cl_I_to_ulong(n),w); } diff --git a/src/integer/algebraic/cl_I_rootp_aux.cc b/src/integer/algebraic/cl_I_rootp_aux.cc index ad0a890..073c5c0 100644 --- a/src/integer/algebraic/cl_I_rootp_aux.cc +++ b/src/integer/algebraic/cl_I_rootp_aux.cc @@ -22,9 +22,9 @@ namespace cln { // > n: ein Integer >0 // > Annahme: x > 1 und n < (integer-length x). // < w: Integer (expt x (/ n)) falls x eine n-te Potenz -// < ergebnis: cl_true ........................, cl_false sonst +// < ergebnis: true ........................, false sonst -cl_boolean cl_rootp_aux (cl_I x, uintL n, cl_I* w) +bool cl_rootp_aux (cl_I x, uintL n, cl_I* w) { // Methode: @@ -59,16 +59,16 @@ cl_boolean cl_rootp_aux (cl_I x, uintL n, cl_I* w) while ((n % 2) == 0) // n gerade? { if (!sqrtp(x,&x)) // Quadratwurzel ziehen versuchen - { return cl_false; } // nicht ganzzahlig -> fertig + { return false; } // nicht ganzzahlig -> fertig n = n >> 1; // n := (/ n 2) } // Nun ist n ungerade. - if (n==1) { *w = x; return cl_true; } // n=1 -> x als Ergebnis + if (n==1) { *w = x; return true; } // n=1 -> x als Ergebnis var uintC oq = 0; // Shift von y am Schluß {var uintC o = ord2(x); if (!(o==0)) {var uintL o_r; divu_3232_3232(o,n, oq=,o_r=); // o_r = o mod n - if (!(o_r==0)) { return cl_false; } // o nicht durch n teilbar -> fertig + if (!(o_r==0)) { return false; } // o nicht durch n teilbar -> fertig // oq = o/n. // dividiere x durch 2^o: x = ash(x,-(sintC)o); @@ -93,7 +93,7 @@ cl_boolean cl_rootp_aux (cl_I x, uintL n, cl_I* w) n_UDS_ok: ; // n_MSDptr/n_len/n_LSDptr ist NUDS zu n. } #endif - I_to_NDS_nocopy(x, ,x_len=,x_LSDptr=,cl_false,); // UDS zu x bilden, x_len>0 + I_to_NDS_nocopy(x, ,x_len=,x_LSDptr=,false,); // UDS zu x bilden, x_len>0 var uintD x_lsd = lspref(x_LSDptr,0); // letztes Digit von x var uintD y_lsd; // n-te Wurzel von x_lsd mod 2^intDsize y_lsd = 1; // Wurzel mod 2^1 @@ -185,7 +185,7 @@ cl_boolean cl_rootp_aux (cl_I x, uintL n, cl_I* w) // mit x vergleichen: if (!(x == c)) // Die ganze Rechnung war umsonst. - { return cl_false; } + { return false; } } // y ist tatsächlich n-te Wurzel von x. // Noch mit 2^oq multiplizieren: @@ -193,7 +193,7 @@ cl_boolean cl_rootp_aux (cl_I x, uintL n, cl_I* w) { *w = y; } else { *w = ash(y,oq); } - return cl_true; + return true; } } diff --git a/src/integer/algebraic/cl_I_sqrt.cc b/src/integer/algebraic/cl_I_sqrt.cc index 44a5eb1..afec169 100644 --- a/src/integer/algebraic/cl_I_sqrt.cc +++ b/src/integer/algebraic/cl_I_sqrt.cc @@ -19,7 +19,7 @@ namespace cln { -cl_boolean isqrt (const cl_I& x, cl_I* w) +bool isqrt (const cl_I& x, cl_I* w) { if (minusp(x)) { std::ostringstream buf; @@ -31,9 +31,9 @@ cl_boolean isqrt (const cl_I& x, cl_I* w) var const uintD* x_MSDptr; var uintC x_len; var const uintD* x_LSDptr; - I_to_NDS_nocopy(x, x_MSDptr=,x_len=,x_LSDptr=,cl_true,); // Digit sequence >=0 zu x + I_to_NDS_nocopy(x, x_MSDptr=,x_len=,x_LSDptr=,true,); // Digit sequence >=0 zu x var DS y; - var cl_boolean squarep; + var bool squarep; UDS_sqrt(x_MSDptr,x_len,x_LSDptr, &y, squarep=); // Wurzel ziehen *w = NUDS_to_I(y.MSDptr,y.len); // als Integer return squarep; diff --git a/src/integer/algebraic/cl_I_sqrtp.cc b/src/integer/algebraic/cl_I_sqrtp.cc index f1b03ff..4934240 100644 --- a/src/integer/algebraic/cl_I_sqrtp.cc +++ b/src/integer/algebraic/cl_I_sqrtp.cc @@ -14,7 +14,7 @@ namespace cln { -cl_boolean sqrtp (const cl_I& x, cl_I* w) +bool sqrtp (const cl_I& x, cl_I* w) { // Methode: // [Henri Cohen: A course in computational algebraic number theory, 2nd prnt., @@ -54,31 +54,31 @@ cl_boolean sqrtp (const cl_I& x, cl_I* w) var uintC x_len; var const uintD* x_LSDptr; I_to_NDS_nocopy(x, x_MSDptr=,x_len=,x_LSDptr=, // Digit sequence >=0 zu x - cl_true, { *w = 0; return cl_true; } // 0 is a square + true, { *w = 0; return true; } // 0 is a square ); // Check mod 64. { var uintD lsd = lspref(x_LSDptr,0); if (!squares_mod_64[lsd & 63]) - { return cl_false; } // not a square mod 64 -> not a square + { return false; } // not a square mod 64 -> not a square } // Check mod 63. { var cl_I_div_t div63 = cl_divide(x,L_to_FN(63)); if (!squares_mod_63[FN_to_UV(div63.remainder)]) - { return cl_false; } // not a square mod 63 -> not a square + { return false; } // not a square mod 63 -> not a square } // Check mod 65. { var cl_I_div_t div65 = cl_divide(x,L_to_FN(65)); if (!squares_mod_65[FN_to_UV(div65.remainder)]) - { return cl_false; } // not a square mod 65 -> not a square + { return false; } // not a square mod 65 -> not a square } // Check mod 11. { var cl_I_div_t div11 = cl_divide(x,L_to_FN(11)); if (!squares_mod_11[FN_to_UV(div11.remainder)]) - { return cl_false; } // not a square mod 11 -> not a square + { return false; } // not a square mod 11 -> not a square } // Check with full precision. { var DS y; - var cl_boolean squarep; + var bool squarep; UDS_sqrt(x_MSDptr,x_len,x_LSDptr, &y, squarep=); // Wurzel ziehen if (squarep) { *w = NUDS_to_I(y.MSDptr,y.len); } // als Integer diff --git a/src/integer/bitwise/cl_I_ash.cc b/src/integer/bitwise/cl_I_ash.cc index 19c9f1c..345de1c 100644 --- a/src/integer/bitwise/cl_I_ash.cc +++ b/src/integer/bitwise/cl_I_ash.cc @@ -39,7 +39,7 @@ const cl_I ash (const cl_I& x, sintC y) var uintD* LSDptr; var uintC len; var const uintD* x_LSDptr; - I_to_NDS_nocopy(x, ,len=,x_LSDptr=,cl_false,); // DS zu x bilden. + I_to_NDS_nocopy(x, ,len=,x_LSDptr=,false,); // DS zu x bilden. if (k >= (uintC)(~len)) // kann len+k+1 Überlauf geben? { throw ash_exception(y); } // ja -> Fehler num_stack_alloc_1(len+k,,LSDptr=); diff --git a/src/integer/bitwise/cl_I_ash_I.cc b/src/integer/bitwise/cl_I_ash_I.cc index cee74a3..15ea728 100644 --- a/src/integer/bitwise/cl_I_ash_I.cc +++ b/src/integer/bitwise/cl_I_ash_I.cc @@ -84,7 +84,7 @@ const cl_I ash (const cl_I& x, const cl_I& y) var uintD* LSDptr; var uintC len; var const uintD* x_LSDptr; - I_to_NDS_nocopy(x, ,len=,x_LSDptr=,cl_false,); // DS zu x bilden. + I_to_NDS_nocopy(x, ,len=,x_LSDptr=,false,); // DS zu x bilden. if (k >= (uintC)(~len)) // kann len+k+1 Überlauf geben? { throw ash_exception(y); } // ja -> Fehler num_stack_alloc_1(len+k,,LSDptr=); diff --git a/src/integer/bitwise/cl_I_byte.h b/src/integer/bitwise/cl_I_byte.h index 6ef57d2..ca5ca3b 100644 --- a/src/integer/bitwise/cl_I_byte.h +++ b/src/integer/bitwise/cl_I_byte.h @@ -20,8 +20,8 @@ extern const cl_I ldb_extract (const cl_I& x, uintC p, uintC q); // Teste, ob eines der Bits p,...,q-1 der Zahl x /=0 ist, // wobei 0 <= p <= q <= l = (integer-length x). -// Ergebnis (wie bei LDB-TEST) cl_false wenn nein, cl_true wenn ja. -extern cl_boolean ldb_extract_test (const cl_I& x, uintC p, uintC q); +// Ergebnis (wie bei LDB-TEST) false wenn nein, true wenn ja. +extern bool ldb_extract_test (const cl_I& x, uintC p, uintC q); // Extrahiere die Bits p,...,q-1 der Zahl x, // wobei 0 <= p <= q <= l = (integer-length x). diff --git a/src/integer/bitwise/cl_I_ldbtest.cc b/src/integer/bitwise/cl_I_ldbtest.cc index c902008..5b01c31 100644 --- a/src/integer/bitwise/cl_I_ldbtest.cc +++ b/src/integer/bitwise/cl_I_ldbtest.cc @@ -15,7 +15,7 @@ namespace cln { -cl_boolean ldb_test (const cl_I& n, const cl_byte& b) +bool ldb_test (const cl_I& n, const cl_byte& b) { // Methode: // (ldb-test (byte s p) n) @@ -31,19 +31,19 @@ cl_boolean ldb_test (const cl_I& n, const cl_byte& b) // extrahiere die Bits p,...,p+s-1 von n und teste sie. var uintC s = b.size; var uintC p = b.position; - if (s==0) return cl_false; + if (s==0) return false; var uintC l = integer_length(n); // l = (integer-length n) if (l<=p) // l<=p if (!minusp(n)) - return cl_false; // n>=0 + return false; // n>=0 else - return cl_true; // n<0 + return true; // n<0 else // l>p { var uintC ps = p+s; if (ps>l) // p+s>l ? - return cl_true; + return true; // Bits p,...,q-1 mit q = min(p+s,l) = p+s extrahieren und testen: return ldb_extract_test(n,p,ps); } diff --git a/src/integer/bitwise/cl_I_ldbx.cc b/src/integer/bitwise/cl_I_ldbx.cc index 2a01516..603f7f6 100644 --- a/src/integer/bitwise/cl_I_ldbx.cc +++ b/src/integer/bitwise/cl_I_ldbx.cc @@ -20,7 +20,7 @@ const cl_I ldb_extract (const cl_I& x, uintC p, uintC q) var const uintD* MSDptr; var uintC len; var const uintD* LSDptr; - I_to_NDS_nocopy(x, MSDptr=,len=,LSDptr=,cl_true, { return 0; } ); // NDS zu x bilden + I_to_NDS_nocopy(x, MSDptr=,len=,LSDptr=,true, { return 0; } ); // NDS zu x bilden // MSDptr erhöhen und len erniedrigen, so daß len = ceiling(q/intDsize) wird: { var uintC qD = ceiling(q,intDsize); // ceiling(q/intDsize) // wegen q<=l ist qD = ceiling(q/intDsize) <= ceiling((l+1)/intDsize) = len, also diff --git a/src/integer/bitwise/cl_I_ldbxtest.cc b/src/integer/bitwise/cl_I_ldbxtest.cc index d5447e7..007a968 100644 --- a/src/integer/bitwise/cl_I_ldbxtest.cc +++ b/src/integer/bitwise/cl_I_ldbxtest.cc @@ -15,11 +15,11 @@ namespace cln { -cl_boolean ldb_extract_test (const cl_I& x, uintC p, uintC q) +bool ldb_extract_test (const cl_I& x, uintC p, uintC q) { var const uintD* MSDptr; var uintC len; var const uintD* LSDptr; - I_to_NDS_nocopy(x, MSDptr=,len=,LSDptr=,cl_true, { return cl_false; } ); // NDS zu x bilden + I_to_NDS_nocopy(x, MSDptr=,len=,LSDptr=,true, { return false; } ); // NDS zu x bilden // MSDptr erhöhen und len erniedrigen, so daß len = ceiling(q/intDsize) wird: { var uintC qD = ceiling(q,intDsize); // ceiling(q/intDsize) // wegen q<=l ist qD = ceiling(q/intDsize) <= ceiling((l+1)/intDsize) = len, also @@ -33,7 +33,7 @@ cl_boolean ldb_extract_test (const cl_I& x, uintC p, uintC q) len -= pD; } // Jetzt enthält MSDptr/len/LSDptr genau die maßgeblichen Digits. - if (len==0) return cl_false; // len=0 -> keine Bits abzutesten + if (len==0) return false; // len=0 -> keine Bits abzutesten q = ((q-1)%intDsize); // q := intDsize - (intDsize*ceiling(q/intDsize) - q) - 1 p = p%intDsize; // p := p - intDsize*floor(p/intDsize) // Jetzt ist 0 <= q < intDsize, 0 <= p < intDsize. @@ -45,16 +45,16 @@ cl_boolean ldb_extract_test (const cl_I& x, uintC p, uintC q) // 1 Digit maßgeblich, wird von beiden Seiten angeschnitten: // Ein AND 2^(q+1)-2^p erreicht dies. if (!(((uintD)(bitm(q+1)-bit(p)) & mspref(MSDptr,0)) == 0)) - return cl_true; + return true; else - return cl_false; + return false; // mindestens 2 Digits. Teste erst die Randdigits, dann die inneren: if (!(((msprefnext(MSDptr) & (uintD)(bitm(q+1)-1)) == 0) && ((lsprefnext(LSDptr) & (uintD)(minus_bit(p))) == 0) ) ) - return cl_true; + return true; len--; // die beiden Randdigits sind jetzt abgezogen. - if (DS_test_loop(MSDptr,len,LSDptr)) { return cl_true; } else { return cl_false; } + if (DS_test_loop(MSDptr,len,LSDptr)) { return true; } else { return false; } } } // namespace cln diff --git a/src/integer/bitwise/cl_I_logbitp.cc b/src/integer/bitwise/cl_I_logbitp.cc index 8227b2e..5a0c3b1 100644 --- a/src/integer/bitwise/cl_I_logbitp.cc +++ b/src/integer/bitwise/cl_I_logbitp.cc @@ -14,7 +14,7 @@ namespace cln { -cl_boolean logbitp (uintC x, const cl_I& y) +bool logbitp (uintC x, const cl_I& y) { // Methode: // Falls x>=intDsize*Länge(y), teste Vorzeichen von y. @@ -23,19 +23,19 @@ cl_boolean logbitp (uintC x, const cl_I& y) var const uintD* yMSDptr; var uintC ylen; var const uintD* yLSDptr; - I_to_NDS_nocopy(y, yMSDptr=,ylen=,yLSDptr=,cl_true, { return cl_false; } ); // DS zu y + I_to_NDS_nocopy(y, yMSDptr=,ylen=,yLSDptr=,true, { return false; } ); // DS zu y if (x < intDsize*ylen) // x ist >=0, < intDsize*ylen { if (lspref(yLSDptr,floor(x,intDsize)) & bit(x%intDsize)) - return cl_true; + return true; else - return cl_false; + return false; } // Vorzeichen von y testen if (/* (ylen > 0) && */ ((sintD)mspref(yMSDptr,0) < 0)) - return cl_true; + return true; else - return cl_false; + return false; } } // namespace cln diff --git a/src/integer/bitwise/cl_I_logbitp_I.cc b/src/integer/bitwise/cl_I_logbitp_I.cc index bb26201..03e8856 100644 --- a/src/integer/bitwise/cl_I_logbitp_I.cc +++ b/src/integer/bitwise/cl_I_logbitp_I.cc @@ -18,7 +18,7 @@ namespace cln { -cl_boolean logbitp (const cl_I& x, const cl_I& y) +bool logbitp (const cl_I& x, const cl_I& y) { // Methode: // Falls x<0, Error. @@ -29,19 +29,19 @@ cl_boolean logbitp (const cl_I& x, const cl_I& y) { var uintV x_ = FN_to_V(x); var uintC ylen; var const uintD* yLSDptr; - I_to_NDS_nocopy(y, ,ylen=,yLSDptr=,cl_true, { return cl_false; } ); // DS zu y + I_to_NDS_nocopy(y, ,ylen=,yLSDptr=,true, { return false; } ); // DS zu y if (x_ < intDsize*ylen) // x ist ein Fixnum >=0, < intDsize*ylen { if (lspref(yLSDptr,floor(x_,intDsize)) & bit(x_%intDsize)) - return cl_true; + return true; else - return cl_false; + return false; } } // Vorzeichen von y testen if (minusp(y)) - return cl_true; + return true; else - return cl_false; + return false; } else // x<0 diff --git a/src/integer/bitwise/cl_I_logtest.cc b/src/integer/bitwise/cl_I_logtest.cc index cb2d937..5a2d0c1 100644 --- a/src/integer/bitwise/cl_I_logtest.cc +++ b/src/integer/bitwise/cl_I_logtest.cc @@ -14,7 +14,7 @@ namespace cln { -cl_boolean logtest (const cl_I& x, const cl_I& y) +bool logtest (const cl_I& x, const cl_I& y) { // Methode: // Fixnums separat behandeln. @@ -27,42 +27,42 @@ cl_boolean logtest (const cl_I& x, const cl_I& y) if (fixnump(y)) // beides Fixnums { if ((x.word & y.word & cl_combine(0,~(cl_uint)0))==0) - return cl_false; + return false; else - return cl_true; + return true; } else // x Fixnum, y Bignum, also ist x echt kürzer - { if (FN_V_minusp(x,FN_to_V(x))) return cl_true; // x<0 -> ja. + { if (FN_V_minusp(x,FN_to_V(x))) return true; // x<0 -> ja. // x>=0. Kombiniere x mit den pFN_maxlength letzten Digits von y. {var const uintD* yLSDptr; var uintV x_ = FN_to_V(x); BN_to_NDS_nocopy(y, ,,yLSDptr=); #if (pFN_maxlength > 1) doconsttimes(pFN_maxlength-1, - if (lsprefnext(yLSDptr) & (uintD)x_) return cl_true; + if (lsprefnext(yLSDptr) & (uintD)x_) return true; x_ = x_ >> intDsize; ); #endif - if (lsprefnext(yLSDptr) & (uintD)x_) return cl_true; - return cl_false; + if (lsprefnext(yLSDptr) & (uintD)x_) return true; + return false; }} else if (fixnump(y)) // x Bignum, y Fixnum, analog wie oben, nur x und y vertauscht - { if (FN_V_minusp(y,FN_to_V(y))) return cl_true; // y<0 -> ja. + { if (FN_V_minusp(y,FN_to_V(y))) return true; // y<0 -> ja. // y>=0. Kombiniere y mit den pFN_maxlength letzten Digits von x. {var const uintD* xLSDptr; var uintV y_ = FN_to_V(y); BN_to_NDS_nocopy(x, ,,xLSDptr=); #if (pFN_maxlength > 1) doconsttimes(pFN_maxlength-1, - if (lsprefnext(xLSDptr) & (uintD)y_) return cl_true; + if (lsprefnext(xLSDptr) & (uintD)y_) return true; y_ = y_ >> intDsize; ); #endif - if (lsprefnext(xLSDptr) & (uintD)y_) return cl_true; - return cl_false; + if (lsprefnext(xLSDptr) & (uintD)y_) return true; + return false; }} else // x,y Bignums @@ -78,14 +78,14 @@ cl_boolean logtest (const cl_I& x, const cl_I& y) { if (xlendata,TheBignum(x)->length),0) < 0); + return (sintD)mspref(arrayMSDptr(TheBignum(x)->data,TheBignum(x)->length),0) < 0; } // (ZEROP x) == (= x 0) -inline cl_boolean zerop (const cl_I& x) +inline bool zerop (const cl_I& x) { - return (cl_boolean)(x.word == cl_combine(cl_FN_tag,0)); + return x.word == cl_combine(cl_FN_tag,0); } // (EQ x y) == (= x y), assuming y a fixnum -inline cl_boolean eq (const cl_I& x, sint32 y) +inline bool eq (const cl_I& x, sint32 y) { - return (cl_boolean)(x.word == cl_combine(cl_FN_tag,y)); + return x.word == cl_combine(cl_FN_tag,y); } @@ -626,7 +626,7 @@ inline sintD FN_MSD (cl_uint word) var uintD CONCAT(FN_store_,__LINE__) [FN_maxlength]; \ { var const cl_I& obj_from_I_to_NDS = (obj); \ if (fixnump(obj_from_I_to_NDS)) \ - { FN_to_NDS(arrayLSDptr(CONCAT(FN_store_,__LINE__),FN_maxlength), cl_FN_word(obj_from_I_to_NDS), MSDptr_zuweisung,len_zuweisung,LSDptr_zuweisung, cl_true,); } \ + { FN_to_NDS(arrayLSDptr(CONCAT(FN_store_,__LINE__),FN_maxlength), cl_FN_word(obj_from_I_to_NDS), MSDptr_zuweisung,len_zuweisung,LSDptr_zuweisung, true,); } \ else \ { BN_to_NDS(obj_from_I_to_NDS,MSDptr_zuweisung,len_zuweisung, LSDptr_zuweisung); } \ } @@ -641,7 +641,7 @@ inline sintD FN_MSD (cl_uint word) var uintD CONCAT(FN_store_,__LINE__) [1+FN_maxlength]; \ { var const cl_I& obj_from_I_to_NDS = (obj); \ if (fixnump(obj_from_I_to_NDS)) \ - { FN_to_NDS(arrayLSDptr(CONCAT(FN_store_,__LINE__),1+FN_maxlength), cl_FN_word(obj_from_I_to_NDS), MSDptr_zuweisung,len_zuweisung,LSDptr_zuweisung, cl_true,); } \ + { FN_to_NDS(arrayLSDptr(CONCAT(FN_store_,__LINE__),1+FN_maxlength), cl_FN_word(obj_from_I_to_NDS), MSDptr_zuweisung,len_zuweisung,LSDptr_zuweisung, true,); } \ else \ { BN_to_NDS_1(obj_from_I_to_NDS,MSDptr_zuweisung,len_zuweisung, LSDptr_zuweisung); } \ } @@ -680,8 +680,8 @@ inline sintD FN_MSD (cl_uint word) // > n: ein Integer >0 // > Annahme: x > 1 und n < (integer-length x). // < w: Integer (expt x (/ n)) falls x eine n-te Potenz -// < ergebnis: cl_true ........................, cl_false sonst - extern cl_boolean cl_rootp_aux (cl_I x, uintL n, cl_I* w); +// < ergebnis: true ........................, false sonst + extern bool cl_rootp_aux (cl_I x, uintL n, cl_I* w); // Hilfsfunktion zur Eingabe von Integers @@ -721,19 +721,19 @@ inline sintD FN_MSD (cl_uint word) class cl_FN : public cl_I { public: // Optimization of method pointer_p(). - cl_boolean pointer_p() const - { return cl_false; } + bool pointer_p() const + { return false; } }; -inline cl_boolean fixnump (const cl_FN& x) - { unused x; return cl_true; } -inline cl_boolean bignump (const cl_FN& x) - { unused x; return cl_false; } +inline bool fixnump (const cl_FN& x) + { unused x; return true; } +inline bool bignump (const cl_FN& x) + { unused x; return false; } -inline cl_boolean minusp (const cl_FN& x) +inline bool minusp (const cl_FN& x) { // This assumes cl_value_shift + cl_value_len == cl_pointer_size. - return (cl_boolean)((cl_sint) x.word < 0); + return (cl_sint) x.word < 0; } @@ -743,21 +743,21 @@ inline cl_boolean minusp (const cl_FN& x) class cl_BN : public cl_I { public: // Optimization of method pointer_p(). - cl_boolean pointer_p() const - { return cl_true; } + bool pointer_p() const + { return true; } }; -inline cl_boolean fixnump (const cl_BN& x) - { unused x; return cl_false; } -inline cl_boolean bignump (const cl_BN& x) - { unused x; return cl_true; } +inline bool fixnump (const cl_BN& x) + { unused x; return false; } +inline bool bignump (const cl_BN& x) + { unused x; return true; } -inline cl_boolean minusp (const cl_BN& x) +inline bool minusp (const cl_BN& x) { - return (cl_boolean)((sintD)mspref(arrayMSDptr(TheBignum(x)->data,TheBignum(x)->length),0) < 0); + return (sintD)mspref(arrayMSDptr(TheBignum(x)->data,TheBignum(x)->length),0) < 0; } -inline cl_boolean zerop (const cl_BN& x) - { unused x; return cl_false; } +inline bool zerop (const cl_BN& x) + { unused x; return false; } } // namespace cln diff --git a/src/integer/conv/cl_I_to_digits.cc b/src/integer/conv/cl_I_to_digits.cc index d661b81..46afb68 100644 --- a/src/integer/conv/cl_I_to_digits.cc +++ b/src/integer/conv/cl_I_to_digits.cc @@ -94,7 +94,7 @@ void I_to_digits (const cl_I& X, uintD base, cl_digits* erg) var const uintD* MSDptr; var uintC len; var const uintD* LSDptr; - I_to_NDS_nocopy(X, MSDptr=,len=,LSDptr=,cl_false,); + I_to_NDS_nocopy(X, MSDptr=,len=,LSDptr=,false,); var int b = (base==2 ? 1 : base==4 ? 2 : base==8 ? 3 : base==16 ? 4 : /*base==32*/ 5); var uintD carry = 0; var int carrybits = 0; diff --git a/src/integer/elem/cl_I_div.cc b/src/integer/elem/cl_I_div.cc index b88661b..c6adb05 100644 --- a/src/integer/elem/cl_I_div.cc +++ b/src/integer/elem/cl_I_div.cc @@ -101,7 +101,7 @@ namespace cln { // x in NDS umwandeln, als UDS auffassen: BN_to_NDS_nocopy(x, x_MSDptr=,x_len=,x_LSDptr=); // y in NDS umwandeln, als UDS auffassen: - I_to_NDS_nocopy(y, y_MSDptr=,y_len=,y_LSDptr=,/*cl_true*/cl_false,); + I_to_NDS_nocopy(y, y_MSDptr=,y_len=,y_LSDptr=,/*true*/false,); // dividieren: {var DS q; var DS r; diff --git a/src/integer/elem/cl_I_equal.cc b/src/integer/elem/cl_I_equal.cc index 7946275..2aaa135 100644 --- a/src/integer/elem/cl_I_equal.cc +++ b/src/integer/elem/cl_I_equal.cc @@ -14,7 +14,7 @@ namespace cln { -cl_boolean equal (const cl_I& x, const cl_I& y) +bool equal (const cl_I& x, const cl_I& y) { // Methode: // x und y haben gleiches Vorzeichen -> @@ -30,28 +30,28 @@ cl_boolean equal (const cl_I& x, const cl_I& y) if (fixnump(y)) // x Fixnum, y Fixnum { // This assumes cl_value_shift + cl_value_len == cl_pointer_size. - return (cl_boolean) ((cl_sint)x.word == (cl_sint)y.word); + return (cl_sint)x.word == (cl_sint)y.word; } else // x Fixnum, y Bignum - return cl_false; + return false; else // x Bignum if (fixnump(y)) // x Bignum, y Fixnum - return cl_false; + return false; else // x Bignum, y Bignum if (x.pointer == y.pointer) - return cl_true; // gleiche Pointer -> selbe Zahl + return true; // gleiche Pointer -> selbe Zahl else { var uintC xlen = TheBignum(x)->length; var uintC ylen = TheBignum(y)->length; if (xlen==ylen) // gleiche Länge -> digitweise vergleichen - return (cl_boolean) (compare_loop_msp(BN_MSDptr(x),BN_MSDptr(y),xlen) == 0); + return compare_loop_msp(BN_MSDptr(x),BN_MSDptr(y),xlen) == 0; else - return cl_false; + return false; } } diff --git a/src/integer/elem/cl_I_minusp.cc b/src/integer/elem/cl_I_minusp.cc index 120c1dd..898543c 100644 --- a/src/integer/elem/cl_I_minusp.cc +++ b/src/integer/elem/cl_I_minusp.cc @@ -15,7 +15,7 @@ namespace cln { -cl_boolean minusp (const cl_I& x) +bool minusp (const cl_I& x) { return inline_minusp(x); } diff --git a/src/integer/elem/cl_I_mul.cc b/src/integer/elem/cl_I_mul.cc index a9de52c..8db6470 100644 --- a/src/integer/elem/cl_I_mul.cc +++ b/src/integer/elem/cl_I_mul.cc @@ -52,8 +52,8 @@ const cl_I operator* (const cl_I& x, const cl_I& y) var const uintD* yLSDptr; var uintD* ergMSDptr; var uintC erglen; - I_to_NDS_nocopy(x, xMSDptr = , xlen = , xLSDptr = , cl_false,); - I_to_NDS_nocopy(y, yMSDptr = , ylen = , yLSDptr = , cl_false,); + I_to_NDS_nocopy(x, xMSDptr = , xlen = , xLSDptr = , false,); + I_to_NDS_nocopy(y, yMSDptr = , ylen = , yLSDptr = , false,); DS_DS_mul_DS(xMSDptr,xlen,xLSDptr,yMSDptr,ylen,yLSDptr, ergMSDptr=,erglen=,); return DS_to_I(ergMSDptr,erglen); } diff --git a/src/integer/elem/cl_I_plusp.cc b/src/integer/elem/cl_I_plusp.cc index d4d47b0..0cbd1f5 100644 --- a/src/integer/elem/cl_I_plusp.cc +++ b/src/integer/elem/cl_I_plusp.cc @@ -17,14 +17,14 @@ namespace cln { -cl_boolean plusp (const cl_I& x) +bool plusp (const cl_I& x) { if (inline_minusp(x)) - return cl_false; // x<0 -> nein + return false; // x<0 -> nein elif (inline_zerop(x)) - return cl_false; // x=0 -> nein + return false; // x=0 -> nein else - return cl_true; // sonst ist x>0. + return true; // sonst ist x>0. } } // namespace cln diff --git a/src/integer/elem/cl_I_square.cc b/src/integer/elem/cl_I_square.cc index 9c8323e..cd48ac3 100644 --- a/src/integer/elem/cl_I_square.cc +++ b/src/integer/elem/cl_I_square.cc @@ -39,7 +39,7 @@ const cl_I square (const cl_I& x) var const uintD* xMSDptr; var uintC xlen; var const uintD* xLSDptr; - I_to_NDS_nocopy(x, xMSDptr = , xlen = , xLSDptr = , cl_false,); + I_to_NDS_nocopy(x, xMSDptr = , xlen = , xLSDptr = , false,); var uintD* ergMSDptr; var uintC erglen = 2*xlen; var uintD* ergLSDptr; diff --git a/src/integer/elem/cl_I_zerop.cc b/src/integer/elem/cl_I_zerop.cc index 93b58f2..c0537fd 100644 --- a/src/integer/elem/cl_I_zerop.cc +++ b/src/integer/elem/cl_I_zerop.cc @@ -15,7 +15,7 @@ namespace cln { -cl_boolean zerop (const cl_I& x) +bool zerop (const cl_I& x) { return inline_zerop(x); } diff --git a/src/integer/gcd/cl_I_gcd.cc b/src/integer/gcd/cl_I_gcd.cc index 357fccf..fb41860 100644 --- a/src/integer/gcd/cl_I_gcd.cc +++ b/src/integer/gcd/cl_I_gcd.cc @@ -492,7 +492,7 @@ namespace cln { // b normalisieren: while (mspref(b_MSDptr,0)==0) { msshrink(b_MSDptr); b_len--; } } } - if (cl_false) + if (false) { subtract: // Ersetze (a,b) := (a-b,b). if (!( subfrom_loop_lsp(b_LSDptr,a_LSDptr,b_len) ==0)) // Übertrag nach b_len Stellen, muß also a_len=b_len+1 sein. @@ -501,7 +501,7 @@ namespace cln { // a normalisieren: while (mspref(a_MSDptr,0)==0) { msshrink(a_MSDptr); a_len--; } } - if (cl_false) + if (false) { divide: // Ersetze (a,b) := (b , a mod b). {var uintD* old_a_LSDptr = a_LSDptr; var DS q; diff --git a/src/integer/gcd/cl_I_xgcd.cc b/src/integer/gcd/cl_I_xgcd.cc index b8618de..8afa2c2 100644 --- a/src/integer/gcd/cl_I_xgcd.cc +++ b/src/integer/gcd/cl_I_xgcd.cc @@ -444,7 +444,7 @@ namespace cln { // b normalisieren: while (mspref(b_MSDptr,0)==0) { msshrink(b_MSDptr); b_len--; } } } - if (cl_false) + if (false) { subtract: // Ersetze (a,b) := (a-b,b). NUDS_likobi0_NUDS(&uAa,&uAb); // uAa := uAa + uAb NUDS_likobi0_NUDS(&uBa,&uBb); // uBa := uBa + uBb @@ -455,7 +455,7 @@ namespace cln { // a normalisieren: while (mspref(a_MSDptr,0)==0) { msshrink(a_MSDptr); a_len--; } } - if (cl_false) + if (false) { divide: // Ersetze (a,b) := (b , a mod b). {var uintD* old_a_LSDptr = a_LSDptr; var DS q; diff --git a/src/integer/hash/cl_I_hashweak_rcpointer.cc b/src/integer/hash/cl_I_hashweak_rcpointer.cc index d6a878b..cc4849f 100644 --- a/src/integer/hash/cl_I_hashweak_rcpointer.cc +++ b/src/integer/hash/cl_I_hashweak_rcpointer.cc @@ -30,7 +30,7 @@ cl_class cl_class_weak_hashtable_from_integer_to_rcpointer = { // These are not inline, because they tend to duplicate a lot of template code. -cl_wht_from_integer_to_rcpointer::cl_wht_from_integer_to_rcpointer (cl_boolean (*maygc_htentry) (const cl_htentry_from_integer_to_rcpointer&)) +cl_wht_from_integer_to_rcpointer::cl_wht_from_integer_to_rcpointer (bool (*maygc_htentry) (const cl_htentry_from_integer_to_rcpointer&)) { var cl_heap_weak_hashtable_from_integer_to_rcpointer* ht = new cl_heap_weak_hashtable_from_integer_to_rcpointer (maygc_htentry); ht->refcount = 1; diff --git a/src/integer/hash/cl_I_hashweak_rcpointer.h b/src/integer/hash/cl_I_hashweak_rcpointer.h index 50ad5e2..11f4b70 100644 --- a/src/integer/hash/cl_I_hashweak_rcpointer.h +++ b/src/integer/hash/cl_I_hashweak_rcpointer.h @@ -17,7 +17,7 @@ typedef _cl_hashtable_iterator cl_hashtabl struct cl_wht_from_integer_to_rcpointer : public cl_gcpointer { // Constructors. - cl_wht_from_integer_to_rcpointer (cl_boolean (*maygc_htentry) (const cl_htentry_from_integer_to_rcpointer&)); + cl_wht_from_integer_to_rcpointer (bool (*maygc_htentry) (const cl_htentry_from_integer_to_rcpointer&)); cl_wht_from_integer_to_rcpointer (const cl_wht_from_integer_to_rcpointer&); // Assignment operators. cl_wht_from_integer_to_rcpointer& operator= (const cl_wht_from_integer_to_rcpointer&); diff --git a/src/integer/input/cl_I_from_string.cc b/src/integer/input/cl_I_from_string.cc index 991f7bd..ce594ea 100644 --- a/src/integer/input/cl_I_from_string.cc +++ b/src/integer/input/cl_I_from_string.cc @@ -18,7 +18,7 @@ cl_read_flags cl_I_read_flags = { syntax_integer, lsyntax_all, 10, - { float_format_ffloat, float_format_lfloat_min, cl_true } + { float_format_ffloat, float_format_lfloat_min, true } }; cl_I::cl_I (const char * string) diff --git a/src/integer/input/cl_I_read_stream.cc b/src/integer/input/cl_I_read_stream.cc index eeae222..1ffd54b 100644 --- a/src/integer/input/cl_I_read_stream.cc +++ b/src/integer/input/cl_I_read_stream.cc @@ -26,17 +26,17 @@ public: char* end_pointer (void) { return buffer+index; } }; -static cl_boolean number_char_p (char c) +static bool number_char_p (char c) { if ((c >= '0') && (c <= '9')) - return cl_true; + return true; if (((c >= 'A') && (c <= 'Z')) || ((c >= 'a') && (c <= 'z'))) - return cl_true; + return true; switch (c) { case '+': case '-': case '.': case '_': case '/': - return cl_true; + return true; default: - return cl_false; + return false; } } diff --git a/src/integer/misc/cl_I_as.cc b/src/integer/misc/cl_I_as.cc index fcbd839..c75553d 100644 --- a/src/integer/misc/cl_I_as.cc +++ b/src/integer/misc/cl_I_as.cc @@ -15,19 +15,19 @@ namespace cln { // Cf. cl_I_p in cl_I_ring.cc. // But here, for better inlining in g++, it is preferrable to finish every -// alternative with either "return cl_true;" or "return cl_false;". +// alternative with either "return true;" or "return false;". -inline cl_boolean cl_I_p (const cl_number& x) +inline bool cl_I_p (const cl_number& x) { if (!x.pointer_p()) switch (x.nonpointer_tag()) { case cl_FN_tag: - return cl_true; + return true; } else if (x.pointer_type() == &cl_class_bignum) - return cl_true; - return cl_false; + return true; + return false; } const cl_I& cl_I_As (const cl_number& x, const char * filename, int line) diff --git a/src/integer/misc/cl_I_oddp.cc b/src/integer/misc/cl_I_oddp.cc index fedaf17..27b6ac8 100644 --- a/src/integer/misc/cl_I_oddp.cc +++ b/src/integer/misc/cl_I_oddp.cc @@ -14,20 +14,20 @@ namespace cln { -cl_boolean oddp (const cl_I& x) +bool oddp (const cl_I& x) { if (fixnump(x)) { // Fixnum: Bit 0 abprüfen if (x.word & bit(cl_value_shift)) - return cl_true; + return true; else - return cl_false; + return false; } else { // Bignum: Bit 0 im letzten Digit abprüfen if (lspref(BN_LSDptr(x),0) & bit(0)) - return cl_true; + return true; else - return cl_false; + return false; } } diff --git a/src/integer/output/cl_I_print_string.cc b/src/integer/output/cl_I_print_string.cc index 49391e2..27d198a 100644 --- a/src/integer/output/cl_I_print_string.cc +++ b/src/integer/output/cl_I_print_string.cc @@ -17,11 +17,11 @@ namespace cln { char * print_integer_to_string (unsigned int base, const cl_I& z) { - var cl_boolean minus_p = cl_false; + var bool minus_p = false; var cl_I abs_z; if (minusp(z)) { // z<0 -> später Vorzeichen ausgeben: - minus_p = cl_true; + minus_p = true; abs_z = -z; } else abs_z = z; diff --git a/src/integer/random/cl_I_random.cc b/src/integer/random/cl_I_random.cc index de51b84..d05e00b 100644 --- a/src/integer/random/cl_I_random.cc +++ b/src/integer/random/cl_I_random.cc @@ -21,7 +21,7 @@ const cl_I random_I (random_state& randomstate, const cl_I& n) var const uintD* n_MSDptr; var uintC n_len; var const uintD* n_LSDptr; - I_to_NDS_nocopy(n, n_MSDptr=,n_len=,n_LSDptr=,cl_false,); // Digit sequence >0 zu n + I_to_NDS_nocopy(n, n_MSDptr=,n_len=,n_LSDptr=,false,); // Digit sequence >0 zu n var uintD* MSDptr; var uintC len = n_len + ceiling(16,intDsize); // 16 Bits mehr // neue UDS mit len Zufallsdigits bilden: diff --git a/src/integer/random/cl_I_trandom.cc b/src/integer/random/cl_I_trandom.cc index 5e00242..1896b4e 100644 --- a/src/integer/random/cl_I_trandom.cc +++ b/src/integer/random/cl_I_trandom.cc @@ -18,8 +18,8 @@ namespace cln { const cl_I testrandom_I (random_state& randomstate) { var uint32 ran = random32(randomstate); - var cl_boolean negative = (cl_boolean)(ran & 1); - var cl_boolean algo = (cl_boolean)((ran>>1) & 1); + var bool negative = (ran & 1); + var bool algo = ((ran>>1) & 1); ran = ran >> 2; ran = ran & ((1<<8)-1); var uintC len = diff --git a/src/integer/ring/cl_0_ring.cc b/src/integer/ring/cl_0_ring.cc index d082877..722c038 100644 --- a/src/integer/ring/cl_0_ring.cc +++ b/src/integer/ring/cl_0_ring.cc @@ -40,20 +40,20 @@ static void null_fprint (cl_heap_ring* R, std::ostream& stream, const _cl_ring_e fprint(stream,"0"); } -static cl_boolean null_equal (cl_heap_ring* R, const _cl_ring_element& x, const _cl_ring_element& y) +static bool null_equal (cl_heap_ring* R, const _cl_ring_element& x, const _cl_ring_element& y) { unused R; unused x; unused y; - return cl_true; + return true; } #define null_zero null_op0 -static cl_boolean null_zerop (cl_heap_ring* R, const _cl_ring_element& x) +static bool null_zerop (cl_heap_ring* R, const _cl_ring_element& x) { unused R; unused x; - return cl_true; + return true; } #define null_plus null_op2 #define null_minus null_op2 diff --git a/src/integer/ring/cl_I_ring.cc b/src/integer/ring/cl_I_ring.cc index 0f4e6d7..416738a 100644 --- a/src/integer/ring/cl_I_ring.cc +++ b/src/integer/ring/cl_I_ring.cc @@ -23,7 +23,7 @@ static void I_fprint (cl_heap_ring* R, std::ostream& stream, const _cl_ring_elem fprint(stream,The(cl_I)(x)); } -static cl_boolean I_equal (cl_heap_ring* R, const _cl_ring_element& x, const _cl_ring_element& y) +static bool I_equal (cl_heap_ring* R, const _cl_ring_element& x, const _cl_ring_element& y) { unused R; return equal(The(cl_I)(x),The(cl_I)(y)); @@ -34,7 +34,7 @@ static const _cl_ring_element I_zero (cl_heap_ring* R) return _cl_ring_element(R, (cl_I)0); } -static cl_boolean I_zerop (cl_heap_ring* R, const _cl_ring_element& x) +static bool I_zerop (cl_heap_ring* R, const _cl_ring_element& x) { unused R; return zerop(The(cl_I)(x)); @@ -80,13 +80,11 @@ static const _cl_ring_element I_expt_pos (cl_heap_ring* R, const _cl_ring_elemen return _cl_ring_element(R, expt_pos(The(cl_I)(x),y)); } -static cl_boolean cl_I_p (const cl_number& x) +static bool cl_I_p (const cl_number& x) { - return (cl_boolean) - (!x.pointer_p() + return (!x.pointer_p() ? x.nonpointer_tag() == cl_FN_tag - : x.pointer_type() == &cl_class_bignum - ); + : x.pointer_type() == &cl_class_bignum); } static cl_ring_setops I_setops = { diff --git a/src/modinteger/cl_MI.cc b/src/modinteger/cl_MI.cc index 071028b..a3d5511 100644 --- a/src/modinteger/cl_MI.cc +++ b/src/modinteger/cl_MI.cc @@ -61,7 +61,7 @@ cl_heap_modint_ring::cl_heap_modint_ring (cl_I m, cl_modint_setops* setopv, cl_m } -static cl_boolean modint_equal (cl_heap_modint_ring* R, const _cl_MI& x, const _cl_MI& y) +static bool modint_equal (cl_heap_modint_ring* R, const _cl_MI& x, const _cl_MI& y) { unused R; return equal(x.rep,y.rep); @@ -141,12 +141,12 @@ namespace cln { // any more except from the hash table and the ring. Note that the ring contains // exactly one reference to the modulus. -static cl_boolean maygc_htentry (const cl_htentry_from_integer_to_rcpointer& entry) +static bool maygc_htentry (const cl_htentry_from_integer_to_rcpointer& entry) { if (!entry.key.pointer_p() || (entry.key.heappointer->refcount == 2)) if (!entry.val.pointer_p() || (entry.val.heappointer->refcount == 1)) - return cl_true; - return cl_false; + return true; + return false; } static const cl_wht_from_integer_to_rcpointer modint_ring_table = cl_wht_from_integer_to_rcpointer(maygc_htentry); diff --git a/src/modinteger/cl_MI_int.h b/src/modinteger/cl_MI_int.h index 0fbfe52..f8e6f78 100644 --- a/src/modinteger/cl_MI_int.h +++ b/src/modinteger/cl_MI_int.h @@ -42,7 +42,7 @@ static const _cl_MI int_zero (cl_heap_modint_ring* R) return _cl_MI(R, 0); } -static cl_boolean int_zerop (cl_heap_modint_ring* R, const _cl_MI& x) +static bool int_zerop (cl_heap_modint_ring* R, const _cl_MI& x) { unused R; return zerop(x.rep); diff --git a/src/modinteger/cl_MI_montgom.h b/src/modinteger/cl_MI_montgom.h index 0f944c3..dba3008 100644 --- a/src/modinteger/cl_MI_montgom.h +++ b/src/modinteger/cl_MI_montgom.h @@ -183,7 +183,7 @@ static cl_heap_modint_ring* try_make_modint_ring_montgom (const cl_I& M) CL_ALLOCA_STACK; var uintC len; var const uintD* M_LSDptr; - I_to_NDS_nocopy(M, ,len=,M_LSDptr=,cl_false,); + I_to_NDS_nocopy(M, ,len=,M_LSDptr=,false,); if (lspref(M_LSDptr,len-1)==0) { len--; } // normalize // Compute U as 2-adic inverse of M. var uintD* U_LSDptr; @@ -194,7 +194,7 @@ static cl_heap_modint_ring* try_make_modint_ring_montgom (const cl_I& M) var uintC i_min; var uintC i_max; var uintC i = floor(m,2); - var cl_boolean negative; + var bool negative; if (U_bit(i)) { for (; --i > 0; ) if (!U_bit(i)) break; @@ -203,7 +203,7 @@ static cl_heap_modint_ring* try_make_modint_ring_montgom (const cl_I& M) for (; ++i < m; ) if (!U_bit(i)) break; i_max = i; - negative = cl_true; + negative = true; } else { for (; --i > 0; ) if (U_bit(i)) break; @@ -212,7 +212,7 @@ static cl_heap_modint_ring* try_make_modint_ring_montgom (const cl_I& M) for (; ++i < m; ) if (U_bit(i)) break; i_max = i; - negative = cl_false; + negative = false; } #undef U_bit // OK, all the bits i_max-1..i_min of U are equal. diff --git a/src/modinteger/cl_MI_pow2m1.h b/src/modinteger/cl_MI_pow2m1.h index 9daecad..496fa4f 100644 --- a/src/modinteger/cl_MI_pow2m1.h +++ b/src/modinteger/cl_MI_pow2m1.h @@ -22,7 +22,7 @@ static inline const cl_I pow2m1_reduce_modulo (cl_heap_modint_ring* _R, const cl // mod(x,m) = mod(x0+x1+x2+...,m). // If x<0, apply this to -1-x, and use mod(x,m) = m-1-mod(-1-x,m). { Mutable(cl_I,x); - var cl_boolean sign = minusp(x); + var bool sign = minusp(x); if (sign) { x = lognot(x); } var const uintC m1 = R->m1; if (x >= R->modulus) { diff --git a/src/modinteger/cl_MI_std.h b/src/modinteger/cl_MI_std.h index e704cc8..ede3818 100644 --- a/src/modinteger/cl_MI_std.h +++ b/src/modinteger/cl_MI_std.h @@ -35,7 +35,7 @@ static const _cl_MI std_zero (cl_heap_modint_ring* R) return _cl_MI(R, 0); } -static cl_boolean std_zerop (cl_heap_modint_ring* R, const _cl_MI& x) +static bool std_zerop (cl_heap_modint_ring* R, const _cl_MI& x) { unused R; return zerop(x.rep); @@ -208,7 +208,7 @@ static const _cl_MI std_expt_pos (cl_heap_modint_ring* R, const _cl_MI& x, const { var const uintD* n_LSDptr; var const uintD* n_MSDptr; - I_to_NDS_nocopy(n, n_MSDptr=,,n_LSDptr=,cl_false,); + I_to_NDS_nocopy(n, n_MSDptr=,,n_LSDptr=,false,); var const uintL k_mask = bit(k)-1; var uintD carry = 0; var unsigned int carrybits = 0; diff --git a/src/numtheory/cl_IF.h b/src/numtheory/cl_IF.h index 6625e73..9be0f14 100644 --- a/src/numtheory/cl_IF.h +++ b/src/numtheory/cl_IF.h @@ -48,7 +48,7 @@ extern uint32 cl_trialdivision (const cl_I& n, uint32 d1, uint32 d2); // Returns true if n looks like a prime (with error probability < 4^-count). // Returns false if n is definitely composite, and then sets factor = some // nontrivial factor or 0. -extern cl_boolean cl_miller_rabin_test (const cl_I& n, int count, cl_I* factor); +extern bool cl_miller_rabin_test (const cl_I& n, int count, cl_I* factor); } // namespace cln diff --git a/src/numtheory/cl_IF_millerrabin.cc b/src/numtheory/cl_IF_millerrabin.cc index cd8b773..3d7c99f 100644 --- a/src/numtheory/cl_IF_millerrabin.cc +++ b/src/numtheory/cl_IF_millerrabin.cc @@ -13,7 +13,7 @@ namespace cln { -cl_boolean cl_miller_rabin_test (const cl_I& n, int count, cl_I* factor) +bool cl_miller_rabin_test (const cl_I& n, int count, cl_I* factor) { // [Cohen], section 8.2, algorithm 8.2.2. var cl_modint_ring R = find_modint_ring(n); // Z/nZ @@ -45,7 +45,7 @@ cl_boolean cl_miller_rabin_test (const cl_I& n, int count, cl_I* factor) // (b-1)*(b+1) == 0 mod n, hence n not prime. if (factor) *factor = gcd(R->retract(b)-1,n); - return cl_false; + return false; } b = new_b; } @@ -57,11 +57,11 @@ cl_boolean cl_miller_rabin_test (const cl_I& n, int count, cl_I* factor) else *factor = 0; } - return cl_false; + return false; passed: ; } - return cl_true; + return true; } } // namespace cln diff --git a/src/numtheory/cl_IF_trialdiv.cc b/src/numtheory/cl_IF_trialdiv.cc index e6e2d06..70f4f62 100644 --- a/src/numtheory/cl_IF_trialdiv.cc +++ b/src/numtheory/cl_IF_trialdiv.cc @@ -26,7 +26,7 @@ uint32 cl_trialdivision (const cl_I& n, uint32 d1, uint32 d2) CL_ALLOCA_STACK; var const uintD* n_MSDptr; var uintC n_len; - I_to_NDS_nocopy(n, n_MSDptr=,n_len=,,cl_false,); + I_to_NDS_nocopy(n, n_MSDptr=,n_len=,,false,); if (mspref(n_MSDptr,0)==0) { msshrink(n_MSDptr); n_len--; } // Make room for a quotient. var uintD* q_MSDptr; diff --git a/src/numtheory/cl_nt_isprobprime.cc b/src/numtheory/cl_nt_isprobprime.cc index 031fe29..0f248c3 100644 --- a/src/numtheory/cl_nt_isprobprime.cc +++ b/src/numtheory/cl_nt_isprobprime.cc @@ -16,7 +16,7 @@ namespace cln { -cl_boolean isprobprime (const cl_I& n) +bool isprobprime (const cl_I& n) { if (!(n > 0)) { std::ostringstream buf; @@ -38,12 +38,12 @@ cl_boolean isprobprime (const cl_I& n) if (i < cl_small_prime_table_size && ((unsigned int) cl_small_prime_table[i] == nn || nn == 2)) - return cl_true; + return true; else - return cl_false; + return false; } if ((nn % 2) == 0 || cl_trialdivision(nn,1,trialdivide_limit)) - return cl_false; + return false; // For small n, only few Miller-Rabin tests are needed. if (nn < 2000U) count = 1; // {2} else if (nn < 1300000U) count = 2; // {2,3} @@ -53,10 +53,10 @@ cl_boolean isprobprime (const cl_I& n) var uint32 nhi = cl_I_to_UL(ldb(n,cl_byte(32,32))); var uint32 nlo = cl_I_to_UL(ldb(n,cl_byte(32,0))); if ((nlo % 2) == 0 || cl_trialdivision(nhi,nlo,1,trialdivide_limit)) - return cl_false; + return false; } else { if (evenp(n) || cl_trialdivision(n,1,trialdivide_limit)) - return cl_false; + return false; } // Step 2: Miller-Rabin test. return cl_miller_rabin_test(n,count,NULL); diff --git a/src/polynomial/elem/cl_UP_GF2.h b/src/polynomial/elem/cl_UP_GF2.h index 5306030..32d3866 100644 --- a/src/polynomial/elem/cl_UP_GF2.h +++ b/src/polynomial/elem/cl_UP_GF2.h @@ -13,7 +13,7 @@ struct cl_heap_GV_I_bits1 : public cl_heap_GV_I { uintD data[1]; }; -static cl_boolean gf2_equal (cl_heap_univpoly_ring* UPR, const _cl_UP& x, const _cl_UP& y) +static bool gf2_equal (cl_heap_univpoly_ring* UPR, const _cl_UP& x, const _cl_UP& y) {{ DeclarePoly(cl_GV_MI,x); DeclarePoly(cl_GV_MI,y); @@ -23,12 +23,12 @@ static cl_boolean gf2_equal (cl_heap_univpoly_ring* UPR, const _cl_UP& x, const var uintL xlen = xv->v.length(); var uintL ylen = yv->v.length(); if (!(xlen == ylen)) - return cl_false; + return false; // We can compare full words since unused bits in the last word are 0. var uintL count = ceiling(xlen,intDsize); if (compare_loop_up(xv->data,yv->data,count) != 0) - return cl_false; - return cl_true; + return false; + return true; }} static const _cl_UP gf2_plus (cl_heap_univpoly_ring* UPR, const _cl_UP& x, const _cl_UP& y) diff --git a/src/polynomial/elem/cl_UP_MI.h b/src/polynomial/elem/cl_UP_MI.h index f76977a..9b672a6 100644 --- a/src/polynomial/elem/cl_UP_MI.h +++ b/src/polynomial/elem/cl_UP_MI.h @@ -60,7 +60,7 @@ static void modint_fprint (cl_heap_univpoly_ring* UPR, std::ostream& stream, con } }} -static cl_boolean modint_equal (cl_heap_univpoly_ring* UPR, const _cl_UP& x, const _cl_UP& y) +static bool modint_equal (cl_heap_univpoly_ring* UPR, const _cl_UP& x, const _cl_UP& y) {{ DeclarePoly(cl_GV_MI,x); DeclarePoly(cl_GV_MI,y); @@ -68,11 +68,11 @@ static cl_boolean modint_equal (cl_heap_univpoly_ring* UPR, const _cl_UP& x, con var sintL xlen = x.length(); var sintL ylen = y.length(); if (!(xlen == ylen)) - return cl_false; + return false; for (var sintL i = xlen-1; i >= 0; i--) if (!R->_equal(x[i],y[i])) - return cl_false; - return cl_true; + return false; + return true; }} static const _cl_UP modint_zero (cl_heap_univpoly_ring* UPR) @@ -80,15 +80,15 @@ static const _cl_UP modint_zero (cl_heap_univpoly_ring* UPR) return _cl_UP(UPR, cl_null_GV_I); } -static cl_boolean modint_zerop (cl_heap_univpoly_ring* UPR, const _cl_UP& x) +static bool modint_zerop (cl_heap_univpoly_ring* UPR, const _cl_UP& x) { unused UPR; { DeclarePoly(cl_GV_MI,x); var sintL xlen = x.length(); if (xlen == 0) - return cl_true; + return true; else - return cl_false; + return false; }} static const _cl_UP modint_plus (cl_heap_univpoly_ring* UPR, const _cl_UP& x, const _cl_UP& y) diff --git a/src/polynomial/elem/cl_UP_gen.h b/src/polynomial/elem/cl_UP_gen.h index dcfd6c7..e827afd 100644 --- a/src/polynomial/elem/cl_UP_gen.h +++ b/src/polynomial/elem/cl_UP_gen.h @@ -56,7 +56,7 @@ static void gen_fprint (cl_heap_univpoly_ring* UPR, std::ostream& stream, const } }} -static cl_boolean gen_equal (cl_heap_univpoly_ring* UPR, const _cl_UP& x, const _cl_UP& y) +static bool gen_equal (cl_heap_univpoly_ring* UPR, const _cl_UP& x, const _cl_UP& y) {{ DeclarePoly(cl_SV_ringelt,x); DeclarePoly(cl_SV_ringelt,y); @@ -64,11 +64,11 @@ static cl_boolean gen_equal (cl_heap_univpoly_ring* UPR, const _cl_UP& x, const var sintL xlen = x.length(); var sintL ylen = y.length(); if (!(xlen == ylen)) - return cl_false; + return false; for (var sintL i = xlen-1; i >= 0; i--) if (!R->_equal(x[i],y[i])) - return cl_false; - return cl_true; + return false; + return true; }} static const _cl_UP gen_zero (cl_heap_univpoly_ring* UPR) @@ -76,15 +76,15 @@ static const _cl_UP gen_zero (cl_heap_univpoly_ring* UPR) return _cl_UP(UPR, cl_null_SV_ringelt); } -static cl_boolean gen_zerop (cl_heap_univpoly_ring* UPR, const _cl_UP& x) +static bool gen_zerop (cl_heap_univpoly_ring* UPR, const _cl_UP& x) { unused UPR; { DeclarePoly(cl_SV_ringelt,x); var sintL xlen = x.length(); if (xlen == 0) - return cl_true; + return true; else - return cl_false; + return false; }} static const _cl_UP gen_plus (cl_heap_univpoly_ring* UPR, const _cl_UP& x, const _cl_UP& y) diff --git a/src/polynomial/elem/cl_UP_named.cc b/src/polynomial/elem/cl_UP_named.cc index a81adaa..dd79734 100644 --- a/src/polynomial/elem/cl_UP_named.cc +++ b/src/polynomial/elem/cl_UP_named.cc @@ -39,13 +39,13 @@ namespace cln { // the ring contains exactly one reference to the base ring and exactly one // reference to the name (on the property list). -static cl_boolean maygc_htentry (const cl_htentry_from_rcpointer2_to_rcpointer& entry) +static bool maygc_htentry (const cl_htentry_from_rcpointer2_to_rcpointer& entry) { if (!entry.key1.pointer_p() || (entry.key1.heappointer->refcount == 2)) if (!entry.key2.pointer_p() || (entry.key2.heappointer->refcount == 2)) if (!entry.val.pointer_p() || (entry.val.heappointer->refcount == 1)) - return cl_true; - return cl_false; + return true; + return false; } static const cl_wht_from_rcpointer2_to_rcpointer univpoly_ring_table = cl_wht_from_rcpointer2_to_rcpointer(maygc_htentry); diff --git a/src/polynomial/elem/cl_UP_no_ring.cc b/src/polynomial/elem/cl_UP_no_ring.cc index 334f40c..53aaf2c 100644 --- a/src/polynomial/elem/cl_UP_no_ring.cc +++ b/src/polynomial/elem/cl_UP_no_ring.cc @@ -39,14 +39,14 @@ static void dummy_fprint (cl_heap_univpoly_ring* R, std::ostream& stream, const unused stream; throw uninitialized_exception(x); } -static cl_boolean dummy_equal (cl_heap_univpoly_ring* R, const _cl_UP& x, const _cl_UP& y) +static bool dummy_equal (cl_heap_univpoly_ring* R, const _cl_UP& x, const _cl_UP& y) { unused R; throw uninitialized_exception(x, y); } #define dummy_zero dummy_op0 -static cl_boolean dummy_zerop (cl_heap_univpoly_ring* R, const _cl_UP& x) +static bool dummy_zerop (cl_heap_univpoly_ring* R, const _cl_UP& x) { unused R; throw uninitialized_exception(x); diff --git a/src/polynomial/elem/cl_UP_number.h b/src/polynomial/elem/cl_UP_number.h index 4966ec0..b6cb8a8 100644 --- a/src/polynomial/elem/cl_UP_number.h +++ b/src/polynomial/elem/cl_UP_number.h @@ -56,7 +56,7 @@ static void num_fprint (cl_heap_univpoly_ring* UPR, std::ostream& stream, const } }} -static cl_boolean num_equal (cl_heap_univpoly_ring* UPR, const _cl_UP& x, const _cl_UP& y) +static bool num_equal (cl_heap_univpoly_ring* UPR, const _cl_UP& x, const _cl_UP& y) {{ DeclarePoly(cl_SV_number,x); DeclarePoly(cl_SV_number,y); @@ -64,11 +64,11 @@ static cl_boolean num_equal (cl_heap_univpoly_ring* UPR, const _cl_UP& x, const var sintL xlen = x.length(); var sintL ylen = y.length(); if (!(xlen == ylen)) - return cl_false; + return false; for (var sintL i = xlen-1; i >= 0; i--) if (!ops.equal(x[i],y[i])) - return cl_false; - return cl_true; + return false; + return true; }} static const _cl_UP num_zero (cl_heap_univpoly_ring* UPR) @@ -76,15 +76,15 @@ static const _cl_UP num_zero (cl_heap_univpoly_ring* UPR) return _cl_UP(UPR, cl_null_SV_number); } -static cl_boolean num_zerop (cl_heap_univpoly_ring* UPR, const _cl_UP& x) +static bool num_zerop (cl_heap_univpoly_ring* UPR, const _cl_UP& x) { unused UPR; { DeclarePoly(cl_SV_number,x); var sintL xlen = x.length(); if (xlen == 0) - return cl_true; + return true; else - return cl_false; + return false; }} static const _cl_UP num_plus (cl_heap_univpoly_ring* UPR, const _cl_UP& x, const _cl_UP& y) diff --git a/src/polynomial/elem/cl_UP_unnamed.cc b/src/polynomial/elem/cl_UP_unnamed.cc index 98d93e3..0ca47d2 100644 --- a/src/polynomial/elem/cl_UP_unnamed.cc +++ b/src/polynomial/elem/cl_UP_unnamed.cc @@ -26,12 +26,12 @@ namespace cln { // any more except from the hash table and the ring. Note that the ring contains // exactly one reference to the base ring. -static cl_boolean maygc_htentry (const cl_htentry_from_rcpointer_to_rcpointer& entry) +static bool maygc_htentry (const cl_htentry_from_rcpointer_to_rcpointer& entry) { if (!entry.key.pointer_p() || (entry.key.heappointer->refcount == 2)) if (!entry.val.pointer_p() || (entry.val.heappointer->refcount == 1)) - return cl_true; - return cl_false; + return true; + return false; } static const cl_wht_from_rcpointer_to_rcpointer univpoly_ring_table = cl_wht_from_rcpointer_to_rcpointer(maygc_htentry); diff --git a/src/rational/algebraic/cl_RA_rootp.cc b/src/rational/algebraic/cl_RA_rootp.cc index 0ad2dba..70b98c8 100644 --- a/src/rational/algebraic/cl_RA_rootp.cc +++ b/src/rational/algebraic/cl_RA_rootp.cc @@ -14,7 +14,7 @@ namespace cln { -cl_boolean rootp (const cl_RA& x, uintL n, cl_RA* w) +bool rootp (const cl_RA& x, uintL n, cl_RA* w) { // Methode: // Bei Integers: klar. @@ -29,13 +29,13 @@ cl_boolean rootp (const cl_RA& x, uintL n, cl_RA* w) var const cl_I& b = denominator(x); var cl_I d; if (!rootp(b,n,&d)) // Nenner auf n-te Potenz testen - return cl_false; + return false; var const cl_I& a = numerator(x); var cl_I c; if (!rootp(a,n,&c)) // Zähler auf n-te Potenz testen - return cl_false; + return false; // beides n-te Potenzen -> Quotient der Wurzeln bilden - *w = I_I_to_RT(c,d); return cl_true; + *w = I_I_to_RT(c,d); return true; }} } // namespace cln diff --git a/src/rational/algebraic/cl_RA_rootp_I.cc b/src/rational/algebraic/cl_RA_rootp_I.cc index dc2f9af..66f7969 100644 --- a/src/rational/algebraic/cl_RA_rootp_I.cc +++ b/src/rational/algebraic/cl_RA_rootp_I.cc @@ -14,7 +14,7 @@ namespace cln { -cl_boolean rootp (const cl_RA& x, const cl_I& n, cl_RA* w) +bool rootp (const cl_RA& x, const cl_I& n, cl_RA* w) { // Methode: // Bei Integers: klar. @@ -29,13 +29,13 @@ cl_boolean rootp (const cl_RA& x, const cl_I& n, cl_RA* w) var const cl_I& b = denominator(x); var cl_I d; if (!rootp(b,n,&d)) // Nenner auf n-te Potenz testen - return cl_false; + return false; var const cl_I& a = numerator(x); var cl_I c; if (!rootp(a,n,&c)) // Zähler auf n-te Potenz testen - return cl_false; + return false; // beides n-te Potenzen -> Quotient der Wurzeln bilden - *w = I_I_to_RT(c,d); return cl_true; + *w = I_I_to_RT(c,d); return true; }} } // namespace cln diff --git a/src/rational/algebraic/cl_RA_sqrtp.cc b/src/rational/algebraic/cl_RA_sqrtp.cc index f341482..31174b9 100644 --- a/src/rational/algebraic/cl_RA_sqrtp.cc +++ b/src/rational/algebraic/cl_RA_sqrtp.cc @@ -14,7 +14,7 @@ namespace cln { -cl_boolean sqrtp (const cl_RA& x, cl_RA* w) +bool sqrtp (const cl_RA& x, cl_RA* w) { // Methode: // Bei Integers: klar. @@ -29,13 +29,13 @@ cl_boolean sqrtp (const cl_RA& x, cl_RA* w) var const cl_I& b = denominator(x); var cl_I d; if (!sqrtp(b,&d)) // Nenner auf Quadratzahl testen - return cl_false; + return false; var const cl_I& a = numerator(x); var cl_I c; if (!sqrtp(a,&c)) // Zähler auf Quadratzahl testen - return cl_false; + return false; // beides Quadratzahlen -> Quotient der Wurzeln bilden - *w = I_I_to_RT(c,d); return cl_true; + *w = I_I_to_RT(c,d); return true; }} } // namespace cln diff --git a/src/rational/cl_RA.h b/src/rational/cl_RA.h index 1b4c5b1..4244135 100644 --- a/src/rational/cl_RA.h +++ b/src/rational/cl_RA.h @@ -45,25 +45,25 @@ inline cl_RA::cl_RA (cl_heap_ratio* ptr) #endif // Type tests. -inline cl_boolean rationalp (const cl_RA& x) - { unused x; return cl_true; } -inline cl_boolean integerp (const cl_RA& x) +inline bool rationalp (const cl_RA& x) + { unused x; return true; } +inline bool integerp (const cl_RA& x) { if (!x.pointer_p()) - return cl_true; + return true; else if (x.pointer_type() == &cl_class_bignum) - return cl_true; - return cl_false; + return true; + return false; } -inline cl_boolean ratiop (const cl_RA& x) +inline bool ratiop (const cl_RA& x) { if (!x.pointer_p()) - return cl_false; + return false; else if (x.pointer_type() == &cl_class_bignum) - return cl_false; - return cl_true; + return false; + return true; } @@ -74,10 +74,10 @@ class cl_RT : public cl_RA { public: }; -inline cl_boolean integerp (const cl_RT& x) - { unused x; return cl_false; } -inline cl_boolean ratiop (const cl_RT& x) - { unused x; return cl_true; } +inline bool integerp (const cl_RT& x) + { unused x; return false; } +inline bool ratiop (const cl_RT& x) + { unused x; return true; } // Access numerator and denominator. inline const cl_I& numerator (const cl_RT& x) @@ -89,9 +89,9 @@ inline const cl_I& denominator (const cl_RT& x) // Sign test: // (MINUSP x) == (< x 0) -inline cl_boolean minusp (const cl_RT& x) +inline bool minusp (const cl_RT& x) { return minusp(numerator(x)); } -inline cl_boolean minusp (const cl_RA& x) +inline bool minusp (const cl_RA& x) { if (ratiop(x)) { DeclareType(cl_RT,x); @@ -103,17 +103,17 @@ inline cl_boolean minusp (const cl_RA& x) } // (ZEROP x) == (= x 0) -inline cl_boolean zerop (const cl_RT& x) - { unused x; return cl_false; } -inline cl_boolean zerop (const cl_RA& x) +inline bool zerop (const cl_RT& x) + { unused x; return false; } +inline bool zerop (const cl_RA& x) { - return (cl_boolean)(x.word == cl_combine(cl_FN_tag,0)); + return x.word == cl_combine(cl_FN_tag,0); } // (EQ x y) == (= x y), assuming y a fixnum -inline cl_boolean eq (const cl_RA& x, sint32 y) +inline bool eq (const cl_RA& x, sint32 y) { - return (cl_boolean)(x.word == cl_combine(cl_FN_tag,y)); + return x.word == cl_combine(cl_FN_tag,y); } // Liefert zu den Integers a und b mit b>1 und ggT(a,b)=1 den Bruch a/b. diff --git a/src/rational/elem/cl_RA_equal.cc b/src/rational/elem/cl_RA_equal.cc index 9c21c0e..1546ef2 100644 --- a/src/rational/elem/cl_RA_equal.cc +++ b/src/rational/elem/cl_RA_equal.cc @@ -14,7 +14,7 @@ namespace cln { -cl_boolean equal (const cl_RA& r, const cl_RA& s) +bool equal (const cl_RA& r, const cl_RA& s) { // Methode: // r,s Integer -> klar @@ -29,20 +29,20 @@ cl_boolean equal (const cl_RA& r, const cl_RA& s) return equal(r,s); } else // r Integer, s Ratio - return cl_false; + return false; else if (integerp(s)) // r Ratio, s Integer - return cl_false; + return false; else { DeclareType(cl_RT,r); DeclareType(cl_RT,s); // r,s Ratios if (!equal(numerator(r),numerator(s))) - return cl_false; + return false; if (!equal(denominator(r),denominator(s))) - return cl_false; - return cl_true; + return false; + return true; } } diff --git a/src/rational/elem/cl_RA_minusp.cc b/src/rational/elem/cl_RA_minusp.cc index 0ae72f6..f7ed825 100644 --- a/src/rational/elem/cl_RA_minusp.cc +++ b/src/rational/elem/cl_RA_minusp.cc @@ -15,7 +15,7 @@ namespace cln { -cl_boolean minusp (const cl_RA& x) +bool minusp (const cl_RA& x) { return inline_minusp(x); } diff --git a/src/rational/elem/cl_RA_plusp.cc b/src/rational/elem/cl_RA_plusp.cc index e0c99ae..e3ab8bd 100644 --- a/src/rational/elem/cl_RA_plusp.cc +++ b/src/rational/elem/cl_RA_plusp.cc @@ -17,14 +17,14 @@ namespace cln { -cl_boolean plusp (const cl_RA& x) +bool plusp (const cl_RA& x) { if (inline_minusp(x)) - return cl_false; // x<0 -> nein + return false; // x<0 -> nein elif (inline_zerop(x)) - return cl_false; // x=0 -> nein + return false; // x=0 -> nein else - return cl_true; // sonst ist x>0. + return true; // sonst ist x>0. } } // namespace cln diff --git a/src/rational/elem/cl_RA_zerop.cc b/src/rational/elem/cl_RA_zerop.cc index e6db433..6d6f8f9 100644 --- a/src/rational/elem/cl_RA_zerop.cc +++ b/src/rational/elem/cl_RA_zerop.cc @@ -15,7 +15,7 @@ namespace cln { -cl_boolean zerop (const cl_RA& x) +bool zerop (const cl_RA& x) { return inline_zerop(x); } diff --git a/src/rational/input/cl_RA_from_string.cc b/src/rational/input/cl_RA_from_string.cc index 13b7c80..c658c07 100644 --- a/src/rational/input/cl_RA_from_string.cc +++ b/src/rational/input/cl_RA_from_string.cc @@ -18,7 +18,7 @@ cl_read_flags cl_RA_read_flags = { syntax_rational, lsyntax_all, 10, - { float_format_ffloat, float_format_lfloat_min, cl_true } + { float_format_ffloat, float_format_lfloat_min, true } }; cl_RA::cl_RA (const char * string) diff --git a/src/rational/input/cl_RA_read_stream.cc b/src/rational/input/cl_RA_read_stream.cc index f14ddce..6dd171d 100644 --- a/src/rational/input/cl_RA_read_stream.cc +++ b/src/rational/input/cl_RA_read_stream.cc @@ -27,17 +27,17 @@ public: char* end_pointer (void) { return buffer+index; } }; -static cl_boolean number_char_p (char c) +static bool number_char_p (char c) { if ((c >= '0') && (c <= '9')) - return cl_true; + return true; if (((c >= 'A') && (c <= 'Z')) || ((c >= 'a') && (c <= 'z'))) - return cl_true; + return true; switch (c) { case '+': case '-': case '.': case '_': case '/': - return cl_true; + return true; default: - return cl_false; + return false; } } diff --git a/src/rational/misc/cl_RA_as.cc b/src/rational/misc/cl_RA_as.cc index 0a35a8d..0f1d946 100644 --- a/src/rational/misc/cl_RA_as.cc +++ b/src/rational/misc/cl_RA_as.cc @@ -15,19 +15,19 @@ namespace cln { // Cf. cl_RA_p in cl_RA_ring.cc. // But here, for better inlining in g++, it is preferrable to finish every -// alternative with either "return cl_true;" or "return cl_false;". +// alternative with either "return true;" or "return false;". -inline cl_boolean cl_RA_p (const cl_number& x) +inline bool cl_RA_p (const cl_number& x) { if (!x.pointer_p()) switch (x.nonpointer_tag()) { case cl_FN_tag: - return cl_true; + return true; } else if (x.pointer_type()->flags & cl_class_flags_subclass_rational) - return cl_true; - return cl_false; + return true; + return false; } const cl_RA& cl_RA_As (const cl_number& x, const char * filename, int line) diff --git a/src/rational/ring/cl_RA_ring.cc b/src/rational/ring/cl_RA_ring.cc index a6aef66..e7d33f3 100644 --- a/src/rational/ring/cl_RA_ring.cc +++ b/src/rational/ring/cl_RA_ring.cc @@ -23,7 +23,7 @@ static void RA_fprint (cl_heap_ring* R, std::ostream& stream, const _cl_ring_ele fprint(stream,The(cl_RA)(x)); } -static cl_boolean RA_equal (cl_heap_ring* R, const _cl_ring_element& x, const _cl_ring_element& y) +static bool RA_equal (cl_heap_ring* R, const _cl_ring_element& x, const _cl_ring_element& y) { unused R; return equal(The(cl_RA)(x),The(cl_RA)(y)); @@ -34,7 +34,7 @@ static const _cl_ring_element RA_zero (cl_heap_ring* R) return _cl_ring_element(R, (cl_RA)0); } -static cl_boolean RA_zerop (cl_heap_ring* R, const _cl_ring_element& x) +static bool RA_zerop (cl_heap_ring* R, const _cl_ring_element& x) { unused R; return zerop(The(cl_RA)(x)); @@ -80,13 +80,11 @@ static const _cl_ring_element RA_expt_pos (cl_heap_ring* R, const _cl_ring_eleme return _cl_ring_element(R, expt_pos(The(cl_RA)(x),y)); } -static cl_boolean cl_RA_p (const cl_number& x) +static bool cl_RA_p (const cl_number& x) { - return (cl_boolean) - (!x.pointer_p() + return (!x.pointer_p() ? x.nonpointer_tag() == cl_FN_tag - : (x.pointer_type()->flags & cl_class_flags_subclass_rational) != 0 - ); + : (x.pointer_type()->flags & cl_class_flags_subclass_rational) != 0); } static cl_ring_setops RA_setops = { diff --git a/src/rational/transcendental/cl_I_logp.cc b/src/rational/transcendental/cl_I_logp.cc index aada2f9..d0e02de 100644 --- a/src/rational/transcendental/cl_I_logp.cc +++ b/src/rational/transcendental/cl_I_logp.cc @@ -15,7 +15,7 @@ namespace cln { -cl_boolean logp (const cl_I& a, const cl_I& b, cl_RA* l) +bool logp (const cl_I& a, const cl_I& b, cl_RA* l) { // Methode: // log(a,b) soll Bruch c/d mit teilerfremdem c>=0,d>0 ergeben. @@ -58,7 +58,7 @@ cl_boolean logp (const cl_I& a, const cl_I& b, cl_RA* l) if (a >= b) { var cl_I_div_t div = cl_divide(a,b); // a durch b dividieren if (!eq(div.remainder,0)) // Rest /=0 ? - return cl_false; // -> fertig + return false; // -> fertig a = div.quotient; // a := a/b ud = uc + ud; vd = vc + vd; } else { @@ -68,7 +68,7 @@ cl_boolean logp (const cl_I& a, const cl_I& b, cl_RA* l) } } // a=1 -> c=0,d=1 -> Ergebnis ud/vd - *l = I_I_to_RA(UL_to_I(ud),UL_to_I(vd)); return cl_true; + *l = I_I_to_RA(UL_to_I(ud),UL_to_I(vd)); return true; }} } // namespace cln diff --git a/src/rational/transcendental/cl_RA_logp.cc b/src/rational/transcendental/cl_RA_logp.cc index 326ec99..84587eb 100644 --- a/src/rational/transcendental/cl_RA_logp.cc +++ b/src/rational/transcendental/cl_RA_logp.cc @@ -14,7 +14,7 @@ namespace cln { -cl_boolean logp (const cl_RA& a, const cl_RA& b, cl_RA* pl) +bool logp (const cl_RA& a, const cl_RA& b, cl_RA* pl) { // Methode: // a=1 -> Ergebnis 0 @@ -32,7 +32,7 @@ cl_boolean logp (const cl_RA& a, const cl_RA& b, cl_RA* pl) // -log(a2/a1,b1/b2) liefern if (eq(a,1)) { // a=1 -> Ergebnis 0 - *pl = 0; return cl_true; + *pl = 0; return true; } if (integerp(b)) { // b Integer @@ -47,13 +47,13 @@ cl_boolean logp (const cl_RA& a, const cl_RA& b, cl_RA* pl) var const cl_I& a1 = numerator(a); var const cl_I& a2 = denominator(a); if (!eq(a1,1)) - return cl_false; + return false; // a1=1 var cl_RA l; if (logp(a2,b,&l)) { - *pl = -l; return cl_true; + *pl = -l; return true; } else - return cl_false; + return false; } } else { // a rational, b Ratio @@ -69,16 +69,16 @@ cl_boolean logp (const cl_RA& a, const cl_RA& b, cl_RA* pl) if (logp(a2,b2,&l2)) { if (eq(b1,1)) { if (eq(a1,1)) - { *pl = l2; return cl_true; } + { *pl = l2; return true; } else - return cl_false; + return false; } else { var cl_RA l1; // rationalen log(a1,b1) versuchen if (logp(a1,b1,&l1)) if (l1 == l2) - { *pl = l2; return cl_true; } - return cl_false; + { *pl = l2; return true; } + return false; } } } @@ -88,19 +88,19 @@ cl_boolean logp (const cl_RA& a, const cl_RA& b, cl_RA* pl) if (logp(a1,b2,&l2)) { if (eq(b1,1)) { if (eq(a2,1)) - { *pl = -l2; return cl_true; } + { *pl = -l2; return true; } else - return cl_false; + return false; } else { var cl_RA l1; // rationalen log(a2,b1) versuchen if (logp(a2,b1,&l1)) if (l1 == l2) - { *pl = -l2; return cl_true; } + { *pl = -l2; return true; } } } } - return cl_false; + return false; } } diff --git a/src/real/cl_R.h b/src/real/cl_R.h index 6023994..c6033b5 100644 --- a/src/real/cl_R.h +++ b/src/real/cl_R.h @@ -15,29 +15,29 @@ extern cl_class cl_class_dfloat; extern cl_class cl_class_lfloat; // Type tests. -inline cl_boolean rationalp (const cl_R& x) +inline bool rationalp (const cl_R& x) { if (!x.pointer_p()) { if (x.nonpointer_tag() == cl_FN_tag) - return cl_true; + return true; } else { if (x.pointer_type()->flags & cl_class_flags_subclass_rational) - return cl_true; + return true; } - return cl_false; + return false; } -inline cl_boolean integerp (const cl_R& x) +inline bool integerp (const cl_R& x) { if (!x.pointer_p()) { if (x.nonpointer_tag() == cl_FN_tag) - return cl_true; + return true; } else { if (x.pointer_type() == &cl_class_bignum) - return cl_true; + return true; } - return cl_false; + return false; } -inline cl_boolean floatp (const cl_R& x) +inline bool floatp (const cl_R& x) { if (!x.pointer_p()) { switch (x.nonpointer_tag()) { @@ -45,22 +45,22 @@ inline cl_boolean floatp (const cl_R& x) #if defined(CL_WIDE_POINTERS) case cl_FF_tag: #endif - return cl_true; + return true; } } else { if (x.pointer_type()->flags & cl_class_flags_subclass_float) - return cl_true; + return true; } - return cl_false; + return false; } // Comparison with a fixnum. -inline cl_boolean eq (const cl_R& x, sint32 y) +inline bool eq (const cl_R& x, sint32 y) { - return (cl_boolean)(x.word == cl_combine(cl_FN_tag,y)); + return x.word == cl_combine(cl_FN_tag,y); } -inline cl_boolean exact_zerop (const cl_R& x) +inline bool exact_zerop (const cl_R& x) { return eq(x,0); } diff --git a/src/real/elem/cl_R_equal.cc b/src/real/elem/cl_R_equal.cc index 032ba3f..b3060ce 100644 --- a/src/real/elem/cl_R_equal.cc +++ b/src/real/elem/cl_R_equal.cc @@ -15,12 +15,12 @@ namespace cln { -inline cl_boolean equal (const cl_F& x, const cl_F& y) +inline bool equal (const cl_F& x, const cl_F& y) { - return (cl_boolean) (compare(x,y) == 0); + return compare(x,y) == 0; } -cl_boolean equal (const cl_R& x, const cl_R& y) +bool equal (const cl_R& x, const cl_R& y) { // Methode: // Beide rational oder beide Floats -> klar. @@ -35,17 +35,17 @@ cl_boolean equal (const cl_R& x, const cl_R& y) return equal(x,y); , // x rational, y Float -> x in Float umwandeln if (!power2p(denominator(x))) - return cl_false; + return false; if (!equal(cl_float(x,y),y)) - return cl_false; + return false; return equal(x,rational(y)); ); , realcase2(y , // x Float, y rational -> y in Float umwandeln if (!power2p(denominator(y))) - return cl_false; + return false; if (!equal(x,cl_float(y,x))) - return cl_false; + return false; return equal(rational(x),y); , // beides Floats return equal(x,y); diff --git a/src/real/elem/cl_R_minusp.cc b/src/real/elem/cl_R_minusp.cc index 58e07c0..6101486 100644 --- a/src/real/elem/cl_R_minusp.cc +++ b/src/real/elem/cl_R_minusp.cc @@ -23,7 +23,7 @@ namespace cln { -cl_boolean minusp (const cl_R& x) +bool minusp (const cl_R& x) #if 0 GEN_R_OP1_2(x, minusp, return) #else // fully inlined, faster diff --git a/src/real/elem/cl_R_plusp.cc b/src/real/elem/cl_R_plusp.cc index 3726392..ab8e274 100644 --- a/src/real/elem/cl_R_plusp.cc +++ b/src/real/elem/cl_R_plusp.cc @@ -11,14 +11,14 @@ namespace cln { -cl_boolean plusp (const cl_R& x) +bool plusp (const cl_R& x) { if (minusp(x)) - return cl_false; // x<0 -> nein + return false; // x<0 -> nein elif (zerop(x)) - return cl_false; // x=0 -> nein + return false; // x=0 -> nein else - return cl_true; // sonst ist x>0. + return true; // sonst ist x>0. } } // namespace cln diff --git a/src/real/elem/cl_R_zerop.cc b/src/real/elem/cl_R_zerop.cc index e4cba8c..c3a30aa 100644 --- a/src/real/elem/cl_R_zerop.cc +++ b/src/real/elem/cl_R_zerop.cc @@ -23,7 +23,7 @@ namespace cln { -cl_boolean zerop (const cl_R& x) +bool zerop (const cl_R& x) #if 0 GEN_R_OP1_2(x, zerop, return) #else // fully inlined, faster diff --git a/src/real/format-output/cl_fmt_cardinal.cc b/src/real/format-output/cl_fmt_cardinal.cc index 3580e41..9d4a426 100644 --- a/src/real/format-output/cl_fmt_cardinal.cc +++ b/src/real/format-output/cl_fmt_cardinal.cc @@ -121,7 +121,7 @@ void format_cardinal (std::ostream& stream, const cl_I& argument) arg = thousands; } while (arg > 0); // Roll back the recursion. - var cl_boolean first_piece = cl_true; + var bool first_piece = true; do { var uintL small = *--small_piece_ptr; var const char * illion = *--illion_ptr; @@ -130,7 +130,7 @@ void format_cardinal (std::ostream& stream, const cl_I& argument) fprint(stream,", "); format_small_cardinal(stream,small); fprint(stream,illion); - first_piece = cl_false; + first_piece = false; } } until (illion_ptr == &illions[0]); } diff --git a/src/real/format-output/cl_fmt_floatstring.cc b/src/real/format-output/cl_fmt_floatstring.cc index caabb20..0addbd3 100644 --- a/src/real/format-output/cl_fmt_floatstring.cc +++ b/src/real/format-output/cl_fmt_floatstring.cc @@ -46,7 +46,7 @@ const digits_with_dot format_float_to_string (const cl_F& arg, const sintL width for (sintL i = 1; i <= places; i++) string[i] = '0'; string[1+places] = '\0'; return digits_with_dot(string, 1+places, - cl_true, (cl_boolean)(places==0), 0 + true, (places==0), 0 ); } // significand : Integer >0 @@ -124,10 +124,10 @@ const digits_with_dot format_float_to_string (const cl_F& arg, const sintL width // = 1 + Stelle der 1. signifikanten Ziffer // oder =0, falls k>=0 // Ausführung der Rundung: - var cl_boolean letzte_stelle_p = cl_false; // d oder width angegeben? + var bool letzte_stelle_p = false; // d oder width angegeben? var sintL letzte_stelle = 0; // falls d oder width angegeben waren: // Stelle der letzten signifikanten Ziffer - var cl_boolean halbzahlig = cl_false; // zeigt an, ob hinten genau ein 0.500000 wegfällt + var bool halbzahlig = false; // zeigt an, ob hinten genau ein 0.500000 wegfällt do { // Solange das Ergebnis auch nach Aufrundung >= 1 bliebe, // eine Vorkommastelle mehr einplanen: @@ -144,7 +144,7 @@ const digits_with_dot format_float_to_string (const cl_F& arg, const sintL width if (dmin > 0) if (letzte_stelle > -dmin) letzte_stelle = -dmin; - letzte_stelle_p = cl_true; + letzte_stelle_p = true; } elif (width > 0) { // Falls nicht d, nur width angegeben: @@ -160,7 +160,7 @@ const digits_with_dot format_float_to_string (const cl_F& arg, const sintL width if (dmin > 0) if (letzte_stelle > -dmin) letzte_stelle = -dmin; - letzte_stelle_p = cl_true; + letzte_stelle_p = true; } if (letzte_stelle_p) { var sintL ziffernzahl = letzte_stelle - stelle; @@ -180,7 +180,7 @@ const digits_with_dot format_float_to_string (const cl_F& arg, const sintL width aufrund_einh = dezimal_einh; // Jetzt darf auch um eine (halbe) DEZIMAL-Einheit gerundet werden. if (aufrund_einh == dezimal_einh) - halbzahlig = cl_true; + halbzahlig = true; } } until (((numerator << 1) + aufrund_einh) < (denominator << 1)); // stelle = Position der ersten signifikanten Stelle + 1 @@ -225,7 +225,7 @@ const digits_with_dot format_float_to_string (const cl_F& arg, const sintL width digit_count++; } // letzte signifikante Ziffer ausgeben: - if (letzte_stelle_p ? (cl_boolean)(stelle >= letzte_stelle) : cl_true) { + if (letzte_stelle_p ? (stelle >= letzte_stelle) : true) { digit = (abrunden && !aufrunden ? digit : aufrunden && !abrunden ? digit+1 : (numerator<<1) <= denominator ? digit : digit+1); @@ -247,8 +247,8 @@ const digits_with_dot format_float_to_string (const cl_F& arg, const sintL width digit_count++; } return digits_with_dot(digitstring.contents(), digit_count+1, - (cl_boolean)(point_pos==0), - (cl_boolean)(point_pos==digit_count), + point_pos==0, + point_pos==digit_count, point_pos ); } diff --git a/src/real/format-output/cl_fmt_integer.cc b/src/real/format-output/cl_fmt_integer.cc index 5446773..ec20622 100644 --- a/src/real/format-output/cl_fmt_integer.cc +++ b/src/real/format-output/cl_fmt_integer.cc @@ -17,8 +17,8 @@ namespace cln { void format_integer (std::ostream& stream, const cl_I& arg, unsigned int base, sintL mincol, char padchar, - char commachar, uintL commainterval, cl_boolean commaflag, - cl_boolean positive_sign_flag) + char commachar, uintL commainterval, bool commaflag, + bool positive_sign_flag) { if ((mincol == 0) && !commaflag && !positive_sign_flag) { // Normale Ausgabe tut's. @@ -29,7 +29,7 @@ void format_integer (std::ostream& stream, const cl_I& arg, var uintL oldstring_length = ::strlen(oldstring); var uintL number_of_digits = (minusp(arg) ? oldstring_length-1 : oldstring_length); var uintL number_of_commas = (commaflag ? floor(number_of_digits-1,commainterval) : 0); - var cl_boolean positive_sign = (cl_boolean) (positive_sign_flag && (arg > 0)); + var bool positive_sign = positive_sign_flag && (arg > 0); var uintL newstring_length = (positive_sign ? 1 : 0) + oldstring_length + number_of_commas; var char* newstring = (char *) malloc_hook(newstring_length+1); newstring[newstring_length] = '\0'; // newstring termination @@ -56,7 +56,7 @@ void format_integer (std::ostream& stream, const cl_I& arg, } } #if 0 - format_padded_string(stream,mincol,1,0,padchar,cl_true,newstring); + format_padded_string(stream,mincol,1,0,padchar,true,newstring); #else // expand this special case of format_padded_string inline: if ((sintL)newstring_length < mincol) format_padding(stream,mincol-newstring_length,padchar); diff --git a/src/real/format-output/cl_fmt_paddedstring.cc b/src/real/format-output/cl_fmt_paddedstring.cc index 1dd9879..20b0b39 100644 --- a/src/real/format-output/cl_fmt_paddedstring.cc +++ b/src/real/format-output/cl_fmt_paddedstring.cc @@ -13,7 +13,7 @@ namespace cln { -void format_padded_string (std::ostream& stream, sintL mincol, sintL colinc, sintL minpad, char padchar, cl_boolean padleftflag, const char * str) +void format_padded_string (std::ostream& stream, sintL mincol, sintL colinc, sintL minpad, char padchar, bool padleftflag, const char * str) { var sintL need = ::strlen(str) + minpad; // so viele Zeichen mindestens var uintL auxpad = (need < mincol diff --git a/src/real/format-output/cl_format.h b/src/real/format-output/cl_format.h index 4c29f0b..a13d551 100644 --- a/src/real/format-output/cl_format.h +++ b/src/real/format-output/cl_format.h @@ -37,14 +37,14 @@ inline void format_padding (std::ostream& stream, sintL count, char ch) // werden mindestens minpad Zeichen eingefügt, eventuelle weitere dann in // Blöcken à colinc Zeichen. Falls padleftflag, werden sie links eingefügt, // sonst rechts vom String. -extern void format_padded_string (std::ostream& stream, sintL mincol, sintL colinc, sintL minpad, char padchar, cl_boolean padleftflag, const char * str); +extern void format_padded_string (std::ostream& stream, sintL mincol, sintL colinc, sintL minpad, char padchar, bool padleftflag, const char * str); // gibt den Integer arg auf den Stream aus: // in Zahlenbasis base, mit Vorzeichen (+ nur falls >0 und positive-sign-flag), // bei commaflag alle drei Stellen unterbrochen durch ein Zeichen commachar. // Das Ganze links aufgefüllt mit padchar's, so daß die Gesamtbreite mindestens // mincol ist. -extern void format_integer (std::ostream& stream, const cl_I& arg, unsigned int base, sintL mincol, char padchar, char commachar, uintL commainterval, cl_boolean commaflag, cl_boolean positive_sign_flag); +extern void format_integer (std::ostream& stream, const cl_I& arg, unsigned int base, sintL mincol, char padchar, char commachar, uintL commainterval, bool commaflag, bool positive_sign_flag); // format_scale_exponent(arg) liefert zur Floating-Point-Zahl arg // drei Werte: mantissa und n, mit @@ -62,11 +62,11 @@ CL_REQUIRE(cl_fmt_scaleexp) struct digits_with_dot { char * string; // Mit malloc_hook() alloziert, mit free_hook() freizugeben. uintL length; // strlen(string) - cl_boolean dot_comes_first; // string[0] == '.' ? - cl_boolean dot_comes_last; // string[strlen(string)-1] == '.' ? + bool dot_comes_first; // string[0] == '.' ? + bool dot_comes_last; // string[strlen(string)-1] == '.' ? uintL dot_position; // string[dot_position] is '.' // Constructor. - digits_with_dot (char* s, uintL l, cl_boolean df, cl_boolean dl, uintL dp) + digits_with_dot (char* s, uintL l, bool df, bool dl, uintL dp) : string(s), length(l), dot_comes_first(df), dot_comes_last(dl), dot_position(dp) {} }; extern const digits_with_dot format_float_to_string (const cl_F& arg, const sintL width, const sintL d, const sintL k, const sintL dmin); diff --git a/src/real/input/cl_R_from_string.cc b/src/real/input/cl_R_from_string.cc index b3b3c9f..346530e 100644 --- a/src/real/input/cl_R_from_string.cc +++ b/src/real/input/cl_R_from_string.cc @@ -18,7 +18,7 @@ cl_read_flags cl_R_read_flags = { syntax_real, lsyntax_all, 10, - { float_format_ffloat, float_format_lfloat_min, cl_true } + { float_format_ffloat, float_format_lfloat_min, true } }; cl_R::cl_R (const char * string) diff --git a/src/real/input/cl_R_read.cc b/src/real/input/cl_R_read.cc index 940e9e9..f0e77bb 100644 --- a/src/real/input/cl_R_read.cc +++ b/src/real/input/cl_R_read.cc @@ -165,29 +165,29 @@ not_rational_syntax: } var const char * ptr_after_sign = ptr; var const char * ptr_after_intpart = skip_digits(ptr_after_sign,string_limit,float_base); - var cl_boolean have_dot = cl_false; + var bool have_dot = false; var const char * ptr_before_fracpart = ptr_after_intpart; var const char * ptr_after_fracpart = ptr_after_intpart; ptr = ptr_after_intpart; if (ptr != string_limit) if (*ptr == '.') { - have_dot = cl_true; + have_dot = true; ptr_before_fracpart = ptr+1; ptr_after_fracpart = skip_digits(ptr_before_fracpart,string_limit,float_base); } ptr = ptr_after_fracpart; var char exponent_marker; - var cl_boolean have_exponent; + var bool have_exponent; var const char * ptr_in_exponent = ptr; var const char * ptr_after_exponent = ptr; if ((ptr == string_limit) || !(((*ptr >= '0') && (*ptr <= '9')) || ((*ptr >= 'A') && (*ptr <= 'Z') && (*ptr != 'I')) || ((*ptr >= 'a') && (*ptr <= 'z') && (*ptr != 'i')) || (*ptr == '.') || (*ptr == '/'))) { // No exponent. - have_exponent = cl_false; + have_exponent = false; // Must have at least one fractional part digit. if (ptr_after_fracpart == ptr_before_fracpart) goto not_float_syntax; exponent_marker = 'E'; } else { - have_exponent = cl_true; + have_exponent = true; // Must have at least one digit. if (ptr_after_sign == ptr_after_intpart) if (ptr_after_fracpart == ptr_before_fracpart) diff --git a/src/real/input/cl_R_read_stream.cc b/src/real/input/cl_R_read_stream.cc index 3f5979e..8415c15 100644 --- a/src/real/input/cl_R_read_stream.cc +++ b/src/real/input/cl_R_read_stream.cc @@ -26,17 +26,17 @@ public: char* end_pointer (void) { return buffer+index; } }; -static cl_boolean number_char_p (char c) +static bool number_char_p (char c) { if ((c >= '0') && (c <= '9')) - return cl_true; + return true; if (((c >= 'A') && (c <= 'Z')) || ((c >= 'a') && (c <= 'z'))) - return cl_true; + return true; switch (c) { case '+': case '-': case '.': case '_': case '/': - return cl_true; + return true; default: - return cl_false; + return false; } } diff --git a/src/real/misc/cl_R_as.cc b/src/real/misc/cl_R_as.cc index a219e23..cb0824a 100644 --- a/src/real/misc/cl_R_as.cc +++ b/src/real/misc/cl_R_as.cc @@ -15,9 +15,9 @@ namespace cln { // Cf. cl_R_p in cl_R_ring.cc. // But here, for better inlining in g++, it is preferrable to finish every -// alternative with either "return cl_true;" or "return cl_false;". +// alternative with either "return true;" or "return false;". -inline cl_boolean cl_R_p (const cl_number& x) +inline bool cl_R_p (const cl_number& x) { if (!x.pointer_p()) switch (x.nonpointer_tag()) { @@ -26,12 +26,12 @@ inline cl_boolean cl_R_p (const cl_number& x) #if defined(CL_WIDE_POINTERS) case cl_FF_tag: #endif - return cl_true; + return true; } else if (x.pointer_type()->flags & cl_class_flags_subclass_real) - return cl_true; - return cl_false; + return true; + return false; } const cl_R& cl_R_As (const cl_number& x, const char * filename, int line) diff --git a/src/real/misc/cl_R_expt_I.cc b/src/real/misc/cl_R_expt_I.cc index 6988eae..14d5425 100644 --- a/src/real/misc/cl_R_expt_I.cc +++ b/src/real/misc/cl_R_expt_I.cc @@ -51,7 +51,7 @@ inline const cl_R expt_pos (const cl_R& x, const cl_I& y) const cl_R expt (const cl_R& x, const cl_I& y) { if (eq(y,0)) { return 1; } // y=0 -> Ergebnis 1 - var cl_boolean y_negative = minusp(y); + var bool y_negative = minusp(y); var cl_I abs_y = (y_negative ? -y : y); // Betrag von y nehmen var cl_R z = expt_pos(x,abs_y); // (expt x (abs y)) return (y_negative ? recip(z) : z); // evtl. noch Kehrwert nehmen diff --git a/src/real/ring/cl_R_ring.cc b/src/real/ring/cl_R_ring.cc index f7330ce..5350bdd 100644 --- a/src/real/ring/cl_R_ring.cc +++ b/src/real/ring/cl_R_ring.cc @@ -24,7 +24,7 @@ static void R_fprint (cl_heap_ring* R, std::ostream& stream, const _cl_ring_elem fprint(stream,The(cl_R)(x)); } -static cl_boolean R_equal (cl_heap_ring* R, const _cl_ring_element& x, const _cl_ring_element& y) +static bool R_equal (cl_heap_ring* R, const _cl_ring_element& x, const _cl_ring_element& y) { unused R; return equal(The(cl_R)(x),The(cl_R)(y)); @@ -35,7 +35,7 @@ static const _cl_ring_element R_zero (cl_heap_ring* R) return _cl_ring_element(R, (cl_R)0); } -static cl_boolean R_zerop (cl_heap_ring* R, const _cl_ring_element& x) +static bool R_zerop (cl_heap_ring* R, const _cl_ring_element& x) { unused R; // Here we return true only if x is the *exact* zero. Because we @@ -85,12 +85,10 @@ static const _cl_ring_element R_expt_pos (cl_heap_ring* R, const _cl_ring_elemen return _cl_ring_element(R, expt(The(cl_R)(x),y)); } -static cl_boolean cl_R_p (const cl_number& x) +static bool cl_R_p (const cl_number& x) { - return (cl_boolean) - (!x.pointer_p() - || (x.pointer_type()->flags & cl_class_flags_subclass_real) != 0 - ); + return (!x.pointer_p() + || (x.pointer_type()->flags & cl_class_flags_subclass_real) != 0); } static cl_ring_setops R_setops = { diff --git a/tests/main.cc b/tests/main.cc index 136eb56..8157200 100644 --- a/tests/main.cc +++ b/tests/main.cc @@ -49,7 +49,7 @@ int main (int argc, char* argv[]) #if 0 cl_I a = "77371252437321868671713407"; cl_I w; - cl_boolean squarep = isqrt(a,&w); + bool squarep = isqrt(a,&w); DUMP(squarep); DUMP(w); DUMP(expt_pos(w,2) <= a); diff --git a/tests/test_I_isqrt.cc b/tests/test_I_isqrt.cc index 6813b76..541dcdc 100644 --- a/tests/test_I_isqrt.cc +++ b/tests/test_I_isqrt.cc @@ -9,7 +9,7 @@ int test_I_isqrt (int iterations) cl_I a = testrandom_I(); if (a >= 0) { cl_I w; - cl_boolean squarep = isqrt(a,&w); + bool squarep = isqrt(a,&w); ASSERT1(w >= 0 && expt_pos(w,2) <= a && a < expt_pos(w+1,2), a); ASSERT1(squarep ? w*w==a : w*w= 0) { cl_I w; - cl_boolean squarep = sqrtp(a,&w); + bool squarep = sqrtp(a,&w); cl_I correct_w; - cl_boolean correct_squarep = isqrt(a,&correct_w); + bool correct_squarep = isqrt(a,&correct_w); ASSERT1(squarep == correct_squarep, a); if (squarep) ASSERT1(w == correct_w, a);