From 665c18cd376d8d8c5a8eafb30681a3f9f46d4a99 Mon Sep 17 00:00:00 2001 From: Richard Kreckel Date: Sat, 15 Sep 2007 21:34:15 +0000 Subject: [PATCH] * */*: Convert encoding from ISO 8859-1 to UTF-8. --- ChangeLog | 4 + NEWS | 4 +- README | 2 +- doc/ratseries/paper/binsplit.tex | 68 +-- examples/atan_recip.cc | 6 +- include/cln/complex.h | 4 +- include/cln/dfloat.h | 2 +- include/cln/ffloat.h | 2 +- include/cln/float.h | 34 +- include/cln/float_io.h | 4 +- include/cln/integer.h | 48 +- include/cln/integer_io.h | 6 +- include/cln/lfloat.h | 6 +- include/cln/random.h | 4 +- include/cln/rational.h | 12 +- include/cln/rational_io.h | 4 +- include/cln/real.h | 40 +- include/cln/sfloat.h | 2 +- src/base/cl_low.h | 246 +++++------ src/base/cl_macros.h | 4 +- src/base/cl_sysdep.h | 4 +- src/base/digit/cl_2D_div.cc | 4 +- src/base/digit/cl_D.h | 20 +- src/base/digitseq/cl_2DS_div.cc | 8 +- src/base/digitseq/cl_DS.h | 388 ++++++++--------- src/base/digitseq/cl_DS_div.cc | 42 +- src/base/digitseq/cl_DS_mul.cc | 32 +- src/base/digitseq/cl_DS_mul_fftm.h | 2 +- src/base/digitseq/cl_DS_mul_fftp.h | 12 +- src/base/digitseq/cl_DS_mul_fftp3.h | 12 +- src/base/digitseq/cl_DS_mul_fftp3m.h | 14 +- src/base/digitseq/cl_DS_mul_kara.h | 52 +-- src/base/digitseq/cl_DS_mul_kara_sqr.h | 16 +- src/base/digitseq/cl_DS_mul_nuss.h | 12 +- src/base/digitseq/cl_DS_sqrt.cc | 62 +-- src/base/digitseq/cl_DS_trandom.cc | 2 +- src/base/digitseq/cl_asm_hppa_.cc | 4 +- src/base/digitseq/cl_asm_i386_.cc | 412 +++++++++--------- src/base/digitseq/cl_asm_m68k_.cc | 368 ++++++++-------- src/base/digitseq/cl_asm_mips_.cc | 6 +- src/base/digitseq/cl_asm_sparc64_.cc | 300 ++++++------- src/base/digitseq/cl_asm_sparc_.cc | 396 ++++++++--------- src/base/low/cl_low_div.cc | 34 +- src/base/low/cl_low_isqrt.cc | 8 +- src/base/low/cl_low_isqrt2.cc | 10 +- src/base/random/cl_UL_random.cc | 6 +- src/base/random/cl_random_from.cc | 10 +- src/base/random/cl_random_impl.h | 14 +- src/complex/algebraic/cl_C_sqrt.cc | 2 +- src/complex/algebraic/cl_DF_hypot.cc | 4 +- src/complex/algebraic/cl_FF_hypot.cc | 4 +- src/complex/algebraic/cl_LF_hypot.cc | 6 +- src/complex/algebraic/cl_R_hypot.cc | 8 +- src/complex/algebraic/cl_SF_hypot.cc | 4 +- src/complex/cl_C.h | 6 +- src/complex/elem/cl_C_equal.cc | 2 +- src/complex/elem/cl_C_zerop.cc | 2 +- src/complex/elem/division/cl_C_DF_recip.cc | 4 +- src/complex/elem/division/cl_C_FF_recip.cc | 4 +- src/complex/elem/division/cl_C_LF_recip.cc | 6 +- src/complex/elem/division/cl_C_SF_recip.cc | 4 +- src/complex/elem/division/cl_C_recip.cc | 8 +- src/complex/misc/cl_C_conjugate.cc | 2 +- src/complex/misc/cl_C_expt.cc | 6 +- src/complex/misc/cl_C_expt_I.cc | 6 +- src/complex/transcendental/cl_C_acosh.cc | 8 +- src/complex/transcendental/cl_C_asin.cc | 4 +- src/complex/transcendental/cl_C_asinh.cc | 12 +- src/complex/transcendental/cl_C_asinh_aux.cc | 32 +- src/complex/transcendental/cl_C_atan.cc | 4 +- src/complex/transcendental/cl_C_atanh.cc | 8 +- src/complex/transcendental/cl_C_atanh_aux.cc | 12 +- src/complex/transcendental/cl_C_expt_C.cc | 10 +- src/complex/transcendental/cl_C_log2.cc | 10 +- src/complex/transcendental/cl_C_phase.cc | 2 +- src/float/cl_F.h | 16 +- src/float/conv/cl_DF_to_FF.cc | 4 +- src/float/conv/cl_DF_to_LF.cc | 4 +- src/float/conv/cl_DF_to_SF.cc | 4 +- src/float/conv/cl_DF_to_double.cc | 2 +- src/float/conv/cl_DF_to_float.cc | 4 +- src/float/conv/cl_FF_to_LF.cc | 4 +- src/float/conv/cl_FF_to_SF.cc | 2 +- src/float/conv/cl_FF_to_float.cc | 2 +- src/float/conv/cl_LF_to_DF.cc | 4 +- src/float/conv/cl_LF_to_FF.cc | 2 +- src/float/conv/cl_LF_to_SF.cc | 2 +- src/float/conv/cl_LF_to_double.cc | 4 +- src/float/conv/cl_LF_to_float.cc | 2 +- src/float/conv/cl_SF_to_LF.cc | 4 +- src/float/dfloat/algebraic/cl_DF_sqrt.cc | 6 +- src/float/dfloat/cl_DF.h | 24 +- src/float/dfloat/conv/cl_DF_from_double.cc | 4 +- src/float/dfloat/conv/cl_DF_to_doublej.cc | 2 +- src/float/dfloat/conv/cl_I_to_double.cc | 16 +- src/float/dfloat/conv/cl_RA_to_double.cc | 2 +- src/float/dfloat/elem/cl_DF_div.cc | 12 +- src/float/dfloat/elem/cl_DF_from_I.cc | 18 +- src/float/dfloat/elem/cl_DF_from_RA.cc | 4 +- src/float/dfloat/elem/cl_DF_fround.cc | 44 +- src/float/dfloat/elem/cl_DF_ftrunc.cc | 6 +- src/float/dfloat/elem/cl_DF_futrunc.cc | 18 +- src/float/dfloat/elem/cl_DF_minus.cc | 4 +- src/float/dfloat/elem/cl_DF_mul.cc | 2 +- src/float/dfloat/elem/cl_DF_plus.cc | 26 +- src/float/dfloat/elem/cl_DF_scale.cc | 4 +- src/float/dfloat/elem/cl_DF_scale_I.cc | 4 +- src/float/ffloat/algebraic/cl_FF_sqrt.cc | 4 +- src/float/ffloat/cl_FF.h | 18 +- src/float/ffloat/conv/cl_FF_from_float.cc | 2 +- src/float/ffloat/conv/cl_FF_to_floatj.cc | 2 +- src/float/ffloat/conv/cl_I_to_float.cc | 14 +- src/float/ffloat/conv/cl_RA_to_float.cc | 2 +- src/float/ffloat/elem/cl_FF_div.cc | 12 +- src/float/ffloat/elem/cl_FF_from_I.cc | 16 +- src/float/ffloat/elem/cl_FF_from_RA.cc | 4 +- src/float/ffloat/elem/cl_FF_fround.cc | 18 +- src/float/ffloat/elem/cl_FF_ftrunc.cc | 2 +- src/float/ffloat/elem/cl_FF_futrunc.cc | 10 +- src/float/ffloat/elem/cl_FF_minus.cc | 4 +- src/float/ffloat/elem/cl_FF_mul.cc | 2 +- src/float/ffloat/elem/cl_FF_plus.cc | 18 +- src/float/ffloat/elem/cl_FF_scale.cc | 4 +- src/float/ffloat/elem/cl_FF_scale_I.cc | 4 +- src/float/input/cl_F_readparsed.cc | 10 +- src/float/lfloat/algebraic/cl_LF_sqrt.cc | 18 +- src/float/lfloat/cl_LF.h | 32 +- src/float/lfloat/cl_LF_impl.h | 16 +- src/float/lfloat/elem/cl_LF_1plus.cc | 44 +- src/float/lfloat/elem/cl_LF_I_div.cc | 8 +- src/float/lfloat/elem/cl_LF_I_mul.cc | 10 +- src/float/lfloat/elem/cl_LF_compare.cc | 16 +- src/float/lfloat/elem/cl_LF_div.cc | 14 +- src/float/lfloat/elem/cl_LF_from_I.cc | 26 +- src/float/lfloat/elem/cl_LF_from_RA.cc | 22 +- src/float/lfloat/elem/cl_LF_fround.cc | 12 +- src/float/lfloat/elem/cl_LF_ftrunc.cc | 4 +- src/float/lfloat/elem/cl_LF_futrunc.cc | 14 +- src/float/lfloat/elem/cl_LF_scale.cc | 8 +- src/float/lfloat/elem/cl_LF_scale_I.cc | 16 +- src/float/lfloat/elem/cl_LF_square.cc | 10 +- src/float/lfloat/elem/cl_LF_to_I.cc | 4 +- src/float/lfloat/misc/cl_LF_extend.cc | 4 +- src/float/lfloat/misc/cl_LF_idecode.cc | 2 +- src/float/lfloat/misc/cl_LF_leninc.cc | 14 +- src/float/lfloat/misc/cl_LF_shorten.cc | 8 +- src/float/lfloat/misc/cl_LF_shortenrel.cc | 2 +- src/float/lfloat/misc/cl_LF_shortenwith.cc | 2 +- src/float/misc/cl_F_extendsqrt.cc | 14 +- src/float/misc/cl_F_leastneg.cc | 2 +- src/float/misc/cl_F_leastpos.cc | 2 +- src/float/misc/cl_F_mostneg.cc | 2 +- src/float/misc/cl_F_mostpos.cc | 2 +- src/float/misc/cl_F_rational.cc | 8 +- src/float/misc/cl_F_shortenrel.cc | 2 +- src/float/misc/cl_float_format.cc | 8 +- src/float/output/cl_F_dprint.cc | 192 ++++---- src/float/output/cl_F_printb.cc | 4 +- src/float/sfloat/algebraic/cl_SF_sqrt.cc | 4 +- src/float/sfloat/cl_SF.h | 8 +- src/float/sfloat/elem/cl_SF_div.cc | 10 +- src/float/sfloat/elem/cl_SF_from_I.cc | 16 +- src/float/sfloat/elem/cl_SF_from_RA.cc | 4 +- src/float/sfloat/elem/cl_SF_fround.cc | 18 +- src/float/sfloat/elem/cl_SF_ftrunc.cc | 2 +- src/float/sfloat/elem/cl_SF_futrunc.cc | 10 +- src/float/sfloat/elem/cl_SF_plus.cc | 14 +- src/float/sfloat/elem/cl_SF_scale.cc | 4 +- src/float/sfloat/elem/cl_SF_scale_I.cc | 4 +- src/float/transcendental/cl_F_atanhx.cc | 20 +- src/float/transcendental/cl_F_atanx.cc | 18 +- src/float/transcendental/cl_F_cos.cc | 6 +- src/float/transcendental/cl_F_cosh.cc | 4 +- src/float/transcendental/cl_F_coshsinh.cc | 4 +- src/float/transcendental/cl_F_cossin.cc | 6 +- src/float/transcendental/cl_F_exp.cc | 4 +- src/float/transcendental/cl_F_expx.cc | 16 +- src/float/transcendental/cl_F_ln.cc | 8 +- src/float/transcendental/cl_F_lnx.cc | 16 +- src/float/transcendental/cl_F_roundpi.cc | 2 +- src/float/transcendental/cl_F_roundpi2.cc | 2 +- src/float/transcendental/cl_F_sin.cc | 6 +- src/float/transcendental/cl_F_sinh.cc | 8 +- src/float/transcendental/cl_F_sinhx.cc | 14 +- src/float/transcendental/cl_F_sinx.cc | 14 +- src/float/transcendental/cl_F_tran.h | 22 +- .../transcendental/cl_LF_catalanconst.cc | 18 +- .../transcendental/cl_LF_coshsinh_aux.cc | 2 +- src/float/transcendental/cl_LF_cossin_aux.cc | 2 +- src/float/transcendental/cl_LF_eulerconst.cc | 20 +- src/float/transcendental/cl_LF_exp1.cc | 8 +- src/float/transcendental/cl_LF_exp_aux.cc | 2 +- src/float/transcendental/cl_LF_ln10.cc | 6 +- src/float/transcendental/cl_LF_ln2.cc | 6 +- src/float/transcendental/cl_LF_pi.cc | 24 +- src/float/transcendental/cl_LF_zeta_int.cc | 6 +- src/integer/algebraic/cl_I_rootp.cc | 2 +- src/integer/algebraic/cl_I_rootp_I.cc | 4 +- src/integer/algebraic/cl_I_rootp_aux.cc | 32 +- src/integer/bitwise/cl_I_ash.cc | 12 +- src/integer/bitwise/cl_I_ash_I.cc | 12 +- src/integer/bitwise/cl_I_ilength.cc | 6 +- src/integer/bitwise/cl_I_ldb.cc | 2 +- src/integer/bitwise/cl_I_ldbx.cc | 12 +- src/integer/bitwise/cl_I_ldbxtest.cc | 14 +- src/integer/bitwise/cl_I_log.h | 2 +- src/integer/bitwise/cl_I_log_aux.cc | 4 +- src/integer/bitwise/cl_I_logand.cc | 14 +- src/integer/bitwise/cl_I_logandc2.cc | 14 +- src/integer/bitwise/cl_I_logbitp.cc | 2 +- src/integer/bitwise/cl_I_logbitp_I.cc | 2 +- src/integer/bitwise/cl_I_logcount.cc | 8 +- src/integer/bitwise/cl_I_logeqv.cc | 14 +- src/integer/bitwise/cl_I_logior.cc | 14 +- src/integer/bitwise/cl_I_lognand.cc | 14 +- src/integer/bitwise/cl_I_lognor.cc | 14 +- src/integer/bitwise/cl_I_lognot.cc | 2 +- src/integer/bitwise/cl_I_logorc2.cc | 14 +- src/integer/bitwise/cl_I_logtest.cc | 18 +- src/integer/bitwise/cl_I_logxor.cc | 14 +- src/integer/bitwise/cl_I_mkf.cc | 2 +- src/integer/bitwise/cl_I_mkfx.cc | 18 +- src/integer/cl_I.h | 26 +- src/integer/conv/cl_I_from_DS.cc | 6 +- src/integer/conv/cl_I_from_L.cc | 4 +- src/integer/conv/cl_I_from_L2.cc | 2 +- src/integer/conv/cl_I_from_NDS.cc | 6 +- src/integer/conv/cl_I_from_NUDS.cc | 2 +- src/integer/conv/cl_I_from_Q.cc | 4 +- src/integer/conv/cl_I_from_UDS.cc | 2 +- src/integer/conv/cl_I_from_UL.cc | 2 +- src/integer/conv/cl_I_from_UL2.cc | 2 +- src/integer/conv/cl_I_from_UQ.cc | 2 +- src/integer/conv/cl_I_mul10plus.cc | 2 +- src/integer/conv/cl_I_to_L.cc | 4 +- src/integer/conv/cl_I_to_Q.cc | 4 +- src/integer/conv/cl_I_to_UL.cc | 2 +- src/integer/conv/cl_I_to_UQ.cc | 2 +- src/integer/conv/cl_I_to_digits.cc | 16 +- src/integer/elem/cl_I_compare.cc | 8 +- src/integer/elem/cl_I_equal.cc | 2 +- src/integer/elem/cl_I_minus.cc | 44 +- src/integer/elem/cl_I_mul.cc | 4 +- src/integer/elem/cl_I_plus.cc | 44 +- src/integer/elem/cl_I_square.cc | 4 +- src/integer/gcd/cl_I_gcd.cc | 72 +-- src/integer/gcd/cl_I_gcd_aux.cc | 2 +- src/integer/gcd/cl_I_gcd_aux2.cc | 16 +- src/integer/gcd/cl_I_lcm.cc | 2 +- src/integer/gcd/cl_I_xgcd.cc | 76 ++-- src/integer/gcd/cl_low_gcd.cc | 4 +- src/integer/misc/cl_I_eqhashcode.cc | 12 +- src/integer/misc/cl_I_oddp.cc | 4 +- src/integer/misc/cl_I_ord2.cc | 8 +- src/integer/misc/cl_I_power2p.cc | 2 +- src/integer/misc/combin/cl_I_combin.h | 2 +- .../misc/combin/cl_I_doublefactorial.cc | 8 +- src/integer/misc/combin/cl_I_factorial.cc | 12 +- src/integer/misc/combin/cl_I_factorial_aux.cc | 2 +- src/integer/output/cl_I_decstring.cc | 2 +- src/integer/output/cl_I_print.cc | 2 +- src/integer/output/cl_I_print_string.cc | 4 +- src/polynomial/elem/cl_asm_sparc_GF2.cc | 12 +- src/rational/algebraic/cl_RA_rootp.cc | 4 +- src/rational/algebraic/cl_RA_rootp_I.cc | 4 +- src/rational/algebraic/cl_RA_sqrtp.cc | 4 +- src/rational/cl_RA.h | 6 +- src/rational/elem/cl_RA_minus.cc | 4 +- src/rational/elem/cl_RA_plus.cc | 4 +- src/rational/input/cl_RA_readparsed.cc | 2 +- src/rational/misc/cl_RA_expt.cc | 6 +- src/rational/misc/cl_RA_expt_I.cc | 6 +- src/rational/misc/cl_RA_exptpos.cc | 2 +- src/rational/misc/cl_RA_exptpos_I.cc | 2 +- src/rational/output/cl_RA_dprint.cc | 2 +- src/rational/output/cl_RA_print.cc | 4 +- src/rational/transcendental/cl_I_logp.cc | 12 +- src/real/cl_R.h | 8 +- src/real/elem/cl_R_div.cc | 2 +- src/real/elem/cl_R_equal.cc | 2 +- src/real/format-output/TODO-format | 28 +- src/real/format-output/cl_fmt_floatstring.cc | 42 +- src/real/format-output/cl_fmt_integer.cc | 6 +- src/real/format-output/cl_fmt_scaleexp.cc | 2 +- src/real/format-output/cl_format.h | 20 +- src/real/misc/cl_R_expt.cc | 6 +- src/real/misc/cl_R_expt_I.cc | 6 +- src/real/misc/cl_R_rationalize.cc | 12 +- src/real/random/cl_R_random.cc | 2 +- src/real/transcendental/cl_R_atan2.cc | 2 +- src/vector/cl_GV_io.h | 2 +- src/vector/cl_SV_io.h | 2 +- 292 files changed, 2572 insertions(+), 2568 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3bf642f..e4d220a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-09-16 Richard B. Kreckel + + * */*: Convert encoding from ISO 8859-1 to UTF-8. + 2007-09-13 Richard B. Kreckel Truncated binary splitting for even more memory efficiency: diff --git a/NEWS b/NEWS index 67b1f40..0b5a323 100644 --- a/NEWS +++ b/NEWS @@ -564,7 +564,7 @@ Implementation changes ---------------------- * Moved the sources to subdirectories. - (Suggested by Jörg Arndt.) + (Suggested by Jörg Arndt.) Other changes ------------- @@ -668,7 +668,7 @@ Algorithmic changes ------------------- * Speed up the multiplication of large numbers by use of an FFT based - algorithm (Schönhage-Strassen). The improvement is noticeable when both + algorithm (Schönhage-Strassen). The improvement is noticeable when both factors have at least 1250 words = 40000 bits = 12000 decimal digits. * Speed up the functions `cl_I gcd (const cl_I&, const cl_I&)' and diff --git a/README b/README index 018972d..ee5bee5 100644 --- a/README +++ b/README @@ -21,7 +21,7 @@ Features: - Automatic, non-interruptive garbage collection. - Speed efficiency: - Assembly language kernel for some CPUs, - - Karatsuba and Schönhage-Strassen multiplication. + - Karatsuba and Schönhage-Strassen multiplication. - Interoperability: - Garbage collection with no burden on the main application, diff --git a/doc/ratseries/paper/binsplit.tex b/doc/ratseries/paper/binsplit.tex index 6092b11..9cb8c6c 100644 --- a/doc/ratseries/paper/binsplit.tex +++ b/doc/ratseries/paper/binsplit.tex @@ -3,8 +3,8 @@ %%% Version 12, 1999-09-07, Bruno %%% ----------------------------- %%% -%%% * Habe neue Referenzen zu den Karatsuba-Arbeiten hinzugefügt, entnommen -%%% dem großartigen Paper CECM-98-118 (98_118-Borwein-Bradley-Crandall.dvi). +%%% * Habe neue Referenzen zu den Karatsuba-Arbeiten hinzugefügt, entnommen +%%% dem großartigen Paper CECM-98-118 (98_118-Borwein-Bradley-Crandall.dvi). %%% * Habe in acm.bst, Funktion format.title, das change.case rausgenommen, %%% das die Namen von Euler, Riemann u.a. in Kleinbuchstaben konvertiert %%% hatte. @@ -12,13 +12,13 @@ %%% Version 11, 1998-12-20, Bruno %%% ----------------------------- %%% -%%% * Habe Referenzen zu den Karatsuba-Arbeiten hinzugefügt. +%%% * Habe Referenzen zu den Karatsuba-Arbeiten hinzugefügt. %%% %%% Version 10, 1998-03-10, Thomas & Bruno %%% -------------------------------------- %%% -%%% * Korrigiere die Formel für a(n) bei zeta(3). -%%% * Schönheitsfehler im Literaturverzeichnis. +%%% * Korrigiere die Formel für a(n) bei zeta(3). +%%% * Schönheitsfehler im Literaturverzeichnis. %%% %%% Version 9, 1998-03-06, Thomas & Bruno %%% ------------------------------------- @@ -28,7 +28,7 @@ %%% Version 8, 1998-01-16b, Thomas %%% ------------------------------ %%% -%%% * Drei Literaturverweise für LiDIA statt nur einem. +%%% * Drei Literaturverweise für LiDIA statt nur einem. %%% %%% Version 7, 1998-01-16a, Bruno %%% ----------------------------- @@ -60,8 +60,8 @@ %%% Version 4, 1997-01-09, Thomas %%% ----------------------------- %%% -%%% * Habe die Komplexitätsaussage für sinh, cosh ergänzt. -%%% * Habe die Versionen der getesteten CAS ergänzt. +%%% * Habe die Komplexitätsaussage für sinh, cosh ergänzt. +%%% * Habe die Versionen der getesteten CAS ergänzt. %%% %%% Version 3, 1997-01-07, Bruno %%% ---------------------------- @@ -90,66 +90,66 @@ %%% Version 2, 1997-01-06, Thomas %%% ----------------------------- %%% -%%% * geänderte Abschnitte sind auskommentiert mit %%%. Alle -%%% Änderungen sind als Vorschlag zu verstehen. Der Grund -%%% wird im folgenden angegeben. Falls Du mit einer Änderung -%%% einverstanden bist, kannst Du alle %%%-Zeilen löschen. +%%% * geänderte Abschnitte sind auskommentiert mit %%%. Alle +%%% Änderungen sind als Vorschlag zu verstehen. Der Grund +%%% wird im folgenden angegeben. Falls Du mit einer Änderung +%%% einverstanden bist, kannst Du alle %%%-Zeilen löschen. %%% %%% * Lyx defines wurden entfernt. Grund: das ISSAC-acmconf.sty -%%% erlaubt keine fremde macros. Übersetzung mit LaTeX geht. -%%% * habe Keyboardumlaute (ä,ü,ö,ß) in LaTeX umgeschrieben. +%%% erlaubt keine fremde macros. Übersetzung mit LaTeX geht. +%%% * habe Keyboardumlaute (ä,ü,ö,ß) in LaTeX umgeschrieben. %%% Grund: damit die Submission in einem file geht. %%% * Habe fontenc und psfig usepackage Befehle entfernt. %%% Grund: fonts bestimmt acmconf.sty und keine Bilder vorhanden. %%% * Habe bibliography mit BibTeX (binsplit.bib) und acm.bst %%% erstellt. Grund: wird von ISSAC '97 verlangt. %%% * Habe langen Formeln in einer eqnarray Umgebung gesteckt. -%%% Grund: acmconf.sty läuft im twocolumn-Modus. Lange Formeln +%%% Grund: acmconf.sty läuft im twocolumn-Modus. Lange Formeln %%% haben die Ausgabe durcheinander gebracht. %%% * Habe Reihenfolge bei der Beschreibung der elementare -%%% Funktionen geändert, sodaß zuerst die rationale und dann +%%% Funktionen geändert, sodaß zuerst die rationale und dann %%% die reelle version beschrieben wird. Grund: Einheitlichkeit. %%% * Habe sinh mit binary-splitting gegen sinh mit exp-Berechnung -%%% getestet. Sie sind ungefähr gleich gut auf meinen Pentium, +%%% getestet. Sie sind ungefähr gleich gut auf meinen Pentium, %%% mir machen "Wackler" beim cosh. cosh ist ab und zu, sowohl -%%% bei kleiner als auch bei große Präzision langsamer. Habe -%%% dies und dem Abschnitt sinh, cosh ausgefüllt. Grund: es hat +%%% bei kleiner als auch bei große Präzision langsamer. Habe +%%% dies und dem Abschnitt sinh, cosh ausgefüllt. Grund: es hat %%% gefehlt. %%% * Habe artanh Abschnitt entfernt. Grund: ich habe in der -%%% Einleitung der elementaren Funktionen darauf verwiesen, daß +%%% Einleitung der elementaren Funktionen darauf verwiesen, daß %%% man die Berechnung anderer Funktionen (wie artanh) auf die -%%% hier erwähnte zurückführen oder auf analoger Weise +%%% hier erwähnte zurückführen oder auf analoger Weise %%% implementieren kann. Ich denke man braucht nicht alles explizit %%% anzugeben. %%% -%%% * Habe Dein Dankeschön an mich entfernt. -%%% * Habe Abschnitt über Konvergenzbeschleunigung entfernt. +%%% * Habe Dein Dankeschön an mich entfernt. +%%% * Habe Abschnitt über Konvergenzbeschleunigung entfernt. %%% Grund: das geht in Dein MathComp paper. %%% -%%% * Habe neue Formel für pi eingefügt. Grund: einfacher, +%%% * Habe neue Formel für pi eingefügt. Grund: einfacher, %%% effizienter und stimmt mit der angegebenen Referenz -%%% überein. +%%% überein. %%% * Habe die Berechnung der Apery Konstante angepasst. %%% Grund: die hier angegebenen Formel wurde mit einer %%% umgeformten Reihe berechnet. Wenn man dieses nicht %%% kennt, wirkt es verwirrend. Keine Effizienz-steigerung. -%%% * Habe die Beschreibung für die erste version der Euler +%%% * Habe die Beschreibung für die erste version der Euler %%% Konstante entfernt. Grund: wird von der zweiten version %%% in jeder Hinsicht (Beweis, Effizienz) gedeckt. -%%% * Habe Abschnitte über Checkpointing und Parallelisierung -%%% eingefügt. Ein Beispiel über die Wirksamkeit habe ich -%%% bei der Apery Konstante angegeben. Grund: damit können wir +%%% * Habe Abschnitte über Checkpointing und Parallelisierung +%%% eingefügt. Ein Beispiel über die Wirksamkeit habe ich +%%% bei der Apery Konstante angegeben. Grund: damit können wir %%% das Paper auch bei PASCO '97 einreichen. %%% -%%% * Habe Beispiel-C++-Implementierung für abpq Reihen eingefügt. +%%% * Habe Beispiel-C++-Implementierung für abpq Reihen eingefügt. %%% Grund: zeigen wie einfach es ist wenn man die Formeln hat ;-) -%%% * Habe Beispiel-Implementierung für abpqcd Reihen eingefügt. +%%% * Habe Beispiel-Implementierung für abpqcd Reihen eingefügt. %%% Grund: dito -%%% * Habe Computational results und Conclusions Abschnitt eingefügt. +%%% * Habe Computational results und Conclusions Abschnitt eingefügt. %%% * Habe die Namen der Konstanten (C, G, ...) and die entsprechenden -%%% Abschnitten eingefügt. Grund: diese Namen werden bei den +%%% Abschnitten eingefügt. Grund: diese Namen werden bei den %%% Tabellen im Abschnitt Computational results benutzt. -%%% * Habe Verweis an LiDIA eingefügt. Grund: wird bei Computational +%%% * Habe Verweis an LiDIA eingefügt. Grund: wird bei Computational %%% results erw\"ahnt. %%% %%% Version 1, 1996-11-30, Bruno diff --git a/examples/atan_recip.cc b/examples/atan_recip.cc index 824814c..f061fae 100644 --- a/examples/atan_recip.cc +++ b/examples/atan_recip.cc @@ -251,7 +251,7 @@ int main (int argc, char * argv[]) // Timings of the above algorithms, on an i486 33 MHz, running Linux. -// m = 390112. (For Jörg Arndt's formula (4.15).) +// m = 390112. (For Jörg Arndt's formula (4.15).) // N 1a 1b 1c 1d 2a 2b 2c 2d 3 // 10 0.0027 0.0018 0.0019 0.0019 0.0032 0.0022 0.0019 0.0019 0.0042 // 25 0.0085 0.0061 0.0058 0.0061 0.0095 0.0069 0.0056 0.0061 0.028 @@ -265,10 +265,10 @@ int main (int argc, char * argv[]) // 10000 // asymp. N^2 N^2 N^2 FAST N^2 N^2 N^2 FAST FAST // -// m = 319. (For Jörg Arndt's formula (4.7).) +// m = 319. (For Jörg Arndt's formula (4.7).) // N 1a 1b 1c 1d 2a 2b 2c 2d 3 // 1000 6.06 4.40 9.17 3.82 5.29 3.90 7.50 3.53 50.3 // -// m = 18. (For Jörg Arndt's formula (4.4).) +// m = 18. (For Jörg Arndt's formula (4.4).) // N 1a 1b 1c 1d 2a 2b 2c 2d 3 // 1000 11.8 9.0 22.3 6.0 10.2 7.7 17.1 5.7 54.3 diff --git a/include/cln/complex.h b/include/cln/complex.h index 18868a9..dc4aacc 100644 --- a/include/cln/complex.h +++ b/include/cln/complex.h @@ -24,7 +24,7 @@ extern const cl_N complex (const cl_R& a, const cl_R& b); // realpart(x) liefert den Realteil der Zahl x. extern const cl_R realpart (const cl_N& x); -// imagpart(x) liefert den Imaginärteil der Zahl x. +// imagpart(x) liefert den Imaginärteil der Zahl x. extern const cl_R imagpart (const cl_N& x); // conjugate(x) liefert die konjugiert komplexe Zahl zur Zahl x. @@ -69,7 +69,7 @@ extern const cl_N sqrt (const cl_N& x); // equal(x,y) vergleicht zwei Zahlen x und y auf Gleichheit. extern bool equal (const cl_N& x, const cl_N& y); -// equal_hashcode(x) liefert einen equal-invarianten Hashcode für x. +// equal_hashcode(x) liefert einen equal-invarianten Hashcode für x. extern uint32 equal_hashcode (const cl_N& x); inline bool operator== (const cl_N& x, const cl_N& y) diff --git a/include/cln/dfloat.h b/include/cln/dfloat.h index 023261b..de10538 100644 --- a/include/cln/dfloat.h +++ b/include/cln/dfloat.h @@ -20,7 +20,7 @@ extern const cl_DF operator- (const cl_DF& x); // Ergebnis: 0 falls x=y, +1 falls x>y, -1 falls xy, -1 falls x uintC len: gewünschte Anzahl Digits, >=LF_minlen +// > uintC len: gewünschte Anzahl Digits, >=LF_minlen extern const cl_LF cl_F_to_LF (const cl_F& x, uintC len); @@ -63,34 +63,34 @@ extern float_format_t default_float_format; extern float_format_t float_format (uintE n); // cl_float(x,y) wandelt ein Float x in das Float-Format des Floats y um -// und rundet dabei nötigenfalls. +// und rundet dabei nötigenfalls. // > x,y: Floats // < ergebnis: (float x y) extern const cl_F cl_float (const cl_F& x, const cl_F& y); // cl_float(x,f) wandelt ein Float x in das Float-Format f um -// und rundet dabei nötigenfalls. +// und rundet dabei nötigenfalls. // > x: ein Float // > f: eine Float-Format-Spezifikation // < ergebnis: (float x f) extern const cl_F cl_float (const cl_F& x, float_format_t f); // cl_float(x) wandelt eine reelle Zahl x in ein Float um -// und rundet dabei nötigenfalls. +// und rundet dabei nötigenfalls. // > x: eine reelle Zahl // < ergebnis: (float x) -// Abhängig von default_float_format. +// Abhängig von default_float_format. inline const cl_F cl_float (const cl_F& x) { return x; } // cl_float(x,y) wandelt ein Integer x in das Float-Format des Floats y um -// und rundet dabei nötigenfalls. +// und rundet dabei nötigenfalls. // > x: ein Integer // > y: ein Float // < ergebnis: (float x y) extern const cl_F cl_float (const cl_I& x, const cl_F& y); // cl_float(x,y) wandelt ein Integer x in das Float-Format f um -// und rundet dabei nötigenfalls. +// und rundet dabei nötigenfalls. // > x: ein Integer // > f: eine Float-Format-Spezifikation // < ergebnis: (float x f) @@ -99,18 +99,18 @@ extern const cl_F cl_float (const cl_I& x, float_format_t f); // cl_float(x) wandelt ein Integer x in ein Float um und rundet dabei. // > x: ein Integer // < ergebnis: (float x) -// Abhängig von default_float_format. +// Abhängig von default_float_format. extern const cl_F cl_float (const cl_I& x); // cl_float(x,y) wandelt eine rationale Zahl x in das Float-Format des -// Floats y um und rundet dabei nötigenfalls. +// Floats y um und rundet dabei nötigenfalls. // > x: eine rationale Zahl // > y: ein Float // < ergebnis: (float x y) extern const cl_F cl_float (const cl_RA& x, const cl_F& y); // cl_float(x,y) wandelt eine rationale Zahl x in das Float-Format f um -// und rundet dabei nötigenfalls. +// und rundet dabei nötigenfalls. // > x: eine rationale Zahl // > f: eine Float-Format-Spezifikation // < ergebnis: (float x f) @@ -119,7 +119,7 @@ extern const cl_F cl_float (const cl_RA& x, float_format_t f); // cl_float(x) wandelt eine rationale Zahl x in ein Float um und rundet dabei. // > x: eine rationale Zahl // < ergebnis: (float x) -// Abhängig von default_float_format. +// Abhängig von default_float_format. extern const cl_F cl_float (const cl_RA& x); // The C++ compilers are not clever enough to guess this: @@ -164,7 +164,7 @@ inline const cl_F operator+ (const cl_F& x, const cl_RA& y) { return x + cl_float(y,x); } inline const cl_F operator+ (const cl_F& x, const cl_I& y) { return x + cl_float(y,x); } -// Dem C++-Compiler muß man nun auch das Folgende sagen: +// Dem C++-Compiler muß man nun auch das Folgende sagen: inline const cl_F operator+ (const int x, const cl_F& y) { return cl_I(x) + y; } inline const cl_F operator+ (const unsigned int x, const cl_F& y) @@ -213,7 +213,7 @@ inline const cl_F operator- (const cl_F& x, const cl_RA& y) { return x - cl_float(y,x); } inline const cl_F operator- (const cl_F& x, const cl_I& y) { return x - cl_float(y,x); } -// Dem C++-Compiler muß man nun auch das Folgende sagen: +// Dem C++-Compiler muß man nun auch das Folgende sagen: inline const cl_F operator- (const int x, const cl_F& y) { return cl_I(x) - y; } inline const cl_F operator- (const unsigned int x, const cl_F& y) @@ -274,7 +274,7 @@ inline const cl_R operator* (const cl_RA& x, const cl_F& y) extern const cl_R cl_F_RA_mul (const cl_F&, const cl_RA&); return cl_F_RA_mul(y,x); } -// Dem C++-Compiler muß man nun auch das Folgende sagen: +// Dem C++-Compiler muß man nun auch das Folgende sagen: inline const cl_R operator* (const int x, const cl_F& y) { return cl_I(x) * y; } inline const cl_R operator* (const unsigned int x, const cl_F& y) @@ -385,7 +385,7 @@ inline const cl_F minus1 (const cl_F& x) // { return x + cl_I(-1); } // Ergebnis: 0 falls x=y, +1 falls x>y, -1 falls x0 ein zufälliges +// random_F(randomstate,n) liefert zu einem Float n>0 ein zufälliges // Float x mit 0 <= x < n. -// > randomstate: ein Random-State, wird verändert +// > randomstate: ein Random-State, wird verändert extern const cl_F random_F (random_state& randomstate, const cl_F& n); inline const cl_F random_F (const cl_F& n) diff --git a/include/cln/float_io.h b/include/cln/float_io.h index 66423ac..efc354d 100644 --- a/include/cln/float_io.h +++ b/include/cln/float_io.h @@ -14,7 +14,7 @@ namespace cln { // read_float(base,sign,string,index1,index4,index2,index3) // > base: Lesebasis (=10) // > sign: Vorzeichen (/=0 falls negativ) -// > string: Simple-String (enthält Ziffern und evtl. Punkt und Exponentmarker) +// > string: Simple-String (enthält Ziffern und evtl. Punkt und Exponentmarker) // > index1: Index vom Mantissenanfang (excl. Vorzeichen) // > index4: Index nach dem Mantissenende // > index2: Index beim Ende der Characters @@ -58,7 +58,7 @@ extern void print_float (std::ostream& stream, const cl_print_number_flags& flag extern void print_float (std::ostream& stream, const cl_print_real_flags& flags, const cl_F& z); extern void print_float (std::ostream& stream, const cl_print_float_flags& flags, const cl_F& z); -// Gibt ein Float binär (sehr primitiv) aus. +// Gibt ein Float binär (sehr primitiv) aus. // print_float_binary(stream,z); // > z: Float // > stream: Stream diff --git a/include/cln/integer.h b/include/cln/integer.h index bf72106..dc89db3 100644 --- a/include/cln/integer.h +++ b/include/cln/integer.h @@ -119,7 +119,7 @@ inline const cl_I logorc1 (const cl_I& x, const cl_I& y) // Ergebnis Integer. extern const cl_I lognot (const cl_I& x); -// Konstanten für BOOLE: +// Konstanten für BOOLE: typedef enum { boole_clr, boole_set, @@ -143,21 +143,21 @@ typedef enum { // Ergebnis Integer. 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. +// 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 bool logtest (const cl_I& x, const cl_I& y); -// Prüft, ob (LOGBITP x y), wo x und y Integers sind. +// Prüft, ob (LOGBITP x y), wo x und y Integers sind. // Ergebnis: /=0, wenn ja; =0, wenn nein. 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. +// Prüft, ob (ODDP x), wo x ein Integer ist. // Ergebnis: /=0, falls ja; =0, falls nein. extern bool oddp (const cl_I& x); -// Prüft, ob (EVENP x), wo x ein Integer ist. +// Prüft, ob (EVENP x), wo x ein Integer ist. // Ergebnis: /=0, falls ja; =0, falls nein. inline bool evenp (const cl_I& x) { return !oddp(x); } @@ -211,7 +211,7 @@ extern const cl_I minus1 (const cl_I& x); // (+ x y), wo x und y Integers sind. Ergebnis Integer. extern const cl_I operator+ (const cl_I& x, const cl_I& y); -// Dem C++-Compiler muß man auch das Folgende sagen: +// Dem C++-Compiler muß man auch das Folgende sagen: inline const cl_I operator+ (const int x, const cl_I& y) { return cl_I(x) + y; } inline const cl_I operator+ (const unsigned int x, const cl_I& y) @@ -246,7 +246,7 @@ extern const cl_I operator- (const cl_I& x); // (- x y), wo x und y Integers sind. Ergebnis Integer. extern const cl_I operator- (const cl_I& x, const cl_I& y); -// Dem C++-Compiler muß man auch das Folgende sagen: +// Dem C++-Compiler muß man auch das Folgende sagen: inline const cl_I operator- (const int x, const cl_I& y) { return cl_I(x) - y; } inline const cl_I operator- (const unsigned int x, const cl_I& y) @@ -294,7 +294,7 @@ inline const cl_I operator>> (const cl_I& x, const cl_I& y) // assume y >= 0 // equal(x,y) vergleicht zwei Integers x und y auf Gleichheit. extern bool equal (const cl_I& x, const cl_I& y); -// equal_hashcode(x) liefert einen equal-invarianten Hashcode für x. +// equal_hashcode(x) liefert einen equal-invarianten Hashcode für x. extern uint32 equal_hashcode (const cl_I& x); // compare(x,y) vergleicht zwei Integers x und y. @@ -336,7 +336,7 @@ struct cl_byte { // (LDB byte n), wo n ein Integer ist. 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. +// ldb_test(n,byte) führt (LDB-TEST byte n) aus, wobei n ein Integer ist. // Ergebnis: false wenn nein (also alle fraglichen Bits =0), true wenn ja. extern bool ldb_test (const cl_I& n, const cl_byte& b); @@ -354,7 +354,7 @@ extern const cl_I dpb (const cl_I& newbyte, const cl_I& n, const cl_byte& b); // (* x y), wo x und y Integers sind. Ergebnis Integer. extern const cl_I operator* (const cl_I& x, const cl_I& y); -// Dem C++-Compiler muß man auch das Folgende sagen: +// Dem C++-Compiler muß man auch das Folgende sagen: inline const cl_I operator* (const int x, const cl_I& y) { return cl_I(x) * y; } inline const cl_I operator* (const unsigned int x, const cl_I& y) @@ -391,7 +391,7 @@ extern const cl_I square (const cl_I& x); extern const cl_I expt_pos (const cl_I& x, uintL y); extern const cl_I expt_pos (const cl_I& x, const cl_I& y); -// Fakultät (! n), wo n Fixnum >=0 ist. Ergebnis Integer. +// Fakultät (! n), wo n Fixnum >=0 ist. Ergebnis Integer. extern const cl_I factorial (uintL n); //CL_REQUIRE(cl_I_factorial) @@ -415,14 +415,14 @@ struct cl_I_div_t { }; // Dividiert zwei Integers x,y >=0 und liefert den Quotienten x/y >=0. -// Bei y=0 Error. Die Division muß aufgehen, sonst Error. +// Bei y=0 Error. Die Division muß aufgehen, sonst Error. // exquopos(x,y) // > x,y: Integers >=0 // < ergebnis: Quotient x/y, ein Integer >=0 extern const cl_I exquopos (const cl_I& x, const cl_I& y); // Dividiert zwei Integers x,y und liefert den Quotienten x/y. -// Bei y=0 Error. Die Division muß aufgehen, sonst Error. +// Bei y=0 Error. Die Division muß aufgehen, sonst Error. // exquo(x,y) // > x,y: Integers // < ergebnis: Quotient x/y, ein Integer @@ -487,7 +487,7 @@ public: // > a,b: zwei Integers // < u, v, g: Integers mit u*a+v*b = g >= 0 extern const cl_I xgcd (const cl_I& a, const cl_I& b, cl_I* u, cl_I* v); -// Im Fall A/=0, B/=0 genügt das Ergebnis (g,u,v) den Ungleichungen: +// Im Fall A/=0, B/=0 genügt das Ergebnis (g,u,v) den Ungleichungen: // Falls |A| = |B| : g = |A|, u = (signum A), v = 0. // Falls |B| | |A|, |B| < |A| : g = |B|, u = 0, v = (signum B). // Falls |A| | |B|, |A| < |B| : g = |A|, u = (signum A), v = 0. @@ -507,12 +507,12 @@ public: // -------------------------------------------- // g = z[n], |u|=x[n], |v|=y[n] // n>=2, z[0] > ... > z[n-1] > z[n] = g, g | z[n-1], also z[n-1] >= 2*g. -// Da aber mit (-1)^i*x[i]*|A| - (-1)^i*y[i]*|B| = z[i] für i=0..n+1 -// und x[i]*y[i+1] - x[i+1]*y[i] = (-1)^i für i=0..n, -// x[i]*z[i+1] - x[i+1]*z[i] = (-1)^i*|B| für i=0..n, -// y[i]*z[i+1] - y[i+1]*z[i] = -(-1)^i*|A| für i=0..n +// Da aber mit (-1)^i*x[i]*|A| - (-1)^i*y[i]*|B| = z[i] für i=0..n+1 +// und x[i]*y[i+1] - x[i+1]*y[i] = (-1)^i für i=0..n, +// x[i]*z[i+1] - x[i+1]*z[i] = (-1)^i*|B| für i=0..n, +// y[i]*z[i+1] - y[i+1]*z[i] = -(-1)^i*|A| für i=0..n // auch |A| = y[i+1]*z[i] + y[i]*z[i+1], |B| = x[i+1]*z[i] + x[i]*z[i+1] -// für i=0..n (Cramersche Regel), folgt +// für i=0..n (Cramersche Regel), folgt // |A| = y[n]*z[n-1] + y[n-1]*z[n] >= y[n]*2*g + 0 = |v|*2*g, // |B| = x[n]*z[n-1] + x[n-1]*z[n] >= x[n]*2*g + 0 = |u|*2*g.) @@ -585,7 +585,7 @@ extern const cl_I cl_recip2adic (uintL n, const cl_I& x); extern const cl_I cl_div2adic (uintL n, const cl_I& x, const cl_I& y); -// numerator(r) liefert den Zähler des Integer r. +// numerator(r) liefert den Zähler des Integer r. inline const cl_I numerator (const cl_I& r) { return r; } // denominator(r) liefert den Nenner (> 0) des Integer r. @@ -600,16 +600,16 @@ extern float float_approx (const cl_I& x); extern double double_approx (const cl_I& x); -// random_I(randomstate,n) liefert zu einem Integer n>0 ein zufälliges +// random_I(randomstate,n) liefert zu einem Integer n>0 ein zufälliges // Integer x mit 0 <= x < n. -// > randomstate: ein Random-State, wird verändert +// > randomstate: ein Random-State, wird verändert extern const cl_I random_I (random_state& randomstate, const cl_I& n); inline const cl_I random_I (const cl_I& n) { return random_I(default_random_state,n); } -// testrandom_I(randomstate) liefert ein zufälliges Integer zum Testen. -// > randomstate: ein Random-State, wird verändert +// testrandom_I(randomstate) liefert ein zufälliges Integer zum Testen. +// > randomstate: ein Random-State, wird verändert extern const cl_I testrandom_I (random_state& randomstate); inline const cl_I testrandom_I () diff --git a/include/cln/integer_io.h b/include/cln/integer_io.h index dc1a599..5255d1d 100644 --- a/include/cln/integer_io.h +++ b/include/cln/integer_io.h @@ -11,14 +11,14 @@ namespace cln { // Undocumented input functions // Wandelt eine Zeichenkette mit Integer-Syntax in ein Integer um. -// Punkte werden überlesen. +// Punkte werden überlesen. // read_integer(base,sign,string,index1,index2) // > base: Lesebasis (>=2, <=36) // > sign: Vorzeichen (/=0 falls negativ) -// > string: Simple-String (enthält Ziffern mit Wert string: Simple-String (enthält Ziffern mit Wert index1: Index der ersten Ziffer // > index2: Index nach der letzten Ziffer -// (also index2-index1 Ziffern, incl. evtl. Dezimalpunkt am Schluß) +// (also index2-index1 Ziffern, incl. evtl. Dezimalpunkt am Schluß) // < ergebnis: Integer extern const cl_I read_integer (unsigned int base, cl_signean sign, const char * string, uintL index1, uintL index2); diff --git a/include/cln/lfloat.h b/include/cln/lfloat.h index e09dc7c..5327ba4 100644 --- a/include/cln/lfloat.h +++ b/include/cln/lfloat.h @@ -20,7 +20,7 @@ extern const cl_LF operator- (const cl_LF& x); // Ergebnis: 0 falls x=y, +1 falls x>y, -1 falls x randomstate: ein Random-State, wird verändert +// > randomstate: ein Random-State, wird verändert // < ergebnis: eine 32-Bit-Zufallszahl extern uint32 random32 (random_state& randomstate); #if defined(HAVE_FAST_LONGLONG) // random64(randomstate) liefert eine neue Zufallszahl. -// > randomstate: ein Random-State, wird verändert +// > randomstate: ein Random-State, wird verändert // < ergebnis: eine 64-Bit-Zufallszahl inline uint64 random64 (random_state& randomstate) { diff --git a/include/cln/rational.h b/include/cln/rational.h index b09962d..d6864a7 100644 --- a/include/cln/rational.h +++ b/include/cln/rational.h @@ -13,7 +13,7 @@ namespace cln { CL_DEFINE_AS_CONVERSION(cl_RA) -// numerator(r) liefert den Zähler der rationalen Zahl r. +// numerator(r) liefert den Zähler der rationalen Zahl r. extern const cl_I numerator (const cl_RA& r); // denominator(r) liefert den Nenner (> 0) der rationalen Zahl r. @@ -25,7 +25,7 @@ extern const cl_RA operator- (const cl_RA& r); // (+ r s), wo r und s rationale Zahlen sind. extern const cl_RA operator+ (const cl_RA& r, const cl_RA& s); -// Dem C++-Compiler muß man auch das Folgende sagen: +// Dem C++-Compiler muß man auch das Folgende sagen: inline const cl_RA operator+ (const int x, const cl_RA& y) { return cl_I(x) + y; } inline const cl_RA operator+ (const unsigned int x, const cl_RA& y) @@ -57,7 +57,7 @@ inline const cl_RA operator+ (const cl_RA& x, const unsigned long long y) // (- r s), wo r und s rationale Zahlen sind. extern const cl_RA operator- (const cl_RA& r, const cl_RA& s); -// Dem C++-Compiler muß man auch das Folgende sagen: +// Dem C++-Compiler muß man auch das Folgende sagen: inline const cl_RA operator- (const int x, const cl_RA& y) { return cl_I(x) - y; } inline const cl_RA operator- (const unsigned int x, const cl_RA& y) @@ -98,7 +98,7 @@ extern const cl_RA abs (const cl_RA& r); // equal(r,s) vergleicht zwei rationale Zahlen r und s auf Gleichheit. extern bool equal (const cl_RA& r, const cl_RA& s); -// equal_hashcode(r) liefert einen equal-invarianten Hashcode für r. +// equal_hashcode(r) liefert einen equal-invarianten Hashcode für r. extern uint32 equal_hashcode (const cl_RA& r); // compare(r,s) vergleicht zwei rationale Zahlen r und s. @@ -132,7 +132,7 @@ extern const cl_RA recip (const cl_RA& r); // Liefert (* r s), wo r und s rationale Zahlen sind. extern const cl_RA operator* (const cl_RA& r, const cl_RA& s); -// Dem C++-Compiler muß man auch das Folgende sagen: +// Dem C++-Compiler muß man auch das Folgende sagen: inline const cl_RA operator* (const int x, const cl_RA& y) { return cl_I(x) * y; } inline const cl_RA operator* (const unsigned int x, const cl_RA& y) @@ -167,7 +167,7 @@ extern const cl_RA square (const cl_RA& r); // Liefert (/ r s), wo r und s rationale Zahlen sind. extern const cl_RA operator/ (const cl_RA& r, const cl_RA& s); -// Dem C++-Compiler muß man auch das Folgende sagen: +// Dem C++-Compiler muß man auch das Folgende sagen: inline const cl_RA operator/ (const int x, const cl_RA& y) { return cl_I(x) / y; } inline const cl_RA operator/ (const unsigned int x, const cl_RA& y) diff --git a/include/cln/rational_io.h b/include/cln/rational_io.h index b34a038..4b886ce 100644 --- a/include/cln/rational_io.h +++ b/include/cln/rational_io.h @@ -14,11 +14,11 @@ namespace cln { // read_rational(base,sign,string,index1,index3,index2) // > base: Lesebasis (>=2, <=36) // > sign: Vorzeichen (/=0 falls negativ) -// > string: Simple-String (enthält Ziffern mit Wert string: Simple-String (enthält Ziffern mit Wert index1: Index der ersten Ziffer // > index3: Index von '/' // > index2: Index nach der letzten Ziffer -// (also index3-index1 Zähler-Ziffern, index2-index3-1 Nenner-Ziffern) +// (also index3-index1 Zähler-Ziffern, index2-index3-1 Nenner-Ziffern) // < ergebnis: rationale Zahl extern const cl_RA read_rational (unsigned int base, cl_signean sign, const char * string, uintL index1, uintL index3, uintL index2); diff --git a/include/cln/real.h b/include/cln/real.h index e2637f2..eede270 100644 --- a/include/cln/real.h +++ b/include/cln/real.h @@ -39,29 +39,29 @@ extern const cl_FF cl_R_to_FF (const cl_R& x); extern const cl_DF cl_R_to_DF (const cl_R& x); // R_to_LF(x,len) wandelt eine reelle Zahl x in ein Long-Float mit len Digits um. -// > uintC len: gewünschte Anzahl Digits, >=LF_minlen +// > uintC len: gewünschte Anzahl Digits, >=LF_minlen // < ergebnis: (coerce x `(long-float ,len)) extern const cl_LF cl_R_to_LF (const cl_R& x, uintC len); // cl_float(x,y) wandelt eine reelle Zahl x in das Float-Format des -// Floats y um und rundet dabei nötigenfalls. +// Floats y um und rundet dabei nötigenfalls. // > x: eine reelle Zahl // > y: ein Float // < ergebnis: (float x y) extern const cl_F cl_float (const cl_R& x, const cl_F& y); // cl_float(x,f) wandelt eine reelle Zahl x in das Float-Format f um -// und rundet dabei nötigenfalls. +// und rundet dabei nötigenfalls. // > x: eine reelle Zahl // > f: eine Float-Format-Spezifikation // < ergebnis: (float x f) extern const cl_F cl_float (const cl_R& x, float_format_t f); // cl_float(x) wandelt eine reelle Zahl x in ein Float um -// und rundet dabei nötigenfalls. +// und rundet dabei nötigenfalls. // > x: eine reelle Zahl // < ergebnis: (float x) -// Abhängig von default_float_format. +// Abhängig von default_float_format. extern const cl_F cl_float (const cl_R& x); @@ -75,7 +75,7 @@ inline const cl_F operator+ (const cl_R& x, const cl_F& y) { return The(cl_F)(x + The(cl_R)(y)); } inline const cl_F operator+ (const cl_F& x, const cl_R& y) { return The(cl_F)(The(cl_R)(x) + y); } -// Dem C++-Compiler muß man nun auch das Folgende sagen: +// Dem C++-Compiler muß man nun auch das Folgende sagen: inline const cl_R operator+ (const int x, const cl_R& y) { return cl_I(x) + y; } inline const cl_R operator+ (const unsigned int x, const cl_R& y) @@ -120,7 +120,7 @@ inline const cl_F operator- (const cl_R& x, const cl_F& y) { return The(cl_F)(x - The(cl_R)(y)); } inline const cl_F operator- (const cl_F& x, const cl_R& y) { return The(cl_F)(The(cl_R)(x) - y); } -// Dem C++-Compiler muß man nun auch das Folgende sagen: +// Dem C++-Compiler muß man nun auch das Folgende sagen: inline const cl_R operator- (const int x, const cl_R& y) { return cl_I(x) - y; } inline const cl_R operator- (const unsigned int x, const cl_R& y) @@ -160,7 +160,7 @@ inline const cl_F operator- (const cl_R& x, const double y) // Liefert (* x y), wo x und y reelle Zahlen sind. extern const cl_R operator* (const cl_R& x, const cl_R& y); -// Dem C++-Compiler muß man auch das Folgende sagen (wg. `int * cl_F' u.ä.): +// Dem C++-Compiler muß man auch das Folgende sagen (wg. `int * cl_F' u.ä.): inline const cl_R operator* (const int x, const cl_R& y) { return cl_I(x) * y; } inline const cl_R operator* (const unsigned int x, const cl_R& y) @@ -206,7 +206,7 @@ extern const cl_R operator/ (const cl_R& x, const cl_R& y); // Spezialfall: x Float -> Ergebnis Float inline const cl_F operator/ (const cl_F& x, const cl_R& y) { return The(cl_F)(The(cl_R)(x) / y); } -// Dem C++-Compiler muß man auch das Folgende sagen (wg. `int / cl_F' u.ä.): +// Dem C++-Compiler muß man auch das Folgende sagen (wg. `int / cl_F' u.ä.): inline const cl_R operator/ (const int x, const cl_R& y) { return cl_I(x) / y; } inline const cl_R operator/ (const unsigned int x, const cl_R& y) @@ -362,7 +362,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 bool equal (const cl_R& x, const cl_R& y); -// equal_hashcode(x) liefert einen equal-invarianten Hashcode für x. +// equal_hashcode(x) liefert einen equal-invarianten Hashcode für x. extern uint32 equal_hashcode (const cl_R& x); // compare(x,y) vergleicht zwei reelle Zahlen x und y. @@ -420,7 +420,7 @@ extern const cl_R atan (const cl_R& x, const cl_R& y); // Spezialfall: y Float -> Ergebnis Float inline const cl_F atan (const cl_R& x, const cl_F& y) { return The(cl_F)(atan(x,The(cl_R)(y))); } -// Dem C++-Compiler muß man nun auch das Folgende sagen: +// Dem C++-Compiler muß man nun auch das Folgende sagen: inline const cl_R atan (const cl_R& x, const int y) { return atan(x,cl_I(y)); } inline const cl_R atan (const cl_R& x, const unsigned int y) @@ -435,7 +435,7 @@ inline const cl_R atan (const cl_R& x, const unsigned long y) extern const cl_R atan (const cl_R& x); // Spezialfall: x Float -> Ergebnis Float inline const cl_F atan (const cl_F& x) { return The(cl_F)(atan(The(cl_R)(x))); } -// Dem C++-Compiler muß man nun auch das Folgende sagen: +// Dem C++-Compiler muß man nun auch das Folgende sagen: inline const cl_R atan (const int x) { return atan(cl_I(x)); } inline const cl_R atan (const unsigned int x) { return atan(cl_I(x)); } inline const cl_R atan (const long x) { return atan(cl_I(x)); } @@ -443,7 +443,7 @@ inline const cl_R atan (const unsigned long x) { return atan(cl_I(x)); } // sin(x) liefert den Sinus (sin x) einer reellen Zahl x. extern const cl_R sin (const cl_R& x); -// Dem C++-Compiler muß man nun auch das Folgende sagen: +// Dem C++-Compiler muß man nun auch das Folgende sagen: inline const cl_R sin (const int x) { return sin(cl_I(x)); } inline const cl_R sin (const unsigned int x) { return sin(cl_I(x)); } inline const cl_R sin (const long x) { return sin(cl_I(x)); } @@ -451,7 +451,7 @@ inline const cl_R sin (const unsigned long x) { return sin(cl_I(x)); } // cos(x) liefert den Cosinus (cos x) einer reellen Zahl x. extern const cl_R cos (const cl_R& x); -// Dem C++-Compiler muß man nun auch das Folgende sagen: +// Dem C++-Compiler muß man nun auch das Folgende sagen: inline const cl_R cos (const int x) { return cos(cl_I(x)); } inline const cl_R cos (const unsigned int x) { return cos(cl_I(x)); } inline const cl_R cos (const long x) { return cos(cl_I(x)); } @@ -462,7 +462,7 @@ extern const cos_sin_t cos_sin (const cl_R& x); // tan(x) liefert den Tangens (tan x) einer reellen Zahl x. extern const cl_R tan (const cl_R& x); -// Dem C++-Compiler muß man nun auch das Folgende sagen: +// Dem C++-Compiler muß man nun auch das Folgende sagen: inline const cl_R tan (const int x) { return tan(cl_I(x)); } inline const cl_R tan (const unsigned int x) { return tan(cl_I(x)); } inline const cl_R tan (const long x) { return tan(cl_I(x)); } @@ -470,7 +470,7 @@ inline const cl_R tan (const unsigned long x) { return tan(cl_I(x)); } // ln(x) liefert zu einer reellen Zahl x>0 die Zahl ln(x). extern const cl_R ln (const cl_R& x); -// Dem C++-Compiler muß man nun auch das Folgende sagen: +// Dem C++-Compiler muß man nun auch das Folgende sagen: inline const cl_R ln (const int x) { return ln(cl_I(x)); } inline const cl_R ln (const unsigned int x) { return ln(cl_I(x)); } inline const cl_R ln (const long x) { return ln(cl_I(x)); } @@ -483,7 +483,7 @@ extern const cl_R log (const cl_R& a, const cl_R& b); // exp(x) liefert zu einer reellen Zahl x die Zahl exp(x). extern const cl_R exp (const cl_R& x); -// Dem C++-Compiler muß man nun auch das Folgende sagen: +// Dem C++-Compiler muß man nun auch das Folgende sagen: inline const cl_R exp (const int x) { return exp(cl_I(x)); } inline const cl_R exp (const unsigned int x) { return exp(cl_I(x)); } inline const cl_R exp (const long x) { return exp(cl_I(x)); } @@ -491,7 +491,7 @@ inline const cl_R exp (const unsigned long x) { return exp(cl_I(x)); } // sinh(x) liefert zu einer reellen Zahl x die Zahl sinh(x). extern const cl_R sinh (const cl_R& x); -// Dem C++-Compiler muß man nun auch das Folgende sagen: +// Dem C++-Compiler muß man nun auch das Folgende sagen: inline const cl_R sinh (const int x) { return sinh(cl_I(x)); } inline const cl_R sinh (const unsigned int x) { return sinh(cl_I(x)); } inline const cl_R sinh (const long x) { return sinh(cl_I(x)); } @@ -499,7 +499,7 @@ inline const cl_R sinh (const unsigned long x) { return sinh(cl_I(x)); } // cosh(x) liefert zu einer reellen Zahl x die Zahl cosh(x). extern const cl_R cosh (const cl_R& x); -// Dem C++-Compiler muß man nun auch das Folgende sagen: +// Dem C++-Compiler muß man nun auch das Folgende sagen: inline const cl_R cosh (const int x) { return cosh(cl_I(x)); } inline const cl_R cosh (const unsigned int x) { return cosh(cl_I(x)); } inline const cl_R cosh (const long x) { return cosh(cl_I(x)); } @@ -510,7 +510,7 @@ extern const cosh_sinh_t cosh_sinh (const cl_R& x); // tanh(x) liefert zu einer reellen Zahl x die Zahl tanh(x). extern const cl_R tanh (const cl_R& x); -// Dem C++-Compiler muß man nun auch das Folgende sagen: +// Dem C++-Compiler muß man nun auch das Folgende sagen: inline const cl_R tanh (const int x) { return tanh(cl_I(x)); } inline const cl_R tanh (const unsigned int x) { return tanh(cl_I(x)); } inline const cl_R tanh (const long x) { return tanh(cl_I(x)); } diff --git a/include/cln/sfloat.h b/include/cln/sfloat.h index a77fc01..396c8da 100644 --- a/include/cln/sfloat.h +++ b/include/cln/sfloat.h @@ -20,7 +20,7 @@ extern const cl_SF operator- (const cl_SF& x); // Ergebnis: 0 falls x=y, +1 falls x>y, -1 falls x arg1, arg2 : zwei 32-Bit-Zahlen // < ergebnis : eine 32-Bit-Zahl -// Es wird vorausgesetzt, daß arg1*arg2 < 2^32. +// Es wird vorausgesetzt, daß arg1*arg2 < 2^32. #if defined(__GNUC__) && defined(__sparc64__) && !defined(NO_ASM) inline uint32 mulu32_unchecked (uint32 arg1, uint32 arg2) { @@ -190,7 +190,7 @@ inline uint32 mulu32_unchecked (uint32 arg1, uint32 arg2) #elif defined(__sparc__) && !defined(NO_ASM) extern "C" uint32 mulu32_unchecked (uint32 x, uint32 y); // extern in Assembler #else - // Wir können dafür auch die Bibliotheksroutine des C-Compilers nehmen: + // Wir können dafür auch die Bibliotheksroutine des C-Compilers nehmen: inline uint32 mulu32_unchecked (uint32 arg1, uint32 arg2) { return arg1 * arg2; @@ -299,7 +299,7 @@ inline uint32 mulu32_unchecked (uint32 arg1, uint32 arg2) // mulu32_ extern in Assembler #if defined(__sparc__) || defined(__sparc64__) extern "C" uint32 _get_g1 (void); - #define mulu32_high (_get_g1()) // Rückgabe im Register %g1 + #define mulu32_high (_get_g1()) // Rückgabe im Register %g1 #elif !defined(__hppa__) #define NEED_VAR_mulu32_high #endif @@ -388,7 +388,7 @@ inline uint32 mulu32_unchecked (uint32 arg1, uint32 arg2) // mulu64_ extern in Assembler #if defined(__sparc64__) extern "C" uint64 _get_g2 (void); - #define mulu64_high (_get_g2()) // Rückgabe im Register %g2 + #define mulu64_high (_get_g2()) // Rückgabe im Register %g2 #else #define NEED_VAR_mulu64_high #endif @@ -403,7 +403,7 @@ inline uint32 mulu32_unchecked (uint32 arg1, uint32 arg2) // Dividiert eine 16-Bit-Zahl durch eine 16-Bit-Zahl und // liefert einen 16-Bit-Quotienten und einen 16-Bit-Rest. // divu_1616_1616(x,y,q=,r=); -// > uint16 x: Zähler +// > uint16 x: Zähler // > uint16 y: Nenner // < uint16 q: floor(x/y) // < uint16 r: x mod y @@ -418,9 +418,9 @@ inline uint32 mulu32_unchecked (uint32 arg1, uint32 arg2) // Dividiert eine 32-Bit-Zahl durch eine 16-Bit-Zahl und // liefert einen 16-Bit-Quotienten und einen 16-Bit-Rest. // divu_3216_1616(x,y,q=,r=); -// > uint32 x: Zähler +// > uint32 x: Zähler // > uint16 y: Nenner -// > Es sei bekannt, daß 0 <= x < 2^16*y . +// > Es sei bekannt, daß 0 <= x < 2^16*y . // < uint16 q: floor(x/y) // < uint16 r: x mod y // < x = q*y+r @@ -511,9 +511,9 @@ inline uint32 mulu32_unchecked (uint32 arg1, uint32 arg2) // Dividiert eine 32-Bit-Zahl durch eine 16-Bit-Zahl und // liefert einen 32-Bit-Quotienten und einen 16-Bit-Rest. // divu_3216_3216(x,y,q=,r=); -// > uint32 x: Zähler +// > uint32 x: Zähler // > uint16 y: Nenner -// Es sei bekannt, daß y>0. +// Es sei bekannt, daß y>0. // < uint32 q: floor(x/y) // < uint16 r: x mod y // < x = q*y+r @@ -561,9 +561,9 @@ inline uint32 mulu32_unchecked (uint32 arg1, uint32 arg2) // Dividiert eine 32-Bit-Zahl durch eine 32-Bit-Zahl und // liefert einen 32-Bit-Quotienten und einen 32-Bit-Rest. // divu_3232_3232(x,y,q=,r=); -// > uint32 x: Zähler +// > uint32 x: Zähler // > uint32 y: Nenner -// Es sei bekannt, daß y>0. +// Es sei bekannt, daß y>0. // < uint32 q: floor(x/y) // < uint32 r: x mod y // < x = q*y+r @@ -597,7 +597,7 @@ inline uint32 mulu32_unchecked (uint32 arg1, uint32 arg2) // y habe genau n+k Bits (1 <= k <= n), d.h. 2^(n+k-1) <= y < 2^(n+k). // Schreibe x = 2^k*x1 + x0 mit x1 := floor(x/2^k) // und y = 2^k*y1 + y0 mit y1 := floor(y/2^k) - // und bilde den Näherungs-Quotienten floor(x1/y1) + // und bilde den Näherungs-Quotienten floor(x1/y1) // oder (noch besser) floor(x1/(y1+1)). // Wegen 0 <= x1 < 2^(2n) und 0 < 2^(n-1) <= y1 < 2^n // und x1/(y1+1) <= x/y < x1/(y1+1) + 2 @@ -610,7 +610,7 @@ inline uint32 mulu32_unchecked (uint32 arg1, uint32 arg2) // gilt floor(x1/(y1+1)) <= floor(x/y) <= floor(x1/(y1+1)) + 2 . // Man bildet also q:=floor(x1/(y1+1)) (ein Shift um n Bit oder // eine (2n)-durch-n-Bit-Division, mit Ergebnis q <= floor(x/y) < beta) - // und x-q*y und muß hiervon noch höchstens 2 mal y abziehen und q + // und x-q*y und muß hiervon noch höchstens 2 mal y abziehen und q // incrementieren, um den Quotienten q = floor(x/y) und den Rest // x-floor(x/y)*y der Division zu bekommen. #define divu_3232_3232(x,y,q_zuweisung,r_zuweisung) \ @@ -628,7 +628,7 @@ inline uint32 mulu32_unchecked (uint32 arg1, uint32 arg2) { var uint32 _x1 = _x; /* x1 := x */ \ var uint32 _y1 = _y; /* y1 := y */ \ var uint16 _q; \ - do { _x1 = floor(_x1,2); _y1 = floor(_y1,2); } /* k erhöhen */\ + do { _x1 = floor(_x1,2); _y1 = floor(_y1,2); } /* k erhöhen */\ until (_y1 <= (uint32)(bit(16)-1)); /* bis y1 < beta */ \ { var uint16 _y2 = low16(_y1)+1; /* y1+1 bilden */ \ if (_y2==0) \ @@ -637,12 +637,12 @@ inline uint32 mulu32_unchecked (uint32 arg1, uint32 arg2) { divu_3216_1616(_x1,_y2,_q=,); } /* Division von x1 durch y1+1 */\ } \ /* _q = q = floor(x1/(y1+1)) */ \ - /* x-q*y bilden (eine 16-mal-32-Bit-Multiplikation ohne Überlauf): */\ + /* x-q*y bilden (eine 16-mal-32-Bit-Multiplikation ohne Überlauf): */\ _x -= highlow32_0(mulu16(_q,high16(_y))); /* q * high16(y) * beta */\ /* gefahrlos, da q*high16(y) <= q*y/beta <= x/beta < beta */ \ _x -= mulu16(_q,low16(_y)); /* q * low16(y) */ \ /* gefahrlos, da q*high16(y)*beta + q*low16(y) = q*y <= x */ \ - /* Noch höchstens 2 mal y abziehen: */ \ + /* Noch höchstens 2 mal y abziehen: */ \ if (_x >= _y) \ { _q += 1; _x -= _y; \ if (_x >= _y) \ @@ -657,9 +657,9 @@ inline uint32 mulu32_unchecked (uint32 arg1, uint32 arg2) // Dividiert eine 64-Bit-Zahl durch eine 32-Bit-Zahl und // liefert einen 32-Bit-Quotienten und einen 32-Bit-Rest. // divu_6432_3232(xhi,xlo,y,q=,r=); -// > uint32 xhi,xlo: x = 2^32*xhi+xlo = Zähler +// > uint32 xhi,xlo: x = 2^32*xhi+xlo = Zähler // > uint32 y: Nenner -// > Es sei bekannt, daß 0 <= x < 2^32*y . +// > Es sei bekannt, daß 0 <= x < 2^32*y . // < uint32 q: floor(x/y) // < uint32 r: x mod y // < x = q*y+r @@ -758,7 +758,7 @@ inline uint32 mulu32_unchecked (uint32 arg1, uint32 arg2) // divu_6432_3232_ extern in Assembler #if defined(__sparc__) || defined(__sparc64__) extern "C" uint32 _get_g1 (void); - #define divu_32_rest (_get_g1()) // Rückgabe im Register %g1 + #define divu_32_rest (_get_g1()) // Rückgabe im Register %g1 #else #define NEED_VAR_divu_32_rest #endif @@ -772,9 +772,9 @@ inline uint32 mulu32_unchecked (uint32 arg1, uint32 arg2) // Dividiert eine 64-Bit-Zahl durch eine 32-Bit-Zahl und // liefert einen 32-Bit-Quotienten und einen 32-Bit-Rest. // divu_6432_3232_w(x,y,q=,r=); -// > uint64 x: Zähler +// > uint64 x: Zähler // > uint32 y: Nenner -// > Es sei bekannt, daß 0 <= x < 2^32*y . +// > Es sei bekannt, daß 0 <= x < 2^32*y . // < uint32 q: floor(x/y) // < uint32 r: x mod y // < x = q*y+r @@ -836,9 +836,9 @@ inline uint32 mulu32_unchecked (uint32 arg1, uint32 arg2) // Dividiert eine 64-Bit-Zahl durch eine 32-Bit-Zahl und // liefert einen 64-Bit-Quotienten und einen 32-Bit-Rest. // divu_6432_6432(x,y,q=,r=); -// > uint64 x: Zähler +// > uint64 x: Zähler // > uint32 y: Nenner -// > Es sei bekannt, daß y>0. +// > Es sei bekannt, daß y>0. // < uint64 q: floor(x/y) // < uint32 r: x mod y // < x = q*y+r @@ -908,9 +908,9 @@ inline uint32 mulu32_unchecked (uint32 arg1, uint32 arg2) // Dividiert eine 64-Bit-Zahl durch eine 64-Bit-Zahl und // liefert einen 64-Bit-Quotienten und einen 64-Bit-Rest. // divu_6464_6464(x,y,q=,r=); -// > uint64 x: Zähler +// > uint64 x: Zähler // > uint64 y: Nenner -// > Es sei bekannt, daß y>0. +// > Es sei bekannt, daß y>0. // < uint64 q: floor(x/y) // < uint64 r: x mod y // < x = q*y+r @@ -957,9 +957,9 @@ inline uint32 mulu32_unchecked (uint32 arg1, uint32 arg2) // Dividiert eine 128-Bit-Zahl durch eine 64-Bit-Zahl und // liefert einen 64-Bit-Quotienten und einen 64-Bit-Rest. // divu_12864_6464(xhi,xlo,y,q=,r=); -// > uint64 xhi,xlo: x = 2^64*xhi+xlo = Zähler +// > uint64 xhi,xlo: x = 2^64*xhi+xlo = Zähler // > uint64 y: Nenner -// > Es sei bekannt, daß 0 <= x < 2^64*y . +// > Es sei bekannt, daß 0 <= x < 2^64*y . // < uint64 q: floor(x/y) // < uint64 r: x mod y // < x = q*y+r @@ -1000,15 +1000,15 @@ inline uint32 mulu32_unchecked (uint32 arg1, uint32 arg2) // < boolean sqrtp: /=0, falls x=y^2 // Methode: // y := 2^16 als Anfangswert, - // y := floor((y + floor(x/y))/2) als nächster Wert, + // y := floor((y + floor(x/y))/2) als nächster Wert, // solange z := floor(x/y) < y, setze y := floor((y+z)/2). // y ist fertig; x=y^2 genau dann, wenn z=y und die letzte Division aufging. // (Beweis: // 1. Die Folge der y ist streng monoton fallend. - // 2. Stets gilt y >= floor(sqrt(x)) (denn für alle y>0 ist + // 2. Stets gilt y >= floor(sqrt(x)) (denn für alle y>0 ist // y + x/y >= 2*sqrt(x) und daher floor((y + floor(x/y))/2) = // floor(y/2 + x/(2*y)) >= floor(sqrt(x)) ). - // 3. Am Schluß gilt x >= y^2. + // 3. Am Schluß gilt x >= y^2. // ) #define isqrt_32_16(x,y_zuweisung,sqrtp_zuweisung) \ { var uint32 _x = (x); \ @@ -1017,12 +1017,12 @@ inline uint32 mulu32_unchecked (uint32 arg1, uint32 arg2) loop \ { var uint16 _z; \ var uint16 _r; \ - if (_x1 >= _y) /* Division _x/_y ergäbe Überlauf -> _z > _y */\ + if (_x1 >= _y) /* Division _x/_y ergäbe Überlauf -> _z > _y */\ { unused (sqrtp_zuweisung FALSE); break; } \ divu_3216_1616(_x,_y, _z=,_r=); /* Dividiere _x/_y */ \ if (_z >= _y) \ { unused (sqrtp_zuweisung (_z == _y) && (_r == 0)); break; } \ - _y = floor((uint16)(_z+_y),2) | bit(16-1); /* _y muß >= 2^15 bleiben */\ + _y = floor((uint16)(_z+_y),2) | bit(16-1); /* _y muß >= 2^15 bleiben */\ } \ y_zuweisung _y; \ } @@ -1036,15 +1036,15 @@ inline uint32 mulu32_unchecked (uint32 arg1, uint32 arg2) #if defined(__sparc__) || defined(__sparc64__) || defined(__m68k__) || defined(__hppa__) // Methode: // y := 2^32 als Anfangswert, - // y := floor((y + floor(x/y))/2) als nächster Wert, + // y := floor((y + floor(x/y))/2) als nächster Wert, // solange z := floor(x/y) < y, setze y := floor((y+z)/2). // y ist fertig; x=y^2 genau dann, wenn z=y und die letzte Division aufging. // (Beweis: // 1. Die Folge der y ist streng monoton fallend. - // 2. Stets gilt y >= floor(sqrt(x)) (denn für alle y>0 ist + // 2. Stets gilt y >= floor(sqrt(x)) (denn für alle y>0 ist // y + x/y >= 2*sqrt(x) und daher floor((y + floor(x/y))/2) = // floor(y/2 + x/(2*y)) >= floor(sqrt(x)) ). - // 3. Am Schluß gilt x >= y^2. + // 3. Am Schluß gilt x >= y^2. // ) #define isqrt_64_32(xhi,xlo,y_zuweisung,sqrtp_zuweisung) \ { var uint32 _xhi = (xhi); \ @@ -1053,12 +1053,12 @@ inline uint32 mulu32_unchecked (uint32 arg1, uint32 arg2) loop \ { var uint32 _z; \ var uint32 _rest; \ - if (_xhi >= _y) /* Division _x/_y ergäbe Überlauf -> _z > _y */\ + if (_xhi >= _y) /* Division _x/_y ergäbe Überlauf -> _z > _y */\ { sqrtp_zuweisung FALSE; break; } \ divu_6432_3232(_xhi,_xlo,_y, _z=,_rest=); /* Dividiere _x/_y */\ if (_z >= _y) \ { sqrtp_zuweisung (_z == _y) && (_rest == 0); break; } \ - _y = floor(_z+_y,2) | bit(32-1); /* _y muß >= 2^31 bleiben */ \ + _y = floor(_z+_y,2) | bit(32-1); /* _y muß >= 2^31 bleiben */ \ } \ y_zuweisung _y; \ } @@ -1066,20 +1066,20 @@ inline uint32 mulu32_unchecked (uint32 arg1, uint32 arg2) // Methode: // Wie bei UDS_sqrt mit n=2. // y = 2^16*yhi + ylo ansetzen. - // Dann muß + // Dann muß // yhi = floor(y/2^16) = floor(floor(sqrt(x))/2^16) // = floor(sqrt(x)/2^16) = floor(sqrt(x/2^32)) = isqrt(xhi) // sein. Es folgt yhi >= 2^15. - // Danach sucht man das größte ylo >=0 mit + // Danach sucht man das größte ylo >=0 mit // x - 2^32*yhi^2 >= 2*2^16*yhi*ylo + ylo^2. // Dazu setzen wir xhi*2^32+xlo := x - 2^32*yhi^2 // (also xhi := xhi - yhi^2, das ist >=0, <=2*yhi). - // Die Schätzung für die zweite Ziffer + // Die Schätzung für die zweite Ziffer // ylo' := min(2^16-1,floor((xhi*2^32+xlo)/(2*2^16*yhi))) - // erfüllt ylo'-1 <= ylo <= ylo', ist also um höchstens 1 zu groß. + // erfüllt ylo'-1 <= ylo <= ylo', ist also um höchstens 1 zu groß. // (Beweis: Rechte Ungleichung klar, da ylo < 2^16 und // xhi*2^32+xlo >= 2*2^16*yhi*ylo + ylo^2 >= 2*2^16*yhi*ylo - // ==> (xhi*2^32+xlo)/(2*2^16*yhi) >= ylo gelten muß. + // ==> (xhi*2^32+xlo)/(2*2^16*yhi) >= ylo gelten muß. // Linke Ungleichung: Falls floor(...)>=2^16, ist // xhi*2^32+xlo >= 2*2^16*2^16*yhi >= 2*2^16*yhi*(2^16-1) + 2^32 // >= 2*2^16*yhi*(2^16-1) + (2^16-1)^2 @@ -1098,7 +1098,7 @@ inline uint32 mulu32_unchecked (uint32 arg1, uint32 arg2) isqrt_32_16(_xhi,_yhi=,); /* yhi := isqrt(xhi) */ \ _xhi -= mulu16(_yhi,_yhi); /* jetzt 0 <= xhi <= 2*yhi */ \ /* x = 2^32*yhi^2 + 2^32*xhi + xlo */ \ - /* Schätzung für die zweite Ziffer berechnen: */ \ + /* Schätzung für die zweite Ziffer berechnen: */ \ /* ylo := min(2^16-1,floor((xhi*2^32+xlo)/(2*2^16*yhi))) bilden: */\ {var uint32 _z = (_xhi << 15) | (_xlo >> 17); /* < 2^15*(2*yhi+1) */\ var uint32 _r = highlow32_0(_yhi); \ @@ -1114,7 +1114,7 @@ inline uint32 mulu32_unchecked (uint32 arg1, uint32 arg2) /* Versuche vom Rest 2^32*floor(r/2^15) + xlo z zu subtrahieren. */\ /* Falls Rest >= z (d.h. r>=2^15 oder xlo>=z), ist ylo fertig, */ \ /* und es gilt x=y^2 genau dann, wenn r<2^15 und xlo=z. */ \ - /* Sonst (d.h. r<2^15 und xlo= 2^32 > z, also x>y^2. */\ if (_r < bit(15)) \ @@ -1140,20 +1140,20 @@ inline uint32 mulu32_unchecked (uint32 arg1, uint32 arg2) // Methode: // Wie bei UDS_sqrt mit n=2. // y = 2^32*yhi + ylo ansetzen. - // Dann muß + // Dann muß // yhi = floor(y/2^32) = floor(floor(sqrt(x))/2^32) // = floor(sqrt(x)/2^32) = floor(sqrt(x/2^64)) = isqrt(xhi) // sein. Es folgt yhi >= 2^31. - // Danach sucht man das größte ylo >=0 mit + // Danach sucht man das größte ylo >=0 mit // x - 2^64*yhi^2 >= 2*2^32*yhi*ylo + ylo^2. // Dazu setzen wir xhi*2^64+xlo := x - 2^64*yhi^2 // (also xhi := xhi - yhi^2, das ist >=0, <=2*yhi). - // Die Schätzung für die zweite Ziffer + // Die Schätzung für die zweite Ziffer // ylo' := min(2^32-1,floor((xhi*2^64+xlo)/(2*2^32*yhi))) - // erfüllt ylo'-1 <= ylo <= ylo', ist also um höchstens 1 zu groß. + // erfüllt ylo'-1 <= ylo <= ylo', ist also um höchstens 1 zu groß. // (Beweis: Rechte Ungleichung klar, da ylo < 2^32 und // xhi*2^64+xlo >= 2*2^32*yhi*ylo + ylo^2 >= 2*2^32*yhi*ylo - // ==> (xhi*2^64+xlo)/(2*2^32*yhi) >= ylo gelten muß. + // ==> (xhi*2^64+xlo)/(2*2^32*yhi) >= ylo gelten muß. // Linke Ungleichung: Falls floor(...)>=2^32, ist // xhi*2^64+xlo >= 2*2^32*2^32*yhi >= 2*2^32*yhi*(2^32-1) + 2^64 // >= 2*2^32*yhi*(2^32-1) + (2^32-1)^2 @@ -1172,7 +1172,7 @@ inline uint32 mulu32_unchecked (uint32 arg1, uint32 arg2) isqrt_64_32(high32(xhi),low32(xhi),yhi=,); /* yhi := isqrt(xhi) */\ xhi -= mulu32_w(yhi,yhi); /* jetzt 0 <= xhi <= 2*yhi */ \ /* x = 2^64*yhi^2 + 2^64*xhi + xlo */ \ - /* Schätzung für die zweite Ziffer berechnen: */ \ + /* Schätzung für die zweite Ziffer berechnen: */ \ /* ylo := min(2^32-1,floor((xhi*2^64+xlo)/(2*2^32*yhi))) bilden: */\ {var uint64 z = (xhi << 31) | (xlo >> 33); /* < 2^31*(2*yhi+1) */ \ var uint64 r = highlow64_0(yhi); \ @@ -1188,7 +1188,7 @@ inline uint32 mulu32_unchecked (uint32 arg1, uint32 arg2) /* Versuche vom Rest 2^64*floor(r/2^31) + xlo z zu subtrahieren. */\ /* Falls Rest >= z (d.h. r>=2^31 oder xlo>=z), ist ylo fertig, */ \ /* und es gilt x=y^2 genau dann, wenn r<2^31 und xlo=z. */ \ - /* Sonst (d.h. r<2^31 und xlo= 2^64 > z, also x>y^2. */\ if (r < bit(31)) \ @@ -1240,14 +1240,14 @@ inline uint32 mulu32_unchecked (uint32 arg1, uint32 arg2) extern uintL isqrt (uintL x1, uintL x0); -// Bits einer 8-Bit-Zahl zählen: +// Bits einer 8-Bit-Zahl zählen: // integerlength8(digit,size=); -// setzt size auf die höchste in digit vorkommende Bitnummer. +// setzt size auf die höchste in digit vorkommende Bitnummer. // > digit: ein uint8 >0 // < size: >0, <=8, mit 2^(size-1) <= digit < 2^size #if defined(__GNUC__) && defined(__m68k__) && !defined(NO_ASM) #define integerlength8(digit,size_zuweisung) \ - { var uintL _zero_counter; /* zählt die führenden Nullbits in digit */\ + { var uintL _zero_counter; /* zählt die führenden Nullbits in digit */\ __asm__("bfffo %1{#0:#8},%0" : "=d" (_zero_counter) : "dm" ((uint8)(digit)) ); \ size_zuweisung (8-_zero_counter); \ } @@ -1261,25 +1261,25 @@ inline uint32 mulu32_unchecked (uint32 arg1, uint32 arg2) #define integerlength8(digit,size_zuweisung) \ { var uintC _bitsize = 1; \ var uintL _x8 = (uint8)(digit); \ - /* _x8 hat höchstens 8 Bits. */\ + /* _x8 hat höchstens 8 Bits. */\ if (_x8 >= bit(4)) { _x8 = _x8>>4; _bitsize += 4; } \ - /* _x8 hat höchstens 4 Bits. */\ + /* _x8 hat höchstens 4 Bits. */\ if (_x8 >= bit(2)) { _x8 = _x8>>2; _bitsize += 2; } \ - /* _x8 hat höchstens 2 Bits. */\ + /* _x8 hat höchstens 2 Bits. */\ if (_x8 >= bit(1)) { /* _x8 = _x8>>1; */ _bitsize += 1; } \ - /* _x8 hat höchstens 1 Bit. Dieses Bit muß gesetzt sein. */\ + /* _x8 hat höchstens 1 Bit. Dieses Bit muß gesetzt sein. */\ size_zuweisung _bitsize; \ } #endif -// Bits einer 16-Bit-Zahl zählen: +// Bits einer 16-Bit-Zahl zählen: // integerlength16(digit,size=); -// setzt size auf die höchste in digit vorkommende Bitnummer. +// setzt size auf die höchste in digit vorkommende Bitnummer. // > digit: ein uint16 >0 // < size: >0, <=16, mit 2^(size-1) <= digit < 2^size #if defined(__GNUC__) && defined(__m68k__) && !defined(NO_ASM) #define integerlength16(digit,size_zuweisung) \ - { var uintL _zero_counter; /* zählt die führenden Nullbits in digit */\ + { var uintL _zero_counter; /* zählt die führenden Nullbits in digit */\ __asm__("bfffo %1{#0:#16},%0" : "=d" (_zero_counter) : "dm" ((uint16)(digit)) ); \ size_zuweisung (16-_zero_counter); \ } @@ -1288,14 +1288,14 @@ inline uint32 mulu32_unchecked (uint32 arg1, uint32 arg2) integerlength32((uint32)(digit),size_zuweisung) // siehe unten #elif defined(__GNUC__) && defined(__i386__) && !defined(NO_ASM) #define integerlength16(digit,size_zuweisung) \ - { var uintW _one_position; /* Position der führenden 1 */\ + { var uintW _one_position; /* Position der führenden 1 */\ __asm__("bsrw %1,%0" : "=r" (_one_position) : "r" ((uint16)(digit)) ); \ size_zuweisung (1+_one_position); \ } // Die weiteren kommen von gcc/longlong.h : #elif defined(__GNUC__) && defined(__ibm032__) && !defined(NO_ASM) // RT/ROMP #define integerlength16(digit,size_zuweisung) \ - { var uintL _zero_counter; /* zählt die führenden Nullbits in digit */\ + { var uintL _zero_counter; /* zählt die führenden Nullbits in digit */\ __asm__("clz %0,%1" : "=r" (_zero_counter) : "r" ((uint32)(digit)) ); \ size_zuweisung (16-_zero_counter); \ } @@ -1303,27 +1303,27 @@ inline uint32 mulu32_unchecked (uint32 arg1, uint32 arg2) #define integerlength16(digit,size_zuweisung) \ { var uintC _bitsize = 1; \ var uintWL _x16 = (uint16)(digit); \ - /* _x16 hat höchstens 16 Bits. */\ + /* _x16 hat höchstens 16 Bits. */\ if (_x16 >= bit(8)) { _x16 = _x16>>8; _bitsize += 8; } \ - /* _x16 hat höchstens 8 Bits. */\ + /* _x16 hat höchstens 8 Bits. */\ if (_x16 >= bit(4)) { _x16 = _x16>>4; _bitsize += 4; } \ - /* _x16 hat höchstens 4 Bits. */\ + /* _x16 hat höchstens 4 Bits. */\ if (_x16 >= bit(2)) { _x16 = _x16>>2; _bitsize += 2; } \ - /* _x16 hat höchstens 2 Bits. */\ + /* _x16 hat höchstens 2 Bits. */\ if (_x16 >= bit(1)) { /* _x16 = _x16>>1; */ _bitsize += 1; } \ - /* _x16 hat höchstens 1 Bit. Dieses Bit muß gesetzt sein. */\ + /* _x16 hat höchstens 1 Bit. Dieses Bit muß gesetzt sein. */\ size_zuweisung _bitsize; \ } #endif -// Bits einer 32-Bit-Zahl zählen: +// Bits einer 32-Bit-Zahl zählen: // integerlength32(digit,size=); -// setzt size auf die höchste in digit vorkommende Bitnummer. +// setzt size auf die höchste in digit vorkommende Bitnummer. // > digit: ein uint32 >0 // < size: >0, <=32, mit 2^(size-1) <= digit < 2^size #if defined(__GNUC__) && defined(__m68k__) && !defined(NO_ASM) #define integerlength32(digit,size_zuweisung) \ - { var uintL _zero_counter; /* zählt die führenden Nullbits in digit */\ + { var uintL _zero_counter; /* zählt die führenden Nullbits in digit */\ __asm__("bfffo %1{#0:#32},%0" : "=d" (_zero_counter) : "dm" ((uint32)(digit)) ); \ size_zuweisung (32-_zero_counter); \ } @@ -1342,7 +1342,7 @@ inline uint32 mulu32_unchecked (uint32 arg1, uint32 arg2) } #elif defined(__GNUC__) && defined(__i386__) && !defined(NO_ASM) #define integerlength32(digit,size_zuweisung) \ - { var uintL _one_position; /* Position der führenden 1 */\ + { var uintL _one_position; /* Position der führenden 1 */\ __asm__("bsrl %1,%0" : "=r" (_one_position) : "rm" ((uint32)(digit)) ); \ size_zuweisung (1+_one_position); \ } @@ -1353,13 +1353,13 @@ inline uint32 mulu32_unchecked (uint32 arg1, uint32 arg2) // Die weiteren kommen von gcc/longlong.h : #elif defined(__GNUC__) && (defined(__a29k__) || defined(___AM29K__)) && !defined(NO_ASM) #define integerlength32(digit,size_zuweisung) \ - { var uintL _zero_counter; /* zählt die führenden Nullbits in digit */\ + { var uintL _zero_counter; /* zählt die führenden Nullbits in digit */\ __asm__("clz %0,%1" : "=r" (_zero_counter) : "r" ((uint32)(digit)) ); \ size_zuweisung (32-_zero_counter); \ } #elif defined(__GNUC__) && defined(__gmicro__) && !defined(NO_ASM) #define integerlength32(digit,size_zuweisung) \ - { var uintL _zero_counter; /* zählt die führenden Nullbits in digit */\ + { var uintL _zero_counter; /* zählt die führenden Nullbits in digit */\ __asm__("bsch/1 %1,%0" : "=g" (_zero_counter) : "g" ((uint32)(digit)) ); \ size_zuweisung (32-_zero_counter); \ } @@ -1367,21 +1367,21 @@ inline uint32 mulu32_unchecked (uint32 arg1, uint32 arg2) #ifdef _AIX // old assembler syntax #define integerlength32(digit,size_zuweisung) \ - { var uintL _zero_counter; /* zählt die führenden Nullbits in digit */\ + { var uintL _zero_counter; /* zählt die führenden Nullbits in digit */\ __asm__("cntlz %0,%1" : "=r" (_zero_counter) : "r" ((uint32)(digit)) ); \ size_zuweisung (32-_zero_counter); \ } #else // new assembler syntax #define integerlength32(digit,size_zuweisung) \ - { var uintL _zero_counter; /* zählt die führenden Nullbits in digit */\ + { var uintL _zero_counter; /* zählt die führenden Nullbits in digit */\ __asm__("cntlzw %0,%1" : "=r" (_zero_counter) : "r" ((uint32)(digit)) ); \ size_zuweisung (32-_zero_counter); \ } #endif #elif defined(__GNUC__) && defined(__m88k__) && !defined(NO_ASM) #define integerlength32(digit,size_zuweisung) \ - { var uintL _one_position; /* Position der führenden 1 */\ + { var uintL _one_position; /* Position der führenden 1 */\ __asm__("ff1 %0,%1" : "=r" (_one_position) : "r" ((uint32)(digit)) ); \ size_zuweisung (1+_one_position); \ } @@ -1397,44 +1397,44 @@ inline uint32 mulu32_unchecked (uint32 arg1, uint32 arg2) #define integerlength32(digit,size_zuweisung) \ { var uintC _bitsize = 1; \ var uintL _x32 = (uint32)(digit); \ - /* _x32 hat höchstens 32 Bits. */\ + /* _x32 hat höchstens 32 Bits. */\ if (_x32 >= bit(16)) { _x32 = _x32>>16; _bitsize += 16; } \ - /* _x32 hat höchstens 16 Bits. */\ + /* _x32 hat höchstens 16 Bits. */\ if (_x32 >= bit(8)) { _x32 = _x32>>8; _bitsize += 8; } \ - /* _x32 hat höchstens 8 Bits. */\ + /* _x32 hat höchstens 8 Bits. */\ if (_x32 >= bit(4)) { _x32 = _x32>>4; _bitsize += 4; } \ - /* _x32 hat höchstens 4 Bits. */\ + /* _x32 hat höchstens 4 Bits. */\ if (_x32 >= bit(2)) { _x32 = _x32>>2; _bitsize += 2; } \ - /* _x32 hat höchstens 2 Bits. */\ + /* _x32 hat höchstens 2 Bits. */\ if (_x32 >= bit(1)) { /* _x32 = _x32>>1; */ _bitsize += 1; } \ - /* _x32 hat höchstens 1 Bit. Dieses Bit muß gesetzt sein. */\ + /* _x32 hat höchstens 1 Bit. Dieses Bit muß gesetzt sein. */\ size_zuweisung _bitsize; \ } #define GENERIC_INTEGERLENGTH32 #endif -// Bits einer 64-Bit-Zahl zählen: +// Bits einer 64-Bit-Zahl zählen: // integerlength64(digit,size=); -// setzt size auf die höchste in digit vorkommende Bitnummer. +// setzt size auf die höchste in digit vorkommende Bitnummer. // > digit: ein uint64 >0 // < size: >0, <=64, mit 2^(size-1) <= digit < 2^size #ifdef GENERIC_INTEGERLENGTH32 #define integerlength64(digit,size_zuweisung) \ { var uintC _bitsize = 1; \ var uint64 _x64 = (uint64)(digit); \ - /* _x64 hat höchstens 64 Bits. */\ + /* _x64 hat höchstens 64 Bits. */\ if (_x64 >= bit(32)) { _x64 = _x64>>32; _bitsize += 32; } \ - /* _x64 hat höchstens 32 Bits. */\ + /* _x64 hat höchstens 32 Bits. */\ if (_x64 >= bit(16)) { _x64 = _x64>>16; _bitsize += 16; } \ - /* _x64 hat höchstens 16 Bits. */\ + /* _x64 hat höchstens 16 Bits. */\ if (_x64 >= bit(8)) { _x64 = _x64>>8; _bitsize += 8; } \ - /* _x64 hat höchstens 8 Bits. */\ + /* _x64 hat höchstens 8 Bits. */\ if (_x64 >= bit(4)) { _x64 = _x64>>4; _bitsize += 4; } \ - /* _x64 hat höchstens 4 Bits. */\ + /* _x64 hat höchstens 4 Bits. */\ if (_x64 >= bit(2)) { _x64 = _x64>>2; _bitsize += 2; } \ - /* _x64 hat höchstens 2 Bits. */\ + /* _x64 hat höchstens 2 Bits. */\ if (_x64 >= bit(1)) { /* _x64 = _x64>>1; */ _bitsize += 1; } \ - /* _x64 hat höchstens 1 Bit. Dieses Bit muß gesetzt sein. */\ + /* _x64 hat höchstens 1 Bit. Dieses Bit muß gesetzt sein. */\ size_zuweisung _bitsize; \ } #else @@ -1451,9 +1451,9 @@ inline uint32 mulu32_unchecked (uint32 arg1, uint32 arg2) } #endif -// Bits einer uintC-Zahl zählen: +// Bits einer uintC-Zahl zählen: // integerlengthC(digit,size=); -// setzt size auf die höchste in digit vorkommende Bitnummer. +// setzt size auf die höchste in digit vorkommende Bitnummer. // > digit: ein uintC >0 // < size: >0, <=intCsize, mit 2^(size-1) <= digit < 2^size #if (intCsize==32) @@ -1463,7 +1463,7 @@ inline uint32 mulu32_unchecked (uint32 arg1, uint32 arg2) #define integerlengthC integerlength64 #endif -// Hintere Nullbits eines 32-Bit-Wortes zählen: +// Hintere Nullbits eines 32-Bit-Wortes zählen: // ord2_32(digit,count=); // setzt size auf die kleinste in digit vorkommende Bitnummer. // > digit: ein uint32 >0 @@ -1496,7 +1496,7 @@ inline uint32 mulu32_unchecked (uint32 arg1, uint32 arg2) } #endif -// Hintere Nullbits eines 64-Bit-Wortes zählen: +// Hintere Nullbits eines 64-Bit-Wortes zählen: // ord2_64(digit,count=); // setzt size auf die kleinste in digit vorkommende Bitnummer. // > digit: ein uint64 >0 @@ -1509,61 +1509,61 @@ inline uint32 mulu32_unchecked (uint32 arg1, uint32 arg2) } -// Bits eines Wortes zählen. +// Bits eines Wortes zählen. // logcount_NN(); // > xNN: ein uintNN // < xNN: Anzahl der darin gesetzten Bits - // Bits von x8 zählen: (Input x8, Output x8) + // Bits von x8 zählen: (Input x8, Output x8) #define logcount_8() \ - ( /* x8 besteht aus 8 1-Bit-Zählern (0,1). */\ + ( /* x8 besteht aus 8 1-Bit-Zählern (0,1). */\ x8 = (x8 & 0x55U) + ((x8 & 0xAAU) >> 1), \ - /* x8 besteht aus 4 2-Bit-Zählern (0,1,2). */\ + /* x8 besteht aus 4 2-Bit-Zählern (0,1,2). */\ x8 = (x8 & 0x33U) + ((x8 & 0xCCU) >> 2), \ - /* x8 besteht aus 2 4-Bit-Zählern (0,1,2,3,4). */\ + /* x8 besteht aus 2 4-Bit-Zählern (0,1,2,3,4). */\ x8 = (x8 & 0x0FU) + (x8 >> 4) \ - /* x8 besteht aus 1 8-Bit-Zähler (0,...,8). */\ + /* x8 besteht aus 1 8-Bit-Zähler (0,...,8). */\ ) - // Bits von x16 zählen: (Input x16, Output x16) + // Bits von x16 zählen: (Input x16, Output x16) #define logcount_16() \ - ( /* x16 besteht aus 16 1-Bit-Zählern (0,1). */\ + ( /* x16 besteht aus 16 1-Bit-Zählern (0,1). */\ x16 = (x16 & 0x5555U) + ((x16 & 0xAAAAU) >> 1), \ - /* x16 besteht aus 8 2-Bit-Zählern (0,1,2). */\ + /* x16 besteht aus 8 2-Bit-Zählern (0,1,2). */\ x16 = (x16 & 0x3333U) + ((x16 & 0xCCCCU) >> 2), \ - /* x16 besteht aus 4 4-Bit-Zählern (0,1,2,3,4). */\ + /* x16 besteht aus 4 4-Bit-Zählern (0,1,2,3,4). */\ x16 = (x16 & 0x0F0FU) + ((x16 & 0xF0F0U) >> 4), \ - /* x16 besteht aus 2 8-Bit-Zählern (0,...,8). */\ + /* x16 besteht aus 2 8-Bit-Zählern (0,...,8). */\ x16 = (x16 & 0x00FFU) + (x16 >> 8) \ - /* x16 besteht aus 1 16-Bit-Zähler (0,...,16). */\ + /* x16 besteht aus 1 16-Bit-Zähler (0,...,16). */\ ) - // Bits von x32 zählen: (Input x32, Output x32) + // Bits von x32 zählen: (Input x32, Output x32) #define logcount_32() \ - ( /* x32 besteht aus 32 1-Bit-Zählern (0,1). */\ + ( /* x32 besteht aus 32 1-Bit-Zählern (0,1). */\ x32 = (x32 & 0x55555555UL) + ((x32 & 0xAAAAAAAAUL) >> 1), \ - /* x32 besteht aus 16 2-Bit-Zählern (0,1,2). */\ + /* x32 besteht aus 16 2-Bit-Zählern (0,1,2). */\ x32 = (x32 & 0x33333333UL) + ((x32 & 0xCCCCCCCCUL) >> 2), \ - /* x32 besteht aus 8 4-Bit-Zählern (0,1,2,3,4). */\ + /* x32 besteht aus 8 4-Bit-Zählern (0,1,2,3,4). */\ x32 = high16(x32)+low16(x32), \ - /* x32 besteht aus 4 4-Bit-Zählern (0,...,8). */\ + /* x32 besteht aus 4 4-Bit-Zählern (0,...,8). */\ x32 = (x32 & 0x0F0FU) + ((x32 & 0xF0F0U) >> 4), \ - /* x32 besteht aus 2 8-Bit-Zählern (0,...,16). */\ + /* x32 besteht aus 2 8-Bit-Zählern (0,...,16). */\ x32 = (x32 & 0x00FFU) + (x32 >> 8) \ - /* x32 besteht aus 1 16-Bit-Zähler (0,...,32). */\ + /* x32 besteht aus 1 16-Bit-Zähler (0,...,32). */\ ) - // Bits von x64 zählen: (Input x64, Output x64) + // Bits von x64 zählen: (Input x64, Output x64) #define logcount_64() \ - ( /* x64 besteht aus 64 1-Bit-Zählern (0,1). */\ + ( /* x64 besteht aus 64 1-Bit-Zählern (0,1). */\ x64 = (x64 & 0x5555555555555555ULL) + ((x64 & 0xAAAAAAAAAAAAAAAAULL) >> 1),\ - /* x64 besteht aus 32 2-Bit-Zählern (0,1,2). */\ + /* x64 besteht aus 32 2-Bit-Zählern (0,1,2). */\ x64 = (x64 & 0x3333333333333333ULL) + ((x64 & 0xCCCCCCCCCCCCCCCCULL) >> 2),\ - /* x64 besteht aus 16 4-Bit-Zählern (0,1,2,3,4). */\ + /* x64 besteht aus 16 4-Bit-Zählern (0,1,2,3,4). */\ x64 = (uint32)(x64 + (x64 >> 32)), \ - /* x64 besteht aus 8 4-Bit-Zählern (0,...,8). */\ + /* x64 besteht aus 8 4-Bit-Zählern (0,...,8). */\ x64 = (x64 & 0x0F0F0F0FUL) + ((x64 & 0xF0F0F0F0UL) >> 4), \ - /* x64 besteht aus 4 8-Bit-Zählern (0,...,16). */\ + /* x64 besteht aus 4 8-Bit-Zählern (0,...,16). */\ x64 = (x64 & 0x00FF00FFU) + ((x64 & 0xFF00FF00U) >> 8), \ - /* x64 besteht aus 2 16-Bit-Zählern (0,...,32). */\ + /* x64 besteht aus 2 16-Bit-Zählern (0,...,32). */\ x64 = (x64 & 0x0000FFFFU) + (x64 >> 16) \ - /* x64 besteht aus 1 16-Bit-Zähler (0,...,64). */\ + /* x64 besteht aus 1 16-Bit-Zähler (0,...,64). */\ ) } // namespace cln diff --git a/src/base/cl_macros.h b/src/base/cl_macros.h index af93ce1..a041e77 100644 --- a/src/base/cl_macros.h +++ b/src/base/cl_macros.h @@ -194,7 +194,7 @@ } // doconsttimes(count,statement); -// führt statement count mal aus (count mal der Code!), +// führt statement count mal aus (count mal der Code!), // wobei count eine constant-expression >=0, <=8 ist. #define doconsttimes(count_from_doconsttimes,statement_from_doconsttimes) \ { if (0 < (count_from_doconsttimes)) { statement_from_doconsttimes; } \ @@ -210,7 +210,7 @@ // DOCONSTTIMES(count,macroname); // ruft count mal den Macro macroname auf (count mal der Code!), // wobei count eine constant-expression >=0, <=8 ist. -// Dabei bekommt macroname der Reihe nach die Werte 0,...,count-1 übergeben. +// Dabei bekommt macroname der Reihe nach die Werte 0,...,count-1 übergeben. #define DOCONSTTIMES(count_from_DOCONSTTIMES,macroname_from_DOCONSTTIMES) \ { if (0 < (count_from_DOCONSTTIMES)) { macroname_from_DOCONSTTIMES((0 < (count_from_DOCONSTTIMES) ? 0 : 0)); } \ if (1 < (count_from_DOCONSTTIMES)) { macroname_from_DOCONSTTIMES((1 < (count_from_DOCONSTTIMES) ? 1 : 0)); } \ diff --git a/src/base/cl_sysdep.h b/src/base/cl_sysdep.h index 8a59f5a..d8f2575 100644 --- a/src/base/cl_sysdep.h +++ b/src/base/cl_sysdep.h @@ -30,7 +30,7 @@ #error "Bogus CL_CPU_BIG_ENDIAN_P!" #endif -// Auswahl der Floating-Point-Fähigkeiten: +// Auswahl der Floating-Point-Fähigkeiten: // FAST_DOUBLE sollte definiert werden, wenn ein Floating-Point-Coprozessor // vorhanden ist, dessen `double'-Typ IEEE-Floating-Points mit 64 Bits sind. // FAST_FLOAT sollte definiert werden, wenn ein Floating-Point-Coprozessor @@ -42,7 +42,7 @@ #endif #if defined(__i386__) && (defined(linux) || defined(__linux__) || defined(NeXT)) // Linux hat einen funktionierenden Floating-Point-Coprozessor-Emulator. - // NeXTstep läuft sowieso nur mit Floating-Point-Coprozessor. + // NeXTstep läuft sowieso nur mit Floating-Point-Coprozessor. // Aber auf Intel-Pentium-Prozessoren ist die FPU fehlerhaft. #define FAST_DOUBLE #define FAST_FLOAT diff --git a/src/base/digit/cl_2D_div.cc b/src/base/digit/cl_2D_div.cc index d99c8e1..ed28af4 100644 --- a/src/base/digit/cl_2D_div.cc +++ b/src/base/digit/cl_2D_div.cc @@ -14,9 +14,9 @@ namespace cln { uintD div2adic (uintD a, uintD b) { // Methode: -// Konstruiere c Bit für Bit. +// Konstruiere c Bit für Bit. // c := 0, d := a. -// Für j=0,...,intDsize: +// Für j=0,...,intDsize: // [Hier b*c == a mod 2^j und d = (a-b*c)/2^j.] j=intDsize -> fertig. // Falls d ungerade, setze c:=c+2^j und d:=(d-b)/2, sonst d:=d/2. // Ergebnis c. diff --git a/src/base/digit/cl_D.h b/src/base/digit/cl_D.h index 50643e9..8b92840 100644 --- a/src/base/digit/cl_D.h +++ b/src/base/digit/cl_D.h @@ -8,11 +8,11 @@ // Aus cln/types.h importiere: // intDsize Anzahl Bits in einem Digit -// uintD, sintD Integer-Typen für ein Digit +// uintD, sintD Integer-Typen für ein Digit // log2_intDsize log2(intDsize) -// HAVE_DD Flag, das anzeigt, ob ein Integertyp für Doppel-Digits da ist +// HAVE_DD Flag, das anzeigt, ob ein Integertyp für Doppel-Digits da ist // intDDsize Anzahl Bits in einem Doppel-Digit -// uintDD,sintDD Integer-Typen für ein Doppel-Digit +// uintDD,sintDD Integer-Typen für ein Doppel-Digit #ifdef HAVE_FAST_LONGLONG #if !((64%intDsize)==0) @@ -96,7 +96,7 @@ inline sint32 sign_of_sintD (sintD wert) // Zwei Digits multiplizieren, mit einem Digit als Ergebnis. // (uintD)lo = muluD_unchecked(uintD arg1, uintD arg2) -// Es wird vorausgesetzt, daß arg1*arg2 < 2^intDsize. +// Es wird vorausgesetzt, daß arg1*arg2 < 2^intDsize. #if (intDsize==8) || (intDsize==16) || (intDsize==64) #define muluD_unchecked(arg1,arg2) ((uintD)((uintD)(arg1)*(uintD)(arg2))) #endif @@ -109,7 +109,7 @@ inline sint32 sign_of_sintD (sintD wert) // bzw. // divuD(uintD xhi, uintD xlo, uintD y, uintD q =, uintD r =); // dividiert x/y und liefert q = floor(x/y) und r = (x mod y). x = q*y+r. -// Es wird vorausgesetzt, daß 0 <= x < 2^intDsize*y. +// Es wird vorausgesetzt, daß 0 <= x < 2^intDsize*y. #if HAVE_DD #if (intDsize==8) #define divuD divu_1616_1616 @@ -137,7 +137,7 @@ inline sint32 sign_of_sintD (sintD wert) // Durch ein Digit dividieren: // floorD(uintD x, uintD y) // dividiert x/y und liefert q = floor(x/y). -// Es wird vorausgesetzt, daß y > 0. +// Es wird vorausgesetzt, daß y > 0. #if (intDsize==8) || (intDsize==16) || (intDsize==64) #define floorD(arg1,arg2) (floor((uintD)(arg1),(uintD)(arg2))) #endif @@ -169,9 +169,9 @@ inline sint32 sign_of_sintD (sintD wert) #define isqrtD isqrt_128_64 #endif -// Bits eines Digit zählen: +// Bits eines Digit zählen: // integerlengthD(digit,size=); -// setzt size auf die höchste in digit vorkommende Bitnummer. +// setzt size auf die höchste in digit vorkommende Bitnummer. // > digit: ein uintD >0 // < size: >0, <=intDsize, mit 2^(size-1) <= digit < 2^size #if (intDsize==8) @@ -187,7 +187,7 @@ inline sint32 sign_of_sintD (sintD wert) #define integerlengthD integerlength64 #endif -// Hintere Nullbits eines Digits zählen: +// Hintere Nullbits eines Digits zählen: // ord2_D(digit,count=); // setzt size auf die kleinste in digit vorkommende Bitnummer. // > digit: ein uintD >0 @@ -204,7 +204,7 @@ inline sint32 sign_of_sintD (sintD wert) } #endif -// Bits eines Wortes zählen. +// Bits eines Wortes zählen. // logcountD(x) // > x: ein uintD // < ergebnis: Anzahl der darin gesetzten Bits diff --git a/src/base/digitseq/cl_2DS_div.cc b/src/base/digitseq/cl_2DS_div.cc index 4b9d8cf..30eed38 100644 --- a/src/base/digitseq/cl_2DS_div.cc +++ b/src/base/digitseq/cl_2DS_div.cc @@ -124,7 +124,7 @@ void div2adic (uintC a_len, const uintD* a_LSDptr, uintC b_len, const uintD* b_L var uintD* p_LSDptr; num_stack_alloc(2*b_len,,p_LSDptr=); cl_UDS_mul(q_LSDptr,b_len,b_LSDptr,b_len,p_LSDptr); - // Überprüfen, daß p == a mod 2^(intDsize*b_len): + // Überprüfen, daß p == a mod 2^(intDsize*b_len): if (compare_loop_msp(a_LSDptr lspop b_len,p_LSDptr lspop b_len,b_len)) throw runtime_exception(); // Quotient q und "Rest" (a-b*q)/2^(intDsize*b_len) ablegen: @@ -141,9 +141,9 @@ void div2adic (uintC a_len, const uintD* a_LSDptr, uintC b_len, const uintD* b_L { // Standard division. var uintD b0inv = div2adic(1,lspref(b_LSDptr,0)); // b' copy_loop_lsp(a_LSDptr,dest_LSDptr,a_len); // d := a - do { var uintD digit = lspref(dest_LSDptr,0); // nächstes d[j] + do { var uintD digit = lspref(dest_LSDptr,0); // nächstes d[j] digit = mul2adic(b0inv,digit); - // digit = nächstes c[j] + // digit = nächstes c[j] if (a_len <= b_len) { mulusub_loop_lsp(digit,b_LSDptr,dest_LSDptr,a_len); } // d := d - b * c[j] * beta^j else @@ -157,7 +157,7 @@ void div2adic (uintC a_len, const uintD* a_LSDptr, uintC b_len, const uintD* b_L } } // Nun ist lspref(dest_LSDptr,0) = 0. lspref(dest_LSDptr,0) = digit; // c[j] ablegen - lsshrink(dest_LSDptr); a_len--; // nächstes j + lsshrink(dest_LSDptr); a_len--; // nächstes j } until (a_len==lendiff); } diff --git a/src/base/digitseq/cl_DS.h b/src/base/digitseq/cl_DS.h index a36e1ee..ee29df7 100644 --- a/src/base/digitseq/cl_DS.h +++ b/src/base/digitseq/cl_DS.h @@ -560,7 +560,7 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des // Kopierschleife: // destptr = copy_loop_up(sourceptr,destptr,count); -// kopiert count (uintC>=0) Digits aufwärts von sourceptr nach destptr +// kopiert count (uintC>=0) Digits aufwärts von sourceptr nach destptr // und liefert das neue destptr. inline uintD* copy_loop_up (const uintD* sourceptr, uintD* destptr, uintC count) { dotimesC(count,count, { *destptr++ = *sourceptr++; } ); @@ -569,7 +569,7 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des // Kopierschleife: // destptr = copy_loop_down(sourceptr,destptr,count); -// kopiert count (uintC>=0) Digits abwärts von sourceptr nach destptr +// kopiert count (uintC>=0) Digits abwärts von sourceptr nach destptr // und liefert das neue destptr. inline uintD* copy_loop_down (const uintD* sourceptr, uintD* destptr, uintC count) { dotimesC(count,count, { *--destptr = *--sourceptr; } ); @@ -580,18 +580,18 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des #ifndef FILL_LOOPS -// Füllschleife: +// Füllschleife: // destptr = fill_loop_up(destptr,count,filler); -// kopiert count (uintC>=0) mal das Digit filler aufwärts nach destptr +// kopiert count (uintC>=0) mal das Digit filler aufwärts nach destptr // und liefert das neue destptr. inline uintD* fill_loop_up (uintD* destptr, uintC count, uintD filler) { dotimesC(count,count, { *destptr++ = filler; } ); return destptr; } -// Füllschleife: +// Füllschleife: // destptr = fill_loop_down(destptr,count,filler); -// kopiert count (uintC>=0) mal das Digit filler abwärts nach destptr +// kopiert count (uintC>=0) mal das Digit filler abwärts nach destptr // und liefert das neue destptr. inline uintD* fill_loop_down (uintD* destptr, uintC count, uintD filler) { dotimesC(count,count, { *--destptr = filler; } ); @@ -602,18 +602,18 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des #ifndef CLEAR_LOOPS -// Lösch-Schleife: +// Lösch-Schleife: // destptr = clear_loop_up(destptr,count); -// löscht count (uintC>=0) Digits aufwärts ab destptr +// löscht count (uintC>=0) Digits aufwärts ab destptr // und liefert das neue destptr. inline uintD* clear_loop_up (uintD* destptr, uintC count) { dotimesC(count,count, { *destptr++ = 0; } ); return destptr; } -// Lösch-Schleife: +// Lösch-Schleife: // destptr = clear_loop_down(destptr,count); -// löscht count (uintC>=0) Digits abwärts ab destptr +// löscht count (uintC>=0) Digits abwärts ab destptr // und liefert das neue destptr. inline uintD* clear_loop_down (uintD* destptr, uintC count) { dotimesC(count,count, { *--destptr = 0; } ); @@ -626,7 +626,7 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des // Test-Schleife: // test_loop_up(ptr,count) -// testet count (uintC>=0) Digits aufwärts ab ptr, ob darunter eines /=0 ist. +// testet count (uintC>=0) Digits aufwärts ab ptr, ob darunter eines /=0 ist. // Ergebnis /=0, falls ja. inline bool test_loop_up (const uintD* ptr, uintC count) { dotimesC(count,count, { if (*ptr++) return true; } ); @@ -635,7 +635,7 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des // Test-Schleife: // test_loop_down(ptr,count) -// testet count (uintC>=0) Digits abwärts ab ptr, ob darunter eines /=0 ist. +// testet count (uintC>=0) Digits abwärts ab ptr, ob darunter eines /=0 ist. // Ergebnis /=0, falls ja. inline bool test_loop_down (const uintD* ptr, uintC count) { dotimesC(count,count, { if (*--ptr) return true; } ); @@ -650,28 +650,28 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des // OR-Schleife: // or_loop_up(xptr,yptr,count); -// verknüpft count (uintC>=0) Digits aufwärts ab xptr und ab yptr +// verknüpft count (uintC>=0) Digits aufwärts ab xptr und ab yptr // mit Ziel ab xptr durch OR. inline void or_loop_up (uintD* xptr, const uintD* yptr, uintC count) { dotimesC(count,count, { *xptr++ |= *yptr++; } ); } // XOR-Schleife: // xor_loop_up(xptr,yptr,count); -// verknüpft count (uintC>=0) Digits aufwärts ab xptr und ab yptr +// verknüpft count (uintC>=0) Digits aufwärts ab xptr und ab yptr // mit Ziel ab xptr durch XOR. inline void xor_loop_up (uintD* xptr, const uintD* yptr, uintC count) { dotimesC(count,count, { *xptr++ ^= *yptr++; } ); } // AND-Schleife: // and_loop_up(xptr,yptr,count); -// verknüpft count (uintC>=0) Digits aufwärts ab xptr und ab yptr +// verknüpft count (uintC>=0) Digits aufwärts ab xptr und ab yptr // mit Ziel ab xptr durch AND. inline void and_loop_up (uintD* xptr, const uintD* yptr, uintC count) { dotimesC(count,count, { *xptr++ &= *yptr++; } ); } // EQV-Schleife: // eqv_loop_up(xptr,yptr,count); -// verknüpft count (uintC>=0) Digits aufwärts ab xptr und ab yptr +// verknüpft count (uintC>=0) Digits aufwärts ab xptr und ab yptr // mit Ziel ab xptr durch EQV (NOT XOR). inline void eqv_loop_up (uintD* xptr, const uintD* yptr, uintC count) { dotimesC(count,count, @@ -681,7 +681,7 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des // NAND-Schleife: // nand_loop_up(xptr,yptr,count); -// verknüpft count (uintC>=0) Digits aufwärts ab xptr und ab yptr +// verknüpft count (uintC>=0) Digits aufwärts ab xptr und ab yptr // mit Ziel ab xptr durch NAND (NOT AND). inline void nand_loop_up (uintD* xptr, const uintD* yptr, uintC count) { dotimesC(count,count, @@ -691,7 +691,7 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des // NOR-Schleife: // nor_loop_up(xptr,yptr,count); -// verknüpft count (uintC>=0) Digits aufwärts ab xptr und ab yptr +// verknüpft count (uintC>=0) Digits aufwärts ab xptr und ab yptr // mit Ziel ab xptr durch NOR (NOT OR). inline void nor_loop_up (uintD* xptr, const uintD* yptr, uintC count) { dotimesC(count,count, @@ -701,21 +701,21 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des // ANDC2-Schleife: // andc2_loop_up(xptr,yptr,count); -// verknüpft count (uintC>=0) Digits aufwärts ab xptr und ab yptr +// verknüpft count (uintC>=0) Digits aufwärts ab xptr und ab yptr // mit Ziel ab xptr durch ANDC2 (AND NOT). inline void andc2_loop_up (uintD* xptr, const uintD* yptr, uintC count) { dotimesC(count,count, { *xptr++ &= ~(*yptr++); } ); } // ORC2-Schleife: // orc2_loop_up(xptr,yptr,count); -// verknüpft count (uintC>=0) Digits aufwärts ab xptr und ab yptr +// verknüpft count (uintC>=0) Digits aufwärts ab xptr und ab yptr // mit Ziel ab xptr durch ORC2 (OR NOT). inline void orc2_loop_up (uintD* xptr, const uintD* yptr, uintC count) { dotimesC(count,count, { *xptr++ |= ~(*yptr++); } ); } // NOT-Schleife: // not_loop_up(xptr,count); -// verknüpft count (uintC>0) Digits aufwärts ab xptr mit Ziel ab xptr +// verknüpft count (uintC>0) Digits aufwärts ab xptr mit Ziel ab xptr // durch NOT. inline void not_loop_up (uintD* xptr, uintC count) { dotimespC(count,count, @@ -729,7 +729,7 @@ 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 +// 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 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; } ); @@ -756,9 +756,9 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des #ifndef ADDSUB_LOOPS // Additionsschleife: -// übertrag = add_loop_down(sourceptr1,sourceptr2,destptr,count); -// addiert count (uintC>=0) Digits abwärts von sourceptr1, von sourceptr2 -// abwärts nach destptr und liefert den Übertrag (0 oder /=0, was 1 bedeutet). +// übertrag = add_loop_down(sourceptr1,sourceptr2,destptr,count); +// addiert count (uintC>=0) Digits abwärts von sourceptr1, von sourceptr2 +// abwärts nach destptr und liefert den Übertrag (0 oder /=0, was 1 bedeutet). inline uintD add_loop_down (const uintD* sourceptr1, const uintD* sourceptr2, uintD* destptr, uintC count) { var uintD source1; var uintD source2; @@ -784,9 +784,9 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des } // Additionsschleife: -// übertrag = addto_loop_down(sourceptr,destptr,count); -// addiert count (uintC>=0) Digits abwärts von sourceptr, von destptr -// abwärts nach destptr und liefert den Übertrag (0 oder /=0, was 1 bedeutet). +// übertrag = addto_loop_down(sourceptr,destptr,count); +// addiert count (uintC>=0) Digits abwärts von sourceptr, von destptr +// abwärts nach destptr und liefert den Übertrag (0 oder /=0, was 1 bedeutet). inline uintD addto_loop_down (const uintD* sourceptr, uintD* destptr, uintC count) { var uintD source1; var uintD source2; @@ -812,20 +812,20 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des } // Incrementierschleife: -// übertrag = inc_loop_down(ptr,count); -// incrementiert count (uintC>=0) Digits abwärts von ptr, so lange bis kein -// Übertrag mehr auftritt und liefert den Übertrag (0 oder /=0, was 1 bedeutet). +// übertrag = inc_loop_down(ptr,count); +// incrementiert count (uintC>=0) Digits abwärts von ptr, so lange bis kein +// Übertrag mehr auftritt und liefert den Übertrag (0 oder /=0, was 1 bedeutet). inline uintD inc_loop_down (uintD* ptr, uintC count) { dotimesC(count,count, - { if (!( ++(*--ptr) == 0 )) return 0; } // kein weiterer Übertrag + { if (!( ++(*--ptr) == 0 )) return 0; } // kein weiterer Übertrag ); - return 1; // weiterer Übertrag + return 1; // weiterer Übertrag } // Subtraktionsschleife: -// übertrag = sub_loop_down(sourceptr1,sourceptr2,destptr,count); -// subtrahiert count (uintC>=0) Digits abwärts von sourceptr1, von sourceptr2 -// abwärts nach destptr und liefert den Übertrag (0 oder /=0, was -1 bedeutet). +// übertrag = sub_loop_down(sourceptr1,sourceptr2,destptr,count); +// subtrahiert count (uintC>=0) Digits abwärts von sourceptr1, von sourceptr2 +// abwärts nach destptr und liefert den Übertrag (0 oder /=0, was -1 bedeutet). inline uintD sub_loop_down (const uintD* sourceptr1, const uintD* sourceptr2, uintD* destptr, uintC count) { var uintD source1; var uintD source2; @@ -851,10 +851,10 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des } // Subtraktionsschleife: -// übertrag = subx_loop_down(sourceptr1,sourceptr2,destptr,count,carry); -// subtrahiert count (uintC>=0) Digits abwärts von sourceptr1 und addiert -// einen Carry (0 oder -1), von sourceptr2 abwärts nach destptr und -// liefert den Übertrag (0 oder /=0, was -1 bedeutet). +// übertrag = subx_loop_down(sourceptr1,sourceptr2,destptr,count,carry); +// subtrahiert count (uintC>=0) Digits abwärts von sourceptr1 und addiert +// einen Carry (0 oder -1), von sourceptr2 abwärts nach destptr und +// liefert den Übertrag (0 oder /=0, was -1 bedeutet). inline uintD subx_loop_down (const uintD* sourceptr1, const uintD* sourceptr2, uintD* destptr, uintC count, uintD carry) { var uintD source1; var uintD source2; @@ -884,10 +884,10 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des } } // Subtraktionsschleife: -// übertrag = subfrom_loop_down(sourceptr,destptr,count); -// subtrahiert count (uintC>=0) Digits abwärts von sourceptr, von destptr -// abwärts nach destptr (dest := dest - source) -// und liefert den Übertrag (0 oder /=0, was -1 bedeutet). +// übertrag = subfrom_loop_down(sourceptr,destptr,count); +// subtrahiert count (uintC>=0) Digits abwärts von sourceptr, von destptr +// abwärts nach destptr (dest := dest - source) +// und liefert den Übertrag (0 oder /=0, was -1 bedeutet). inline uintD subfrom_loop_down (const uintD* sourceptr, uintD* destptr, uintC count) { var uintD source1; var uintD source2; @@ -913,20 +913,20 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des } // Decrementierschleife: -// übertrag = dec_loop_down(ptr,count); -// decrementiert count (uintC>=0) Digits abwärts von ptr, so lange bis kein -// Übertrag mehr auftritt und liefert den Übertrag (0 oder -1). +// übertrag = dec_loop_down(ptr,count); +// decrementiert count (uintC>=0) Digits abwärts von ptr, so lange bis kein +// Übertrag mehr auftritt und liefert den Übertrag (0 oder -1). inline uintD dec_loop_down (uintD* ptr, uintC count) { dotimesC(count,count, - { if (!( (*--ptr)-- == 0 )) return 0; } // kein weiterer Übertrag + { if (!( (*--ptr)-- == 0 )) return 0; } // kein weiterer Übertrag ); - return (uintD)(-1); // weiterer Übertrag + return (uintD)(-1); // weiterer Übertrag } // Negierschleife: -// übertrag = neg_loop_down(ptr,count); -// negiert count (uintC>=0) Digits abwärts von ptr, -// und liefert den Übertrag (0 oder -1). +// übertrag = neg_loop_down(ptr,count); +// negiert count (uintC>=0) Digits abwärts von ptr, +// und liefert den Übertrag (0 oder -1). inline uintD neg_loop_down (uintD* ptr, uintC count) { // erstes Digit /=0 suchen: until (count==0) { if (!(*--ptr == 0)) goto L1; count--; } @@ -942,9 +942,9 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des #ifndef SHIFT_LOOPS // Schiebeschleife um 1 Bit nach links: -// übertrag = shift1left_loop_down(ptr,count); -// schiebt count (uintC>=0) Digits abwärts von ptr um 1 Bit nach links, -// und liefert den Übertrag (0 oder /=0, was 1 bedeutet). +// übertrag = shift1left_loop_down(ptr,count); +// schiebt count (uintC>=0) Digits abwärts von ptr um 1 Bit nach links, +// und liefert den Übertrag (0 oder /=0, was 1 bedeutet). #if HAVE_DD inline uintD shift1left_loop_down (uintD* ptr, uintC count) { var uintDD accu = 0; @@ -967,10 +967,10 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des #endif // Schiebeschleife um i Bits nach links: -// übertrag = shiftleft_loop_down(ptr,count,i,übertrag_init); -// schiebt count (uintC>=0) Digits abwärts von ptr um i Bits (0=0, <2^i). +// übertrag = shiftleft_loop_down(ptr,count,i,übertrag_init); +// schiebt count (uintC>=0) Digits abwärts von ptr um i Bits (0=0, <2^i). #if HAVE_DD inline uintD shiftleft_loop_down (uintD* ptr, uintC count, uintC i, uintD carry) { var uintDD accu = (uintDD)carry; @@ -993,11 +993,11 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des #endif // Schiebe- und Kopierschleife um i Bits nach links: -// übertrag = shiftleftcopy_loop_down(sourceptr,destptr,count,i); -// kopiert count (uintC>=0) Digits abwärts von sourceptr nach destptr +// übertrag = shiftleftcopy_loop_down(sourceptr,destptr,count,i); +// kopiert count (uintC>=0) Digits abwärts von sourceptr nach destptr // und schiebt sie dabei um i Bits (0=0, <2^i). +// wobei ganz rechts mit i Nullbits aufgefüllt wird, +// und liefert den Übertrag (was links rauskommt, >=0, <2^i). #if HAVE_DD inline uintD shiftleftcopy_loop_down (const uintD* sourceptr, uintD* destptr, uintC count, uintC i) { var uintDD accu = 0; @@ -1021,10 +1021,10 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des #endif // Schiebeschleife um 1 Bit nach rechts: -// übertrag = shift1right_loop_up(ptr,count,übertrag_init); -// schiebt count (uintC>=0) Digits aufwärts von ptr um 1 Bit nach rechts, -// wobei links das Bit übertrag_init (sollte =0 oder =-1 sein) hineingeschoben -// wird, und liefert den Übertrag (0 oder /=0, was 1 bedeutet). +// übertrag = shift1right_loop_up(ptr,count,übertrag_init); +// schiebt count (uintC>=0) Digits aufwärts von ptr um 1 Bit nach rechts, +// wobei links das Bit übertrag_init (sollte =0 oder =-1 sein) hineingeschoben +// wird, und liefert den Übertrag (0 oder /=0, was 1 bedeutet). #if HAVE_DD inline uintD shift1right_loop_up (uintD* ptr, uintC count, uintD carry) { var uintDD accu = (sintDD)(sintD)carry & ((uintDD)1 << (2*intDsize-1)); // 0 oder bit(2*intDsize-1) @@ -1047,17 +1047,17 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des #endif // Schiebeschleife um i Bits nach rechts: -// übertrag = shiftright_loop_up(ptr,count,i); -// schiebt count (uintC>=0) Digits aufwärts von ptr um i Bits (0=0) Digits aufwärts von ptr um i Bits (0>i)+accu; *ptr++ = highD(accu); }); return lowD(accu); @@ -1076,18 +1076,18 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des #endif // Schiebeschleife um i Bits nach rechts: -// übertrag = shiftrightsigned_loop_up(ptr,count,i); -// schiebt count (uintC>0) Digits aufwärts von ptr um i Bits (00) Digits aufwärts von ptr um i Bits (0>i; dotimespC(count,count, - { // Die oberen i Bits von (uintD)accu bilden hier den Übertrag. + { // Die oberen i Bits von (uintD)accu bilden hier den Übertrag. accu = highlowDD_0(lowD(accu)); - // Die oberen i Bits von (uintDD)accu bilden hier den Übertrag. + // Die oberen i Bits von (uintDD)accu bilden hier den Übertrag. accu = (highlowDD_0(*ptr)>>i)+accu; *ptr++ = highD(accu); }); return lowD(accu); @@ -1111,19 +1111,19 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des #endif // Schiebe- und Kopier-Schleife um i Bits nach rechts: -// übertrag = shiftrightcopy_loop_up(sourceptr,destptr,count,i,carry); -// kopiert count (uintC>=0) Digits aufwärts von sourceptr nach destptr +// übertrag = shiftrightcopy_loop_up(sourceptr,destptr,count,i,carry); +// kopiert count (uintC>=0) Digits aufwärts von sourceptr nach destptr // und schiebt sie dabei um i Bits (0>i; dotimesC(count,count, - { // Die oberen i Bits von (uintD)accu bilden hier den Übertrag. + { // Die oberen i Bits von (uintD)accu bilden hier den Übertrag. accu = highlowDD_0(lowD(accu)); - // Die oberen i Bits von (uintDD)accu bilden hier den Übertrag. + // Die oberen i Bits von (uintDD)accu bilden hier den Übertrag. accu = (highlowDD_0(*sourceptr++)>>i)+accu; *destptr++ = highD(accu); }); return lowD(accu); @@ -1222,7 +1222,7 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des // muluadd_loop_down(digit,sourceptr,destptr,len); // multipliziert die UDS sourceptr[-len..-1] (len>0) // mit dem einzelnen digit, legt das Ergebnis in der UDS destptr[-len..-1] -// ab und liefert den weiteren Übertrag. +// ab und liefert den weiteren Übertrag. #if HAVE_DD inline uintD muluadd_loop_down (uintD digit, const uintD* sourceptr, uintD* destptr, uintC len) { var uintDD carry = 0; @@ -1264,7 +1264,7 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des // mulusub_loop_down(digit,sourceptr,destptr,len); // multipliziert die UDS sourceptr[-len..-1] (len>0) mit dem einzelnen // digit, subtrahiert das Ergebnis von der UDS destptr[-len..-1] und liefert -// den weiteren Übertrag (>=0, evtl. von destptr[-len-1] zu subtrahieren). +// den weiteren Übertrag (>=0, evtl. von destptr[-len-1] zu subtrahieren). #if HAVE_DD inline uintD mulusub_loop_down (uintD digit, const uintD* sourceptr, uintD* destptr, uintC len) { var uintDD carry = 0; @@ -1280,7 +1280,7 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des return lowD(carry); } else - return 0; // nichts zu subtrahieren -> kein Übertrag + return 0; // nichts zu subtrahieren -> kein Übertrag } #else inline uintD mulusub_loop_down (uintD digit, const uintD* sourceptr, uintD* destptr, uintC len) @@ -1300,7 +1300,7 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des return carry; } else - return 0; // nichts zu subtrahieren -> kein Übertrag + return 0; // nichts zu subtrahieren -> kein Übertrag } #endif @@ -1364,28 +1364,28 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des // OR-Schleife: // or_loop_down(xptr,yptr,count); -// verknüpft count (uintC>=0) Digits abwärts ab xptr und ab yptr +// verknüpft count (uintC>=0) Digits abwärts ab xptr und ab yptr // mit Ziel ab xptr durch OR. inline void or_loop_down (uintD* xptr, const uintD* yptr, uintC count) { dotimesC(count,count, { *--xptr |= *--yptr; } ); } // XOR-Schleife: // xor_loop_down(xptr,yptr,count); -// verknüpft count (uintC>=0) Digits abwärts ab xptr und ab yptr +// verknüpft count (uintC>=0) Digits abwärts ab xptr und ab yptr // mit Ziel ab xptr durch XOR. inline void xor_loop_down (uintD* xptr, const uintD* yptr, uintC count) { dotimesC(count,count, { *--xptr ^= *--yptr; } ); } // AND-Schleife: // and_loop_down(xptr,yptr,count); -// verknüpft count (uintC>=0) Digits abwärts ab xptr und ab yptr +// verknüpft count (uintC>=0) Digits abwärts ab xptr und ab yptr // mit Ziel ab xptr durch AND. inline void and_loop_down (uintD* xptr, const uintD* yptr, uintC count) { dotimesC(count,count, { *--xptr &= *--yptr; } ); } // EQV-Schleife: // eqv_loop_down(xptr,yptr,count); -// verknüpft count (uintC>=0) Digits abwärts ab xptr und ab yptr +// verknüpft count (uintC>=0) Digits abwärts ab xptr und ab yptr // mit Ziel ab xptr durch EQV (NOT XOR). inline void eqv_loop_down (uintD* xptr, const uintD* yptr, uintC count) { dotimesC(count,count, @@ -1395,7 +1395,7 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des // NAND-Schleife: // nand_loop_down(xptr,yptr,count); -// verknüpft count (uintC>=0) Digits abwärts ab xptr und ab yptr +// verknüpft count (uintC>=0) Digits abwärts ab xptr und ab yptr // mit Ziel ab xptr durch NAND (NOT AND). inline void nand_loop_down (uintD* xptr, const uintD* yptr, uintC count) { dotimesC(count,count, @@ -1405,7 +1405,7 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des // NOR-Schleife: // nor_loop_down(xptr,yptr,count); -// verknüpft count (uintC>=0) Digits abwärts ab xptr und ab yptr +// verknüpft count (uintC>=0) Digits abwärts ab xptr und ab yptr // mit Ziel ab xptr durch NOR (NOT OR). inline void nor_loop_down (uintD* xptr, const uintD* yptr, uintC count) { dotimesC(count,count, @@ -1415,21 +1415,21 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des // ANDC2-Schleife: // andc2_loop_down(xptr,yptr,count); -// verknüpft count (uintC>=0) Digits abwärts ab xptr und ab yptr +// verknüpft count (uintC>=0) Digits abwärts ab xptr und ab yptr // mit Ziel ab xptr durch ANDC2 (AND NOT). inline void andc2_loop_down (uintD* xptr, const uintD* yptr, uintC count) { dotimesC(count,count, { *--xptr &= ~(*--yptr); } ); } // ORC2-Schleife: // orc2_loop_down(xptr,yptr,count); -// verknüpft count (uintC>=0) Digits abwärts ab xptr und ab yptr +// verknüpft count (uintC>=0) Digits abwärts ab xptr und ab yptr // mit Ziel ab xptr durch ORC2 (OR NOT). inline void orc2_loop_down (uintD* xptr, const uintD* yptr, uintC count) { dotimesC(count,count, { *--xptr |= ~(*--yptr); } ); } // NOT-Schleife: // not_loop_down(xptr,count); -// verknüpft count (uintC>0) Digits abwärts ab xptr mit Ziel ab xptr +// verknüpft count (uintC>0) Digits abwärts ab xptr mit Ziel ab xptr // durch NOT. inline void not_loop_down (uintD* xptr, uintC count) { dotimespC(count,count, @@ -1443,7 +1443,7 @@ 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 +// 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 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; } ); @@ -1470,9 +1470,9 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des #ifndef ADDSUB_LOOPS // Additionsschleife: -// übertrag = add_loop_up(sourceptr1,sourceptr2,destptr,count); -// addiert count (uintC>=0) Digits aufwärts von sourceptr1, von sourceptr2 -// aufwärts nach destptr und liefert den Übertrag (0 oder /=0, was 1 bedeutet). +// übertrag = add_loop_up(sourceptr1,sourceptr2,destptr,count); +// addiert count (uintC>=0) Digits aufwärts von sourceptr1, von sourceptr2 +// aufwärts nach destptr und liefert den Übertrag (0 oder /=0, was 1 bedeutet). inline uintD add_loop_up (const uintD* sourceptr1, const uintD* sourceptr2, uintD* destptr, uintC count) { var uintD source1; var uintD source2; @@ -1498,9 +1498,9 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des } // Additionsschleife: -// übertrag = addto_loop_up(sourceptr,destptr,count); -// addiert count (uintC>=0) Digits aufwärts von sourceptr, von destptr -// aufwärts nach destptr und liefert den Übertrag (0 oder /=0, was 1 bedeutet). +// übertrag = addto_loop_up(sourceptr,destptr,count); +// addiert count (uintC>=0) Digits aufwärts von sourceptr, von destptr +// aufwärts nach destptr und liefert den Übertrag (0 oder /=0, was 1 bedeutet). inline uintD addto_loop_up (const uintD* sourceptr, uintD* destptr, uintC count) { var uintD source1; var uintD source2; @@ -1526,20 +1526,20 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des } // Incrementierschleife: -// übertrag = inc_loop_up(ptr,count); -// incrementiert count (uintC>=0) Digits aufwärts von ptr, so lange bis kein -// Übertrag mehr auftritt und liefert den Übertrag (0 oder /=0, was 1 bedeutet). +// übertrag = inc_loop_up(ptr,count); +// incrementiert count (uintC>=0) Digits aufwärts von ptr, so lange bis kein +// Übertrag mehr auftritt und liefert den Übertrag (0 oder /=0, was 1 bedeutet). inline uintD inc_loop_up (uintD* ptr, uintC count) { dotimesC(count,count, - { if (!( ++(*ptr++) == 0 )) return 0; } // kein weiterer Übertrag + { if (!( ++(*ptr++) == 0 )) return 0; } // kein weiterer Übertrag ); - return 1; // weiterer Übertrag + return 1; // weiterer Übertrag } // Subtraktionsschleife: -// übertrag = sub_loop_up(sourceptr1,sourceptr2,destptr,count); -// subtrahiert count (uintC>=0) Digits aufwärts von sourceptr1, von sourceptr2 -// aufwärts nach destptr und liefert den Übertrag (0 oder /=0, was -1 bedeutet). +// übertrag = sub_loop_up(sourceptr1,sourceptr2,destptr,count); +// subtrahiert count (uintC>=0) Digits aufwärts von sourceptr1, von sourceptr2 +// aufwärts nach destptr und liefert den Übertrag (0 oder /=0, was -1 bedeutet). inline uintD sub_loop_up (const uintD* sourceptr1, const uintD* sourceptr2, uintD* destptr, uintC count) { var uintD source1; var uintD source2; @@ -1565,10 +1565,10 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des } // Subtraktionsschleife: -// übertrag = subx_loop_up(sourceptr1,sourceptr2,destptr,count,carry); -// subtrahiert count (uintC>=0) Digits aufwärts von sourceptr1 und addiert -// einen Carry (0 oder -1), von sourceptr2 aufwärts nach destptr und -// liefert den Übertrag (0 oder /=0, was -1 bedeutet). +// übertrag = subx_loop_up(sourceptr1,sourceptr2,destptr,count,carry); +// subtrahiert count (uintC>=0) Digits aufwärts von sourceptr1 und addiert +// einen Carry (0 oder -1), von sourceptr2 aufwärts nach destptr und +// liefert den Übertrag (0 oder /=0, was -1 bedeutet). inline uintD subx_loop_up (const uintD* sourceptr1, const uintD* sourceptr2, uintD* destptr, uintC count, uintD carry) { var uintD source1; var uintD source2; @@ -1598,10 +1598,10 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des } } // Subtraktionsschleife: -// übertrag = subfrom_loop_up(sourceptr,destptr,count); -// subtrahiert count (uintC>=0) Digits aufwärts von sourceptr, von destptr -// aufwärts nach destptr (dest := dest - source) -// und liefert den Übertrag (0 oder /=0, was -1 bedeutet). +// übertrag = subfrom_loop_up(sourceptr,destptr,count); +// subtrahiert count (uintC>=0) Digits aufwärts von sourceptr, von destptr +// aufwärts nach destptr (dest := dest - source) +// und liefert den Übertrag (0 oder /=0, was -1 bedeutet). inline uintD subfrom_loop_up (const uintD* sourceptr, uintD* destptr, uintC count) { var uintD source1; var uintD source2; @@ -1627,20 +1627,20 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des } // Decrementierschleife: -// übertrag = dec_loop_up(ptr,count); -// decrementiert count (uintC>=0) Digits aufwärts von ptr, so lange bis kein -// Übertrag mehr auftritt und liefert den Übertrag (0 oder -1). +// übertrag = dec_loop_up(ptr,count); +// decrementiert count (uintC>=0) Digits aufwärts von ptr, so lange bis kein +// Übertrag mehr auftritt und liefert den Übertrag (0 oder -1). inline uintD dec_loop_up (uintD* ptr, uintC count) { dotimesC(count,count, - { if (!( (*ptr++)-- == 0 )) return 0; } // kein weiterer Übertrag + { if (!( (*ptr++)-- == 0 )) return 0; } // kein weiterer Übertrag ); - return (uintD)(-1); // weiterer Übertrag + return (uintD)(-1); // weiterer Übertrag } // Negierschleife: -// übertrag = neg_loop_up(ptr,count); -// negiert count (uintC>=0) Digits aufwärts von ptr, -// und liefert den Übertrag (0 oder -1). +// übertrag = neg_loop_up(ptr,count); +// negiert count (uintC>=0) Digits aufwärts von ptr, +// und liefert den Übertrag (0 oder -1). inline uintD neg_loop_up (uintD* ptr, uintC count) { // erstes Digit /=0 suchen: until (count==0) { if (!(*ptr == 0)) goto L1; ptr++; count--; } @@ -1656,9 +1656,9 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des #ifndef SHIFT_LOOPS // Schiebeschleife um 1 Bit nach links: -// übertrag = shift1left_loop_up(ptr,count); -// schiebt count (uintC>=0) Digits aufwärts von ptr um 1 Bit nach links, -// und liefert den Übertrag (0 oder /=0, was 1 bedeutet). +// übertrag = shift1left_loop_up(ptr,count); +// schiebt count (uintC>=0) Digits aufwärts von ptr um 1 Bit nach links, +// und liefert den Übertrag (0 oder /=0, was 1 bedeutet). #if HAVE_DD inline uintD shift1left_loop_up (uintD* ptr, uintC count) { var uintDD accu = 0; @@ -1681,10 +1681,10 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des #endif // Schiebeschleife um i Bits nach links: -// übertrag = shiftleft_loop_up(ptr,count,i,übertrag_init); -// schiebt count (uintC>=0) Digits aufwärts von ptr um i Bits (0=0, <2^i). +// übertrag = shiftleft_loop_up(ptr,count,i,übertrag_init); +// schiebt count (uintC>=0) Digits aufwärts von ptr um i Bits (0=0, <2^i). #if HAVE_DD inline uintD shiftleft_loop_up (uintD* ptr, uintC count, uintC i, uintD carry) { var uintDD accu = (uintDD)carry; @@ -1707,11 +1707,11 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des #endif // Schiebe- und Kopierschleife um i Bits nach links: -// übertrag = shiftleftcopy_loop_up(sourceptr,destptr,count,i); -// kopiert count (uintC>=0) Digits aufwärts von sourceptr nach destptr +// übertrag = shiftleftcopy_loop_up(sourceptr,destptr,count,i); +// kopiert count (uintC>=0) Digits aufwärts von sourceptr nach destptr // und schiebt sie dabei um i Bits (0=0, <2^i). +// wobei ganz rechts mit i Nullbits aufgefüllt wird, +// und liefert den Übertrag (was links rauskommt, >=0, <2^i). #if HAVE_DD inline uintD shiftleftcopy_loop_up (const uintD* sourceptr, uintD* destptr, uintC count, uintC i) { var uintDD accu = 0; @@ -1735,10 +1735,10 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des #endif // Schiebeschleife um 1 Bit nach rechts: -// übertrag = shift1right_loop_down(ptr,count,übertrag_init); -// schiebt count (uintC>=0) Digits abwärts von ptr um 1 Bit nach rechts, -// wobei links das Bit übertrag_init (sollte =0 oder =-1 sein) hineingeschoben -// wird, und liefert den Übertrag (0 oder /=0, was 1 bedeutet). +// übertrag = shift1right_loop_down(ptr,count,übertrag_init); +// schiebt count (uintC>=0) Digits abwärts von ptr um 1 Bit nach rechts, +// wobei links das Bit übertrag_init (sollte =0 oder =-1 sein) hineingeschoben +// wird, und liefert den Übertrag (0 oder /=0, was 1 bedeutet). #if HAVE_DD inline uintD shift1right_loop_down (uintD* ptr, uintC count, uintD carry) { var uintDD accu = (sintDD)(sintD)carry & ((uintDD)1 << (2*intDsize-1)); // 0 oder bit(2*intDsize-1) @@ -1761,17 +1761,17 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des #endif // Schiebeschleife um i Bits nach rechts: -// übertrag = shiftright_loop_down(ptr,count,i); -// schiebt count (uintC>=0) Digits abwärts von ptr um i Bits (0=0) Digits abwärts von ptr um i Bits (0>i)+accu; *ptr = highD(accu); }); return lowD(accu); @@ -1790,18 +1790,18 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des #endif // Schiebeschleife um i Bits nach rechts: -// übertrag = shiftrightsigned_loop_down(ptr,count,i); -// schiebt count (uintC>0) Digits abwärts von ptr um i Bits (00) Digits abwärts von ptr um i Bits (0>i; dotimespC(count,count, - { // Die oberen i Bits von (uintD)accu bilden hier den Übertrag. + { // Die oberen i Bits von (uintD)accu bilden hier den Übertrag. accu = highlowDD_0(lowD(accu)); - // Die oberen i Bits von (uintDD)accu bilden hier den Übertrag. + // Die oberen i Bits von (uintDD)accu bilden hier den Übertrag. accu = (highlowDD_0(*--ptr)>>i)+accu; *ptr = highD(accu); }); return lowD(accu); @@ -1825,19 +1825,19 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des #endif // Schiebe- und Kopier-Schleife um i Bits nach rechts: -// übertrag = shiftrightcopy_loop_down(sourceptr,destptr,count,i,carry); -// kopiert count (uintC>=0) Digits abwärts von sourceptr nach destptr +// übertrag = shiftrightcopy_loop_down(sourceptr,destptr,count,i,carry); +// kopiert count (uintC>=0) Digits abwärts von sourceptr nach destptr // und schiebt sie dabei um i Bits (0>i; dotimesC(count,count, - { // Die oberen i Bits von (uintD)accu bilden hier den Übertrag. + { // Die oberen i Bits von (uintD)accu bilden hier den Übertrag. accu = highlowDD_0(lowD(accu)); - // Die oberen i Bits von (uintDD)accu bilden hier den Übertrag. + // Die oberen i Bits von (uintDD)accu bilden hier den Übertrag. accu = (highlowDD_0(*--sourceptr)>>i)+accu; *--destptr = highD(accu); }); return lowD(accu); @@ -1936,7 +1936,7 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des // muluadd_loop_up(digit,sourceptr,destptr,len); // multipliziert die UDS sourceptr[0..len-1] (len>0) // mit dem einzelnen digit, legt das Ergebnis in der UDS destptr[0..len-1] -// ab und liefert den weiteren Übertrag. +// ab und liefert den weiteren Übertrag. #if HAVE_DD inline uintD muluadd_loop_up (uintD digit, const uintD* sourceptr, uintD* destptr, uintC len) { var uintDD carry = 0; @@ -1978,7 +1978,7 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des // mulusub_loop_up(digit,sourceptr,destptr,len); // multipliziert die UDS sourceptr[0..len-1] (len>0) mit dem einzelnen // digit, subtrahiert das Ergebnis von der UDS destptr[0..len-1] und liefert -// den weiteren Übertrag (>=0, evtl. von destptr[len] zu subtrahieren). +// den weiteren Übertrag (>=0, evtl. von destptr[len] zu subtrahieren). #if HAVE_DD inline uintD mulusub_loop_up (uintD digit, const uintD* sourceptr, uintD* destptr, uintC len) { var uintDD carry = 0; @@ -1994,7 +1994,7 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des return lowD(carry); } else - return 0; // nichts zu subtrahieren -> kein Übertrag + return 0; // nichts zu subtrahieren -> kein Übertrag } #else inline uintD mulusub_loop_up (uintD digit, const uintD* sourceptr, uintD* destptr, uintC len) @@ -2014,7 +2014,7 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des return carry; } else - return 0; // nichts zu subtrahieren -> kein Übertrag + return 0; // nichts zu subtrahieren -> kein Übertrag } #endif @@ -2097,7 +2097,7 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des // XOR-Schleife: // xor_loop_up(xptr,yptr,count); -// verknüpft count (uintC>=0) Digits aufwärts ab xptr und ab yptr +// verknüpft count (uintC>=0) Digits aufwärts ab xptr und ab yptr // mit Ziel ab xptr durch XOR. inline void xor_loop_up (uintD* xptr, const uintD* yptr, uintC count) { dotimesC(count,count, { *xptr++ ^= *yptr++; } ); } @@ -2107,11 +2107,11 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des #if !defined(SHIFT_LOOPS) && CL_DS_BIG_ENDIAN_P // Schiebe- und Kopierschleife um i Bits nach links: -// übertrag = shiftleftcopy_loop_up(sourceptr,destptr,count,i); -// kopiert count (uintC>=0) Digits aufwärts von sourceptr nach destptr +// übertrag = shiftleftcopy_loop_up(sourceptr,destptr,count,i); +// kopiert count (uintC>=0) Digits aufwärts von sourceptr nach destptr // und schiebt sie dabei um i Bits (0=0, <2^i). +// wobei ganz rechts mit i Nullbits aufgefüllt wird, +// und liefert den Übertrag (was links rauskommt, >=0, <2^i). #if HAVE_DD inline uintD shiftleftcopy_loop_up (const uintD* sourceptr, uintD* destptr, uintC count, uintC i) { var uintDD accu = 0; @@ -2140,7 +2140,7 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des // Schiebe- und XOR-Schleife: // shiftxor_loop_up(xptr,yptr,count,i); -// verknüpft count+1 Digits aufwärts ab xptr mit count Digits aufwärts ab yptr, +// verknüpft count+1 Digits aufwärts ab xptr mit count Digits aufwärts ab yptr, // um i Bits verschoben, durch XOR. (count uintC>=0, 0 Longword: // get_32_Dptr(ptr) -// holt die nächsten 32 Bits aus den 32/intDsize Digits ab ptr. +// holt die nächsten 32 Bits aus den 32/intDsize Digits ab ptr. // set_32_Dptr(ptr,wert); // speichert den Wert wert (32 Bits) in die 32/intDsize Digits ab ptr. // get_max32_Dptr(count,ptr) -// holt die nächsten count Bits aus den ceiling(count/intDsize) Digits ab ptr. +// holt die nächsten count Bits aus den ceiling(count/intDsize) Digits ab ptr. // set_max32_Dptr(count,ptr,wert) // speichert wert (count Bits) in die ceiling(count/intDsize) Digits ab ptr. // Jeweils ptr eine Variable vom Typ uintD*, @@ -2348,11 +2348,11 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des #if (cl_word_size==64) // get_64_Dptr(ptr) -// holt die nächsten 64 Bits aus den 64/intDsize Digits ab ptr. +// holt die nächsten 64 Bits aus den 64/intDsize Digits ab ptr. // set_64_Dptr(ptr,wert); // speichert den Wert wert (64 Bits) in die 64/intDsize Digits ab ptr. // get_max64_Dptr(count,ptr) -// holt die nächsten count Bits aus den ceiling(count/intDsize) Digits ab ptr. +// holt die nächsten count Bits aus den ceiling(count/intDsize) Digits ab ptr. // set_max64_Dptr(count,ptr,wert) // speichert wert (count Bits) in die ceiling(count/intDsize) Digits ab ptr. // Jeweils ptr eine Variable vom Typ uintD*, @@ -2489,8 +2489,8 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des // num_stack_alloc_1(need, MSDptr = , LSDptr = ); // num_stack_small_alloc_1(need, MSDptr = , LSDptr = ); -// wie num_stack_alloc, nur daß unterhalb von MSDptr noch ein Digit Platz -// zusätzlich belegt wird. +// wie num_stack_alloc, nur daß unterhalb von MSDptr noch ein Digit Platz +// zusätzlich belegt wird. #define num_stack_array(need,low_zuweisung,high_zuweisung) \ {var uintC __need = (uintC)(need); \ @@ -2524,47 +2524,47 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des // Macro: In der DS MSDptr/len/LSDptr wird eine 1 unterhalb des Pointers ptr -// addiert. Unterhalb von MSDptr muß 1 Digit Platz sein. +// addiert. Unterhalb von MSDptr muß 1 Digit Platz sein. // Dabei ist ptr - MSDptr = count und 0 < count <= len . -// Eventuell wird MSDptr erniedrigt und len erhöht. +// Eventuell wird MSDptr erniedrigt und len erhöht. #define DS_1_plus(ptr,count) \ {var uintD* ptr_from_DS_1_plus = (ptr); \ var uintC count_from_DS_1_plus = (count); \ - loop { if (--count_from_DS_1_plus==0) /* Zähler erniedrigen */\ + loop { if (--count_from_DS_1_plus==0) /* Zähler erniedrigen */\ { /* Beim Most Significant Digit angelangt */\ lsprefnext(ptr_from_DS_1_plus) += 1; \ /* jetzt ist ptr_from_DS_1_plus = MSDptr */\ if (mspref(ptr_from_DS_1_plus,0) == (uintD)bit(intDsize-1)) \ - { /* 7FFF + 1 muß zu 00008000 werden: */\ + { /* 7FFF + 1 muß zu 00008000 werden: */\ lsprefnext(MSDptr) = 0; \ len++; \ } \ break; \ } \ if (!((lsprefnext(ptr_from_DS_1_plus) += 1) == 0)) /* weiterincrementieren */\ - break; /* kein weiterer Übertrag -> Schleife abbrechen */\ + break; /* kein weiterer Übertrag -> Schleife abbrechen */\ } } // Macro: In der DS MSDptr/len/LSDptr wird eine 1 unterhalb des Pointers ptr -// subtrahiert. Unterhalb von MSDptr muß 1 Digit Platz sein. +// subtrahiert. Unterhalb von MSDptr muß 1 Digit Platz sein. // Dabei ist ptr - MSDptr = count und 0 < count <= len . -// Eventuell wird MSDptr erniedrigt und len erhöht. +// Eventuell wird MSDptr erniedrigt und len erhöht. #define DS_minus1_plus(ptr,count) \ {var uintD* ptr_from_DS_minus1_plus = (ptr); \ var uintC count_from_DS_minus1_plus = (count); \ - loop { if (--count_from_DS_minus1_plus==0) /* Zähler erniedrigen */\ + loop { if (--count_from_DS_minus1_plus==0) /* Zähler erniedrigen */\ { /* Beim Most Significant Digit angelangt */\ lsprefnext(ptr_from_DS_minus1_plus) -= 1; \ /* jetzt ist ptr_from_DS_minus1_plus = MSDptr */\ if (mspref(ptr_from_DS_minus1_plus,0) == (uintD)bit(intDsize-1)-1) \ - { /* 8000 - 1 muß zu FFFF7FFF werden: */\ + { /* 8000 - 1 muß zu FFFF7FFF werden: */\ lsprefnext(MSDptr) = (uintD)(-1); \ len++; \ } \ break; \ } \ if (!((sintD)(lsprefnext(ptr_from_DS_minus1_plus) -= 1) == -1)) /* weiterdecrementieren */\ - break; /* kein weiterer Übertrag -> Schleife abbrechen */\ + break; /* kein weiterer Übertrag -> Schleife abbrechen */\ } } @@ -2574,7 +2574,7 @@ inline uintD divucopy_loop_down (uintD digit, const uintD* sourceptr, uintD* des // multipliziert die UDS sourceptr1[-len1..-1] (len1>0) // mit der UDS sourceptr2[-len1..-1] (len2>0) // und legt das Ergebnis in der UDS destptr[-len..-1] (len=len1+len2) ab. -// Unterhalb von destptr werden len Digits Platz benötigt. +// Unterhalb von destptr werden len Digits Platz benötigt. extern void cl_UDS_mul (const uintD* sourceptr1, uintC len1, const uintD* sourceptr2, uintC len2, uintD* destptr); @@ -2626,10 +2626,10 @@ extern void cl_UDS_mul_square (const uintD* sourceptr, uintC len, if (MSD2_from_DSmal==0) { msprefnext(MSDptr0) = 0; len2_from_DSmal--; } \ cl_UDS_mul((LSDptr1),len1_from_DSmal,(LSDptr2),len2_from_DSmal,LSDptr0); \ if ((sintD)MSD1_from_DSmal < 0) /* n<0 ? */\ - /* muß m bzw. m+b^l subtrahieren, um k Digits verschoben: */\ + /* muß m bzw. m+b^l subtrahieren, um k Digits verschoben: */\ { subfrom_loop_lsp(LSDptr2,LSDptr0 lspop len1,len2); } \ if ((sintD)MSD2_from_DSmal < 0) /* m<0 ? */\ - /* muß n bzw. n+b^k subtrahieren, um l Digits verschoben: */\ + /* muß n bzw. n+b^k subtrahieren, um l Digits verschoben: */\ { subfrom_loop_lsp(LSDptr1,LSDptr0 lspop len2,len1); } @@ -2642,12 +2642,12 @@ extern void cl_UDS_mul_square (const uintD* sourceptr, uintC len, // q = q_MSDptr/q_len/q_LSDptr, r = r_MSDptr/r_len/r_LSDptr beides // Normalized Unsigned Digit sequences. // Vorsicht: q_LSDptr <= r_MSDptr, -// Vorzeichenerweiterung von r kann q zerstören! +// Vorzeichenerweiterung von r kann q zerstören! // Vorzeichenerweiterung von q ist erlaubt. // a und b werden nicht modifiziert. // num_stack wird erniedrigt. #define UDS_divide(a_MSDptr,a_len,a_LSDptr,b_MSDptr,b_len,b_LSDptr,q_,r_) \ - /* Platz fürs Ergebnis machen. Brauche maximal a_len+1 Digits. */\ + /* Platz fürs Ergebnis machen. Brauche maximal a_len+1 Digits. */\ var uintC _a_len = (a_len); \ var uintD* roomptr; num_stack_alloc_1(_a_len+1,roomptr=,); \ cl_UDS_divide(a_MSDptr,_a_len,a_LSDptr,b_MSDptr,b_len,b_LSDptr,roomptr,q_,r_); @@ -2657,16 +2657,16 @@ extern void cl_UDS_mul_square (const uintD* sourceptr, uintC len, // Bildet zu einer Unsigned Digit sequence a die Wurzel -// (genauer: Gaußklammer aus Wurzel aus a). +// (genauer: Gaußklammer aus Wurzel aus a). // 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 +// < NUDS b: Gaußklammer der Wurzel aus a // < 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. #define UDS_sqrt(a_MSDptr,a_len,a_LSDptr,b_,squarep_zuweisung) \ - { /* ceiling(a_len,2) Digits Platz fürs Ergebnis machen: */\ + { /* ceiling(a_len,2) Digits Platz fürs Ergebnis machen: */\ var uintC _a_len = (a_len); \ num_stack_alloc_1(ceiling(_a_len,2),(b_)->MSDptr=,); \ squarep_zuweisung cl_UDS_sqrt(a_MSDptr,_a_len,a_LSDptr,b_); \ diff --git a/src/base/digitseq/cl_DS_div.cc b/src/base/digitseq/cl_DS_div.cc index 2ea8b61..7393dc8 100644 --- a/src/base/digitseq/cl_DS_div.cc +++ b/src/base/digitseq/cl_DS_div.cc @@ -115,7 +115,7 @@ namespace cln { // q = q_MSDptr/q_len/q_LSDptr, r = r_MSDptr/r_len/r_LSDptr beides // Normalized Unsigned Digit sequences. // Vorsicht: q_LSDptr <= r_MSDptr, -// Vorzeichenerweiterung von r kann q zerstören! +// Vorzeichenerweiterung von r kann q zerstören! // Vorzeichenerweiterung von q ist erlaubt. // a und b werden nicht modifiziert. // @@ -132,19 +132,19 @@ namespace cln { // Normalisiere [q[m-1],...,q[0]], liefert q. // Falls m>=n>1, Multiple-Precision-Division: // Es gilt a/b < beta^(m-n+1). -// s:=intDsize-1-(Nummer des höchsten Bits in b[n-1]), 0<=s=beta/2. -// Für j=m-n,...,0: {Hier 0 <= r < b*beta^(j+1).} +// Für j=m-n,...,0: {Hier 0 <= r < b*beta^(j+1).} // Berechne q* : // q* := floor((r[j+n]*beta+r[j+n-1])/b[n-1]). -// Bei Überlauf (q* >= beta) setze q* := beta-1. +// Bei Überlauf (q* >= beta) setze q* := beta-1. // Berechne c2 := ((r[j+n]*beta+r[j+n-1]) - q* * b[n-1])*beta + r[j+n-2] // und c3 := b[n-2] * q*. // {Es ist 0 <= c2 < 2*beta^2, sogar 0 <= c2 < beta^2 falls kein -// Überlauf aufgetreten war. Ferner 0 <= c3 < beta^2. -// Bei Überlauf und r[j+n]*beta+r[j+n-1] - q* * b[n-1] >= beta, -// das heißt c2 >= beta^2, kann man die nächste Abfrage überspringen.} +// Überlauf aufgetreten war. Ferner 0 <= c3 < beta^2. +// Bei Überlauf und r[j+n]*beta+r[j+n-1] - q* * b[n-1] >= beta, +// das heißt c2 >= beta^2, kann man die nächste Abfrage überspringen.} // Solange c3 > c2, {hier 0 <= c2 < c3 < beta^2} setze // q* := q* - 1, c2 := c2 + b[n-1]*beta, c3 := c3 - b[n-2]. // Falls q* > 0: @@ -156,8 +156,8 @@ namespace cln { // u:=u div beta (+ 1, falls bei der Subtraktion Carry) // r[n+j]:=r[n+j]-u. // {Da stets u = (q* * [b[i-1],...,b[0]] div beta^i) + 1 -// < q* + 1 <= beta, läuft der Übertrag u nicht über.} -// Tritt dabei ein negativer Übertrag auf, so setze q* := q* - 1 +// < q* + 1 <= beta, läuft der Übertrag u nicht über.} +// Tritt dabei ein negativer Übertrag auf, so setze q* := q* - 1 // und [r[n+j],...,r[j]] := [r[n+j],...,r[j]] + [0,b[n-1],...,b[0]]. // Setze q[j] := q*. // Normalisiere [q[m-n],..,q[0]] und erhalte den Quotienten q, @@ -168,9 +168,9 @@ namespace cln { const uintD* b_MSDptr, uintC b_len, const uintD* b_LSDptr, uintD* roomptr, // ab roomptr kommen a_len+1 freie Digits DS* q_, DS* r_) - { // a normalisieren (a_MSDptr erhöhen, a_len erniedrigen): + { // a normalisieren (a_MSDptr erhöhen, a_len erniedrigen): while ((a_len>0) && (mspref(a_MSDptr,0)==0)) { msshrink(a_MSDptr); a_len--; } - // b normalisieren (b_MSDptr erhöhen, b_len erniedrigen): + // b normalisieren (b_MSDptr erhöhen, b_len erniedrigen): loop { if (b_len==0) { throw division_by_0_exception(); } if (mspref(b_MSDptr,0)==0) { msshrink(b_MSDptr); b_len--; } @@ -244,7 +244,7 @@ namespace cln { var uintD* r_LSDptr = roomptr mspop (a_len+1); // Speicheraufbau: r_MSDptr/ a_len+1 /r_LSDptr // | r | - // später: q_MSDptr/a_len-b_len+1/r_MSDptr/b_len/r_LSDptr + // später: q_MSDptr/a_len-b_len+1/r_MSDptr/b_len/r_LSDptr // | q | r | if (s==0) { copy_loop_lsp(a_LSDptr,r_LSDptr,a_len); mspref(r_MSDptr,0) = 0; } @@ -281,7 +281,7 @@ namespace cln { var uintD* p_MSDptr; var uintD* p_LSDptr; UDS_UDS_mul_UDS(j+2,d_LSDptr, b_len,b_LSDptr, p_MSDptr=,,p_LSDptr=); - // d ist um höchstens 2 zu groß, muß also evtl. zweimal um 1 + // d ist um höchstens 2 zu groß, muß also evtl. zweimal um 1 // decrementieren, bis das Produkt <= a wird. if ((mspref(p_MSDptr,0) > 0) || (compare_loop_msp(p_MSDptr mspop 1,r_MSDptr,a_len+1) > 0)) { dec_loop_lsp(d_LSDptr,j+2); @@ -298,7 +298,7 @@ namespace cln { subfrom_loop_lsp(p_LSDptr,r_LSDptr,a_len+1); if (test_loop_msp(r_MSDptr,j)) throw runtime_exception(); r_MSDptr = r_LSDptr lspop b_len; // = r_MSDptr mspop (j+1); - // d ist um höchstens 2 zu klein, muß also evtl. zweimal um 1 + // d ist um höchstens 2 zu klein, muß also evtl. zweimal um 1 // incrementieren, bis der Rest < b wird. if ((lspref(r_MSDptr,0) > 0) || (compare_loop_msp(r_MSDptr,b_MSDptr,b_len) >= 0)) { inc_loop_lsp(d_LSDptr,j+2); @@ -324,13 +324,13 @@ namespace cln { var uintDD b_msdd = highlowDD(b_msd,b_2msd); // b[n-1]*beta+b[n-2] #endif // Divisions-Schleife: (wird m-n+1 mal durchlaufen) - // j = Herabzähler, b_MSDptr/b_len/b_LSDptr = [b[n-1],...,b[0]], b_len=n, + // j = Herabzähler, b_MSDptr/b_len/b_LSDptr = [b[n-1],...,b[0]], b_len=n, // r_MSDptr = Pointer auf r[n+j] = Pointer auf q[j], // r_ptr = Pointer oberhalb von r[j]. do { var uintD q_stern; var uintD c1; if (mspref(r_MSDptr,0) < b_msd) // r[j+n] < b[n-1] ? - { // Dividiere r[j+n]*beta+r[j+n-1] durch b[n-1], ohne Überlauf: + { // Dividiere r[j+n]*beta+r[j+n-1] durch b[n-1], ohne Überlauf: #if HAVE_DD divuD(highlowDD(mspref(r_MSDptr,0),mspref(r_MSDptr,1)),b_msd, q_stern=,c1=); #else @@ -338,7 +338,7 @@ namespace cln { #endif } else - { // Überlauf, also r[j+n]*beta+r[j+n-1] >= beta*b[n-1] + { // Überlauf, also r[j+n]*beta+r[j+n-1] >= beta*b[n-1] q_stern = bitm(intDsize)-1; // q* = beta-1 // Teste ob r[j+n]*beta+r[j+n-1] - (beta-1)*b[n-1] >= beta // <==> r[j+n]*beta+r[j+n-1] + b[n-1] >= beta*b[n-1]+beta @@ -356,11 +356,11 @@ namespace cln { #if HAVE_DD { var uintDD c2 = highlowDD(c1,mspref(r_MSDptr,2)); // c1*beta+r[j+n-2] var uintDD c3 = muluD(b_2msd,q_stern); // b[n-2] * q* - // Solange c2 < c3, c2 erhöhen, c3 erniedrigen: + // Solange c2 < c3, c2 erhöhen, c3 erniedrigen: // Rechne dabei mit c3-c2: // solange >0, um b[n-1]*beta+b[n-2] erniedrigen. // Dies kann wegen b[n-1]*beta+b[n-2] >= beta^2/2 - // höchstens zwei mal auftreten. + // höchstens zwei mal auftreten. if (c3 > c2) { q_stern = q_stern-1; // q* := q* - 1 if (c3-c2 > b_msdd) @@ -386,9 +386,9 @@ namespace cln { { // Subtraktionsschleife: r := r - b * q* * beta^j var uintD carry = mulusub_loop_lsp(q_stern,b_LSDptr,r_ptr,b_len); // Noch r_ptr[-b_len-1] -= carry, d.h. r_MSDptr[0] -= carry - // durchführen und danach r_MSDptr[0] vergessen: + // durchführen und danach r_MSDptr[0] vergessen: if (carry > mspref(r_MSDptr,0)) - // Subtraktion ergab Übertrag + // Subtraktion ergab Übertrag { q_stern = q_stern-1; // q* := q* - 1 addto_loop_lsp(b_LSDptr,r_ptr,b_len); // Additionsschleife // r[n+j] samt Carry kann vergessen werden... diff --git a/src/base/digitseq/cl_DS_mul.cc b/src/base/digitseq/cl_DS_mul.cc index 314e4cb..774edce 100644 --- a/src/base/digitseq/cl_DS_mul.cc +++ b/src/base/digitseq/cl_DS_mul.cc @@ -21,7 +21,7 @@ namespace cln { // multipliziert die UDS sourceptr1[-len1..-1] (len1>0) // mit der UDS sourceptr2[-len1..-1] (len2>0) // und legt das Ergebnis in der UDS destptr[-len..-1] (len=len1+len2) ab. -// Unterhalb von destptr werden len Digits Platz benötigt. +// Unterhalb von destptr werden len Digits Platz benötigt. void cl_UDS_mul (const uintD* sourceptr1, uintC len1, const uintD* sourceptr2, uintC len2, uintD* destptr); @@ -38,12 +38,12 @@ namespace cln { mulu_loop_lsp(lsprefnext(sourceptr1),sourceptr2,destptr,len2); lsshrink(destptr); var uintD* destptr2 = destptr lspop len2; - // äußere Schleife läuft über source1 : + // äußere Schleife läuft über source1 : dotimespC(len1,len1-1, - { // innere Schleife läuft über source2 : + { // innere Schleife läuft über source2 : var uintD carry = muluadd_loop_lsp(lsprefnext(sourceptr1),sourceptr2,destptr,len2); - lsprefnext(destptr2) = carry; // UDS um das Carry-Digit verlängern + lsprefnext(destptr2) = carry; // UDS um das Carry-Digit verlängern lsshrink(destptr); }); } @@ -170,7 +170,7 @@ namespace cln { // FFT-Multiplikation nach Nussbaumer: O(n log n log log n) #include "cl_DS_mul_nuss.h" - // nuss_threshold = Länge, ab der die Nussbaumer-Multiplikation bevorzugt + // nuss_threshold = Länge, ab der die Nussbaumer-Multiplikation bevorzugt // wird. Der Break-Even-Point bestimmt sich aus Zeitmessungen. // Multiplikation zweier N-Wort-Zahlen unter Linux mit einem 80486: // N kara nuss nuss-asm (time in sec.) @@ -184,7 +184,7 @@ namespace cln { // FFT-Multiplikation in Z/pZ: O(n log n log log n) #include "cl_DS_mul_fftp.h" - // fftp_threshold = Länge, ab der die FFT-Multiplikation mod p bevorzugt + // fftp_threshold = Länge, ab der die FFT-Multiplikation mod p bevorzugt // wird. Der Break-Even-Point bestimmt sich aus Zeitmessungen. // Multiplikation zweier N-Wort-Zahlen unter Linux mit einem 80486: // N kara fftp (time in sec.) @@ -197,9 +197,9 @@ namespace cln { int cl_fftp_threshold = 1000000; // FFT-Multiplikation in Z/pZ: O(n log n log log n) -// für drei verschiedene Primzahlen p1,p2,p3 < 2^32. +// für drei verschiedene Primzahlen p1,p2,p3 < 2^32. #include "cl_DS_mul_fftp3.h" - // fftp3_threshold = Länge, ab der die FFT-Multiplikation mod p_i bevorzugt + // fftp3_threshold = Länge, ab der die FFT-Multiplikation mod p_i bevorzugt // wird. Der Break-Even-Point bestimmt sich aus Zeitmessungen. // Multiplikation zweier N-Wort-Zahlen unter Linux mit einem 80486: // N kara fftp3 fftp (time in sec.) @@ -213,10 +213,10 @@ namespace cln { int cl_fftp3_threshold = 1000000; // FFT-Multiplikation in Z/pZ: O(n log n log log n) -// für drei verschiedene Primzahlen p1,p2,p3 < 2^32, +// für drei verschiedene Primzahlen p1,p2,p3 < 2^32, // mit Montgomery-Multiplikation. #include "cl_DS_mul_fftp3m.h" - // fftp3_threshold = Länge, ab der die FFT-Multiplikation mod p_i bevorzugt + // fftp3_threshold = Länge, ab der die FFT-Multiplikation mod p_i bevorzugt // wird. Der Break-Even-Point bestimmt sich aus Zeitmessungen. // Multiplikation zweier N-Wort-Zahlen unter // Linux mit einem 80486, 33 MHz, mit Benutzung der GMP-Low-Level-Funktionen: @@ -299,7 +299,7 @@ namespace cln { // // 1250 3100 1.35 1.07 0.28 0.21 // // Es gibt also noch Werte von (len1,len2) mit 1250 <= len1 <= len2, bei // // denen "kara" schneller ist als "fftm", aber nicht viele und dort auch - // // nur um 5%. Darum wählen wir ab hier die FFT-Multiplikation. + // // nur um 5%. Darum wählen wir ab hier die FFT-Multiplikation. // // 140000: 4.15s 12.53 23.7 // // 14000: 4.16s // // 11000: 4.16s @@ -375,7 +375,7 @@ namespace cln { #if 0 // Doesn't seem to be worth the effort -// FFT-Multiplikation über den komplexen Zahlen. +// FFT-Multiplikation über den komplexen Zahlen. #include "cl_DS_mul_fftc.h" // Multiplikation zweier N-Wort-Zahlen unter // Linux mit einem i486 33 MHz @@ -401,7 +401,7 @@ namespace cln { // 10000 0.88 4.95 // 25000 2.3 (15MB) -// FFT-Multiplikation über den komplexen Zahlen, Symmetrie ausnutzend. +// FFT-Multiplikation über den komplexen Zahlen, Symmetrie ausnutzend. #include "cl_DS_mul_fftcs.h" // Multiplikation zweier N-Wort-Zahlen unter // Linux mit einem i486 33 MHz @@ -442,9 +442,9 @@ namespace cln { #endif -#if 0 // Keine gute Fehlerabschätzung +#if 0 // Keine gute Fehlerabschätzung -// FFT-Multiplikation über den komplexen Zahlen, mit reellen Zahlen rechnend. +// FFT-Multiplikation über den komplexen Zahlen, mit reellen Zahlen rechnend. #include "cl_DS_mul_fftr.h" // Multiplikation zweier N-Wort-Zahlen unter // Linux mit einem i486 33 MHz @@ -482,7 +482,7 @@ namespace cln { if (len1 < cl_karatsuba_threshold) // Multiplikation nach Schulmethode mulu_2loop(sourceptr1,len1,sourceptr2,len2,destptr); - else // len1 groß + else // len1 groß if (!cl_fftm_suitable(len1,len2)) // Karatsuba-Multiplikation // (ausgelagert, um die eigentliche Multiplikationsfunktion nicht diff --git a/src/base/digitseq/cl_DS_mul_fftm.h b/src/base/digitseq/cl_DS_mul_fftm.h index 9c9a5de..a984802 100644 --- a/src/base/digitseq/cl_DS_mul_fftm.h +++ b/src/base/digitseq/cl_DS_mul_fftm.h @@ -11,7 +11,7 @@ // multiplication, multiplication by the Nth root and unity and division // by N. Hence we can use the domain Z/(p^m Z) even if p is not a prime! -// We use the Schönhage-Strassen choice of the modulus: p = 2^R+1. This +// We use the Schönhage-Strassen choice of the modulus: p = 2^R+1. This // has two big advantages: Multiplication and division by 2 (which is a // (2R)th root of unity) or a power of 2 is just a shift and an subtraction. // And multiplication mod p is just a normal multiplication, followed by diff --git a/src/base/digitseq/cl_DS_mul_fftp.h b/src/base/digitseq/cl_DS_mul_fftp.h index 94a0197..7abbe4a 100644 --- a/src/base/digitseq/cl_DS_mul_fftp.h +++ b/src/base/digitseq/cl_DS_mul_fftp.h @@ -654,8 +654,8 @@ static void mulu_fft_modp (const uintD* sourceptr1, uintC len1, // Es ist 2 <= len1 <= len2. { // Methode: - // source1 ist ein Stück der Länge N1, source2 ein oder mehrere Stücke - // der Länge N2, mit N1+N2 <= N, wobei N Zweierpotenz ist. + // source1 ist ein Stück der Länge N1, source2 ein oder mehrere Stücke + // der Länge N2, mit N1+N2 <= N, wobei N Zweierpotenz ist. // sum(i=0..N-1, x_i b^i) * sum(i=0..N-1, y_i b^i) wird errechnet, // indem man die beiden Polynome // sum(i=0..N-1, x_i T^i), sum(i=0..N-1, y_i T^i) @@ -663,12 +663,12 @@ static void mulu_fft_modp (const uintD* sourceptr1, uintC len1, var uint32 n; integerlengthC(len1-1, n=); // 2^(n-1) < len1 <= 2^n var uintC len = (uintC)1 << n; // kleinste Zweierpotenz >= len1 - // Wählt man N = len, so hat man ceiling(len2/(len-len1+1)) * FFT(len). - // Wählt man N = 2*len, so hat man ceiling(len2/(2*len-len1+1)) * FFT(2*len). - // Wir wählen das billigere von beiden: + // Wählt man N = len, so hat man ceiling(len2/(len-len1+1)) * FFT(len). + // Wählt man N = 2*len, so hat man ceiling(len2/(2*len-len1+1)) * FFT(2*len). + // Wir wählen das billigere von beiden: // Bei ceiling(len2/(len-len1+1)) <= 2 * ceiling(len2/(2*len-len1+1)) // nimmt man N = len, bei ....... > ........ dagegen N = 2*len. - // (Wahl von N = 4*len oder mehr bringt nur in Extremfällen etwas.) + // (Wahl von N = 4*len oder mehr bringt nur in Extremfällen etwas.) if (len2 > 2 * (len-len1+1) * (len2 <= (2*len-len1+1) ? 1 : ceiling(len2,(2*len-len1+1)))) { n = n+1; len = len << 1; diff --git a/src/base/digitseq/cl_DS_mul_fftp3.h b/src/base/digitseq/cl_DS_mul_fftp3.h index d857eea..4d52e22 100644 --- a/src/base/digitseq/cl_DS_mul_fftp3.h +++ b/src/base/digitseq/cl_DS_mul_fftp3.h @@ -521,8 +521,8 @@ static void mulu_fft_modp3 (const uintD* sourceptr1, uintC len1, // Es ist 2 <= len1 <= len2. { // Methode: - // source1 ist ein Stück der Länge N1, source2 ein oder mehrere Stücke - // der Länge N2, mit N1+N2 <= N, wobei N Zweierpotenz ist. + // source1 ist ein Stück der Länge N1, source2 ein oder mehrere Stücke + // der Länge N2, mit N1+N2 <= N, wobei N Zweierpotenz ist. // sum(i=0..N-1, x_i b^i) * sum(i=0..N-1, y_i b^i) wird errechnet, // indem man die beiden Polynome // sum(i=0..N-1, x_i T^i), sum(i=0..N-1, y_i T^i) @@ -530,12 +530,12 @@ static void mulu_fft_modp3 (const uintD* sourceptr1, uintC len1, var uint32 n; integerlengthC(len1-1, n=); // 2^(n-1) < len1 <= 2^n var uintC len = (uintC)1 << n; // kleinste Zweierpotenz >= len1 - // Wählt man N = len, so hat man ceiling(len2/(len-len1+1)) * FFT(len). - // Wählt man N = 2*len, so hat man ceiling(len2/(2*len-len1+1)) * FFT(2*len). - // Wir wählen das billigere von beiden: + // Wählt man N = len, so hat man ceiling(len2/(len-len1+1)) * FFT(len). + // Wählt man N = 2*len, so hat man ceiling(len2/(2*len-len1+1)) * FFT(2*len). + // Wir wählen das billigere von beiden: // Bei ceiling(len2/(len-len1+1)) <= 2 * ceiling(len2/(2*len-len1+1)) // nimmt man N = len, bei ....... > ........ dagegen N = 2*len. - // (Wahl von N = 4*len oder mehr bringt nur in Extremfällen etwas.) + // (Wahl von N = 4*len oder mehr bringt nur in Extremfällen etwas.) if (len2 > 2 * (len-len1+1) * (len2 <= (2*len-len1+1) ? 1 : ceiling(len2,(2*len-len1+1)))) { n = n+1; len = len << 1; diff --git a/src/base/digitseq/cl_DS_mul_fftp3m.h b/src/base/digitseq/cl_DS_mul_fftp3m.h index 0aed00b..ba16cb9 100644 --- a/src/base/digitseq/cl_DS_mul_fftp3m.h +++ b/src/base/digitseq/cl_DS_mul_fftp3m.h @@ -389,7 +389,7 @@ static inline void subp3m (const fftp3m_word& a, const fftp3m_word& b, fftp3m_wo static void mulp3m (const fftp3m_word& a, const fftp3m_word& b, fftp3m_word& res) { check_fftp3m_word(a); check_fftp3m_word(b); - // Multiplication à la Montgomery: + // Multiplication à la Montgomery: #define mul_mod_p(aw,bw,result_zuweisung,p,m,n,j,js,table) \ { /* table[i] == i*2^(m-1) mod p for 0 <= i < 2^(m-n+1) */\ var uint32 hi; \ @@ -700,8 +700,8 @@ static void mulu_fft_modp3m (const uintD* sourceptr1, uintC len1, // Es ist 2 <= len1 <= len2. { // Methode: - // source1 ist ein Stück der Länge N1, source2 ein oder mehrere Stücke - // der Länge N2, mit N1+N2 <= N, wobei N Zweierpotenz ist. + // source1 ist ein Stück der Länge N1, source2 ein oder mehrere Stücke + // der Länge N2, mit N1+N2 <= N, wobei N Zweierpotenz ist. // sum(i=0..N-1, x_i b^i) * sum(i=0..N-1, y_i b^i) wird errechnet, // indem man die beiden Polynome // sum(i=0..N-1, x_i T^i), sum(i=0..N-1, y_i T^i) @@ -709,12 +709,12 @@ static void mulu_fft_modp3m (const uintD* sourceptr1, uintC len1, var uint32 n; integerlengthC(len1-1, n=); // 2^(n-1) < len1 <= 2^n var uintC len = (uintC)1 << n; // kleinste Zweierpotenz >= len1 - // Wählt man N = len, so hat man ceiling(len2/(len-len1+1)) * FFT(len). - // Wählt man N = 2*len, so hat man ceiling(len2/(2*len-len1+1)) * FFT(2*len). - // Wir wählen das billigere von beiden: + // Wählt man N = len, so hat man ceiling(len2/(len-len1+1)) * FFT(len). + // Wählt man N = 2*len, so hat man ceiling(len2/(2*len-len1+1)) * FFT(2*len). + // Wir wählen das billigere von beiden: // Bei ceiling(len2/(len-len1+1)) <= 2 * ceiling(len2/(2*len-len1+1)) // nimmt man N = len, bei ....... > ........ dagegen N = 2*len. - // (Wahl von N = 4*len oder mehr bringt nur in Extremfällen etwas.) + // (Wahl von N = 4*len oder mehr bringt nur in Extremfällen etwas.) if (len2 > 2 * (len-len1+1) * (len2 <= (2*len-len1+1) ? 1 : ceiling(len2,(2*len-len1+1)))) { n = n+1; len = len << 1; diff --git a/src/base/digitseq/cl_DS_mul_kara.h b/src/base/digitseq/cl_DS_mul_kara.h index 8531b5b..3682a6d 100644 --- a/src/base/digitseq/cl_DS_mul_kara.h +++ b/src/base/digitseq/cl_DS_mul_kara.h @@ -6,14 +6,14 @@ // = x1*y1 * b^2k + ((x1+x0)*(y1+y0)-x1*y1-x0*y0) * b^k + x0*y0 // Methode 1 (Collins/Loos, Degel): // source2 wird in floor(len2/len1) einzelne UDS mit je einer - // Länge len3 (len1 <= len3 < 2*len1) unterteilt, + // Länge len3 (len1 <= len3 < 2*len1) unterteilt, // jeweils k=floor(len3/2). // Methode 2 (Haible): // source2 wird in ceiling(len2/len1) einzelne UDS mit je einer - // Länge len3 (0 < len3 <= len1) unterteilt, jeweils k=floor(len1/2). - // Aufwand für die hinteren Einzelteile: + // Länge len3 (0 < len3 <= len1) unterteilt, jeweils k=floor(len1/2). + // Aufwand für die hinteren Einzelteile: // bei beiden Methoden jeweils 3*len1^2. - // Aufwand für das vorderste Teil (alles, falls len1 <= len2 < 2*len1) + // Aufwand für das vorderste Teil (alles, falls len1 <= len2 < 2*len1) // mit r = len1, s = (len2 mod len1) + len1 (>= len1, < 2*len1): // bei Methode 1: // | : | r @@ -24,23 +24,23 @@ // | | : | s // (s-r)*r + r/2*r/2 + r/2*r/2 + r/2*r/2 = r*s - r^2/4 . // Wegen (r*s/2 + s^2/4) - (r*s - r^2/4) = (r-s)^2/4 >= 0 - // ist Methode 2 günstiger. - // Denkfehler! Dies gilt - wenn überhaupt - nur knapp oberhalb des + // ist Methode 2 günstiger. + // Denkfehler! Dies gilt - wenn überhaupt - nur knapp oberhalb des // Break-Even-Points. - // Im allgemeinen ist der Multiplikationsaufwand für zwei Zahlen der - // Längen u bzw. v nämlich gegeben durch min(u,v)^c * max(u,v), + // Im allgemeinen ist der Multiplikationsaufwand für zwei Zahlen der + // Längen u bzw. v nämlich gegeben durch min(u,v)^c * max(u,v), // wobei c = log3/log2 - 1 = 0.585... - // Dadurch wird der Aufwand in Abhängigkeit des Parameters t = k, + // Dadurch wird der Aufwand in Abhängigkeit des Parameters t = k, // r/2 <= t <= s/2 (der einzig sinnvolle Bereich), zu // (r-t)^c*(s-t) + t^c*(s-t) + t^(1+c). // Dessen Optimum liegt (im Bereich r <= s <= 2*r) - // - im klassischen Fall c=1 tatsächlich stets bei t=r/2 [Methode 2], + // - im klassischen Fall c=1 tatsächlich stets bei t=r/2 [Methode 2], // - im Karatsuba-Fall c=0.6 aber offenbar bei t=s/2 [Methode 1] // oder ganz knapp darunter. // Auch erweist sich Methode 1 im Experiment als effizienter. // Daher implementieren wir Methode 1 : { // Es ist 2 <= len1 <= len2. - // Spezialfall Quadrieren abfangen (häufig genug, daß sich das lohnt): + // Spezialfall Quadrieren abfangen (häufig genug, daß sich das lohnt): if (sourceptr1 == sourceptr2) if (len1 == len2) { mulu_karatsuba_square(sourceptr1,len1,destptr); return; } @@ -48,8 +48,8 @@ if (len2 >= 2*len1) { CL_SMALL_ALLOCA_STACK; // Teilprodukte von jeweils len1 mal len1 Digits bilden: - var uintC k_lo = floor(len1,2); // Länge der Low-Teile: floor(len1/2) >0 - var uintC k_hi = len1 - k_lo; // Länge der High-Teile: ceiling(len1/2) >0 + var uintC k_lo = floor(len1,2); // Länge der Low-Teile: floor(len1/2) >0 + var uintC k_hi = len1 - k_lo; // Länge der High-Teile: ceiling(len1/2) >0 // Es gilt k_lo <= k_hi <= len1, k_lo + k_hi = len1. // Summe x1+x0 berechnen: var uintD* sum1_MSDptr; @@ -65,11 +65,11 @@ } if (carry) { lsprefnext(sum1_MSDptr) = 1; sum1_len++; } } - { // Platz für Summe y1+y0 belegen: + { // Platz für Summe y1+y0 belegen: var uintC sum2_maxlen = k_hi+1; var uintD* sum2_LSDptr; num_stack_small_alloc(sum2_maxlen,,sum2_LSDptr=); - // Platz für Produkte x0*y0, x1*y1 belegen: + // Platz für Produkte x0*y0, x1*y1 belegen: { var uintD* prod_MSDptr; var uintD* prod_LSDptr; var uintD* prodhi_LSDptr; @@ -79,11 +79,11 @@ // Produkte x1*y1 in prod_MSDptr/2*k_hi/prodhi_LSDptr // und x0*y0 in prodhi_LSDptr/2*k_lo/prod_LSDptr, // dann das Produkt (b^k*x1+x0)*(b^k*y1+y0) enthalten. - // Platz fürs Produkt (x1+x0)*(y1+y0) belegen: + // Platz fürs Produkt (x1+x0)*(y1+y0) belegen: {var uintD* prodmid_MSDptr; var uintD* prodmid_LSDptr; num_stack_small_alloc(sum1_len+sum2_maxlen,prodmid_MSDptr=,prodmid_LSDptr=); - // Schleife über die hinteren Einzelteile: + // Schleife über die hinteren Einzelteile: do { // Produkt x0*y0 berechnen: cl_UDS_mul(sourceptr1,k_lo,sourceptr2,k_lo,prod_LSDptr); // Produkt x1*y1 berechnen: @@ -118,7 +118,7 @@ if (!(carry==0)) { dec_loop_lsp(prodmid_LSDptr lspop 2*k_lo,prodmid_len-2*k_lo); } } - // prodmid_LSDptr[-prodmid_len..-1] enthält nun x0*y1+x1*y0. + // prodmid_LSDptr[-prodmid_len..-1] enthält nun x0*y1+x1*y0. // Dies wird zu prod = x1*y1*b^(2*k) + x0*y0 addiert: {var uintD carry = addto_loop_lsp(prodmid_LSDptr,prod_LSDptr lspop k_lo,prodmid_len); @@ -151,8 +151,8 @@ var uintC prod_len = len1+len2; var uintD* prod_LSDptr; num_stack_small_alloc(prod_len,prod_MSDptr=,prod_LSDptr=); - { var uintC k_hi = floor(len2,2); // Länge der High-Teile: floor(len2/2) >0 - var uintC k_lo = len2 - k_hi; // Länge der Low-Teile: ceiling(len2/2) >0 + { var uintC k_hi = floor(len2,2); // Länge der High-Teile: floor(len2/2) >0 + var uintC k_lo = len2 - k_hi; // Länge der Low-Teile: ceiling(len2/2) >0 // Es gilt k_hi <= k_lo <= len1 <= len2, k_lo + k_hi = len2. var uintC x1_len = len1-k_lo; // <= len2-k_lo = k_hi <= k_lo // Summe x1+x0 berechnen: @@ -183,14 +183,14 @@ } if (carry) { lsprefnext(sum2_MSDptr) = 1; sum2_len++; } } - // Platz für Produkte x0*y0, x1*y1: + // Platz für Produkte x0*y0, x1*y1: { var uintC prodhi_len = x1_len+k_hi; var uintD* prodhi_LSDptr = prod_LSDptr lspop 2*k_lo; // prod_MSDptr/len1+len2/prod_LSDptr wird zuerst die beiden // Produkte x1*y1 in prod_MSDptr/x1_len+k_hi/prodhi_LSDptr // und x0*y0 in prodhi_LSDptr/2*k_lo/prod_LSDptr, // dann das Produkt (b^k*x1+x0)*(b^k*y1+y0) enthalten. - // Platz fürs Produkt (x1+x0)*(y1+y0) belegen: + // Platz fürs Produkt (x1+x0)*(y1+y0) belegen: {var uintD* prodmid_MSDptr; var uintC prodmid_len = sum1_len+sum2_len; var uintD* prodmid_LSDptr; @@ -220,13 +220,13 @@ // Carry um maximal 1 Digit weitertragen: if (!(carry==0)) { lspref(prodmid_LSDptr,2*k_lo) -= 1; } } - // prodmid_LSDptr[-prodmid_len..-1] enthält nun x0*y1+x1*y0. + // prodmid_LSDptr[-prodmid_len..-1] enthält nun x0*y1+x1*y0. // Dies ist < b^k_lo * b^k_hi + b^x1_len * b^k_lo // = b^len2 + b^len1 <= 2 * b^len2, - // paßt also in len2+1 Digits. + // paßt also in len2+1 Digits. // Im Fall x1_len=0 ist es sogar < b^k_lo * b^k_hi = b^len2, - // es paßt also in len2 Digits. - // prodmid_len, wenn möglich, um maximal 2 verkleinern: + // es paßt also in len2 Digits. + // prodmid_len, wenn möglich, um maximal 2 verkleinern: // (benutzt prodmid_len >= 2*k_lo >= len2 >= 2) if (mspref(prodmid_MSDptr,0)==0) { prodmid_len--; diff --git a/src/base/digitseq/cl_DS_mul_kara_sqr.h b/src/base/digitseq/cl_DS_mul_kara_sqr.h index e91b434..34f00ca 100644 --- a/src/base/digitseq/cl_DS_mul_kara_sqr.h +++ b/src/base/digitseq/cl_DS_mul_kara_sqr.h @@ -1,4 +1,4 @@ - // Eine vereinfachte Version von mulu_karatsuba für den Fall + // Eine vereinfachte Version von mulu_karatsuba für den Fall // sourceptr1 == sourceptr2 && len1 == len2. // Weniger Variablen, eine Additionsschleife weniger, eine Kopierschleife // weniger, und bei rekursiven Aufrufen ist wieder @@ -9,8 +9,8 @@ CL_SMALL_ALLOCA_STACK; var uintC prod_len = 2*len; var uintD* prod_LSDptr = destptr; - var uintC k_hi = floor(len,2); // Länge der High-Teile: floor(len/2) >0 - var uintC k_lo = len - k_hi; // Länge der Low-Teile: ceiling(len/2) >0 + var uintC k_hi = floor(len,2); // Länge der High-Teile: floor(len/2) >0 + var uintC k_lo = len - k_hi; // Länge der Low-Teile: ceiling(len/2) >0 // Es gilt k_hi <= k_lo <= len, k_lo + k_hi = len. // Summe x1+x0 berechnen: var uintD* sum_MSDptr; @@ -26,14 +26,14 @@ } if (carry) { lsprefnext(sum_MSDptr) = 1; sum_len++; } } - // Platz für Produkte x0*x0, x1*x1: + // Platz für Produkte x0*x0, x1*x1: { var uintC prodhi_len = 2*k_hi; var uintD* prodhi_LSDptr = prod_LSDptr lspop 2*k_lo; // prod_MSDptr/2*len/prod_LSDptr wird zuerst die beiden // Produkte x1*x1 in prod_MSDptr/2*k_hi/prodhi_LSDptr // und x0*x0 in prodhi_LSDptr/2*k_lo/prod_LSDptr, // dann das Produkt (b^k*x1+x0)*(b^k*x1+x0) enthalten. - // Platz fürs Produkt (x1+x0)*(x1+x0) belegen: + // Platz fürs Produkt (x1+x0)*(x1+x0) belegen: {var uintD* prodmid_MSDptr; var uintC prodmid_len = 2*sum_len; var uintD* prodmid_LSDptr; @@ -59,10 +59,10 @@ // Carry um maximal 1 Digit weitertragen: if (!(carry==0)) { lspref(prodmid_LSDptr,2*k_lo) -= 1; } } - // prodmid_LSDptr[-prodmid_len..-1] enthält nun 2*x0*x1. + // prodmid_LSDptr[-prodmid_len..-1] enthält nun 2*x0*x1. // Dies ist < 2 * b^k_lo * b^k_hi = 2 * b^len, - // paßt also in len+1 Digits. - // prodmid_len, wenn möglich, um maximal 2 verkleinern: + // paßt also in len+1 Digits. + // prodmid_len, wenn möglich, um maximal 2 verkleinern: // (benutzt prodmid_len >= 2*k_lo >= len >= 2) if (mspref(prodmid_MSDptr,0)==0) { prodmid_len--; diff --git a/src/base/digitseq/cl_DS_mul_nuss.h b/src/base/digitseq/cl_DS_mul_nuss.h index fb475e5..fc9602f 100644 --- a/src/base/digitseq/cl_DS_mul_nuss.h +++ b/src/base/digitseq/cl_DS_mul_nuss.h @@ -1350,8 +1350,8 @@ static void mulu_nussbaumer (const uintD* sourceptr1, uintC len1, // Es ist 2 <= len1 <= len2. { // Methode: - // source1 ist ein Stück der Länge N1, source2 ein oder mehrere Stücke - // der Länge N2, mit N1+N2 <= N, wobei N Zweierpotenz ist. + // source1 ist ein Stück der Länge N1, source2 ein oder mehrere Stücke + // der Länge N2, mit N1+N2 <= N, wobei N Zweierpotenz ist. // sum(i=0..N-1, x_i b^i) * sum(i=0..N-1, y_i b^i) wird errechnet, // indem man die beiden Polynome // sum(i=0..N-1, x_i T^i), sum(i=0..N-1, y_i T^i) @@ -1359,12 +1359,12 @@ static void mulu_nussbaumer (const uintD* sourceptr1, uintC len1, var uint32 n; integerlengthC(len1-1, n=); // 2^(n-1) < len1 <= 2^n var uintC len = (uintC)1 << n; // kleinste Zweierpotenz >= len1 - // Wählt man N = len, so hat man ceiling(len2/(len-len1+1)) * FFT(len). - // Wählt man N = 2*len, so hat man ceiling(len2/(2*len-len1+1)) * FFT(2*len). - // Wir wählen das billigere von beiden: + // Wählt man N = len, so hat man ceiling(len2/(len-len1+1)) * FFT(len). + // Wählt man N = 2*len, so hat man ceiling(len2/(2*len-len1+1)) * FFT(2*len). + // Wir wählen das billigere von beiden: // Bei ceiling(len2/(len-len1+1)) <= 2 * ceiling(len2/(2*len-len1+1)) // nimmt man N = len, bei ....... > ........ dagegen N = 2*len. - // (Wahl von N = 4*len oder mehr bringt nur in Extremfällen etwas.) + // (Wahl von N = 4*len oder mehr bringt nur in Extremfällen etwas.) if (len2 > 2 * (len-len1+1) * (len2 <= (2*len-len1+1) ? 1 : ceiling(len2,(2*len-len1+1)))) { n = n+1; len = len << 1; diff --git a/src/base/digitseq/cl_DS_sqrt.cc b/src/base/digitseq/cl_DS_sqrt.cc index 9b0f99c..e623664 100644 --- a/src/base/digitseq/cl_DS_sqrt.cc +++ b/src/base/digitseq/cl_DS_sqrt.cc @@ -52,36 +52,36 @@ namespace cln { #endif // Bildet zu einer Unsigned Digit sequence a die Wurzel -// (genauer: Gaußklammer aus Wurzel aus a). +// (genauer: Gaußklammer aus Wurzel aus a). // 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 +// < NUDS b: Gaußklammer der Wurzel aus a // < 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). -// Wähle s (0<=s<16) so, daß beta^(2n)/4 <= A*2^(2s) < beta^(2n). +// Wähle n so, daß beta^(2n-2) <= A < beta^(2n). +// Wähle s (0<=s<16) so, daß beta^(2n)/4 <= A*2^(2s) < beta^(2n). // Setze A:=A*2^(2s) und kopiere dabei A. Suche B=floor(sqrt(A)). -// Mache Platz für B=[0,b[n-1],...,b[0]], (mit einem Nulldigit Platz davor, +// Mache Platz für B=[0,b[n-1],...,b[0]], (mit einem Nulldigit Platz davor, // da dort nicht B, sondern 2*B abgespeichert werden wird). -// Auf den Plätzen [a[2n-1],...,a[2n-2j]] wird die Differenz +// Auf den Plätzen [a[2n-1],...,a[2n-2j]] wird die Differenz // [a[2n-1],...,a[2n-2j]] - [b[n-1],...,b[n-j]] ^ 2 abgespeichert. // Bestimme b[n-1] = floor(sqrt(a[2n-1]*beta+a[2n-2])) mit Heron/Newton: // {x:=beta als vorheriger Anfangswert, dann:} // x := floor((beta+a[2n-1])/2) // wiederhole: d:=floor((a[2n-1]*beta+a[2n-2])/x). -// Falls d=beta/4 ist b[n-1]>=beta/2.} // Erniedrige [a[2n-1],a[2n-2]] um b[n-1]^2. -// Für j=1,...,n: +// Für j=1,...,n: // {Hier [b[n-1],...,b[n-j]] = floor(sqrt(altes [a[2n-1],...,a[2n-2j]])), // in [a[2n-1],...,a[2n-2j]] steht jetzt der Rest // [a[2n-1],...,a[2n-2j]] - [b[n-1],...,b[n-j]]^2, er ist >=0 und -// und <= 2 * [b[n-1],...,b[n-j]], belegt daher höchstens j Digits und 1 Bit. +// und <= 2 * [b[n-1],...,b[n-j]], belegt daher höchstens j Digits und 1 Bit. // Daher sind nur [a[2n-j],...,a[2n-2j]] von Belang.} -// Für j= 0). @@ -89,19 +89,19 @@ namespace cln { // b* := min(beta-1,floor([a[2n-j],a[2n-j-1],a[2n-j-2]]/(2*b[n-1]))), // [a[2n-j],...,a[2n-2j-1]] wie angegeben erniedigen. // Solange die Differenz <0 ist, setze b* := b* - 1 und -// erhöhe [a[2n-j],...,a[2n-2j-1]] um 2 * [b[n-1],...,b[n-j]]. +// erhöhe [a[2n-j],...,a[2n-2j-1]] um 2 * [b[n-1],...,b[n-j]]. // Erniedrige [a[2n-j],...,a[2n-2j-2]] um b* ^ 2. // Tritt dabei ein negativer Carry auf, // so setze b* := b* - 1, // setze b[n-j-1] := b* (im Speicher um 1 Bit nach links verschoben), -// erhöhe [a[2n-j],...,a[2n-2j-2]] um 2*[b[n-1],...,b[n-j-1]]+1. +// erhöhe [a[2n-j],...,a[2n-2j-2]] um 2*[b[n-1],...,b[n-j-1]]+1. // Sonst setze b[n-j-1] := b* (im Speicher um 1 Bit nach links verschoben). -// Nächstes j. -// Für j=n: +// Nächstes j. +// Für j=n: // Falls [a[n],...,a[0]] = [0,...,0], ist die Wurzel exakt, sonst nicht. // 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. +// Das Ergebnis ist eine NUDS der Länge n. bool cl_UDS_sqrt (const uintD* a_MSDptr, uintC a_len, const uintD* a_LSDptr, DS* b_) { // A normalisieren: @@ -138,7 +138,7 @@ bool cl_UDS_sqrt (const uintD* a_MSDptr, uintC a_len, const uintD* a_LSDptr, DS* #define a_MSDptr new_a_MSDptr // Nun ist A = a_MSDptr/2n/.. if (cl_recipsqrt_suitable(n)) - { // C := 1/sqrt(A) und dann D := A*C näherungsweise errechnen. + { // C := 1/sqrt(A) und dann D := A*C näherungsweise errechnen. // D evtl. korrigieren, liefert B. var uintD* c_MSDptr; var uintD* c_LSDptr; @@ -199,7 +199,7 @@ bool cl_UDS_sqrt (const uintD* a_MSDptr, uintC a_len, const uintD* a_LSDptr, DS* else return true; // ja -> Wurzel exakt } - // Platz für B belegen: + // Platz für B belegen: { var uintD* b_MSDptr = b_->MSDptr mspop -1; // ab hier n+1 Digits Platz var uintD b_msd; // B = [0,b[n-1],...,b[0]] = b_MSDptr/n+1/.. @@ -214,16 +214,16 @@ bool cl_UDS_sqrt (const uintD* a_MSDptr, uintC a_len, const uintD* a_LSDptr, DS* loop // Heron-Iterationsschleife { var uintD d; // Dividiere d := floor((a[2n-1]*beta+a[2n-2])/x) : - if (a_msd>=x) break; // Überlauf -> d>=beta -> fertig + if (a_msd>=x) break; // Überlauf -> d>=beta -> fertig #if HAVE_DD divuD(a_msdd,x, d=,); #else divuD(a_msd,a_2msd,x, d=,); #endif if (d >= x) break; // d>=x -> fertig - // Nächste Iteration: x := floor((x+d)/2) + // Nächste Iteration: x := floor((x+d)/2) // (Da die Folge der x bekanntlich monoton fallend ist - // und bei b[n-1] >= beta/2 endet, muß x >= beta/2 werden, + // und bei b[n-1] >= beta/2 endet, muß x >= beta/2 werden, // d.h. x+d>=beta.) #if HAVE_DD x = (uintD)(floor((uintDD)x + (uintDD)d, 2)); @@ -267,19 +267,19 @@ bool cl_UDS_sqrt (const uintD* a_MSDptr, uintC a_len, const uintD* a_LSDptr, DS* var uintDD a_123dd = highlowDD(a_2d,a_3d); a_123dd = a_123dd>>1; if (!(a_1d==0)) { a_123dd |= bit(2*intDsize-1); } if (highD(a_123dd) >= b_msd) - { b_stern = bitm(intDsize)-1; } // bei Überlauf: beta-1 + { b_stern = bitm(intDsize)-1; } // bei Überlauf: beta-1 else { divuD(a_123dd,b_msd, b_stern=,); } #else a_3d = a_3d>>1; if (!((a_2d & bit(0)) ==0)) { a_3d |= bit(intDsize-1); } a_2d = a_2d>>1; if (!(a_1d==0)) { a_2d |= bit(intDsize-1); } if (a_2d >= b_msd) - { b_stern = bitm(intDsize)-1; } // bei Überlauf: beta-1 + { b_stern = bitm(intDsize)-1; } // bei Überlauf: beta-1 else { divuD(a_2d,a_3d,b_msd, b_stern=,); } #endif } - // b_stern = b* in der ersten Schätzung. + // b_stern = b* in der ersten Schätzung. a_lptr = a_lptr mspop 1; // Pointer hinter a[2n-2j-1] // Subtraktion [a[2n-j],...,a[2n-2j-1]] -= b* * [b[n],b[n-1],...,b[n-j]] : { var uintD carry = mulusub_loop_lsp(b_stern,b_ptr,a_lptr,j+1); @@ -287,15 +287,15 @@ bool cl_UDS_sqrt (const uintD* a_MSDptr, uintC a_len, const uintD* a_LSDptr, DS* { mspref(a_mptr,0) -= carry; } else { mspref(a_mptr,0) -= carry; // a[2n-j] wird <0 - // negativer Übertrag -> b* nach unten korrigieren: + // negativer Übertrag -> b* nach unten korrigieren: loop { b_stern = b_stern-1; // b* := b* - 1 - // erhöhe [a[2n-j],...,a[2n-2j-1]] um [b[n],...,b[n-j]]: + // erhöhe [a[2n-j],...,a[2n-2j-1]] um [b[n],...,b[n-j]]: if (!(( addto_loop_lsp(b_ptr,a_lptr,j+1) ==0))) - if ((mspref(a_mptr,0) += 1) ==0) // Übertrag zu a[2n-j] + if ((mspref(a_mptr,0) += 1) ==0) // Übertrag zu a[2n-j] break; // macht a[2n-j] wieder >=0 -> Subtraktionsergebnis >=0 } } } - // b_stern = b* in der zweiten Schätzung. + // b_stern = b* in der zweiten Schätzung. a_mptr = a_mptr mspop 1; // Pointer auf a[2n-j-1] a_lptr = a_lptr mspop 1; // Pointer hinter a[2n-2j-2] // Ziehe b* ^ 2 von [a[2n-j],...,a[2n-2j-2]] ab: @@ -323,12 +323,12 @@ bool cl_UDS_sqrt (const uintD* a_MSDptr, uintC a_len, const uintD* a_LSDptr, DS* }} #endif if (TRUE) - { // muß noch [a[2n-j],...,a[2n-2j]] um 1 erniedrigen: + { // muß noch [a[2n-j],...,a[2n-2j]] um 1 erniedrigen: if ( dec_loop_lsp(a_lptr lspop 2,j+1) ==0) goto b_stern_ok; // Subtraktion von b*^2 lieferte negativen Carry b_stern = b_stern-1; // b* := b* - 1 - // erhöhe [a[2n-j-1],...,a[2n-2j-2]] um [b[n],...,b[n-j],0] + 2 * b* + 1 - if ((sintD)b_stern < 0) { mspref(b_ptr,-1) |= bit(0); } // höchstes Bit von b* in b[n-j] ablegen + // erhöhe [a[2n-j-1],...,a[2n-2j-2]] um [b[n],...,b[n-j],0] + 2 * b* + 1 + if ((sintD)b_stern < 0) { mspref(b_ptr,-1) |= bit(0); } // höchstes Bit von b* in b[n-j] ablegen mspref(b_ptr,0) = (uintD)(b_stern<<1)+1; // niedrige Bits von b* und eine 1 als b[n-j-1] ablegen addto_loop_lsp(b_ptr mspop 1,a_lptr,j+2); // (a[2n-j] wird nicht mehr gebraucht.) @@ -338,7 +338,7 @@ bool cl_UDS_sqrt (const uintD* a_MSDptr, uintC a_len, const uintD* a_LSDptr, DS* else b_stern_ok: { // b* als b[n-j-1] ablegen: - if ((sintD)b_stern < 0) { mspref(b_ptr,-1) |= bit(0); } // höchstes Bit von b* in b[n-j] ablegen + if ((sintD)b_stern < 0) { mspref(b_ptr,-1) |= bit(0); } // höchstes Bit von b* in b[n-j] ablegen mspref(b_ptr,0) = (uintD)(b_stern<<1); // niedrige Bits von b* als b[n-j-1] ablegen b_ptr = b_ptr mspop 1; } diff --git a/src/base/digitseq/cl_DS_trandom.cc b/src/base/digitseq/cl_DS_trandom.cc index 5ef781f..043d3be 100644 --- a/src/base/digitseq/cl_DS_trandom.cc +++ b/src/base/digitseq/cl_DS_trandom.cc @@ -17,7 +17,7 @@ namespace cln { void testrandom_UDS (random_state& randomstate, uintD* MSDptr, uintC len) { - // Idea from Torbjörn Granlund, see his "random2.c" file in gmp 2.0. + // Idea from Torbjörn Granlund, see his "random2.c" file in gmp 2.0. var uintD* ptr = MSDptr mspop len; DS_clear_loop(MSDptr,len,ptr); var uintC bit_pos = 0; diff --git a/src/base/digitseq/cl_asm_hppa_.cc b/src/base/digitseq/cl_asm_hppa_.cc index b98dc60..02ec344 100644 --- a/src/base/digitseq/cl_asm_hppa_.cc +++ b/src/base/digitseq/cl_asm_hppa_.cc @@ -1,10 +1,10 @@ // Externe Routinen zu ARILEV1.D // Prozessor: HPPA, wegen XMPYU nur auf HPPA 1.1 (etwa HP9000/720) // Compiler: GNU-C oder HP-C -// Parameter-Übergabe: in Registern %arg0,%arg1,%arg2, Rückgabewert in %ret0. +// Parameter-Übergabe: in Registern %arg0,%arg1,%arg2, Rückgabewert in %ret0. // Einstellungen: intCsize=32, intDsize=32. -// Großenteils abgeschrieben von hppa.s aus der PARI/GP-Distribution. +// Großenteils abgeschrieben von hppa.s aus der PARI/GP-Distribution. .SHORTDATA .IMPORT $global$,DATA diff --git a/src/base/digitseq/cl_asm_i386_.cc b/src/base/digitseq/cl_asm_i386_.cc index 4c8a59b..24e0bb2 100644 --- a/src/base/digitseq/cl_asm_i386_.cc +++ b/src/base/digitseq/cl_asm_i386_.cc @@ -2,9 +2,9 @@ // Prozessor: 80386 im native mode // Assembler-Syntax: GNU oder SUN, Moves von links nach rechts // Compiler: GNU-C oder SUN-C -// Parameter-Übergabe: auf dem Stack 4(%esp),8(%esp),... -// Register: %eax,%edx,%ecx dürfen stets verändert werden, alles andere retten. -// Ergebnis-Übergabe: in %eax +// Parameter-Übergabe: auf dem Stack 4(%esp),8(%esp),... +// Register: %eax,%edx,%ecx dürfen stets verändert werden, alles andere retten. +// Ergebnis-Übergabe: in %eax // Einstellungen: intCsize=32, intDsize=32. // Bruno Haible 14.8.1992 @@ -42,7 +42,7 @@ #define shcl #endif #if defined(__EMX__) - // Direction-Flag ist defaultmäßig gelöscht + // Direction-Flag ist defaultmäßig gelöscht #define dir0start #define dir0end #define dir1start std @@ -174,7 +174,7 @@ C(mulu32_:) #ifndef __GNUC__ /* mit GNU-C machen wir divu_6432_3232() als Macro, der inline dividiert */ // extern struct { uint32 q; uint32 r; } divu_6432_3232_ (uint32 xhi, uint32 xlo, uint32 y); -// x = 2^32*xhi+xlo = q*y+r schreiben. Sei bekannt, daß 0 <= x < 2^32*y . +// x = 2^32*xhi+xlo = q*y+r schreiben. Sei bekannt, daß 0 <= x < 2^32*y . .globl C(divu_6432_3232_) ALIGN DECLARE_FUNCTION(divu_6432_3232_) @@ -198,11 +198,11 @@ C(copy_loop_up:) movl 12(%esp),%ecx // %ecx = count dir0start rep - movsl // %ecx mal aufwärts (%edi) := (%esi) + movsl // %ecx mal aufwärts (%edi) := (%esi) dir0end - movl %eax,%esi // %esi zurück + movl %eax,%esi // %esi zurück movl %edi,%eax // %edi als Ergebnis - movl %edx,%edi // %edi zurück + movl %edx,%edi // %edi zurück ret // extern uintD* copy_loop_down (uintD* sourceptr, uintD* destptr, uintC count); @@ -218,11 +218,11 @@ C(copy_loop_down:) leal -4(%edi),%edi dir1start rep - movsl // %ecx mal abwärts (%edi) := (%esi) + movsl // %ecx mal abwärts (%edi) := (%esi) dir1end - movl %eax,%esi // %esi zurück + movl %eax,%esi // %esi zurück leal 4(%edi),%eax // %edi als Ergebnis - movl %edx,%edi // %edi zurück + movl %edx,%edi // %edi zurück ret // extern uintD* fill_loop_up (uintD* destptr, uintC count, uintD filler); @@ -235,10 +235,10 @@ C(fill_loop_up:) movl 12(%esp),%eax // %eax = filler dir0start rep - stosl // %ecx mal aufwärts (%edi) := %eax + stosl // %ecx mal aufwärts (%edi) := %eax dir0end movl %edi,%eax // %edi als Ergebnis - movl %edx,%edi // %edi zurück + movl %edx,%edi // %edi zurück ret // extern uintD* fill_loop_down (uintD* destptr, uintC count, uintD filler); @@ -252,10 +252,10 @@ C(fill_loop_down:) leal -4(%edi),%edi dir1start rep - stosl // %ecx mal abwärts (%edi) := %eax + stosl // %ecx mal abwärts (%edi) := %eax dir1end leal 4(%edi),%eax // %edi als Ergebnis - movl %edx,%edi // %edi zurück + movl %edx,%edi // %edi zurück ret // extern uintD* clear_loop_up (uintD* destptr, uintC count); @@ -268,10 +268,10 @@ C(clear_loop_up:) xorl %eax,%eax // %eax = 0 dir0start rep - stosl // %ecx mal aufwärts (%edi) := %eax + stosl // %ecx mal aufwärts (%edi) := %eax dir0end movl %edi,%eax // %edi als Ergebnis - movl %edx,%edi // %edi zurück + movl %edx,%edi // %edi zurück ret // extern uintD* clear_loop_down (uintD* destptr, uintC count); @@ -285,10 +285,10 @@ C(clear_loop_down:) xorl %eax,%eax // %eax = 0 dir1start rep - stosl // %ecx mal abwärts (%edi) := %eax + stosl // %ecx mal abwärts (%edi) := %eax dir1end leal 4(%edi),%eax // %edi als Ergebnis - movl %edx,%edi // %edi zurück + movl %edx,%edi // %edi zurück ret // extern boolean test_loop_up (uintD* ptr, uintC count); @@ -301,13 +301,13 @@ C(test_loop_up:) xorl %eax,%eax // %eax = 0 dir0start repz // Falls %ecx > 0: - scasl // %ecx mal aufwärts (%edi) testen + scasl // %ecx mal aufwärts (%edi) testen // und weiterschleifen, falls Z, d.h. (%edi)=0. dir0end // Noch ist %eax = 0. jz L(tlu1) // alles =0 -> Ergebnis 0 incl %eax // Ergebnis 1 -L(tlu1:) movl %edx,%edi // %edi zurück +L(tlu1:) movl %edx,%edi // %edi zurück ret // extern boolean test_loop_down (uintD* ptr, uintC count); @@ -321,13 +321,13 @@ C(test_loop_down:) leal -4(%edi),%edi dir1start repz // Falls %ecx > 0: - scasl // %ecx mal aufwärts (%edi) testen + scasl // %ecx mal aufwärts (%edi) testen // und weiterschleifen, falls Z, d.h. (%edi)=0. dir1end // Noch ist %eax = 0. jz L(tld1) // alles =0 -> Ergebnis 0 incl %eax // Ergebnis 1 -L(tld1:) movl %edx,%edi // %edi zurück +L(tld1:) movl %edx,%edi // %edi zurück ret #if CL_DS_BIG_ENDIAN_P @@ -347,7 +347,7 @@ L(olu1:) movl (%edx,%esi),%eax // *yptr leal 4(%edx),%edx // xptr++, yptr++ decl %ecx jnz L(olu1) -L(olu2:) popl %esi // %esi zurück +L(olu2:) popl %esi // %esi zurück ret #endif @@ -367,7 +367,7 @@ L(xlu1:) movl (%edx,%esi),%eax // *yptr leal 4(%edx),%edx // xptr++, yptr++ decl %ecx jnz L(xlu1) -L(xlu2:) popl %esi // %esi zurück +L(xlu2:) popl %esi // %esi zurück ret #if CL_DS_BIG_ENDIAN_P @@ -387,7 +387,7 @@ L(alu1:) movl (%edx,%esi),%eax // *yptr leal 4(%edx),%edx // xptr++, yptr++ decl %ecx jnz L(alu1) -L(alu2:) popl %esi // %esi zurück +L(alu2:) popl %esi // %esi zurück ret // extern void eqv_loop_up (uintD* xptr, uintD* yptr, uintC count); @@ -407,7 +407,7 @@ L(elu1:) movl (%edx),%eax // *xptr leal 4(%edx),%edx // xptr++, yptr++ decl %ecx jnz L(elu1) -L(elu2:) popl %esi // %esi zurück +L(elu2:) popl %esi // %esi zurück ret // extern void nand_loop_up (uintD* xptr, uintD* yptr, uintC count); @@ -427,7 +427,7 @@ L(nalu1:) movl (%edx),%eax // *xptr leal 4(%edx),%edx // xptr++, yptr++ decl %ecx jnz L(nalu1) -L(nalu2:) popl %esi // %esi zurück +L(nalu2:) popl %esi // %esi zurück ret // extern void nor_loop_up (uintD* xptr, uintD* yptr, uintC count); @@ -447,7 +447,7 @@ L(nolu1:) movl (%edx),%eax // *xptr leal 4(%edx),%edx // xptr++, yptr++ decl %ecx jnz L(nolu1) -L(nolu2:) popl %esi // %esi zurück +L(nolu2:) popl %esi // %esi zurück ret // extern void andc2_loop_up (uintD* xptr, uintD* yptr, uintC count); @@ -466,7 +466,7 @@ L(aclu1:) movl (%edx,%esi),%eax // *yptr leal 4(%edx),%edx // xptr++, yptr++ decl %ecx jnz L(aclu1) -L(aclu2:) popl %esi // %esi zurück +L(aclu2:) popl %esi // %esi zurück ret // extern void orc2_loop_up (uintD* xptr, uintD* yptr, uintC count); @@ -485,7 +485,7 @@ L(oclu1:) movl (%edx,%esi),%eax // *yptr leal 4(%edx),%edx // xptr++, yptr++ decl %ecx jnz L(oclu1) -L(oclu2:) popl %esi // %esi zurück +L(oclu2:) popl %esi // %esi zurück ret // extern void not_loop_up (uintD* xptr, uintC count); @@ -519,10 +519,10 @@ L(atlu1:) movl (%edx,%esi),%eax // *yptr decl %ecx jnz L(atlu1) L(atlu2:) xorl %eax,%eax // Ergebnis 0 - popl %esi // %esi zurück + popl %esi // %esi zurück ret L(atlu3:) movl $1,%eax // Ergebnis 1 (nicht irgendwas /=0 !) - popl %esi // %esi zurück + popl %esi // %esi zurück ret #endif @@ -538,15 +538,15 @@ C(compare_loop_up:) movl 12(%esp),%ecx // %ecx = count dir0start repz // Falls %ecx > 0: - cmpsl // %ecx mal aufwärts (%edi) und (%esi) vergleichen + cmpsl // %ecx mal aufwärts (%edi) und (%esi) vergleichen // und weiterschleifen, falls Z, d.h. (%edi)=(%esi). dir0end // Flags -> Ergebnis: - // Z,NC -> bis zum Schluß (%esi)-(%edi) = 0 -> x=y -> Ergebnis 0 - // NZ,C -> schließlich (%esi)-(%edi) < 0 -> x Ergebnis -1 - // NZ,NC -> schließlich (%esi)-(%edi) > 0 -> x>y -> Ergebnis +1 - movl %eax,%edi // %edi zurück - movl %edx,%esi // %esi zurück + // Z,NC -> bis zum Schluß (%esi)-(%edi) = 0 -> x=y -> Ergebnis 0 + // NZ,C -> schließlich (%esi)-(%edi) < 0 -> x Ergebnis -1 + // NZ,NC -> schließlich (%esi)-(%edi) > 0 -> x>y -> Ergebnis +1 + movl %eax,%edi // %edi zurück + movl %edx,%esi // %esi zurück jbe L(cmlu1) // "be" = Z oder C movl $1,%eax // Ergebnis +1 ret @@ -567,7 +567,7 @@ C(add_loop_down:) movl 24(%esp),%ecx // %ecx = count subl %edi,%edx subl %edi,%esi - orl %ecx,%ecx // %ecx = 0 ?, Carry löschen + orl %ecx,%ecx // %ecx = 0 ?, Carry löschen jz L(ald2) L(ald1:) leal -4(%edi),%edi // sourceptr1--, sourceptr2--, destptr-- movl (%edx,%edi),%eax // *sourceptr1 @@ -576,8 +576,8 @@ L(ald1:) leal -4(%edi),%edi // sourceptr1--, sourceptr2--, destptr-- decl %ecx jnz L(ald1) L(ald2:) sbbl %eax,%eax // Ergebnis := - Carry - popl %edi // %edi zurück - popl %esi // %esi zurück + popl %edi // %edi zurück + popl %esi // %esi zurück ret // extern uintD addto_loop_down (uintD* sourceptr, uintD* destptr, uintC count); @@ -589,7 +589,7 @@ C(addto_loop_down:) movl 12(%esp),%edi // %edi = destptr movl 16(%esp),%ecx // %ecx = count subl %edi,%edx - orl %ecx,%ecx // %ecx = 0 ?, Carry löschen + orl %ecx,%ecx // %ecx = 0 ?, Carry löschen jz L(atld2) L(atld1:) leal -4(%edi),%edi // sourceptr--, destptr-- movl (%edx,%edi),%eax // *sourceptr @@ -597,7 +597,7 @@ L(atld1:) leal -4(%edi),%edi // sourceptr--, destptr-- decl %ecx jnz L(atld1) L(atld2:) sbbl %eax,%eax // Ergebnis := - Carry - popl %edi // %edi zurück + popl %edi // %edi zurück ret // extern uintD inc_loop_down (uintD* ptr, uintC count); @@ -629,7 +629,7 @@ C(sub_loop_down:) movl 24(%esp),%ecx // %ecx = count subl %edi,%edx subl %edi,%esi - orl %ecx,%ecx // %ecx = 0 ?, Carry löschen + orl %ecx,%ecx // %ecx = 0 ?, Carry löschen jz L(sld2) L(sld1:) leal -4(%edi),%edi // sourceptr1--, sourceptr2--, destptr-- movl (%edx,%edi),%eax // *sourceptr1 @@ -638,8 +638,8 @@ L(sld1:) leal -4(%edi),%edi // sourceptr1--, sourceptr2--, destptr-- decl %ecx jnz L(sld1) L(sld2:) sbbl %eax,%eax // Ergebnis := - Carry - popl %edi // %edi zurück - popl %esi // %esi zurück + popl %edi // %edi zurück + popl %esi // %esi zurück ret // extern uintD subx_loop_down (uintD* sourceptr1, uintD* sourceptr2, uintD* destptr, uintC count, uintD carry); @@ -665,12 +665,12 @@ L(sxld1:) leal -4(%edi),%edi // sourceptr1--, sourceptr2--, destptr-- decl %ecx jnz L(sxld1) sbbl %eax,%eax // Ergebnis := - Carry - popl %edi // %edi zurück - popl %esi // %esi zurück + popl %edi // %edi zurück + popl %esi // %esi zurück ret L(sxld2:) movl 28(%esp),%eax // Ergebnis := carry - popl %edi // %edi zurück - popl %esi // %esi zurück + popl %edi // %edi zurück + popl %esi // %esi zurück ret // extern uintD subfrom_loop_down (uintD* sourceptr, uintD* destptr, uintC count); @@ -682,7 +682,7 @@ C(subfrom_loop_down:) movl 12(%esp),%edi // %edi = destptr movl 16(%esp),%ecx // %ecx = count subl %edi,%edx - orl %ecx,%ecx // %ecx = 0 ?, Carry löschen + orl %ecx,%ecx // %ecx = 0 ?, Carry löschen jz L(sfld2) L(sfld1:) leal -4(%edi),%edi // sourceptr--, destptr-- movl (%edx,%edi),%eax // *sourceptr @@ -690,7 +690,7 @@ L(sfld1:) leal -4(%edi),%edi // sourceptr--, destptr-- decl %ecx jnz L(sfld1) L(sfld2:) sbbl %eax,%eax // Ergebnis := - Carry - popl %edi // %edi zurück + popl %edi // %edi zurück ret // extern uintD dec_loop_down (uintD* ptr, uintC count); @@ -743,7 +743,7 @@ L(nld5:) movl $-1,%eax // Ergebnis := -1 C(shift1left_loop_down:) movl 4(%esp),%edx // %edx = ptr movl 8(%esp),%ecx // %ecx = count - orl %ecx,%ecx // %ecx = 0 ?, Carry löschen + orl %ecx,%ecx // %ecx = 0 ?, Carry löschen jz L(s1lld2) nop ; nop ; nop ; nop L(s1lld1:) leal -4(%edx),%edx // ptr-- @@ -791,13 +791,13 @@ L(slld1:) // weiteres Digit shiften: jnz L(slld1) L(slld2:) movl %eax,%ebx L(slld3:) xorl %eax,%eax // %eax := 0 - shldl shcl %ebx,%eax // %eax := höchste %cl=i Bits von %ebx - popl %ebx // %ebx zurück - popl %edi // %edi zurück + shldl shcl %ebx,%eax // %eax := höchste %cl=i Bits von %ebx + popl %ebx // %ebx zurück + popl %edi // %edi zurück ret L(slld4:) movl 24(%esp),%eax // %eax := carry - popl %ebx // %ebx zurück - popl %edi // %edi zurück + popl %ebx // %ebx zurück + popl %edi // %edi zurück ret // extern uintD shiftleftcopy_loop_down (uintD* sourceptr, uintD* destptr, uintC count, uintC i); @@ -826,7 +826,7 @@ C(shiftleftcopy_loop_down:) jz L(slcld2) L(slcld1:) // weiteres Digit shiften: leal -4(%edi),%edi // sourceptr--, destptr-- - movl (%edi,%esi),%eax // nächstes Digit nach %eax + movl (%edi,%esi),%eax // nächstes Digit nach %eax shrdl shcl %eax,%ebx // %ebx um %cl=32-i Bits rechts shiften, %eax von links reinshiften movl %ebx,(%edi) // %ebx als *destptr ablegen // Letztes Digit in %eax. @@ -834,7 +834,7 @@ L(slcld1:) // weiteres Digit shiften: jz L(slcld3) // weiteres Digit shiften: leal -4(%edi),%edi // sourceptr--, destptr-- - movl (%edi,%esi),%ebx // nächstes Digit nach %ebx + movl (%edi,%esi),%ebx // nächstes Digit nach %ebx shrdl shcl %ebx,%eax // %eax um %cl=32-i Bits rechts shiften, %ebx von links reinshiften movl %eax,(%edi) // %eax als *destptr ablegen // Letztes Digit in %ebx. @@ -842,14 +842,14 @@ L(slcld1:) // weiteres Digit shiften: jnz L(slcld1) L(slcld2:) movl %ebx,%eax L(slcld3:) shrl %cl,%eax // %eax um 32-i Bits nach rechts shiften - popl %ebx // %ebx zurück - popl %edi // %edi zurück - popl %esi // %esi zurück + popl %ebx // %ebx zurück + popl %edi // %edi zurück + popl %esi // %esi zurück ret L(slcld4:) xorl %eax,%eax // %eax := 0 - popl %ebx // %ebx zurück - popl %edi // %edi zurück - popl %esi // %esi zurück + popl %ebx // %ebx zurück + popl %edi // %edi zurück + popl %esi // %esi zurück ret // extern uintD shift1right_loop_up (uintD* ptr, uintC count, uintD carry); @@ -905,12 +905,12 @@ L(srlu1:) // weiteres Digit shiften: L(srlu2:) movl %eax,%ebx L(srlu3:) xorl %eax,%eax // %eax := 0 shrdl shcl %ebx,%eax // %eax := niedrigste %cl=i Bits von %ebx, als Bits 31..32-i - popl %ebx // %ebx zurück - popl %edi // %edi zurück + popl %ebx // %ebx zurück + popl %edi // %edi zurück ret L(srlu4:) xorl %eax,%eax // %eax := 0 - popl %ebx // %ebx zurück - popl %edi // %edi zurück + popl %ebx // %ebx zurück + popl %edi // %edi zurück ret // extern uintD shiftrightsigned_loop_up (uintD* ptr, uintC count, uintC i); @@ -947,8 +947,8 @@ L(srslu1:) // weiteres Digit shiften: L(srslu2:) movl %eax,%ebx L(srslu3:) xorl %eax,%eax // %eax := 0 shrdl shcl %ebx,%eax // %eax := niedrigste %cl=i Bits von %ebx, als Bits 31..32-i - popl %ebx // %ebx zurück - popl %edi // %edi zurück + popl %ebx // %ebx zurück + popl %edi // %edi zurück ret // extern uintD shiftrightcopy_loop_up (uintD* sourceptr, uintD* destptr, uintC count, uintC i, uintD carry); @@ -976,7 +976,7 @@ C(shiftrightcopy_loop_up:) jz L(srcld2) L(srcld1:) // weiteres Digit shiften: leal 4(%edi),%edi // sourceptr++, destptr++ - movl (%edi,%esi),%eax // nächstes Digit nach %eax + movl (%edi,%esi),%eax // nächstes Digit nach %eax shldl shcl %eax,%ebx // %ebx um %cl=32-i Bits links shiften, %eax von rechts reinshiften movl %ebx,(%edi) // %ebx als *destptr ablegen // Letztes Digit in %eax. @@ -984,7 +984,7 @@ L(srcld1:) // weiteres Digit shiften: jz L(srcld3) // weiteres Digit shiften: leal 4(%edi),%edi // sourceptr++, destptr++ - movl (%edi,%esi),%ebx // nächstes Digit nach %ebx + movl (%edi,%esi),%ebx // nächstes Digit nach %ebx shldl shcl %ebx,%eax // %eax um %cl=32-i Bits links shiften, %ebx von rechts reinshiften movl %eax,(%edi) // %eax als *destptr ablegen // Letztes Digit in %ebx. @@ -992,9 +992,9 @@ L(srcld1:) // weiteres Digit shiften: jnz L(srcld1) L(srcld2:) movl %ebx,%eax L(srcld3:) shll %cl,%eax // %eax um 32-i Bits nach links shiften - popl %ebx // %ebx zurück - popl %edi // %edi zurück - popl %esi // %esi zurück + popl %ebx // %ebx zurück + popl %edi // %edi zurück + popl %esi // %esi zurück ret // extern uintD mulusmall_loop_down (uintD digit, uintD* ptr, uintC len, uintD newdigit); @@ -1017,14 +1017,14 @@ L(msld1:) movl (%edi,%ecx,4),%eax // *ptr mull %ebx // %edx|%eax := digit * *ptr addl %ebp,%eax // carry und Low-Teil des Produktes addieren movl $0,%ebp - adcl %edx,%ebp // Übertrag zum High-Teil %edx dazu, gibt neuen carry + adcl %edx,%ebp // Übertrag zum High-Teil %edx dazu, gibt neuen carry movl %eax,(%edi,%ecx,4) // Low-Teil als *ptr ablegen decl %ecx // count--, ptr-- jnz L(msld1) -L(msld2:) movl %ebp,%eax // Ergebnis := letzter Übertrag - popl %ebx // %ebx zurück - popl %edi // %edi zurück - popl %ebp // %ebp zurück +L(msld2:) movl %ebp,%eax // Ergebnis := letzter Übertrag + popl %ebx // %ebx zurück + popl %edi // %edi zurück + popl %ebp // %ebp zurück ret // extern void mulu_loop_down (uintD digit, uintD* sourceptr, uintD* destptr, uintC len); @@ -1048,15 +1048,15 @@ L(muld1:) movl (%esi,%ecx,4),%eax // *sourceptr mull %ebx // %edx|%eax := digit * *sourceptr addl %ebp,%eax // carry und Low-Teil des Produktes addieren movl $0,%ebp - adcl %edx,%ebp // Übertrag zum High-Teil %edx dazu, gibt neuen carry + adcl %edx,%ebp // Übertrag zum High-Teil %edx dazu, gibt neuen carry movl %eax,(%edi,%ecx,4) // Low-Teil als *destptr ablegen decl %ecx // count--, sourceptr--, destptr-- jnz L(muld1) - movl %ebp,(%edi) // letzten Übertrag ablegen - popl %ebx // %ebx zurück - popl %esi // %esi zurück - popl %edi // %edi zurück - popl %ebp // %ebp zurück + movl %ebp,(%edi) // letzten Übertrag ablegen + popl %ebx // %ebx zurück + popl %esi // %esi zurück + popl %edi // %edi zurück + popl %ebp // %ebp zurück ret // extern uintD muluadd_loop_down (uintD digit, uintD* sourceptr, uintD* destptr, uintC len); @@ -1080,16 +1080,16 @@ L(muald1:) movl (%esi,%ecx,4),%eax // *sourceptr mull %ebx // %edx|%eax := digit * *sourceptr addl %ebp,%eax // carry und Low-Teil des Produktes addieren movl $0,%ebp - adcl %ebp,%edx // Übertrag zum High-Teil %edx dazu + adcl %ebp,%edx // Übertrag zum High-Teil %edx dazu addl %eax,(%edi,%ecx,4) // Low-Teil zu *destptr addieren - adcl %edx,%ebp // zweiten Übertrag zu %edx addieren, gibt neuen carry + adcl %edx,%ebp // zweiten Übertrag zu %edx addieren, gibt neuen carry decl %ecx // count--, sourceptr--, destptr-- jnz L(muald1) - movl %ebp,%eax // Ergebnis := letzter Übertrag - popl %ebx // %ebx zurück - popl %esi // %esi zurück - popl %edi // %edi zurück - popl %ebp // %ebp zurück + movl %ebp,%eax // Ergebnis := letzter Übertrag + popl %ebx // %ebx zurück + popl %esi // %esi zurück + popl %edi // %edi zurück + popl %ebp // %ebp zurück ret // extern uintD mulusub_loop_down (uintD digit, uintD* sourceptr, uintD* destptr, uintC len); @@ -1113,16 +1113,16 @@ L(musld1:) movl (%esi,%ecx,4),%eax // *sourceptr mull %ebx // %edx|%eax := digit * *sourceptr addl %ebp,%eax // carry und Low-Teil des Produktes addieren movl $0,%ebp - adcl %ebp,%edx // Übertrag zum High-Teil %edx dazu + adcl %ebp,%edx // Übertrag zum High-Teil %edx dazu subl %eax,(%edi,%ecx,4) // Low-Teil von *destptr subtrahieren - adcl %edx,%ebp // zweiten Übertrag zu %edx addieren, gibt neuen carry + adcl %edx,%ebp // zweiten Übertrag zu %edx addieren, gibt neuen carry decl %ecx // count--, sourceptr--, destptr-- jnz L(musld1) - movl %ebp,%eax // Ergebnis := letzter Übertrag - popl %ebx // %ebx zurück - popl %esi // %esi zurück - popl %edi // %edi zurück - popl %ebp // %ebp zurück + movl %ebp,%eax // Ergebnis := letzter Übertrag + popl %ebx // %ebx zurück + popl %esi // %esi zurück + popl %edi // %edi zurück + popl %ebp // %ebp zurück ret // extern uintD divu_loop_up (uintD digit, uintD* ptr, uintC len); @@ -1136,15 +1136,15 @@ C(divu_loop_up:) movl 20(%esp),%ecx // %ecx = len xorl %edx,%edx // %edx = Rest := 0 jecxz L(dlu2) // %ecx = 0 ? -L(dlu1:) movl (%edi),%eax // nächstes Digit *ptr +L(dlu1:) movl (%edi),%eax // nächstes Digit *ptr divl %ebx // Division von %edx|%eax durch %ebx movl %eax,(%edi) // Quotient %eax ablegen, Rest in %edx behalten leal 4(%edi),%edi // ptr++ decl %ecx jnz L(dlu1) L(dlu2:) movl %edx,%eax // Ergebnis := letzter Rest - popl %ebx // %ebx zurück - popl %edi // %edi zurück + popl %ebx // %ebx zurück + popl %edi // %edi zurück ret // extern uintD divucopy_loop_up (uintD digit, uintD* sourceptr, uintD* destptr, uintC len); @@ -1161,16 +1161,16 @@ C(divucopy_loop_up:) xorl %edx,%edx // %edx = Rest := 0 jecxz L(dclu2) // %ecx = 0 ? subl %edi,%esi -L(dclu1:) movl (%esi,%edi),%eax // nächstes Digit *ptr +L(dclu1:) movl (%esi,%edi),%eax // nächstes Digit *ptr divl %ebx // Division von %edx|%eax durch %ebx movl %eax,(%edi) // Quotient %eax ablegen, Rest in %edx behalten leal 4(%edi),%edi // sourceptr++, destptr++ decl %ecx jnz L(dclu1) L(dclu2:) movl %edx,%eax // Ergebnis := letzter Rest - popl %ebx // %ebx zurück - popl %esi // %esi zurück - popl %edi // %edi zurück + popl %ebx // %ebx zurück + popl %esi // %esi zurück + popl %edi // %edi zurück ret #endif @@ -1192,7 +1192,7 @@ L(old1:) leal -4(%edx),%edx // xptr--, yptr-- orl %eax,(%edx) // *xptr |= ... decl %ecx jnz L(old1) -L(old2:) popl %esi // %esi zurück +L(old2:) popl %esi // %esi zurück ret // extern void xor_loop_down (uintD* xptr, uintD* yptr, uintC count); @@ -1210,7 +1210,7 @@ L(xld1:) leal -4(%edx),%edx // xptr--, yptr-- xorl %eax,(%edx) // *xptr ^= ... decl %ecx jnz L(xld1) -L(xld2:) popl %esi // %esi zurück +L(xld2:) popl %esi // %esi zurück ret // extern void and_loop_down (uintD* xptr, uintD* yptr, uintC count); @@ -1228,7 +1228,7 @@ L(ald1:) leal -4(%edx),%edx // xptr--, yptr-- andl %eax,(%edx) // *xptr &= ... decl %ecx jnz L(ald1) -L(ald2:) popl %esi // %esi zurück +L(ald2:) popl %esi // %esi zurück ret // extern void eqv_loop_down (uintD* xptr, uintD* yptr, uintC count); @@ -1248,7 +1248,7 @@ L(eld1:) leal -4(%edx),%edx // xptr--, yptr-- movl %eax,(%edx) // =: *xptr decl %ecx jnz L(eld1) -L(eld2:) popl %esi // %esi zurück +L(eld2:) popl %esi // %esi zurück ret // extern void nand_loop_down (uintD* xptr, uintD* yptr, uintC count); @@ -1268,7 +1268,7 @@ L(nald1:) leal -4(%edx),%edx // xptr--, yptr-- movl %eax,(%edx) // =: *xptr decl %ecx jnz L(nald1) -L(nald2:) popl %esi // %esi zurück +L(nald2:) popl %esi // %esi zurück ret // extern void nor_loop_down (uintD* xptr, uintD* yptr, uintC count); @@ -1288,7 +1288,7 @@ L(nold1:) leal -4(%edx),%edx // xptr--, yptr-- movl %eax,(%edx) // =: *xptr decl %ecx jnz L(nold1) -L(nold2:) popl %esi // %esi zurück +L(nold2:) popl %esi // %esi zurück ret // extern void andc2_loop_down (uintD* xptr, uintD* yptr, uintC count); @@ -1307,7 +1307,7 @@ L(acld1:) leal -4(%edx),%edx // xptr--, yptr-- andl %eax,(%edx) // *xptr &= ... decl %ecx jnz L(acld1) -L(acld2:) popl %esi // %esi zurück +L(acld2:) popl %esi // %esi zurück ret // extern void orc2_loop_down (uintD* xptr, uintD* yptr, uintC count); @@ -1326,7 +1326,7 @@ L(ocld1:) leal -4(%edx),%edx // xptr--, yptr-- orl %eax,(%edx) // *xptr |= ... decl %ecx jnz L(ocld1) -L(ocld2:) popl %esi // %esi zurück +L(ocld2:) popl %esi // %esi zurück ret // extern void not_loop_down (uintD* xptr, uintC count); @@ -1360,10 +1360,10 @@ L(atld1:) leal -4(%edx),%edx // xptr--, yptr-- decl %ecx jnz L(atld1) L(atld2:) xorl %eax,%eax // Ergebnis 0 - popl %esi // %esi zurück + popl %esi // %esi zurück ret L(atld3:) movl $1,%eax // Ergebnis 1 (nicht irgendwas /=0 !) - popl %esi // %esi zurück + popl %esi // %esi zurück ret // extern cl_signean compare_loop_down (uintD* xptr, uintD* yptr, uintC count); @@ -1379,15 +1379,15 @@ C(compare_loop_down:) leal -4(%edi),%edi dir1start repz // Falls %ecx > 0: - cmpsl // %ecx mal aufwärts (%edi) und (%esi) vergleichen + cmpsl // %ecx mal aufwärts (%edi) und (%esi) vergleichen // und weiterschleifen, falls Z, d.h. (%edi)=(%esi). dir1end // Flags -> Ergebnis: - // Z,NC -> bis zum Schluß (%esi)-(%edi) = 0 -> x=y -> Ergebnis 0 - // NZ,C -> schließlich (%esi)-(%edi) < 0 -> x Ergebnis -1 - // NZ,NC -> schließlich (%esi)-(%edi) > 0 -> x>y -> Ergebnis +1 - movl %eax,%edi // %edi zurück - movl %edx,%esi // %esi zurück + // Z,NC -> bis zum Schluß (%esi)-(%edi) = 0 -> x=y -> Ergebnis 0 + // NZ,C -> schließlich (%esi)-(%edi) < 0 -> x Ergebnis -1 + // NZ,NC -> schließlich (%esi)-(%edi) > 0 -> x>y -> Ergebnis +1 + movl %eax,%edi // %edi zurück + movl %edx,%esi // %esi zurück jbe L(cmld1) // "be" = Z oder C movl $1,%eax // Ergebnis +1 ret @@ -1406,7 +1406,7 @@ C(add_loop_up:) movl 24(%esp),%ecx // %ecx = count subl %edi,%edx subl %edi,%esi - orl %ecx,%ecx // %ecx = 0 ?, Carry löschen + orl %ecx,%ecx // %ecx = 0 ?, Carry löschen jz L(alu2) L(alu1:) movl (%edx,%edi),%eax // *sourceptr1 adcl (%esi,%edi),%eax // + *sourceptr2 + carry @@ -1415,8 +1415,8 @@ L(alu1:) movl (%edx,%edi),%eax // *sourceptr1 decl %ecx jnz L(alu1) L(alu2:) sbbl %eax,%eax // Ergebnis := - Carry - popl %edi // %edi zurück - popl %esi // %esi zurück + popl %edi // %edi zurück + popl %esi // %esi zurück ret // extern uintD addto_loop_up (uintD* sourceptr, uintD* destptr, uintC count); @@ -1428,7 +1428,7 @@ C(addto_loop_up:) movl 12(%esp),%edi // %edi = destptr movl 16(%esp),%ecx // %ecx = count subl %edi,%edx - orl %ecx,%ecx // %ecx = 0 ?, Carry löschen + orl %ecx,%ecx // %ecx = 0 ?, Carry löschen jz L(atlu2) L(atlu1:) movl (%edx,%edi),%eax // *sourceptr adcl %eax,(%edi) // + *destptr + carry =: *destptr, neuer Carry @@ -1436,7 +1436,7 @@ L(atlu1:) movl (%edx,%edi),%eax // *sourceptr decl %ecx jnz L(atlu1) L(atlu2:) sbbl %eax,%eax // Ergebnis := - Carry - popl %edi // %edi zurück + popl %edi // %edi zurück ret // extern uintD inc_loop_up (uintD* ptr, uintC count); @@ -1468,7 +1468,7 @@ C(sub_loop_up:) movl 24(%esp),%ecx // %ecx = count subl %edi,%edx subl %edi,%esi - orl %ecx,%ecx // %ecx = 0 ?, Carry löschen + orl %ecx,%ecx // %ecx = 0 ?, Carry löschen jz L(slu2) L(slu1:) movl (%edx,%edi),%eax // *sourceptr1 sbbl (%esi,%edi),%eax // - *sourceptr2 - carry @@ -1477,8 +1477,8 @@ L(slu1:) movl (%edx,%edi),%eax // *sourceptr1 decl %ecx jnz L(slu1) L(slu2:) sbbl %eax,%eax // Ergebnis := - Carry - popl %edi // %edi zurück - popl %esi // %esi zurück + popl %edi // %edi zurück + popl %esi // %esi zurück ret // extern uintD subx_loop_up (uintD* sourceptr1, uintD* sourceptr2, uintD* destptr, uintC count, uintD carry); @@ -1504,12 +1504,12 @@ L(sxlu1:) movl (%edx,%edi),%eax // *sourceptr1 decl %ecx jnz L(sxlu1) sbbl %eax,%eax // Ergebnis := - Carry - popl %edi // %edi zurück - popl %esi // %esi zurück + popl %edi // %edi zurück + popl %esi // %esi zurück ret L(sxlu2:) movl 28(%esp),%eax // Ergebnis := carry - popl %edi // %edi zurück - popl %esi // %esi zurück + popl %edi // %edi zurück + popl %esi // %esi zurück ret // extern uintD subfrom_loop_up (uintD* sourceptr, uintD* destptr, uintC count); @@ -1521,7 +1521,7 @@ C(subfrom_loop_up:) movl 12(%esp),%edi // %edi = destptr movl 16(%esp),%ecx // %ecx = count subl %edi,%edx - orl %ecx,%ecx // %ecx = 0 ?, Carry löschen + orl %ecx,%ecx // %ecx = 0 ?, Carry löschen jz L(sflu2) L(sflu1:) movl (%edx,%edi),%eax // *sourceptr sbbl %eax,(%edi) // *destptr - *sourceptr - carry =: *destptr, neuer Carry @@ -1529,7 +1529,7 @@ L(sflu1:) movl (%edx,%edi),%eax // *sourceptr decl %ecx jnz L(sflu1) L(sflu2:) sbbl %eax,%eax // Ergebnis := - Carry - popl %edi // %edi zurück + popl %edi // %edi zurück ret // extern uintD dec_loop_up (uintD* ptr, uintC count); @@ -1582,7 +1582,7 @@ L(nlu5:) movl $-1,%eax // Ergebnis := -1 C(shift1left_loop_up:) movl 4(%esp),%edx // %edx = ptr movl 8(%esp),%ecx // %ecx = count - orl %ecx,%ecx // %ecx = 0 ?, Carry löschen + orl %ecx,%ecx // %ecx = 0 ?, Carry löschen jz L(s1llu2) nop ; nop ; nop ; nop L(s1llu1:) rcll $1,(%edx) // *ptr und Carry um 1 Bit links rotieren @@ -1630,13 +1630,13 @@ L(sllu1:) // weiteres Digit shiften: jnz L(sllu1) L(sllu2:) movl %eax,%ebx L(sllu3:) xorl %eax,%eax // %eax := 0 - shldl shcl %ebx,%eax // %eax := höchste %cl=i Bits von %ebx - popl %ebx // %ebx zurück - popl %edi // %edi zurück + shldl shcl %ebx,%eax // %eax := höchste %cl=i Bits von %ebx + popl %ebx // %ebx zurück + popl %edi // %edi zurück ret L(sllu4:) movl 24(%esp),%eax // %eax := carry - popl %ebx // %ebx zurück - popl %edi // %edi zurück + popl %ebx // %ebx zurück + popl %edi // %edi zurück ret #endif @@ -1666,7 +1666,7 @@ C(shiftleftcopy_loop_up:) decl %edx jz L(slclu2) L(slclu1:) // weiteres Digit shiften: - movl (%edi,%esi),%eax // nächstes Digit nach %eax + movl (%edi,%esi),%eax // nächstes Digit nach %eax shrdl shcl %eax,%ebx // %ebx um %cl=32-i Bits rechts shiften, %eax von links reinshiften movl %ebx,(%edi) // %ebx als *destptr ablegen leal 4(%edi),%edi // sourceptr++, destptr++ @@ -1674,7 +1674,7 @@ L(slclu1:) // weiteres Digit shiften: decl %edx jz L(slclu3) // weiteres Digit shiften: - movl (%edi,%esi),%ebx // nächstes Digit nach %ebx + movl (%edi,%esi),%ebx // nächstes Digit nach %ebx shrdl shcl %ebx,%eax // %eax um %cl=32-i Bits rechts shiften, %ebx von links reinshiften movl %eax,(%edi) // %eax als *destptr ablegen leal 4(%edi),%edi // sourceptr++, destptr++ @@ -1683,14 +1683,14 @@ L(slclu1:) // weiteres Digit shiften: jnz L(slclu1) L(slclu2:) movl %ebx,%eax L(slclu3:) shrl %cl,%eax // %eax um 32-i Bits nach rechts shiften - popl %ebx // %ebx zurück - popl %edi // %edi zurück - popl %esi // %esi zurück + popl %ebx // %ebx zurück + popl %edi // %edi zurück + popl %esi // %esi zurück ret L(slclu4:) xorl %eax,%eax // %eax := 0 - popl %ebx // %ebx zurück - popl %edi // %edi zurück - popl %esi // %esi zurück + popl %ebx // %ebx zurück + popl %edi // %edi zurück + popl %esi // %esi zurück ret #if !CL_DS_BIG_ENDIAN_P @@ -1748,12 +1748,12 @@ L(srld1:) // weiteres Digit shiften: L(srld2:) movl %eax,%ebx L(srld3:) xorl %eax,%eax // %eax := 0 shrdl shcl %ebx,%eax // %eax := niedrigste %cl=i Bits von %ebx, als Bits 31..32-i - popl %ebx // %ebx zurück - popl %edi // %edi zurück + popl %ebx // %ebx zurück + popl %edi // %edi zurück ret L(srld4:) xorl %eax,%eax // %eax := 0 - popl %ebx // %ebx zurück - popl %edi // %edi zurück + popl %ebx // %ebx zurück + popl %edi // %edi zurück ret // extern uintD shiftrightsigned_loop_down (uintD* ptr, uintC count, uintC i); @@ -1792,8 +1792,8 @@ L(srsld1:) // weiteres Digit shiften: L(srsld2:) movl %eax,%ebx L(srsld3:) xorl %eax,%eax // %eax := 0 shrdl shcl %ebx,%eax // %eax := niedrigste %cl=i Bits von %ebx, als Bits 31..32-i - popl %ebx // %ebx zurück - popl %edi // %edi zurück + popl %ebx // %ebx zurück + popl %edi // %edi zurück ret // extern uintD shiftrightcopy_loop_down (uintD* sourceptr, uintD* destptr, uintC count, uintC i, uintD carry); @@ -1823,7 +1823,7 @@ C(shiftrightcopy_loop_down:) nop ; nop ; nop L(srclu1:) // weiteres Digit shiften: leal -4(%edi),%edi // sourceptr--, destptr-- - movl (%edi,%esi),%eax // nächstes Digit nach %eax + movl (%edi,%esi),%eax // nächstes Digit nach %eax shldl shcl %eax,%ebx // %ebx um %cl=32-i Bits links shiften, %eax von rechts reinshiften movl %ebx,(%edi) // %ebx als *destptr ablegen // Letztes Digit in %eax. @@ -1831,7 +1831,7 @@ L(srclu1:) // weiteres Digit shiften: jz L(srclu3) // weiteres Digit shiften: leal -4(%edi),%edi // sourceptr--, destptr-- - movl (%edi,%esi),%ebx // nächstes Digit nach %ebx + movl (%edi,%esi),%ebx // nächstes Digit nach %ebx shldl shcl %ebx,%eax // %eax um %cl=32-i Bits links shiften, %ebx von rechts reinshiften movl %eax,(%edi) // %eax als *destptr ablegen // Letztes Digit in %ebx. @@ -1839,9 +1839,9 @@ L(srclu1:) // weiteres Digit shiften: jnz L(srclu1) L(srclu2:) movl %ebx,%eax L(srclu3:) shll %cl,%eax // %eax um 32-i Bits nach links shiften - popl %ebx // %ebx zurück - popl %edi // %edi zurück - popl %esi // %esi zurück + popl %ebx // %ebx zurück + popl %edi // %edi zurück + popl %esi // %esi zurück ret // extern uintD mulusmall_loop_up (uintD digit, uintD* ptr, uintC len, uintD newdigit); @@ -1862,14 +1862,14 @@ L(mslu1:) movl (%edi,%ecx,4),%eax // *ptr mull %ebx // %edx|%eax := digit * *ptr addl %ebp,%eax // carry und Low-Teil des Produktes addieren movl $0,%ebp - adcl %edx,%ebp // Übertrag zum High-Teil %edx dazu, gibt neuen carry + adcl %edx,%ebp // Übertrag zum High-Teil %edx dazu, gibt neuen carry movl %eax,(%edi,%ecx,4) // Low-Teil als *ptr ablegen incl %ecx // count--, ptr++ jnz L(mslu1) -L(mslu2:) movl %ebp,%eax // Ergebnis := letzter Übertrag - popl %ebx // %ebx zurück - popl %edi // %edi zurück - popl %ebp // %ebp zurück +L(mslu2:) movl %ebp,%eax // Ergebnis := letzter Übertrag + popl %ebx // %ebx zurück + popl %edi // %edi zurück + popl %ebp // %ebp zurück ret // extern void mulu_loop_up (uintD digit, uintD* sourceptr, uintD* destptr, uintC len); @@ -1893,15 +1893,15 @@ L(mulu1:) movl (%esi,%ecx,4),%eax // *sourceptr mull %ebx // %edx|%eax := digit * *sourceptr addl %ebp,%eax // carry und Low-Teil des Produktes addieren movl $0,%ebp - adcl %edx,%ebp // Übertrag zum High-Teil %edx dazu, gibt neuen carry + adcl %edx,%ebp // Übertrag zum High-Teil %edx dazu, gibt neuen carry movl %eax,(%edi,%ecx,4) // Low-Teil als *destptr ablegen incl %ecx // count--, sourceptr++, destptr++ jnz L(mulu1) - movl %ebp,(%edi) // letzten Übertrag ablegen - popl %ebx // %ebx zurück - popl %esi // %esi zurück - popl %edi // %edi zurück - popl %ebp // %ebp zurück + movl %ebp,(%edi) // letzten Übertrag ablegen + popl %ebx // %ebx zurück + popl %esi // %esi zurück + popl %edi // %edi zurück + popl %ebp // %ebp zurück ret // extern uintD muluadd_loop_up (uintD digit, uintD* sourceptr, uintD* destptr, uintC len); @@ -1925,16 +1925,16 @@ L(mualu1:) movl (%esi,%ecx,4),%eax // *sourceptr mull %ebx // %edx|%eax := digit * *sourceptr addl %ebp,%eax // carry und Low-Teil des Produktes addieren movl $0,%ebp - adcl %ebp,%edx // Übertrag zum High-Teil %edx dazu + adcl %ebp,%edx // Übertrag zum High-Teil %edx dazu addl %eax,(%edi,%ecx,4) // Low-Teil zu *destptr addieren - adcl %edx,%ebp // zweiten Übertrag zu %edx addieren, gibt neuen carry + adcl %edx,%ebp // zweiten Übertrag zu %edx addieren, gibt neuen carry incl %ecx // count--, sourceptr++, destptr++ jnz L(mualu1) - movl %ebp,%eax // Ergebnis := letzter Übertrag - popl %ebx // %ebx zurück - popl %esi // %esi zurück - popl %edi // %edi zurück - popl %ebp // %ebp zurück + movl %ebp,%eax // Ergebnis := letzter Übertrag + popl %ebx // %ebx zurück + popl %esi // %esi zurück + popl %edi // %edi zurück + popl %ebp // %ebp zurück ret // extern uintD mulusub_loop_up (uintD digit, uintD* sourceptr, uintD* destptr, uintC len); @@ -1958,16 +1958,16 @@ L(muslu1:) movl (%esi,%ecx,4),%eax // *sourceptr mull %ebx // %edx|%eax := digit * *sourceptr addl %ebp,%eax // carry und Low-Teil des Produktes addieren movl $0,%ebp - adcl %ebp,%edx // Übertrag zum High-Teil %edx dazu + adcl %ebp,%edx // Übertrag zum High-Teil %edx dazu subl %eax,(%edi,%ecx,4) // Low-Teil von *destptr subtrahieren - adcl %edx,%ebp // zweiten Übertrag zu %edx addieren, gibt neuen carry + adcl %edx,%ebp // zweiten Übertrag zu %edx addieren, gibt neuen carry incl %ecx // count--, sourceptr++, destptr++ jnz L(muslu1) - movl %ebp,%eax // Ergebnis := letzter Übertrag - popl %ebx // %ebx zurück - popl %esi // %esi zurück - popl %edi // %edi zurück - popl %ebp // %ebp zurück + movl %ebp,%eax // Ergebnis := letzter Übertrag + popl %ebx // %ebx zurück + popl %esi // %esi zurück + popl %edi // %edi zurück + popl %ebp // %ebp zurück ret // extern uintD divu_loop_down (uintD digit, uintD* ptr, uintC len); @@ -1982,14 +1982,14 @@ C(divu_loop_down:) xorl %edx,%edx // %edx = Rest := 0 jecxz L(dld2) // %ecx = 0 ? L(dld1:) leal -4(%edi),%edi // ptr-- - movl (%edi),%eax // nächstes Digit *ptr + movl (%edi),%eax // nächstes Digit *ptr divl %ebx // Division von %edx|%eax durch %ebx movl %eax,(%edi) // Quotient %eax ablegen, Rest in %edx behalten decl %ecx jnz L(dld1) L(dld2:) movl %edx,%eax // Ergebnis := letzter Rest - popl %ebx // %ebx zurück - popl %edi // %edi zurück + popl %ebx // %ebx zurück + popl %edi // %edi zurück ret // extern uintD divucopy_loop_down (uintD digit, uintD* sourceptr, uintD* destptr, uintC len); @@ -2007,15 +2007,15 @@ C(divucopy_loop_down:) jecxz L(dcld2) // %ecx = 0 ? subl %edi,%esi L(dcld1:) leal -4(%edi),%edi // sourceptr--, destptr-- - movl (%esi,%edi),%eax // nächstes Digit *ptr + movl (%esi,%edi),%eax // nächstes Digit *ptr divl %ebx // Division von %edx|%eax durch %ebx movl %eax,(%edi) // Quotient %eax ablegen, Rest in %edx behalten decl %ecx jnz L(dcld1) L(dcld2:) movl %edx,%eax // Ergebnis := letzter Rest - popl %ebx // %ebx zurück - popl %esi // %esi zurück - popl %edi // %edi zurück + popl %ebx // %ebx zurück + popl %esi // %esi zurück + popl %edi // %edi zurück ret #endif @@ -2038,33 +2038,33 @@ C(shiftxor_loop_up:) movl (%esi,%edi),%ebx // *yptr in %ebx halten movl %ebx,%eax // und in %eax rechnen: shll %cl,%eax // um i Bits links shiften, rechts Nullen rein - xorl %eax,(%esi) // und mit *xptr verknüpfen und ablegen + xorl %eax,(%esi) // und mit *xptr verknüpfen und ablegen leal 4(%esi),%esi // sourceptr++, destptr++ // Letztes Digit in %ebx. negb %cl // 32-i decl %edx jz L(shxlu2) L(shxlu1:) // weiteres Digit shiften: - movl (%esi,%edi),%eax // nächstes Digit nach %eax + movl (%esi,%edi),%eax // nächstes Digit nach %eax shrdl shcl %eax,%ebx // %ebx um %cl=32-i Bits rechts shiften, %eax von links reinshiften - xorl %ebx,(%esi) // %ebx mit *xptr verknüpfen und ablegen + xorl %ebx,(%esi) // %ebx mit *xptr verknüpfen und ablegen leal 4(%esi),%esi // xptr++, yptr++ // Letztes Digit in %eax. decl %edx jz L(shxlu3) // weiteres Digit shiften: - movl (%esi,%edi),%ebx // nächstes Digit nach %ebx + movl (%esi,%edi),%ebx // nächstes Digit nach %ebx shrdl shcl %ebx,%eax // %eax um %cl=32-i Bits rechts shiften, %ebx von links reinshiften - xorl %eax,(%esi) // %eax mit *xptr verknüpfen und ablegen + xorl %eax,(%esi) // %eax mit *xptr verknüpfen und ablegen leal 4(%esi),%esi // xptr++, yptr++ // Letztes Digit in %ebx. decl %edx jnz L(shxlu1) L(shxlu2:) movl %ebx,%eax L(shxlu3:) shrl %cl,%eax // %eax um 32-i Bits nach rechts shiften - xorl %eax,(%esi) // und mit *xptr verknüpfen und ablegen -L(shxlu4:) popl %ebx // %ebx zurück - popl %edi // %edi zurück - popl %esi // %esi zurück + xorl %eax,(%esi) // und mit *xptr verknüpfen und ablegen +L(shxlu4:) popl %ebx // %ebx zurück + popl %edi // %edi zurück + popl %esi // %esi zurück ret diff --git a/src/base/digitseq/cl_asm_m68k_.cc b/src/base/digitseq/cl_asm_m68k_.cc index 50a0a9b..efb81c8 100644 --- a/src/base/digitseq/cl_asm_m68k_.cc +++ b/src/base/digitseq/cl_asm_m68k_.cc @@ -2,11 +2,11 @@ // Prozessor: 680x0 mit x>=2 // Assembler-Syntax: meist "$" streichen, auf A/UX "$" durch "%" ersetzen // Compiler: CC oder GNU-C auf SUN3 oder AMIGA oder A/UX -// Parameter-Übergabe: -// auf dem Stack: sp@(4), sp@(8), ... (.W-Größen belegen 4 Byte!), -// Rückgabewert in d0. +// Parameter-Übergabe: +// auf dem Stack: sp@(4), sp@(8), ... (.W-Größen belegen 4 Byte!), +// Rückgabewert in d0. // Register a0-a1,d0-d1 frei verwendbar, -// Register a2-a4,d2-d7 müssen gerettet werden. +// Register a2-a4,d2-d7 müssen gerettet werden. // Einstellungen: intCsize=16, intDsize=32. #ifdef ASM_UNDERSCORE @@ -19,7 +19,7 @@ #define C(entrypoint) entrypoint #endif - // Befehl, der das X- und das C-Bit löscht (und evtl. d1 modifiziert): + // Befehl, der das X- und das C-Bit löscht (und evtl. d1 modifiziert): #if defined(sun) // SUN-Assembler #define clrx subw $d1,$d1 @@ -90,7 +90,7 @@ C(mulu32_:) | Input in d0,d1, Output in d0,mulu32_high #ifndef __GNUC__ /* mit GNU-C machen wir divu_6432_3232() als Macro, der inline dividiert */ .globl C(divu_6432_3232_) | extern struct { uint32 q; uint32 r; } divu_6432_3232_ (uint32 xhi, uint32 xlo, uint32 y); -| x = 2^32*xhi+xlo = q*y+r schreiben. Sei bekannt, daß 0 <= x < 2^32*y . +| x = 2^32*xhi+xlo = q*y+r schreiben. Sei bekannt, daß 0 <= x < 2^32*y . DECLARE_FUNCTION(divu_6432_3232_) C(divu_6432_3232_:) | Input in d1,d0,d2, Output in d0,divu_32_rest movel $sp@(4),$d1 @@ -202,7 +202,7 @@ C(test_loop_down:) | Input in a0,d0.W, Output in d0.W=d0.L | extern void or_loop_up (uintD* xptr, uintD* yptr, uintC count); DECLARE_FUNCTION(or_loop_up) -C(or_loop_up:) | Input in a0,a1,d0.W, verändert d1 +C(or_loop_up:) | Input in a0,a1,d0.W, verändert d1 movel $sp@(4),$a0 movel $sp@(8),$a1 movew $sp@(12+2),$d0 @@ -216,7 +216,7 @@ C(or_loop_up:) | Input in a0,a1,d0.W, ver | extern void xor_loop_up (uintD* xptr, uintD* yptr, uintC count); DECLARE_FUNCTION(xor_loop_up) -C(xor_loop_up:) | Input in a0,a1,d0.W, verändert d1 +C(xor_loop_up:) | Input in a0,a1,d0.W, verändert d1 movel $sp@(4),$a0 movel $sp@(8),$a1 movew $sp@(12+2),$d0 @@ -230,7 +230,7 @@ C(xor_loop_up:) | Input in a0,a1,d0.W, ver | extern void and_loop_up (uintD* xptr, uintD* yptr, uintC count); DECLARE_FUNCTION(and_loop_up) -C(and_loop_up:) | Input in a0,a1,d0.W, verändert d1 +C(and_loop_up:) | Input in a0,a1,d0.W, verändert d1 movel $sp@(4),$a0 movel $sp@(8),$a1 movew $sp@(12+2),$d0 @@ -242,7 +242,7 @@ C(and_loop_up:) | Input in a0,a1,d0.W, ver | extern void eqv_loop_up (uintD* xptr, uintD* yptr, uintC count); DECLARE_FUNCTION(eqv_loop_up) -C(eqv_loop_up:) | Input in a0,a1,d0.W, verändert d1 +C(eqv_loop_up:) | Input in a0,a1,d0.W, verändert d1 movel $sp@(4),$a0 movel $sp@(8),$a1 movew $sp@(12+2),$d0 @@ -255,7 +255,7 @@ C(eqv_loop_up:) | Input in a0,a1,d0.W, ver | extern void nand_loop_up (uintD* xptr, uintD* yptr, uintC count); DECLARE_FUNCTION(nand_loop_up) -C(nand_loop_up:) | Input in a0,a1,d0.W, verändert d1 +C(nand_loop_up:) | Input in a0,a1,d0.W, verändert d1 movel $sp@(4),$a0 movel $sp@(8),$a1 movew $sp@(12+2),$d0 @@ -268,7 +268,7 @@ C(nand_loop_up:) | Input in a0,a1,d0.W, ver | extern void nor_loop_up (uintD* xptr, uintD* yptr, uintC count); DECLARE_FUNCTION(nor_loop_up) -C(nor_loop_up:) | Input in a0,a1,d0.W, verändert d1 +C(nor_loop_up:) | Input in a0,a1,d0.W, verändert d1 movel $sp@(4),$a0 movel $sp@(8),$a1 movew $sp@(12+2),$d0 @@ -281,7 +281,7 @@ C(nor_loop_up:) | Input in a0,a1,d0.W, ver | extern void andc2_loop_up (uintD* xptr, uintD* yptr, uintC count); DECLARE_FUNCTION(andc2_loop_up) -C(andc2_loop_up:) | Input in a0,a1,d0.W, verändert d1 +C(andc2_loop_up:) | Input in a0,a1,d0.W, verändert d1 movel $sp@(4),$a0 movel $sp@(8),$a1 movew $sp@(12+2),$d0 @@ -294,7 +294,7 @@ C(andc2_loop_up:) | Input in a0,a1,d0.W, ver | extern void orc2_loop_up (uintD* xptr, uintD* yptr, uintC count); DECLARE_FUNCTION(orc2_loop_up) -C(orc2_loop_up:) | Input in a0,a1,d0.W, verändert d1 +C(orc2_loop_up:) | Input in a0,a1,d0.W, verändert d1 movel $sp@(4),$a0 movel $sp@(8),$a1 movew $sp@(12+2),$d0 @@ -317,7 +317,7 @@ C(not_loop_up:) | Input in a0,d0.W | extern boolean and_test_loop_up (uintD* xptr, uintD* yptr, uintC count); DECLARE_FUNCTION(and_test_loop_up) -C(and_test_loop_up:) | Input in a0,a1,d0.W, verändert d1, Output in d0.W=d0.L +C(and_test_loop_up:) | Input in a0,a1,d0.W, verändert d1, Output in d0.W=d0.L movel $sp@(4),$a0 movel $sp@(8),$a1 movew $sp@(12+2),$d0 @@ -355,20 +355,20 @@ C(compare_loop_up:) | Input in a0,a1,d0.W, Output in d0.W=d0.L | extern uintD add_loop_down (uintD* sourceptr1, uintD* sourceptr2, uintD* destptr, uintC count); DECLARE_FUNCTION(add_loop_down) -C(add_loop_down:) | Input in a0,a1,a2,d0.W, verändert d1,d2, Output in d0 +C(add_loop_down:) | Input in a0,a1,a2,d0.W, verändert d1,d2, Output in d0 moveml $a2/$d2,$sp@- movel $sp@(8+4),$a0 movel $sp@(8+8),$a1 movel $sp@(8+12),$a2 movew $sp@(8+16+2),$d0 - clrx | X-Bit löschen + clrx | X-Bit löschen bras 2f 1: movel $a0@-,$d1 movel $a1@-,$d2 addxl $d2,$d1 movel $d1,$a2@- 2: dbra $d0,1b - subxl $d0,$d0 | -1 falls X gesetzt, 0 falls X gelöscht + subxl $d0,$d0 | -1 falls X gesetzt, 0 falls X gelöscht moveml $sp@+,$a2/$d2 rts @@ -378,11 +378,11 @@ C(addto_loop_down:) | Input in a0,a1,d0.W, Output in d0 movel $sp@(4),$a0 movel $sp@(8),$a1 movew $sp@(12+2),$d0 - clrx | X-Bit löschen + clrx | X-Bit löschen bras 2f 1: addxl $a0@-,$a1@- 2: dbra $d0,1b - subxl $d0,$d0 | -1 falls X gesetzt, 0 falls X gelöscht + subxl $d0,$d0 | -1 falls X gesetzt, 0 falls X gelöscht rts | extern uintD inc_loop_down (uintD* ptr, uintC count); @@ -391,35 +391,35 @@ C(inc_loop_down:) | Input in a0,d0.W, Output in d0 movel $sp@(4),$a0 movew $sp@(8+2),$d0 dbra $d0,1f | simuliere gesetzten Carry - moveq #-1,$d0 | d0.L=-1 für Übertrag + moveq #-1,$d0 | d0.L=-1 für Übertrag rts 1: addql #1,$a0@- dbcc $d0,1b - subxl $d0,$d0 | kein Carry -> d0.L=0, sonst d0.L=-1 für Übertrag + subxl $d0,$d0 | kein Carry -> d0.L=0, sonst d0.L=-1 für Übertrag rts | extern uintD sub_loop_down (uintD* sourceptr1, uintD* sourceptr2, uintD* destptr, uintC count); DECLARE_FUNCTION(sub_loop_down) -C(sub_loop_down:) | Input in a0,a1,a2,d0.W, verändert d1,d2, Output in d0 +C(sub_loop_down:) | Input in a0,a1,a2,d0.W, verändert d1,d2, Output in d0 moveml $a2/$d2,$sp@- movel $sp@(8+4),$a0 movel $sp@(8+8),$a1 movel $sp@(8+12),$a2 movew $sp@(8+16+2),$d0 - clrx | X-Bit löschen + clrx | X-Bit löschen bras 2f 1: movel $a0@-,$d1 movel $a1@-,$d2 subxl $d2,$d1 movel $d1,$a2@- 2: dbra $d0,1b - subxl $d0,$d0 | -1 falls X gesetzt, 0 falls X gelöscht + subxl $d0,$d0 | -1 falls X gesetzt, 0 falls X gelöscht moveml $sp@+,$a2/$d2 rts | extern uintD subx_loop_down (uintD* sourceptr1, uintD* sourceptr2, uintD* destptr, uintC count, uintD carry); DECLARE_FUNCTION(subx_loop_down) -C(subx_loop_down:) | Input in a0,a1,a2,d0.W,d1, verändert d2, Output in d0 +C(subx_loop_down:) | Input in a0,a1,a2,d0.W,d1, verändert d2, Output in d0 moveml $a2/$d2,$sp@- movel $sp@(8+4),$a0 movel $sp@(8+8),$a1 @@ -433,7 +433,7 @@ C(subx_loop_down:) | Input in a0,a1,a2,d0.W,d1, ver subxl $d2,$d1 movel $d1,$a2@- 2: dbra $d0,1b - subxl $d0,$d0 | -1 falls X gesetzt, 0 falls X gelöscht + subxl $d0,$d0 | -1 falls X gesetzt, 0 falls X gelöscht moveml $sp@+,$a2/$d2 rts @@ -443,11 +443,11 @@ C(subfrom_loop_down:) | Input in a0,a1,d0.W, Output in d0 movel $sp@(4),$a0 movel $sp@(8),$a1 movew $sp@(12+2),$d0 - clrx | X-Bit löschen + clrx | X-Bit löschen bras 2f 1: subxl $a0@-,$a1@- 2: dbra $d0,1b - subxl $d0,$d0 | -1 falls X gesetzt, 0 falls X gelöscht + subxl $d0,$d0 | -1 falls X gesetzt, 0 falls X gelöscht rts | extern uintD dec_loop_down (uintD* ptr, uintC count); @@ -456,11 +456,11 @@ C(dec_loop_down:) | Input in a0,d0.W, Output in d0 movel $sp@(4),$a0 movew $sp@(8+2),$d0 dbra $d0,1f | simuliere gesetzten Carry - moveq #-1,$d0 | d0.L=-1 als Übertrag + moveq #-1,$d0 | d0.L=-1 als Übertrag rts 1: subql #1,$a0@- dbcc $d0,1b | kein Carry -> Schleife abbrechen - subxl $d0,$d0 | kein Carry -> d0.L=0, sonst d0.L=-1 als Übertrag + subxl $d0,$d0 | kein Carry -> d0.L=0, sonst d0.L=-1 als Übertrag rts | extern uintD neg_loop_down (uintD* ptr, uintC count); @@ -468,11 +468,11 @@ C(dec_loop_down:) | Input in a0,d0.W, Output in d0 C(neg_loop_down:) | Input in a0,d0.W, Output in d0 movel $sp@(4),$a0 movew $sp@(8+2),$d0 - clrx | X-Bit löschen + clrx | X-Bit löschen bras 2f 1: negxl $a0@- 2: dbra $d0,1b - subxl $d0,$d0 | -1 falls X gesetzt, 0 falls X gelöscht + subxl $d0,$d0 | -1 falls X gesetzt, 0 falls X gelöscht rts | extern uintD shift1left_loop_down (uintD* ptr, uintC count); @@ -480,12 +480,12 @@ C(neg_loop_down:) | Input in a0,d0.W, Output in d0 C(shift1left_loop_down:) | Input in a0,d0.W, Output in d0.L movel $sp@(4),$a0 movew $sp@(8+2),$d0 - clrx | X-Bit löschen + clrx | X-Bit löschen bras 2f 1: roxlw $a0@- | Digit a0@- um 1 Bit links schieben, X-Bit als Buffer roxlw $a0@- 2: dbra $d0,1b - subxl $d0,$d0 | -1 falls X gesetzt, 0 falls X gelöscht + subxl $d0,$d0 | -1 falls X gesetzt, 0 falls X gelöscht rts | extern uintD shiftleft_loop_down (uintD* ptr, uintC count, uintC i, uintD carry); @@ -500,15 +500,15 @@ C(shiftleft_loop_down:) | Input in a0,d0.W,d1.W,d2, Output in d0 moveq #32,$d5 subw $d1,$d5 | a0 = ptr, d0.W = count, d1.W = i, d5.W = 32-i, - | d2.L = Schiebe-Übertrag (i Bits), d3.L = Schiebe-Akku + | d2.L = Schiebe-Übertrag (i Bits), d3.L = Schiebe-Akku bras 2f 1: movel $a0@-,$d3 | d3.L = neues Digit movel $d3,$d4 lsll $d1,$d4 | um i Bits nach links schieben - orl $d2,$d4 | mit vorigem Übertrag kombinieren + orl $d2,$d4 | mit vorigem Übertrag kombinieren movel $d4,$a0@ | 32 Bits ablegen movel $d3,$d2 - lsrl $d5,$d2 | neuen Übertrag bilden + lsrl $d5,$d2 | neuen Übertrag bilden 2: dbra $d0,1b | Schleife d0.W mal durchlaufen movel $d2,$d0 moveml $sp@+,$d2-$d5 @@ -523,16 +523,16 @@ C(shiftleft_loop_down:) | Input in a0,d0.W,d1.W,d2, Output in d0 lsll $d1,$d5 subql #1,$d5 | a0 = ptr, d0.W = count, d1.W = i, d5.L = 2^i-1 - | d2.L = Schiebe-Übertrag (i Bits), d3.L = Schiebe-Akku + | d2.L = Schiebe-Übertrag (i Bits), d3.L = Schiebe-Akku bras 2f 1: movel $a0@-,$d3 | d3.L = neues Digit roll $d1,$d3 | um i Bits links rotieren movel $d3,$d4 andl $d5,$d3 | untere i Bits in d3 eorl $d3,$d4 | obere 32-i Bits in d4 - orl $d2,$d4 | mit vorigem übertrag kombinieren + orl $d2,$d4 | mit vorigem übertrag kombinieren movel $d4,$a0@ | 32 Bits ablegen - movel $d3,$d2 | neuer Übertrag + movel $d3,$d2 | neuer Übertrag 2: dbra $d0,1b | Schleife d0.W mal durchlaufen movel $d2,$d0 moveml $sp@+,$d2-$d5 @@ -552,15 +552,15 @@ C(shiftleftcopy_loop_down:) | Input in a0,a1,d0.W,d1.W, Output in d0 subw $d1,$d5 clrl $d2 | a0 = sourceptr, a1 = destptr, d0.W = count, d1.W = i, d5.W = 32-i, - | d2.L = Schiebe-Übertrag (i Bits), d3.L = Schiebe-Akku + | d2.L = Schiebe-Übertrag (i Bits), d3.L = Schiebe-Akku bras 2f 1: movel $a0@-,$d3 | d3.L = neues Digit movel $d3,$d4 lsll $d1,$d4 | um i Bits nach links schieben - orl $d2,$d4 | mit vorigem Übertrag kombinieren + orl $d2,$d4 | mit vorigem Übertrag kombinieren movel $d4,$a1@- | 32 Bits ablegen movel $d3,$d2 - lsrl $d5,$d2 | neuen Übertrag bilden + lsrl $d5,$d2 | neuen Übertrag bilden 2: dbra $d0,1b | Schleife d0.W mal durchlaufen movel $d2,$d0 moveml $sp@+,$d2-$d5 @@ -575,16 +575,16 @@ C(shiftleftcopy_loop_down:) | Input in a0,a1,d0.W,d1.W, Output in d0 lsll $d1,$d5 subql #1,$d5 | a0 = sourceptr, a1 = destptr, d0.W = count, d1.W = i, d5.L = 2^i-1 - | d2.L = Schiebe-Übertrag (i Bits), d3.L = Schiebe-Akku + | d2.L = Schiebe-Übertrag (i Bits), d3.L = Schiebe-Akku bras 2f 1: movel $a0@-,$d3 | d3.L = neues Digit roll $d1,$d3 | um i Bits links rotieren movel $d3,$d4 andl $d5,$d3 | untere i Bits in d3 eorl $d3,$d4 | obere 32-i Bits in d4 - orl $d2,$d4 | mit vorigem übertrag kombinieren + orl $d2,$d4 | mit vorigem übertrag kombinieren movel $d4,$a1@- | 32 Bits ablegen - movel $d3,$d2 | neuer Übertrag + movel $d3,$d2 | neuer Übertrag 2: dbra $d0,1b | Schleife d0.W mal durchlaufen movel $d2,$d0 moveml $sp@+,$d2-$d5 @@ -597,12 +597,12 @@ C(shift1right_loop_up:) | Input in a0,d0.W,d1, Output in d0 movel $sp@(4),$a0 movew $sp@(8+2),$d0 movel $sp@(12),$d1 - roxrl #1,$d1 | X-Bit löschen oder setzen, je nach d1 + roxrl #1,$d1 | X-Bit löschen oder setzen, je nach d1 bras 2f 1: roxrw $a0@+ | Digit a0@+ um 1 Bit rechts schieben, X-Bit als Buffer roxrw $a0@+ 2: dbra $d0,1b - subxl $d0,$d0 | -1 falls X gesetzt, 0 falls X gelöscht + subxl $d0,$d0 | -1 falls X gesetzt, 0 falls X gelöscht rts | extern uintD shiftright_loop_up (uintD* ptr, uintC count, uintC i); @@ -616,19 +616,19 @@ C(shiftright_loop_up:) | Input in a0,d0.W,d1.W, Output in d0 moveq #32,$d5 subw $d1,$d5 | a0 = ptr, d0.W = count, d1.W = i, d5.W = 32-i, - | d2.L = Schiebe-Übertrag (i Bits), d3.L = Schiebe-Akku + | d2.L = Schiebe-Übertrag (i Bits), d3.L = Schiebe-Akku clrl $d2 bras 2f - 1: | a0 = Aufwärtszähler Adresse, d0.W = Herabzähler, d1.W = i, d5.W = 32-i, - | d2.L = Schiebe-Übertrag (obere i Bits, restliche 32-i Bits sind 0) + 1: | a0 = Aufwärtszähler Adresse, d0.W = Herabzähler, d1.W = i, d5.W = 32-i, + | d2.L = Schiebe-Übertrag (obere i Bits, restliche 32-i Bits sind 0) | d3.L = Schiebe-Akku movel $a0@,$d3 | neue Daten movel $d3,$d4 lsrl $d1,$d3 | um i Bits rechts schieben - orl $d2,$d3 | und mit vorigem Übertrag kombinieren + orl $d2,$d3 | und mit vorigem Übertrag kombinieren movel $d3,$a0@+ | ablegen lsll $d5,$d4 | um (32-i) Bits links geschoben - movel $d4,$d2 | liefert neuen Übertrag + movel $d4,$d2 | liefert neuen Übertrag 2: dbra $d0,1b | Schleife d0.W mal durchlaufen movel $d2,$d0 moveml $sp@+,$d2-$d5 @@ -641,19 +641,19 @@ C(shiftright_loop_up:) | Input in a0,d0.W,d1.W, Output in d0 moveq #-1,$d5 lsrl $d1,$d5 | a0 = ptr, d0.W = count, d1.W = i, d5.L = 2^(32-i)-1, - | d2.L = Schiebe-Übertrag (i Bits), d3.L = Schiebe-Akku + | d2.L = Schiebe-Übertrag (i Bits), d3.L = Schiebe-Akku clrl $d2 bras 2f - 1: | a0 = Aufwärtszähler Adresse, d0.W = Herabzähler, d1.W = i, d5.L = 2^(32-i)-1, - | d2.L = Schiebe-Übertrag (obere i Bits, restliche 32-i Bits sind 0) + 1: | a0 = Aufwärtszähler Adresse, d0.W = Herabzähler, d1.W = i, d5.L = 2^(32-i)-1, + | d2.L = Schiebe-Übertrag (obere i Bits, restliche 32-i Bits sind 0) | d3.L = Schiebe-Akku movel $a0@,$d3 | neue Daten rorl $d1,$d3 | um i Bits rechts rotieren movel $d3,$d4 andl $d5,$d3 | untere 32-i Bits eorl $d3,$d4 | obere i Bits - orl $d2,$d3 | und mit vorigem Übertrag kombinieren - movel $d4,$d2 | neuer Übertrag + orl $d2,$d3 | und mit vorigem Übertrag kombinieren + movel $d4,$d2 | neuer Übertrag movel $d3,$a0@+ | ablegen 2: dbra $d0,1b | Schleife d0.W mal durchlaufen movel $d2,$d0 @@ -672,22 +672,22 @@ C(shiftrightsigned_loop_up:) | Input in a0,d0.W,d1.W, Output in d0 moveq #32,$d5 subw $d1,$d5 | a0 = ptr, d0.W = count, d1.W = i, d5.W = 32-i, - | d2.L = Schiebe-Übertrag (i Bits), d3.L = Schiebe-Akku + | d2.L = Schiebe-Übertrag (i Bits), d3.L = Schiebe-Akku subqw #1,$d0 movel $a0@,$d3 | erstes Digit movel $d3,$d4 asrl $d1,$d3 | um i Bits rechts schieben bras 2f - 1: | a0 = Aufwärtszähler Adresse, d0.W = Herabzähler, d1.W = i, d5.W = 32-i, - | d2.L = Schiebe-Übertrag (obere i Bits, restliche 32-i Bits sind 0) + 1: | a0 = Aufwärtszähler Adresse, d0.W = Herabzähler, d1.W = i, d5.W = 32-i, + | d2.L = Schiebe-Übertrag (obere i Bits, restliche 32-i Bits sind 0) | d3.L = Schiebe-Akku movel $a0@,$d3 | neue Daten movel $d3,$d4 lsrl $d1,$d3 | um i Bits rechts schieben - orl $d2,$d3 | und mit vorigem Übertrag kombinieren + orl $d2,$d3 | und mit vorigem Übertrag kombinieren 2: movel $d3,$a0@+ | ablegen lsll $d5,$d4 | um (32-i) Bits links geschoben - movel $d4,$d2 | liefert neuen Übertrag + movel $d4,$d2 | liefert neuen Übertrag dbra $d0,1b | Schleife d0.W mal durchlaufen movel $d2,$d0 moveml $sp@+,$d2-$d5 @@ -700,7 +700,7 @@ C(shiftrightsigned_loop_up:) | Input in a0,d0.W,d1.W, Output in d0 moveq #-1,$d5 lsrl $d1,$d5 | a0 = ptr, d0.W = count, d1.W = i, d5.L = 2^(32-i)-1, - | d2.L = Schiebe-Übertrag (i Bits), d3.L = Schiebe-Akku + | d2.L = Schiebe-Übertrag (i Bits), d3.L = Schiebe-Akku subqw #1,$d0 movel $a0@,$d3 | erstes Digit movel $d3,$d4 @@ -710,16 +710,16 @@ C(shiftrightsigned_loop_up:) | Input in a0,d0.W,d1.W, Output in d0 andl $d4,$d2 | obere 32-i Bits asrl $d1,$d3 | erstes Digit um i Bits rechts shiften bras 2f - 1: | a0 = Aufwärtszähler Adresse, d0.W = Herabzähler, d1.W = i, d5.L = 2^(32-i)-1, - | d2.L = Schiebe-Übertrag (obere i Bits, restliche 32-i Bits sind 0) + 1: | a0 = Aufwärtszähler Adresse, d0.W = Herabzähler, d1.W = i, d5.L = 2^(32-i)-1, + | d2.L = Schiebe-Übertrag (obere i Bits, restliche 32-i Bits sind 0) | d3.L = Schiebe-Akku movel $a0@,$d3 | neue Daten rorl $d1,$d3 | um i Bits rechts rotieren movel $d3,$d4 andl $d5,$d3 | untere 32-i Bits eorl $d3,$d4 | obere i Bits - orl $d2,$d3 | und mit vorigem Übertrag kombinieren - movel $d4,$d2 | neuer Übertrag + orl $d2,$d3 | und mit vorigem Übertrag kombinieren + movel $d4,$d2 | neuer Übertrag 2: movel $d3,$a0@+ | ablegen dbra $d0,1b | Schleife d0.W mal durchlaufen movel $d2,$d0 @@ -740,18 +740,18 @@ C(shiftrightcopy_loop_up:) | Input in a0,a1,d0.W,d1.W,d2, Output in d0 moveq #32,$d5 subw $d1,$d5 | a0 = ptr, d0.W = count, d1.W = i, d5.W = 32-i - | d2.L = Schiebe-Übertrag (i Bits), d3.L = Schiebe-Akku + | d2.L = Schiebe-Übertrag (i Bits), d3.L = Schiebe-Akku bras 2f - 1: | a0,a1 = Aufwärtszähler Adresse, d0.W = Herabzähler, d1.W = i, d5.W = 32-i - | d2.L = Schiebe-Übertrag (obere i Bits, restliche 32-i Bits sind 0) + 1: | a0,a1 = Aufwärtszähler Adresse, d0.W = Herabzähler, d1.W = i, d5.W = 32-i + | d2.L = Schiebe-Übertrag (obere i Bits, restliche 32-i Bits sind 0) | d3.L = Schiebe-Akku movel $a0@+,$d3 | neue Daten movel $d3,$d4 lsrl $d1,$d3 | um i Bits rechts schieben - orl $d2,$d3 | und mit vorigem Übertrag kombinieren + orl $d2,$d3 | und mit vorigem Übertrag kombinieren movel $d3,$a1@+ | ablegen movel $d4,$d2 - 2: lsll $d5,$d2 | um (32-i) Bits links geschoben, gibt neuen Übertrag + 2: lsll $d5,$d2 | um (32-i) Bits links geschoben, gibt neuen Übertrag dbra $d0,1b | Schleife d0.W mal durchlaufen movel $d2,$d0 moveml $sp@+,$d2-$d5 @@ -767,18 +767,18 @@ C(shiftrightcopy_loop_up:) | Input in a0,a1,d0.W,d1.W,d2, Output in d0 lsrl $d1,$d5 rorl $d1,$d2 | a0 = ptr, d0.W = count, d1.W = i, d5.L = 2^(32-i)-1 - | d2.L = Schiebe-Übertrag (i Bits), d3.L = Schiebe-Akku + | d2.L = Schiebe-Übertrag (i Bits), d3.L = Schiebe-Akku bras 2f - 1: | a0,a1 = Aufwärtszähler Adresse, d0.W = Herabzähler, d1.W = i, d5.L = 2^(32-i)-1 - | d2.L = Schiebe-Übertrag (obere i Bits, restliche 32-i Bits sind 0) + 1: | a0,a1 = Aufwärtszähler Adresse, d0.W = Herabzähler, d1.W = i, d5.L = 2^(32-i)-1 + | d2.L = Schiebe-Übertrag (obere i Bits, restliche 32-i Bits sind 0) | d3.L = Schiebe-Akku movel $a0@+,$d3 | neue Daten rorl $d1,$d3 | um i Bits rechts rotieren movel $d3,$d4 andl $d5,$d3 | untere 32-i Bits eorl $d3,$d4 | obere i Bits - orl $d2,$d3 | und mit vorigem Übertrag kombinieren - movel $d4,$d2 | neuer Übertrag + orl $d2,$d3 | und mit vorigem Übertrag kombinieren + movel $d4,$d2 | neuer Übertrag movel $d3,$a1@+ | ablegen 2: dbra $d0,1b | Schleife d0.W mal durchlaufen movel $d2,$d0 @@ -794,9 +794,9 @@ C(mulusmall_loop_down:) | Input in d0,a0,d1.W,d2, Output in d0 movel $sp@(12+8),$a0 movew $sp@(12+12+2),$d1 movel $sp@(12+16),$d2 - addw #0,$d1 | X-Bit löschen + addw #0,$d1 | X-Bit löschen bras 2f - 1: movel $a0@-,$d3 | nächstes Digit + 1: movel $a0@-,$d3 | nächstes Digit mulul $d0,$d4:$d3 | mit digit multiplizieren addxl $d2,$d3 | und bisherigen Carry und X-Bit addieren movel $d3,$a0@ | Low-Digit ablegen @@ -816,9 +816,9 @@ C(mulu_loop_down:) | Input in d0,a0,a1,d1.W movel $sp@(12+8),$a0 movel $sp@(12+12),$a1 movew $sp@(12+16+2),$d1 - subl $d2,$d2 | carry := 0, X-Bit löschen + subl $d2,$d2 | carry := 0, X-Bit löschen bras 2f - 1: movel $a0@-,$d3 | nächstes Digit + 1: movel $a0@-,$d3 | nächstes Digit mulul $d0,$d4:$d3 | mit digit multiplizieren addxl $d2,$d3 | und bisherigen Carry und X-Bit addieren movel $d3,$a1@- | Low-Digit ablegen @@ -838,7 +838,7 @@ C(mulu_loop_down:) | Input in d0,a0,a1,d1.W clrl $d5 | 0 clrl $d2 | carry bras 2f - 1: movel $a0@-,$d3 | nächstes Digit + 1: movel $a0@-,$d3 | nächstes Digit mulul $d0,$d4:$d3 | mit digit multiplizieren addl $d2,$d3 | und bisherigen Carry addieren addxl $d5,$d4 @@ -859,13 +859,13 @@ C(muluadd_loop_down:) | Input in d0,a0,a1,d1.W, Output in d0 movel $sp@(16+12),$a1 movew $sp@(16+16+2),$d1 clrl $d5 | 0 - subl $d2,$d2 | carry := 0, X-Bit löschen + subl $d2,$d2 | carry := 0, X-Bit löschen bras 2f - 1: movel $a0@-,$d3 | nächstes Digit + 1: movel $a0@-,$d3 | nächstes Digit mulul $d0,$d4:$d3 | mit digit multiplizieren addxl $d2,$d3 | und bisherigen Carry und X-Bit addieren addxl $d5,$d4 - addl $d3,$a1@- | Low-Digit zum dest-Digit addieren, X als Übertrag + addl $d3,$a1@- | Low-Digit zum dest-Digit addieren, X als Übertrag movel $d4,$d2 | High-Digit gibt neuen Carry 2: dbra $d1,1b addxl $d5,$d2 | letztes X-Bit addieren @@ -882,13 +882,13 @@ C(mulusub_loop_down:) | Input in d0,a0,a1,d1.W, Output in d0 movel $sp@(16+12),$a1 movew $sp@(16+16+2),$d1 clrl $d5 | 0 - subl $d2,$d2 | carry := 0, X-Bit löschen + subl $d2,$d2 | carry := 0, X-Bit löschen bras 2f - 1: movel $a0@-,$d3 | nächstes Digit + 1: movel $a0@-,$d3 | nächstes Digit mulul $d0,$d4:$d3 | mit digit multiplizieren addxl $d2,$d3 | und bisherigen Carry und X-Bit addieren addxl $d5,$d4 - subl $d3,$a1@- | Low-Digit vom dest-Digit subtrahieren, X als Übertrag + subl $d3,$a1@- | Low-Digit vom dest-Digit subtrahieren, X als Übertrag movel $d4,$d2 | High-Digit gibt neuen Carry 2: dbra $d1,1b clrl $d0 @@ -905,7 +905,7 @@ C(divu_loop_up:) | Input in d0,a0,d1.W, Output in d0 movew $sp@(8+12+2),$d1 clrl $d2 | Rest := 0 bras 2f - 1: movel $a0@,$d3 | nächst-niedriges Digit + 1: movel $a0@,$d3 | nächst-niedriges Digit divul $d0,$d2:$d3 | mit Rest kombinieren und durch digit dividieren movel $d3,$a0@+ | Quotient ablegen, Rest in d2 2: dbra $d1,1b @@ -923,7 +923,7 @@ C(divucopy_loop_up:) | Input in d0,a0,a1,d1.W, Output in d0 movew $sp@(8+16+2),$d1 clrl $d2 | Rest := 0 bras 2f - 1: movel $a0@+,$d3 | nächst-niedriges Digit + 1: movel $a0@+,$d3 | nächst-niedriges Digit divul $d0,$d2:$d3 | mit Rest kombinieren und durch digit dividieren movel $d3,$a1@+ | Quotient ablegen, Rest in d2 2: dbra $d1,1b @@ -937,7 +937,7 @@ C(divucopy_loop_up:) | Input in d0,a0,a1,d1.W, Output in d0 | extern void or_loop_down (uintD* xptr, uintD* yptr, uintC count); DECLARE_FUNCTION(or_loop_down) -C(or_loop_down:) | Input in a0,a1,d0.W, verändert d1 +C(or_loop_down:) | Input in a0,a1,d0.W, verändert d1 movel $sp@(4),$a0 movel $sp@(8),$a1 movew $sp@(12+2),$d0 @@ -949,7 +949,7 @@ C(or_loop_down:) | Input in a0,a1,d0.W, ver | extern void xor_loop_down (uintD* xptr, uintD* yptr, uintC count); DECLARE_FUNCTION(xor_loop_down) -C(xor_loop_down:) | Input in a0,a1,d0.W, verändert d1 +C(xor_loop_down:) | Input in a0,a1,d0.W, verändert d1 movel $sp@(4),$a0 movel $sp@(8),$a1 movew $sp@(12+2),$d0 @@ -961,7 +961,7 @@ C(xor_loop_down:) | Input in a0,a1,d0.W, ver | extern void and_loop_down (uintD* xptr, uintD* yptr, uintC count); DECLARE_FUNCTION(and_loop_down) -C(and_loop_down:) | Input in a0,a1,d0.W, verändert d1 +C(and_loop_down:) | Input in a0,a1,d0.W, verändert d1 movel $sp@(4),$a0 movel $sp@(8),$a1 movew $sp@(12+2),$d0 @@ -973,7 +973,7 @@ C(and_loop_down:) | Input in a0,a1,d0.W, ver | extern void eqv_loop_down (uintD* xptr, uintD* yptr, uintC count); DECLARE_FUNCTION(eqv_loop_down) -C(eqv_loop_down:) | Input in a0,a1,d0.W, verändert d1 +C(eqv_loop_down:) | Input in a0,a1,d0.W, verändert d1 movel $sp@(4),$a0 movel $sp@(8),$a1 movew $sp@(12+2),$d0 @@ -986,7 +986,7 @@ C(eqv_loop_down:) | Input in a0,a1,d0.W, ver | extern void nand_loop_down (uintD* xptr, uintD* yptr, uintC count); DECLARE_FUNCTION(nand_loop_down) -C(nand_loop_down:) | Input in a0,a1,d0.W, verändert d1 +C(nand_loop_down:) | Input in a0,a1,d0.W, verändert d1 movel $sp@(4),$a0 movel $sp@(8),$a1 movew $sp@(12+2),$d0 @@ -999,7 +999,7 @@ C(nand_loop_down:) | Input in a0,a1,d0.W, ver | extern void nor_loop_down (uintD* xptr, uintD* yptr, uintC count); DECLARE_FUNCTION(nor_loop_down) -C(nor_loop_down:) | Input in a0,a1,d0.W, verändert d1 +C(nor_loop_down:) | Input in a0,a1,d0.W, verändert d1 movel $sp@(4),$a0 movel $sp@(8),$a1 movew $sp@(12+2),$d0 @@ -1012,7 +1012,7 @@ C(nor_loop_down:) | Input in a0,a1,d0.W, ver | extern void andc2_loop_down (uintD* xptr, uintD* yptr, uintC count); DECLARE_FUNCTION(andc2_loop_down) -C(andc2_loop_down:) | Input in a0,a1,d0.W, verändert d1 +C(andc2_loop_down:) | Input in a0,a1,d0.W, verändert d1 movel $sp@(4),$a0 movel $sp@(8),$a1 movew $sp@(12+2),$d0 @@ -1025,7 +1025,7 @@ C(andc2_loop_down:) | Input in a0,a1,d0.W, ver | extern void orc2_loop_down (uintD* xptr, uintD* yptr, uintC count); DECLARE_FUNCTION(orc2_loop_down) -C(orc2_loop_down:) | Input in a0,a1,d0.W, verändert d1 +C(orc2_loop_down:) | Input in a0,a1,d0.W, verändert d1 movel $sp@(4),$a0 movel $sp@(8),$a1 movew $sp@(12+2),$d0 @@ -1048,7 +1048,7 @@ C(not_loop_down:) | Input in a0,d0.W | extern boolean and_test_loop_down (uintD* xptr, uintD* yptr, uintC count); DECLARE_FUNCTION(and_test_loop_down) -C(and_test_loop_down:) | Input in a0,a1,d0.W, verändert d1, Output in d0.W=d0.L +C(and_test_loop_down:) | Input in a0,a1,d0.W, verändert d1, Output in d0.W=d0.L movel $sp@(4),$a0 movel $sp@(8),$a1 movew $sp@(12+2),$d0 @@ -1064,7 +1064,7 @@ C(and_test_loop_down:) | Input in a0,a1,d0.W, ver | extern cl_signean compare_loop_down (uintD* xptr, uintD* yptr, uintC count); DECLARE_FUNCTION(compare_loop_down) -C(compare_loop_down:) | Input in a0,a1,d0.W, verändert d1,d2, Output in d0.W=d0.L +C(compare_loop_down:) | Input in a0,a1,d0.W, verändert d1,d2, Output in d0.W=d0.L movel $d2,$sp@- movel $sp@(4+4),$a0 movel $sp@(4+8),$a1 @@ -1088,38 +1088,38 @@ C(compare_loop_down:) | Input in a0,a1,d0.W, ver | extern uintD add_loop_up (uintD* sourceptr1, uintD* sourceptr2, uintD* destptr, uintC count); DECLARE_FUNCTION(add_loop_up) -C(add_loop_up:) | Input in a0,a1,a2,d0.W, verändert d1,d2, Output in d0 +C(add_loop_up:) | Input in a0,a1,a2,d0.W, verändert d1,d2, Output in d0 moveml $a2/$d2,$sp@- movel $sp@(8+4),$a0 movel $sp@(8+8),$a1 movel $sp@(8+12),$a2 movew $sp@(8+16+2),$d0 - clrx | X-Bit löschen + clrx | X-Bit löschen bras 2f 1: movel $a0@+,$d1 movel $a1@+,$d2 addxl $d2,$d1 movel $d1,$a2@+ 2: dbra $d0,1b - subxl $d0,$d0 | -1 falls X gesetzt, 0 falls X gelöscht + subxl $d0,$d0 | -1 falls X gesetzt, 0 falls X gelöscht moveml $sp@+,$a2/$d2 rts | extern uintD addto_loop_up (uintD* sourceptr, uintD* destptr, uintC count); DECLARE_FUNCTION(addto_loop_up) -C(addto_loop_up:) | Input in a0,a1,d0.W, verändert d1,d2, Output in d0 +C(addto_loop_up:) | Input in a0,a1,d0.W, verändert d1,d2, Output in d0 movel $d2,$sp@- movel $sp@(4+4),$a0 movel $sp@(4+8),$a1 movew $sp@(4+12+2),$d0 - clrx | X-Bit löschen + clrx | X-Bit löschen bras 2f 1: movel $a0@+,$d1 movel $a1@,$d2 addxl $d1,$d2 movel $d2,$a1@+ 2: dbra $d0,1b - subxl $d0,$d0 | -1 falls X gesetzt, 0 falls X gelöscht + subxl $d0,$d0 | -1 falls X gesetzt, 0 falls X gelöscht movel $sp@+,$d2 rts @@ -1129,35 +1129,35 @@ C(inc_loop_up:) | Input in a0,d0.W, Output in d0 movel $sp@(4),$a0 movew $sp@(8+2),$d0 dbra $d0,1f | simuliere gesetzten Carry - moveq #-1,$d0 | d0.L=-1 für Übertrag + moveq #-1,$d0 | d0.L=-1 für Übertrag rts 1: addql #1,$a0@+ dbcc $d0,1b - subxl $d0,$d0 | kein Carry -> d0.L=0, sonst d0.L=-1 für Übertrag + subxl $d0,$d0 | kein Carry -> d0.L=0, sonst d0.L=-1 für Übertrag rts | extern uintD sub_loop_up (uintD* sourceptr1, uintD* sourceptr2, uintD* destptr, uintC count); DECLARE_FUNCTION(sub_loop_up) -C(sub_loop_up:) | Input in a0,a1,a2,d0.W, verändert d1,d2, Output in d0 +C(sub_loop_up:) | Input in a0,a1,a2,d0.W, verändert d1,d2, Output in d0 moveml $a2/$d2,$sp@- movel $sp@(8+4),$a0 movel $sp@(8+8),$a1 movel $sp@(8+12),$a2 movew $sp@(8+16+2),$d0 - clrx | X-Bit löschen + clrx | X-Bit löschen bras 2f 1: movel $a0@+,$d1 movel $a1@+,$d2 subxl $d2,$d1 movel $d1,$a2@+ 2: dbra $d0,1b - subxl $d0,$d0 | -1 falls X gesetzt, 0 falls X gelöscht + subxl $d0,$d0 | -1 falls X gesetzt, 0 falls X gelöscht moveml $sp@+,$a2/$d2 rts | extern uintD subx_loop_up (uintD* sourceptr1, uintD* sourceptr2, uintD* destptr, uintC count, uintD carry); DECLARE_FUNCTION(subx_loop_up) -C(subx_loop_up:) | Input in a0,a1,a2,d0.W,d1, verändert d2, Output in d0 +C(subx_loop_up:) | Input in a0,a1,a2,d0.W,d1, verändert d2, Output in d0 moveml $a2/$d2,$sp@- movel $sp@(8+4),$a0 movel $sp@(8+8),$a1 @@ -1171,7 +1171,7 @@ C(subx_loop_up:) | Input in a0,a1,a2,d0.W,d1, ver subxl $d2,$d1 movel $d1,$a2@+ 2: dbra $d0,1b - subxl $d0,$d0 | -1 falls X gesetzt, 0 falls X gelöscht + subxl $d0,$d0 | -1 falls X gesetzt, 0 falls X gelöscht moveml $sp@+,$a2/$d2 rts @@ -1181,14 +1181,14 @@ C(subfrom_loop_up:) | Input in a0,a1,d0.W, Output in d0 movel $sp@(4),$a0 movel $sp@(8),$a1 movew $sp@(12+2),$d0 - clrx | X-Bit löschen + clrx | X-Bit löschen bras 2f 1: movel $a0@+,$d1 movel $a1@,$d2 subxl $d1,$d2 movel $d2,$a1@+ 2: dbra $d0,1b - subxl $d0,$d0 | -1 falls X gesetzt, 0 falls X gelöscht + subxl $d0,$d0 | -1 falls X gesetzt, 0 falls X gelöscht rts | extern uintD dec_loop_up (uintD* ptr, uintC count); @@ -1197,11 +1197,11 @@ C(dec_loop_up:) | Input in a0,d0.W, Output in d0 movel $sp@(4),$a0 movew $sp@(8+2),$d0 dbra $d0,1f | simuliere gesetzten Carry - moveq #-1,$d0 | d0.L=-1 als Übertrag + moveq #-1,$d0 | d0.L=-1 als Übertrag rts 1: subql #1,$a0@+ dbcc $d0,1b | kein Carry -> Schleife abbrechen - subxl $d0,$d0 | kein Carry -> d0.L=0, sonst d0.L=-1 als Übertrag + subxl $d0,$d0 | kein Carry -> d0.L=0, sonst d0.L=-1 als Übertrag rts | extern uintD neg_loop_up (uintD* ptr, uintC count); @@ -1209,25 +1209,25 @@ C(dec_loop_up:) | Input in a0,d0.W, Output in d0 C(neg_loop_up:) | Input in a0,d0.W, Output in d0 movel $sp@(4),$a0 movew $sp@(8+2),$d0 - clrx | X-Bit löschen + clrx | X-Bit löschen bras 2f 1: negxl $a0@+ 2: dbra $d0,1b - subxl $d0,$d0 | -1 falls X gesetzt, 0 falls X gelöscht + subxl $d0,$d0 | -1 falls X gesetzt, 0 falls X gelöscht rts | extern uintD shift1left_loop_up (uintD* ptr, uintC count); DECLARE_FUNCTION(shift1left_loop_up) -C(shift1left_loop_up:) | Input in a0,d0.W, verändert d1, Output in d0.L +C(shift1left_loop_up:) | Input in a0,d0.W, verändert d1, Output in d0.L movel $sp@(4),$a0 movew $sp@(8+2),$d0 - clrx | X-Bit löschen + clrx | X-Bit löschen bras 2f 1: movel $a0@,$d1 roxll #1,$d1 movel $d1,$a0@+ 2: dbra $d0,1b - subxl $d0,$d0 | -1 falls X gesetzt, 0 falls X gelöscht + subxl $d0,$d0 | -1 falls X gesetzt, 0 falls X gelöscht rts | extern uintD shiftleft_loop_up (uintD* ptr, uintC count, uintC i, uintD carry); @@ -1242,15 +1242,15 @@ C(shiftleft_loop_up:) | Input in a0,d0.W,d1.W,d2, Output in d0 moveq #32,$d5 subw $d1,$d5 | a0 = ptr, d0.W = count, d1.W = i, d5.W = 32-i, - | d2.L = Schiebe-Übertrag (i Bits), d3.L = Schiebe-Akku + | d2.L = Schiebe-Übertrag (i Bits), d3.L = Schiebe-Akku bras 2f 1: movel $a0@,$d3 | d3.L = neues Digit movel $d3,$d4 lsll $d1,$d4 | um i Bits nach links schieben - orl $d2,$d4 | mit vorigem Übertrag kombinieren + orl $d2,$d4 | mit vorigem Übertrag kombinieren movel $d4,$a0@+ | 32 Bits ablegen movel $d3,$d2 - lsrl $d5,$d2 | neuen Übertrag bilden + lsrl $d5,$d2 | neuen Übertrag bilden 2: dbra $d0,1b | Schleife d0.W mal durchlaufen movel $d2,$d0 moveml $sp@+,$d2-$d5 @@ -1265,16 +1265,16 @@ C(shiftleft_loop_up:) | Input in a0,d0.W,d1.W,d2, Output in d0 lsll $d1,$d5 subql #1,$d5 | a0 = ptr, d0.W = count, d1.W = i, d5.L = 2^i-1 - | d2.L = Schiebe-Übertrag (i Bits), d3.L = Schiebe-Akku + | d2.L = Schiebe-Übertrag (i Bits), d3.L = Schiebe-Akku bras 2f 1: movel $a0@,$d3 | d3.L = neues Digit roll $d1,$d3 | um i Bits links rotieren movel $d3,$d4 andl $d5,$d3 | untere i Bits in d3 eorl $d3,$d4 | obere 32-i Bits in d4 - orl $d2,$d4 | mit vorigem übertrag kombinieren + orl $d2,$d4 | mit vorigem übertrag kombinieren movel $d4,$a0@+ | 32 Bits ablegen - movel $d3,$d2 | neuer Übertrag + movel $d3,$d2 | neuer Übertrag 2: dbra $d0,1b | Schleife d0.W mal durchlaufen movel $d2,$d0 moveml $sp@+,$d2-$d5 @@ -1296,15 +1296,15 @@ C(shiftleftcopy_loop_up:) | Input in a0,a1,d0.W,d1.W, Output in d0 subw $d1,$d5 clrl $d2 | a0 = sourceptr, a1 = destptr, d0.W = count, d1.W = i, d5.W = 32-i, - | d2.L = Schiebe-Übertrag (i Bits), d3.L = Schiebe-Akku + | d2.L = Schiebe-Übertrag (i Bits), d3.L = Schiebe-Akku bras 2f 1: movel $a0@+,$d3 | d3.L = neues Digit movel $d3,$d4 lsll $d1,$d4 | um i Bits nach links schieben - orl $d2,$d4 | mit vorigem Übertrag kombinieren + orl $d2,$d4 | mit vorigem Übertrag kombinieren movel $d4,$a1@+ | 32 Bits ablegen movel $d3,$d2 - lsrl $d5,$d2 | neuen Übertrag bilden + lsrl $d5,$d2 | neuen Übertrag bilden 2: dbra $d0,1b | Schleife d0.W mal durchlaufen movel $d2,$d0 moveml $sp@+,$d2-$d5 @@ -1319,16 +1319,16 @@ C(shiftleftcopy_loop_up:) | Input in a0,a1,d0.W,d1.W, Output in d0 lsll $d1,$d5 subql #1,$d5 | a0 = sourceptr, a1 = destptr, d0.W = count, d1.W = i, d5.L = 2^i-1 - | d2.L = Schiebe-Übertrag (i Bits), d3.L = Schiebe-Akku + | d2.L = Schiebe-Übertrag (i Bits), d3.L = Schiebe-Akku bras 2f 1: movel $a0@+,$d3 | d3.L = neues Digit roll $d1,$d3 | um i Bits links rotieren movel $d3,$d4 andl $d5,$d3 | untere i Bits in d3 eorl $d3,$d4 | obere 32-i Bits in d4 - orl $d2,$d4 | mit vorigem übertrag kombinieren + orl $d2,$d4 | mit vorigem übertrag kombinieren movel $d4,$a1@+ | 32 Bits ablegen - movel $d3,$d2 | neuer Übertrag + movel $d3,$d2 | neuer Übertrag 2: dbra $d0,1b | Schleife d0.W mal durchlaufen movel $d2,$d0 moveml $sp@+,$d2-$d5 @@ -1343,13 +1343,13 @@ C(shift1right_loop_down:) | Input in a0,d0.W,d1, Output in d0 movel $sp@(4),$a0 movew $sp@(8+2),$d0 movel $sp@(12),$d1 - roxrl #1,$d1 | X-Bit löschen oder setzen, je nach d1 + roxrl #1,$d1 | X-Bit löschen oder setzen, je nach d1 bras 2f 1: movel $a0@-,$d1 roxrl #1,$d1 movel $d1,$a0@ 2: dbra $d0,1b - subxl $d0,$d0 | -1 falls X gesetzt, 0 falls X gelöscht + subxl $d0,$d0 | -1 falls X gesetzt, 0 falls X gelöscht rts | extern uintD shiftright_loop_down (uintD* ptr, uintC count, uintC i); @@ -1363,19 +1363,19 @@ C(shiftright_loop_down:) | Input in a0,d0.W,d1.W, Output in d0 moveq #32,$d5 subw $d1,$d5 | a0 = ptr, d0.W = count, d1.W = i, d5.W = 32-i, - | d2.L = Schiebe-Übertrag (i Bits), d3.L = Schiebe-Akku + | d2.L = Schiebe-Übertrag (i Bits), d3.L = Schiebe-Akku clrl $d2 bras 2f - 1: | a0 = Aufwärtszähler Adresse, d0.W = Herabzähler, d1.W = i, d5.W = 32-i, - | d2.L = Schiebe-Übertrag (obere i Bits, restliche 32-i Bits sind 0) + 1: | a0 = Aufwärtszähler Adresse, d0.W = Herabzähler, d1.W = i, d5.W = 32-i, + | d2.L = Schiebe-Übertrag (obere i Bits, restliche 32-i Bits sind 0) | d3.L = Schiebe-Akku movel $a0@-,$d3 | neue Daten movel $d3,$d4 lsrl $d1,$d3 | um i Bits rechts schieben - orl $d2,$d3 | und mit vorigem Übertrag kombinieren + orl $d2,$d3 | und mit vorigem Übertrag kombinieren movel $d3,$a0@ | ablegen lsll $d5,$d4 | um (32-i) Bits links geschoben - movel $d4,$d2 | liefert neuen Übertrag + movel $d4,$d2 | liefert neuen Übertrag 2: dbra $d0,1b | Schleife d0.W mal durchlaufen movel $d2,$d0 moveml $sp@+,$d2-$d5 @@ -1388,19 +1388,19 @@ C(shiftright_loop_down:) | Input in a0,d0.W,d1.W, Output in d0 moveq #-1,$d5 lsrl $d1,$d5 | a0 = ptr, d0.W = count, d1.W = i, d5.L = 2^(32-i)-1, - | d2.L = Schiebe-Übertrag (i Bits), d3.L = Schiebe-Akku + | d2.L = Schiebe-Übertrag (i Bits), d3.L = Schiebe-Akku clrl $d2 bras 2f - 1: | a0 = Aufwärtszähler Adresse, d0.W = Herabzähler, d1.W = i, d5.L = 2^(32-i)-1, - | d2.L = Schiebe-Übertrag (obere i Bits, restliche 32-i Bits sind 0) + 1: | a0 = Aufwärtszähler Adresse, d0.W = Herabzähler, d1.W = i, d5.L = 2^(32-i)-1, + | d2.L = Schiebe-Übertrag (obere i Bits, restliche 32-i Bits sind 0) | d3.L = Schiebe-Akku movel $a0@-,$d3 | neue Daten rorl $d1,$d3 | um i Bits rechts rotieren movel $d3,$d4 andl $d5,$d3 | untere 32-i Bits eorl $d3,$d4 | obere i Bits - orl $d2,$d3 | und mit vorigem Übertrag kombinieren - movel $d4,$d2 | neuer Übertrag + orl $d2,$d3 | und mit vorigem Übertrag kombinieren + movel $d4,$d2 | neuer Übertrag movel $d3,$a0@ | ablegen 2: dbra $d0,1b | Schleife d0.W mal durchlaufen movel $d2,$d0 @@ -1419,22 +1419,22 @@ C(shiftrightsigned_loop_down:) | Input in a0,d0.W,d1.W, Output in d0 moveq #32,$d5 subw $d1,$d5 | a0 = ptr, d0.W = count, d1.W = i, d5.W = 32-i, - | d2.L = Schiebe-Übertrag (i Bits), d3.L = Schiebe-Akku + | d2.L = Schiebe-Übertrag (i Bits), d3.L = Schiebe-Akku subqw #1,$d0 movel $a0@-,$d3 | erstes Digit movel $d3,$d4 asrl $d1,$d3 | um i Bits rechts schieben bras 2f - 1: | a0 = Aufwärtszähler Adresse, d0.W = Herabzähler, d1.W = i, d5.W = 32-i, - | d2.L = Schiebe-Übertrag (obere i Bits, restliche 32-i Bits sind 0) + 1: | a0 = Aufwärtszähler Adresse, d0.W = Herabzähler, d1.W = i, d5.W = 32-i, + | d2.L = Schiebe-Übertrag (obere i Bits, restliche 32-i Bits sind 0) | d3.L = Schiebe-Akku movel $a0@-,$d3 | neue Daten movel $d3,$d4 lsrl $d1,$d3 | um i Bits rechts schieben - orl $d2,$d3 | und mit vorigem Übertrag kombinieren + orl $d2,$d3 | und mit vorigem Übertrag kombinieren 2: movel $d3,$a0@ | ablegen lsll $d5,$d4 | um (32-i) Bits links geschoben - movel $d4,$d2 | liefert neuen Übertrag + movel $d4,$d2 | liefert neuen Übertrag dbra $d0,1b | Schleife d0.W mal durchlaufen movel $d2,$d0 moveml $sp@+,$d2-$d5 @@ -1447,7 +1447,7 @@ C(shiftrightsigned_loop_down:) | Input in a0,d0.W,d1.W, Output in d0 moveq #-1,$d5 lsrl $d1,$d5 | a0 = ptr, d0.W = count, d1.W = i, d5.L = 2^(32-i)-1, - | d2.L = Schiebe-Übertrag (i Bits), d3.L = Schiebe-Akku + | d2.L = Schiebe-Übertrag (i Bits), d3.L = Schiebe-Akku subqw #1,$d0 movel $a0@-,$d3 | erstes Digit movel $d3,$d4 @@ -1457,16 +1457,16 @@ C(shiftrightsigned_loop_down:) | Input in a0,d0.W,d1.W, Output in d0 andl $d4,$d2 | obere 32-i Bits asrl $d1,$d3 | erstes Digit um i Bits rechts shiften bras 2f - 1: | a0 = Aufwärtszähler Adresse, d0.W = Herabzähler, d1.W = i, d5.L = 2^(32-i)-1, - | d2.L = Schiebe-Übertrag (obere i Bits, restliche 32-i Bits sind 0) + 1: | a0 = Aufwärtszähler Adresse, d0.W = Herabzähler, d1.W = i, d5.L = 2^(32-i)-1, + | d2.L = Schiebe-Übertrag (obere i Bits, restliche 32-i Bits sind 0) | d3.L = Schiebe-Akku movel $a0@-,$d3 | neue Daten rorl $d1,$d3 | um i Bits rechts rotieren movel $d3,$d4 andl $d5,$d3 | untere 32-i Bits eorl $d3,$d4 | obere i Bits - orl $d2,$d3 | und mit vorigem Übertrag kombinieren - movel $d4,$d2 | neuer Übertrag + orl $d2,$d3 | und mit vorigem Übertrag kombinieren + movel $d4,$d2 | neuer Übertrag 2: movel $d3,$a0@ | ablegen dbra $d0,1b | Schleife d0.W mal durchlaufen movel $d2,$d0 @@ -1487,18 +1487,18 @@ C(shiftrightcopy_loop_down:) | Input in a0,a1,d0.W,d1.W,d2, Output in d0 moveq #32,$d5 subw $d1,$d5 | a0 = ptr, d0.W = count, d1.W = i, d5.W = 32-i - | d2.L = Schiebe-Übertrag (i Bits), d3.L = Schiebe-Akku + | d2.L = Schiebe-Übertrag (i Bits), d3.L = Schiebe-Akku bras 2f - 1: | a0,a1 = Aufwärtszähler Adresse, d0.W = Herabzähler, d1.W = i, d5.W = 32-i - | d2.L = Schiebe-Übertrag (obere i Bits, restliche 32-i Bits sind 0) + 1: | a0,a1 = Aufwärtszähler Adresse, d0.W = Herabzähler, d1.W = i, d5.W = 32-i + | d2.L = Schiebe-Übertrag (obere i Bits, restliche 32-i Bits sind 0) | d3.L = Schiebe-Akku movel $a0@-,$d3 | neue Daten movel $d3,$d4 lsrl $d1,$d3 | um i Bits rechts schieben - orl $d2,$d3 | und mit vorigem Übertrag kombinieren + orl $d2,$d3 | und mit vorigem Übertrag kombinieren movel $d3,$a1@- | ablegen movel $d4,$d2 - 2: lsll $d5,$d2 | um (32-i) Bits links geschoben, gibt neuen Übertrag + 2: lsll $d5,$d2 | um (32-i) Bits links geschoben, gibt neuen Übertrag dbra $d0,1b | Schleife d0.W mal durchlaufen movel $d2,$d0 moveml $sp@+,$d2-$d5 @@ -1514,18 +1514,18 @@ C(shiftrightcopy_loop_down:) | Input in a0,a1,d0.W,d1.W,d2, Output in d0 lsrl $d1,$d5 rorl $d1,$d2 | a0 = ptr, d0.W = count, d1.W = i, d5.L = 2^(32-i)-1 - | d2.L = Schiebe-Übertrag (i Bits), d3.L = Schiebe-Akku + | d2.L = Schiebe-Übertrag (i Bits), d3.L = Schiebe-Akku bras 2f - 1: | a0,a1 = Aufwärtszähler Adresse, d0.W = Herabzähler, d1.W = i, d5.L = 2^(32-i)-1 - | d2.L = Schiebe-Übertrag (obere i Bits, restliche 32-i Bits sind 0) + 1: | a0,a1 = Aufwärtszähler Adresse, d0.W = Herabzähler, d1.W = i, d5.L = 2^(32-i)-1 + | d2.L = Schiebe-Übertrag (obere i Bits, restliche 32-i Bits sind 0) | d3.L = Schiebe-Akku movel $a0@-,$d3 | neue Daten rorl $d1,$d3 | um i Bits rechts rotieren movel $d3,$d4 andl $d5,$d3 | untere 32-i Bits eorl $d3,$d4 | obere i Bits - orl $d2,$d3 | und mit vorigem Übertrag kombinieren - movel $d4,$d2 | neuer Übertrag + orl $d2,$d3 | und mit vorigem Übertrag kombinieren + movel $d4,$d2 | neuer Übertrag movel $d3,$a1@- | ablegen 2: dbra $d0,1b | Schleife d0.W mal durchlaufen movel $d2,$d0 @@ -1541,9 +1541,9 @@ C(mulusmall_loop_up:) | Input in d0,a0,d1.W,d2, Output in d0 movel $sp@(12+8),$a0 movew $sp@(12+12+2),$d1 movel $sp@(12+16),$d2 - addw #0,$d1 | X-Bit löschen + addw #0,$d1 | X-Bit löschen bras 2f - 1: movel $a0@,$d3 | nächstes Digit + 1: movel $a0@,$d3 | nächstes Digit mulul $d0,$d4:$d3 | mit digit multiplizieren addxl $d2,$d3 | und bisherigen Carry und X-Bit addieren movel $d3,$a0@+ | Low-Digit ablegen @@ -1563,9 +1563,9 @@ C(mulu_loop_up:) | Input in d0,a0,a1,d1.W movel $sp@(12+8),$a0 movel $sp@(12+12),$a1 movew $sp@(12+16+2),$d1 - subl $d2,$d2 | carry := 0, X-Bit löschen + subl $d2,$d2 | carry := 0, X-Bit löschen bras 2f - 1: movel $a0@+,$d3 | nächstes Digit + 1: movel $a0@+,$d3 | nächstes Digit mulul $d0,$d4:$d3 | mit digit multiplizieren addxl $d2,$d3 | und bisherigen Carry und X-Bit addieren movel $d3,$a1@+ | Low-Digit ablegen @@ -1585,7 +1585,7 @@ C(mulu_loop_up:) | Input in d0,a0,a1,d1.W clrl $d5 | 0 clrl $d2 | carry bras 2f - 1: movel $a0@+,$d3 | nächstes Digit + 1: movel $a0@+,$d3 | nächstes Digit mulul $d0,$d4:$d3 | mit digit multiplizieren addl $d2,$d3 | und bisherigen Carry addieren addxl $d5,$d4 @@ -1606,13 +1606,13 @@ C(muluadd_loop_up:) | Input in d0,a0,a1,d1.W, Output in d0 movel $sp@(16+12),$a1 movew $sp@(16+16+2),$d1 clrl $d5 | 0 - subl $d2,$d2 | carry := 0, X-Bit löschen + subl $d2,$d2 | carry := 0, X-Bit löschen bras 2f - 1: movel $a0@+,$d3 | nächstes Digit + 1: movel $a0@+,$d3 | nächstes Digit mulul $d0,$d4:$d3 | mit digit multiplizieren addxl $d2,$d3 | und bisherigen Carry und X-Bit addieren addxl $d5,$d4 - addl $d3,$a1@+ | Low-Digit zum dest-Digit addieren, X als Übertrag + addl $d3,$a1@+ | Low-Digit zum dest-Digit addieren, X als Übertrag movel $d4,$d2 | High-Digit gibt neuen Carry 2: dbra $d1,1b addxl $d5,$d2 | letztes X-Bit addieren @@ -1629,13 +1629,13 @@ C(mulusub_loop_up:) | Input in d0,a0,a1,d1.W, Output in d0 movel $sp@(16+12),$a1 movew $sp@(16+16+2),$d1 clrl $d5 | 0 - subl $d2,$d2 | carry := 0, X-Bit löschen + subl $d2,$d2 | carry := 0, X-Bit löschen bras 2f - 1: movel $a0@+,$d3 | nächstes Digit + 1: movel $a0@+,$d3 | nächstes Digit mulul $d0,$d4:$d3 | mit digit multiplizieren addxl $d2,$d3 | und bisherigen Carry und X-Bit addieren addxl $d5,$d4 - subl $d3,$a1@+ | Low-Digit vom dest-Digit subtrahieren, X als Übertrag + subl $d3,$a1@+ | Low-Digit vom dest-Digit subtrahieren, X als Übertrag movel $d4,$d2 | High-Digit gibt neuen Carry 2: dbra $d1,1b clrl $d0 @@ -1652,7 +1652,7 @@ C(divu_loop_down:) | Input in d0,a0,d1.W, Output in d0 movew $sp@(8+12+2),$d1 clrl $d2 | Rest := 0 bras 2f - 1: movel $a0@-,$d3 | nächst-niedriges Digit + 1: movel $a0@-,$d3 | nächst-niedriges Digit divul $d0,$d2:$d3 | mit Rest kombinieren und durch digit dividieren movel $d3,$a0@ | Quotient ablegen, Rest in d2 2: dbra $d1,1b @@ -1670,7 +1670,7 @@ C(divucopy_loop_down:) | Input in d0,a0,a1,d1.W, Output in d0 movew $sp@(8+16+2),$d1 clrl $d2 | Rest := 0 bras 2f - 1: movel $a0@-,$d3 | nächst-niedriges Digit + 1: movel $a0@-,$d3 | nächst-niedriges Digit divul $d0,$d2:$d3 | mit Rest kombinieren und durch digit dividieren movel $d3,$a1@- | Quotient ablegen, Rest in d2 2: dbra $d1,1b @@ -1692,15 +1692,15 @@ C(shiftxor_loop_up:) | Input in a0,a1,d0.W,d1.W subw $d1,$d5 clrl $d2 | a0 = xptr, a1 = yptr, d0.W = count, d1.W = i, d5.W = 32-i, - | d2.L = Schiebe-Übertrag (i Bits), d3.L = Schiebe-Akku + | d2.L = Schiebe-Übertrag (i Bits), d3.L = Schiebe-Akku bras 2f 1: movel $a1@+,$d3 | d3.L = neues Digit movel $d3,$d4 lsll $d1,$d4 | um i Bits nach links schieben - orl $d2,$d4 | mit vorigem Übertrag kombinieren + orl $d2,$d4 | mit vorigem Übertrag kombinieren eorl $d4,$a0@+ | 32 Bits ablegen movel $d3,$d2 - lsrl $d5,$d2 | neuen Übertrag bilden + lsrl $d5,$d2 | neuen Übertrag bilden 2: dbra $d0,1b | Schleife d0.W mal durchlaufen eorl $d2,$a0@ moveml $sp@+,$d2-$d5 diff --git a/src/base/digitseq/cl_asm_mips_.cc b/src/base/digitseq/cl_asm_mips_.cc index 0f23dab..f91244b 100644 --- a/src/base/digitseq/cl_asm_mips_.cc +++ b/src/base/digitseq/cl_asm_mips_.cc @@ -2,12 +2,12 @@ // Prozessor: MIPS // Endianness: irrelevant // Compiler: GNU-C oder ... -// Parameter-Übergabe: +// Parameter-Übergabe: // o32: in Registern $4,$5,$6,$7, und auf dem Stack 16($sp),... // n32: in Registern $4,$5,$6,$7,$8,$9,$10,$11, und auf dem Stack 4($sp),... -// Rückgabewert: in Register $2 +// Rückgabewert: in Register $2 // Einstellungen: intCsize=32, intDsize=32. -// Besonderheiten: Nach jedem Ladebefehl ein Wartetakt nötig, bevor der +// Besonderheiten: Nach jedem Ladebefehl ein Wartetakt nötig, bevor der // geholte Wert benutzt werden darf. // Strictly speaking, the MIPS ABI (-32 or -n32) is independent from the CPU diff --git a/src/base/digitseq/cl_asm_sparc64_.cc b/src/base/digitseq/cl_asm_sparc64_.cc index e4acced..22f3db7 100644 --- a/src/base/digitseq/cl_asm_sparc64_.cc +++ b/src/base/digitseq/cl_asm_sparc64_.cc @@ -1,15 +1,15 @@ // Externe Routinen zu ARILEV1.D // Prozessor: SPARC 64-bit // Compiler: GNU-C oder ... -// Parameter-Übergabe: in Registern %o0-%o5. -// Parameter-Übergabe: in Registern %o0-%o5. +// Parameter-Übergabe: in Registern %o0-%o5. +// Parameter-Übergabe: in Registern %o0-%o5. // Argumente vom Typ uint8, uint16, uint32 sind bereits vom Aufrufer zu // uint64 umgewandelt worden (zero-extend, "srl reg,0,reg"). // Argumente vom Typ sint8, sint16, sint32 sind bereits vom Aufrufer zu // sint64 umgewandelt worden (sign-extend, "sra reg,0,reg"). -// Ergebnisse vom Typ uint8, uint16, uint32 müssen vor Rückgabe zu uint64 +// Ergebnisse vom Typ uint8, uint16, uint32 müssen vor Rückgabe zu uint64 // umgewandelt werden (zero-extend, "srl reg,0,reg"). -// Ergebnisse vom Typ sint8, sint16, sint32 müssen vor Rückgabe zu sint64 +// Ergebnisse vom Typ sint8, sint16, sint32 müssen vor Rückgabe zu sint64 // umgewandelt werden (sign-extend, "sra reg,0,reg"). // Einstellungen: intCsize=32, intDsize=32. @@ -32,11 +32,11 @@ #define DECLARE_FUNCTION(name) #endif - // Indikatoren für Anweisungen (Instruktionen) in Delay-Slots - // (diese werden VOR der vorigen Instruktion ausgeführt): - #define _ // Instruktion, die stets ausgeführt wird - #define __ // Instruktion, die nur im Sprung-Fall ausgeführt wird - // Abkürzungen für Anweisungen: + // Indikatoren für Anweisungen (Instruktionen) in Delay-Slots + // (diese werden VOR der vorigen Instruktion ausgeführt): + #define _ // Instruktion, die stets ausgeführt wird + #define __ // Instruktion, die nur im Sprung-Fall ausgeführt wird + // Abkürzungen für Anweisungen: #define ret jmp %i7+8 // return from subroutine #define retl jmp %o7+8 // return from leaf subroutine (no save/restore) @@ -73,7 +73,7 @@ #endif #define LOOP_TYPE 1 // 1: Standard-Schleifen - // 2: Schleifen ohne Pointer, nur mit Zähler + // 2: Schleifen ohne Pointer, nur mit Zähler #define STANDARD_LOOPS (LOOP_TYPE==1) #define COUNTER_LOOPS (LOOP_TYPE==2) @@ -128,7 +128,7 @@ C(mulu64_:) // Input in %o0,%o1, Output in %o0,%g2 _ movcs %xcc,%o3,%g2 // add carry to high part // extern struct { uint32 q; uint32 r; } divu_6432_3232_ (uint32 xhi, uint32 xlo, uint32 y); -// x = 2^32*xhi+xlo = q*y+r schreiben. Sei bekannt, daß 0 <= x < 2^32*y . +// x = 2^32*xhi+xlo = q*y+r schreiben. Sei bekannt, daß 0 <= x < 2^32*y . DECLARE_FUNCTION(divu_6432_3232_) C(divu_6432_3232_:) // Input in %o0,%o1,%o2, Output in %o0,%g1 wr %o0,%g0,%y @@ -139,7 +139,7 @@ C(divu_6432_3232_:) // Input in %o0,%o1,%o2, Output in %o0,%g1 _ srl %o0,0,%o0 // extern struct { uint16 q; uint16 r; } divu_3216_1616_ (uint32 x, uint16 y); -// x = q*y+r schreiben. Sei bekannt, daß 0 <= x < 2^16*y . +// x = q*y+r schreiben. Sei bekannt, daß 0 <= x < 2^16*y . DECLARE_FUNCTION(divu_3216_1616_) C(divu_3216_1616_:) // Input in %o0,%o1, Output in %o0 (Rest und Quotient). wr %g0,%g0,%y @@ -197,8 +197,8 @@ C(copy_loop_up:) // Input in %o0,%o1,%o2, Output in %o0 sllx %o2,3,%o2 // %o2 = -8*count sub %o0,%o2,%o0 // %o0 = &sourceptr[count] sub %o1,%o2,%o1 // %o1 = &destptr[count-1] -1: ldx [%o0+%o2],%o3 // nächstes Digit holen - addcc %o2,8,%o2 // Zähler "erniedrigen", Pointer erhöhen +1: ldx [%o0+%o2],%o3 // nächstes Digit holen + addcc %o2,8,%o2 // Zähler "erniedrigen", Pointer erhöhen bne,pt %xcc,1b _ stx %o3,[%o1+%o2] // Digit ablegen 2: retl @@ -228,8 +228,8 @@ C(copy_loop_down:) // Input in %o0,%o1,%o2, Output in %o0 sllx %o2,3,%o2 // %o2 = 8*count sub %o0,%o2,%o0 // %o0 = &sourceptr[-count-1] sub %o1,%o2,%o1 // %o1 = &destptr[-count] -1: ldx [%o0+%o2],%o3 // nächstes Digit holen - subcc %o2,8,%o2 // Zähler erniedrigen, Pointer erniedrigen +1: ldx [%o0+%o2],%o3 // nächstes Digit holen + subcc %o2,8,%o2 // Zähler erniedrigen, Pointer erniedrigen bne,pt %xcc,1b _ stx %o3,[%o1+%o2] // Digit ablegen 2: retl @@ -257,7 +257,7 @@ C(fill_loop_up:) // Input in %o0,%o1,%o2, Output in %o0 sub %g0,%o1,%o1 // %o1 = -count sllx %o1,3,%o1 // %o1 = -8*count sub %o0,%o1,%o0 // %o0 = &destptr[count-1] -1: addcc %o1,8,%o1 // Zähler "erniedrigen", Pointer erhöhen +1: addcc %o1,8,%o1 // Zähler "erniedrigen", Pointer erhöhen bne,pt %xcc,1b _ stx %o2,[%o0+%o1] // Digit ablegen 2: retl @@ -283,7 +283,7 @@ C(fill_loop_down:) // Input in %o0,%o1,%o2, Output in %o0 brz,pn %o1,2f _ sllx %o1,3,%o1 // %o1 = 8*count sub %o0,%o1,%o0 // %o0 = &destptr[-count] -1: subcc %o1,8,%o1 // Zähler erniedrigen, Pointer erniedrigen +1: subcc %o1,8,%o1 // Zähler erniedrigen, Pointer erniedrigen bne,pt %xcc,1b _ stx %o2,[%o0+%o1] // Digit ablegen 2: retl @@ -311,7 +311,7 @@ C(clear_loop_up:) // Input in %o0,%o1, Output in %o0 sub %g0,%o1,%o1 // %o1 = -count sllx %o1,3,%o1 // %o1 = -8*count sub %o0,%o1,%o0 // %o0 = &destptr[count-1] -1: addcc %o1,8,%o1 // Zähler "erniedrigen", Pointer erhöhen +1: addcc %o1,8,%o1 // Zähler "erniedrigen", Pointer erhöhen bne,pt %xcc,1b _ stx %g0,[%o0+%o1] // Digit 0 ablegen 2: retl @@ -337,7 +337,7 @@ C(clear_loop_down:) // Input in %o0,%o1, Output in %o0 brz,pn %o1,2f _ sllx %o1,3,%o1 // %o1 = 8*count sub %o0,%o1,%o0 // %o0 = &destptr[-count] -1: subcc %o1,8,%o1 // Zähler erniedrigen, Pointer erniedrigen +1: subcc %o1,8,%o1 // Zähler erniedrigen, Pointer erniedrigen bne,pt %xcc,1b _ stx %g0,[%o0+%o1] // Digit 0 ablegen 2: retl @@ -368,11 +368,11 @@ C(test_loop_up:) // Input in %o0,%o1, Output in %o0 _ sub %g0,%o1,%o1 // %o1 = -count sllx %o1,3,%o1 // %o1 = -8*count sub %o0,%o1,%o0 // %o0 = &ptr[count] - ldx [%o0+%o1],%o2 // nächstes Digit holen + ldx [%o0+%o1],%o2 // nächstes Digit holen 1: brnz,pn %o2,3f // testen - _ addcc %o1,8,%o1 // Zähler "erniedrigen", Pointer erhöhen + _ addcc %o1,8,%o1 // Zähler "erniedrigen", Pointer erhöhen bne,a,pt %xcc,1b - __ ldx [%o0+%o1],%o2 // nächstes Digit holen + __ ldx [%o0+%o1],%o2 // nächstes Digit holen 2: retl _ mov 0,%o0 3: retl @@ -403,11 +403,11 @@ C(test_loop_down:) // Input in %o0,%o1, Output in %o0 _ sllx %o1,3,%o1 // %o1 = 8*count sub %o0,%o1,%o0 // %o0 = &ptr[-count] sub %o1,8,%o1 - ldx [%o0+%o1],%o2 // nächstes Digit holen + ldx [%o0+%o1],%o2 // nächstes Digit holen 1: brnz,pn %o2,3f // testen - _ subcc %o1,8,%o1 // Zähler erniedrigen, Pointer erniedrigen + _ subcc %o1,8,%o1 // Zähler erniedrigen, Pointer erniedrigen bcc,a,pt %xcc,1b - __ ldx [%o0+%o1],%o2 // nächstes Digit holen + __ ldx [%o0+%o1],%o2 // nächstes Digit holen 2: retl _ mov 0,%o0 3: retl @@ -426,7 +426,7 @@ C(or_loop_up:) // Input in %o0,%o1,%o2 1: ldx [%o0],%o3 // *xptr ldx [%o0+%o1],%o4 // *yptr subcc %o2,1,%o2 - or %o3,%o4,%o3 // verknüpfen + or %o3,%o4,%o3 // verknüpfen stx %o3,[%o0] // =: *xptr bne,pt %xcc,1b _ add %o0,8,%o0 // xptr++, yptr++ @@ -441,10 +441,10 @@ C(or_loop_up:) // Input in %o0,%o1,%o2 sllx %o2,3,%o2 // %o2 = -8*count sub %o0,%o2,%o0 // %o0 = &xptr[count-1] sub %o1,%o2,%o1 // %o1 = &yptr[count] -1: ldx [%o1+%o2],%o3 // nächstes Digit holen - addcc %o2,8,%o2 // Zähler "erniedrigen", Pointer erhöhen +1: ldx [%o1+%o2],%o3 // nächstes Digit holen + addcc %o2,8,%o2 // Zähler "erniedrigen", Pointer erhöhen ldx [%o0+%o2],%o4 // noch ein Digit holen - or %o4,%o3,%o3 // beide verknüpfen + or %o4,%o3,%o3 // beide verknüpfen bne,pt %xcc,1b _ stx %o3,[%o1+%o2] // Digit ablegen 2: retl @@ -463,7 +463,7 @@ C(xor_loop_up:) // Input in %o0,%o1,%o2 1: ldx [%o0],%o3 // *xptr ldx [%o0+%o1],%o4 // *yptr subcc %o2,1,%o2 - xor %o3,%o4,%o3 // verknüpfen + xor %o3,%o4,%o3 // verknüpfen stx %o3,[%o0] // =: *xptr bne,pt %xcc,1b _ add %o0,8,%o0 // xptr++, yptr++ @@ -478,10 +478,10 @@ C(xor_loop_up:) // Input in %o0,%o1,%o2 sllx %o2,3,%o2 // %o2 = -8*count sub %o0,%o2,%o0 // %o0 = &xptr[count-1] sub %o1,%o2,%o1 // %o1 = &yptr[count] -1: ldx [%o1+%o2],%o3 // nächstes Digit holen - addcc %o2,8,%o2 // Zähler "erniedrigen", Pointer erhöhen +1: ldx [%o1+%o2],%o3 // nächstes Digit holen + addcc %o2,8,%o2 // Zähler "erniedrigen", Pointer erhöhen ldx [%o0+%o2],%o4 // noch ein Digit holen - xor %o4,%o3,%o3 // beide verknüpfen + xor %o4,%o3,%o3 // beide verknüpfen bne,pt %xcc,1b _ stx %o3,[%o1+%o2] // Digit ablegen 2: retl @@ -500,7 +500,7 @@ C(and_loop_up:) // Input in %o0,%o1,%o2 1: ldx [%o0],%o3 // *xptr ldx [%o0+%o1],%o4 // *yptr subcc %o2,1,%o2 - and %o3,%o4,%o3 // verknüpfen + and %o3,%o4,%o3 // verknüpfen stx %o3,[%o0] // =: *xptr bne,pt %xcc,1b _ add %o0,8,%o0 // xptr++, yptr++ @@ -515,10 +515,10 @@ C(and_loop_up:) // Input in %o0,%o1,%o2 sllx %o2,3,%o2 // %o2 = -8*count sub %o0,%o2,%o0 // %o0 = &xptr[count-1] sub %o1,%o2,%o1 // %o1 = &yptr[count] -1: ldx [%o1+%o2],%o3 // nächstes Digit holen - addcc %o2,8,%o2 // Zähler "erniedrigen", Pointer erhöhen +1: ldx [%o1+%o2],%o3 // nächstes Digit holen + addcc %o2,8,%o2 // Zähler "erniedrigen", Pointer erhöhen ldx [%o0+%o2],%o4 // noch ein Digit holen - and %o4,%o3,%o3 // beide verknüpfen + and %o4,%o3,%o3 // beide verknüpfen bne,pt %xcc,1b _ stx %o3,[%o1+%o2] // Digit ablegen 2: retl @@ -535,7 +535,7 @@ C(eqv_loop_up:) // Input in %o0,%o1,%o2 1: ldx [%o0],%o3 // *xptr ldx [%o0+%o1],%o4 // *yptr subcc %o2,1,%o2 - xnor %o3,%o4,%o3 // verknüpfen + xnor %o3,%o4,%o3 // verknüpfen stx %o3,[%o0] // =: *xptr bne,pt %xcc,1b _ add %o0,8,%o0 // xptr++, yptr++ @@ -550,10 +550,10 @@ C(eqv_loop_up:) // Input in %o0,%o1,%o2 sllx %o2,3,%o2 // %o2 = -8*count sub %o0,%o2,%o0 // %o0 = &xptr[count-1] sub %o1,%o2,%o1 // %o1 = &yptr[count] -1: ldx [%o1+%o2],%o3 // nächstes Digit holen - addcc %o2,8,%o2 // Zähler "erniedrigen", Pointer erhöhen +1: ldx [%o1+%o2],%o3 // nächstes Digit holen + addcc %o2,8,%o2 // Zähler "erniedrigen", Pointer erhöhen ldx [%o0+%o2],%o4 // noch ein Digit holen - xnor %o4,%o3,%o3 // beide verknüpfen + xnor %o4,%o3,%o3 // beide verknüpfen bne,pt %xcc,1b _ stx %o3,[%o1+%o2] // Digit ablegen 2: retl @@ -570,7 +570,7 @@ C(nand_loop_up:) // Input in %o0,%o1,%o2 1: ldx [%o0],%o3 // *xptr ldx [%o0+%o1],%o4 // *yptr subcc %o2,1,%o2 - and %o3,%o4,%o3 // verknüpfen + and %o3,%o4,%o3 // verknüpfen xnor %g0,%o3,%o3 stx %o3,[%o0] // =: *xptr bne,pt %xcc,1b @@ -586,10 +586,10 @@ C(nand_loop_up:) // Input in %o0,%o1,%o2 sllx %o2,3,%o2 // %o2 = -8*count sub %o0,%o2,%o0 // %o0 = &xptr[count-1] sub %o1,%o2,%o1 // %o1 = &yptr[count] -1: ldx [%o1+%o2],%o3 // nächstes Digit holen - addcc %o2,8,%o2 // Zähler "erniedrigen", Pointer erhöhen +1: ldx [%o1+%o2],%o3 // nächstes Digit holen + addcc %o2,8,%o2 // Zähler "erniedrigen", Pointer erhöhen ldx [%o0+%o2],%o4 // noch ein Digit holen - and %o4,%o3,%o3 // beide verknüpfen + and %o4,%o3,%o3 // beide verknüpfen xnor %g0,%o3,%o3 bne,pt %xcc,1b _ stx %o3,[%o1+%o2] // Digit ablegen @@ -607,7 +607,7 @@ C(nor_loop_up:) // Input in %o0,%o1,%o2 1: ldx [%o0],%o3 // *xptr ldx [%o0+%o1],%o4 // *yptr subcc %o2,1,%o2 - or %o3,%o4,%o3 // verknüpfen + or %o3,%o4,%o3 // verknüpfen xnor %g0,%o3,%o3 stx %o3,[%o0] // =: *xptr bne,pt %xcc,1b @@ -623,10 +623,10 @@ C(nor_loop_up:) // Input in %o0,%o1,%o2 sllx %o2,3,%o2 // %o2 = -8*count sub %o0,%o2,%o0 // %o0 = &xptr[count-1] sub %o1,%o2,%o1 // %o1 = &yptr[count] -1: ldx [%o1+%o2],%o3 // nächstes Digit holen - addcc %o2,8,%o2 // Zähler "erniedrigen", Pointer erhöhen +1: ldx [%o1+%o2],%o3 // nächstes Digit holen + addcc %o2,8,%o2 // Zähler "erniedrigen", Pointer erhöhen ldx [%o0+%o2],%o4 // noch ein Digit holen - or %o4,%o3,%o3 // beide verknüpfen + or %o4,%o3,%o3 // beide verknüpfen xnor %g0,%o3,%o3 bne,pt %xcc,1b _ stx %o3,[%o1+%o2] // Digit ablegen @@ -644,7 +644,7 @@ C(andc2_loop_up:) // Input in %o0,%o1,%o2 1: ldx [%o0],%o3 // *xptr ldx [%o0+%o1],%o4 // *yptr subcc %o2,1,%o2 - andn %o3,%o4,%o3 // verknüpfen + andn %o3,%o4,%o3 // verknüpfen stx %o3,[%o0] // =: *xptr bne,pt %xcc,1b _ add %o0,8,%o0 // xptr++, yptr++ @@ -659,10 +659,10 @@ C(andc2_loop_up:) // Input in %o0,%o1,%o2 sllx %o2,3,%o2 // %o2 = -8*count sub %o0,%o2,%o0 // %o0 = &xptr[count-1] sub %o1,%o2,%o1 // %o1 = &yptr[count] -1: ldx [%o1+%o2],%o3 // nächstes Digit holen - addcc %o2,8,%o2 // Zähler "erniedrigen", Pointer erhöhen +1: ldx [%o1+%o2],%o3 // nächstes Digit holen + addcc %o2,8,%o2 // Zähler "erniedrigen", Pointer erhöhen ldx [%o0+%o2],%o4 // noch ein Digit holen - andn %o4,%o3,%o3 // beide verknüpfen + andn %o4,%o3,%o3 // beide verknüpfen bne,pt %xcc,1b _ stx %o3,[%o1+%o2] // Digit ablegen 2: retl @@ -679,7 +679,7 @@ C(orc2_loop_up:) // Input in %o0,%o1,%o2 1: ldx [%o0],%o3 // *xptr ldx [%o0+%o1],%o4 // *yptr subcc %o2,1,%o2 - orn %o3,%o4,%o3 // verknüpfen + orn %o3,%o4,%o3 // verknüpfen stx %o3,[%o0] // =: *xptr bne,pt %xcc,1b _ add %o0,8,%o0 // xptr++, yptr++ @@ -694,10 +694,10 @@ C(orc2_loop_up:) // Input in %o0,%o1,%o2 sllx %o2,3,%o2 // %o2 = -8*count sub %o0,%o2,%o0 // %o0 = &xptr[count-1] sub %o1,%o2,%o1 // %o1 = &yptr[count] -1: ldx [%o1+%o2],%o3 // nächstes Digit holen - addcc %o2,8,%o2 // Zähler "erniedrigen", Pointer erhöhen +1: ldx [%o1+%o2],%o3 // nächstes Digit holen + addcc %o2,8,%o2 // Zähler "erniedrigen", Pointer erhöhen ldx [%o0+%o2],%o4 // noch ein Digit holen - orn %o4,%o3,%o3 // beide verknüpfen + orn %o4,%o3,%o3 // beide verknüpfen bne,pt %xcc,1b _ stx %o3,[%o1+%o2] // Digit ablegen 2: retl @@ -727,8 +727,8 @@ C(not_loop_up:) // Input in %o0,%o1 sub %g0,%o1,%o1 // %o1 = -count sllx %o1,3,%o1 // %o1 = -8*count sub %o0,%o1,%o0 // %o0 = &destptr[count-1] -1: addcc %o1,8,%o1 // Zähler "erniedrigen", Pointer erhöhen - ldx [%o0+%o1],%o2 // nächstes Digit holen +1: addcc %o1,8,%o1 // Zähler "erniedrigen", Pointer erhöhen + ldx [%o0+%o1],%o2 // nächstes Digit holen xnor %g0,%o2,%o2 bne,pt %xcc,1b _ stx %o2,[%o0+%o1] // Digit ablegen @@ -763,13 +763,13 @@ C(and_test_loop_up:) // Input in %o0,%o1,%o2, Output in %o0 sllx %o2,3,%o2 // %o2 = -8*count sub %o0,%o2,%o0 // %o0 = &xptr[count] sub %o1,%o2,%o1 // %o1 = &yptr[count] - ldx [%o0+%o2],%o3 // nächstes Digit holen + ldx [%o0+%o2],%o3 // nächstes Digit holen 1: ldx [%o1+%o2],%o4 // noch ein Digit holen - andcc %o3,%o4,%g0 // beide verknüpfen + andcc %o3,%o4,%g0 // beide verknüpfen bne,pn %xcc,3f - _ addcc %o2,8,%o2 // Zähler "erniedrigen", Pointer erhöhen + _ addcc %o2,8,%o2 // Zähler "erniedrigen", Pointer erhöhen bne,a,pt %xcc,1b - __ ldx [%o0+%o2],%o3 // nächstes Digit holen + __ ldx [%o0+%o2],%o3 // nächstes Digit holen 2: retl _ mov 0,%o0 3: retl @@ -808,13 +808,13 @@ C(compare_loop_up:) // Input in %o0,%o1,%o2, Output in %o0 sllx %o2,3,%o2 // %o2 = -8*count sub %o0,%o2,%o0 // %o0 = &xptr[count] sub %o1,%o2,%o1 // %o1 = &yptr[count] - ldx [%o0+%o2],%o3 // nächstes Digit holen + ldx [%o0+%o2],%o3 // nächstes Digit holen 1: ldx [%o1+%o2],%o4 // noch ein Digit holen subcc %o3,%o4,%g0 // vergleichen bne,pn %xcc,3f - _ addcc %o2,8,%o2 // Zähler "erniedrigen", Pointer erhöhen + _ addcc %o2,8,%o2 // Zähler "erniedrigen", Pointer erhöhen bne,a,pt %xcc,1b - __ ldx [%o0+%o2],%o3 // nächstes Digit holen + __ ldx [%o0+%o2],%o3 // nächstes Digit holen 2: retl _ mov 0,%o0 3: subcc %o3,%o4,%g0 // nochmals vergleichen @@ -828,7 +828,7 @@ C(compare_loop_up:) // Input in %o0,%o1,%o2, Output in %o0 // extern uintD add_loop_down (uintD* sourceptr1, uintD* sourceptr2, uintD* destptr, uintC count); DECLARE_FUNCTION(add_loop_down) -C(add_loop_down:) // Input in %o0,%o1,%o2,%o3, verändert %g1, Output in %o0 +C(add_loop_down:) // Input in %o0,%o1,%o2,%o3, verändert %g1, Output in %o0 #if STANDARD_LOOPS // srl %o3,0,%o3 // zero-extend %o3 = count brz,pn %o3,2f @@ -946,7 +946,7 @@ C(inc_loop_down:) // Input in %o0,%o1, Output in %o0 1: addcc %o2,1,%o2 // incrementieren bne,pn %xcc,3f _ stx %o2,[%o0+%o1] // ablegen - subcc %o1,8,%o1 // Zähler erniedrigen, Pointer erniedrigen + subcc %o1,8,%o1 // Zähler erniedrigen, Pointer erniedrigen bne,a,pt %xcc,1b __ ldx [%o0+%o1],%o2 2: retl @@ -957,7 +957,7 @@ C(inc_loop_down:) // Input in %o0,%o1, Output in %o0 // extern uintD sub_loop_down (uintD* sourceptr1, uintD* sourceptr2, uintD* destptr, uintC count); DECLARE_FUNCTION(sub_loop_down) -C(sub_loop_down:) // Input in %o0,%o1,%o2,%o3, verändert %g1, Output in %o0 +C(sub_loop_down:) // Input in %o0,%o1,%o2,%o3, verändert %g1, Output in %o0 #if STANDARD_LOOPS // srl %o3,0,%o3 // zero-extend %o3 = count brz,pn %o3,2f @@ -1003,7 +1003,7 @@ C(sub_loop_down:) // Input in %o0,%o1,%o2,%o3, ver // extern uintD subx_loop_down (uintD* sourceptr1, uintD* sourceptr2, uintD* destptr, uintC count, uintD carry); DECLARE_FUNCTION(subx_loop_down) -C(subx_loop_down:) // Input in %o0,%o1,%o2,%o3,%o4, verändert %g1, Output in %o0 +C(subx_loop_down:) // Input in %o0,%o1,%o2,%o3,%o4, verändert %g1, Output in %o0 #if STANDARD_LOOPS // srl %o3,0,%o3 // zero-extend %o3 = count brz,pn %o3,2f @@ -1121,7 +1121,7 @@ C(dec_loop_down:) // Input in %o0,%o1, Output in %o0 1: subcc %o2,1,%o2 // decrementieren bcc,pn %xcc,3f _ stx %o2,[%o0+%o1] // ablegen - subcc %o1,8,%o1 // Zähler erniedrigen, Pointer erniedrigen + subcc %o1,8,%o1 // Zähler erniedrigen, Pointer erniedrigen bne,a,pt %xcc,1b __ ldx [%o0+%o1],%o2 2: retl @@ -1170,7 +1170,7 @@ C(neg_loop_down:) // Input in %o0,%o1, Output in %o0 ldx [%o0+%o1],%o2 // digit holen 1: subcc %g0,%o2,%o2 // negieren, testen bne,pn %xcc,3f - _ subcc %o1,8,%o1 // Zähler erniedrigen, Pointer erniedrigen + _ subcc %o1,8,%o1 // Zähler erniedrigen, Pointer erniedrigen bne,a,pt %xcc,1b __ ldx [%o0+%o1],%o2 2: retl @@ -1212,7 +1212,7 @@ C(shift1left_loop_down:) // Input in %o0,%o1, Output in %o0 // extern uintD shiftleft_loop_down (uintD* ptr, uintC count, uintC i, uintD carry); DECLARE_FUNCTION(shiftleft_loop_down) -C(shiftleft_loop_down:) // Input in %o0,%o1,%o2,%o3, verändert %g1, Output in %o0 +C(shiftleft_loop_down:) // Input in %o0,%o1,%o2,%o3, verändert %g1, Output in %o0 // srl %o1,0,%o1 // zero-extend %o1 = count brz,pn %o1,2f _ sub %g0,%o2,%g1 // 64-i (mod 64) @@ -1222,7 +1222,7 @@ C(shiftleft_loop_down:) // Input in %o0,%o1,%o2,%o3, ver sllx %o4,%o2,%o5 // dessen niedere (64-i) Bits or %o3,%o5,%o5 // mit dem alten Carry kombinieren stx %o5,[%o0] // Digit ablegen - srlx %o4,%g1,%o3 // dessen höchste i Bits liefern den neuen Carry + srlx %o4,%g1,%o3 // dessen höchste i Bits liefern den neuen Carry bne,pt %xcc,1b _ sub %o0,8,%o0 2: retl @@ -1230,7 +1230,7 @@ C(shiftleft_loop_down:) // Input in %o0,%o1,%o2,%o3, ver // extern uintD shiftleftcopy_loop_down (uintD* sourceptr, uintD* destptr, uintC count, uintC i); DECLARE_FUNCTION(shiftleftcopy_loop_down) -C(shiftleftcopy_loop_down:) // Input in %o0,%o1,%o2,%o3, verändert %g1,%g2, Output in %o0 +C(shiftleftcopy_loop_down:) // Input in %o0,%o1,%o2,%o3, verändert %g1,%g2, Output in %o0 // srl %o2,0,%o2 // zero-extend %o2 = count brz,pn %o2,2f _ mov 0,%o4 // Carry := 0 @@ -1242,7 +1242,7 @@ C(shiftleftcopy_loop_down:) // Input in %o0,%o1,%o2,%o3, ver or %o4,%g2,%g2 // mit dem alten Carry kombinieren sub %o1,8,%o1 stx %g2,[%o1] // Digit ablegen - srlx %o5,%g1,%o4 // dessen höchste i Bits liefern den neuen Carry + srlx %o5,%g1,%o4 // dessen höchste i Bits liefern den neuen Carry bne,pt %xcc,1b _ sub %o0,8,%o0 2: retl @@ -1267,7 +1267,7 @@ C(shift1right_loop_up:) // Input in %o0,%o1,%o2, Output in %o0 // extern uintD shiftright_loop_up (uintD* ptr, uintC count, uintC i); DECLARE_FUNCTION(shiftright_loop_up) -C(shiftright_loop_up:) // Input in %o0,%o1,%o2, verändert %g1, Output in %o0 +C(shiftright_loop_up:) // Input in %o0,%o1,%o2, verändert %g1, Output in %o0 // srl %o1,0,%o1 // zero-extend %o1 = count sub %g0,%o2,%g1 // 64-i (mod 64) brz,pn %o1,2f @@ -1285,7 +1285,7 @@ C(shiftright_loop_up:) // Input in %o0,%o1,%o2, ver // extern uintD shiftrightsigned_loop_up (uintD* ptr, uintC count, uintC i); DECLARE_FUNCTION(shiftrightsigned_loop_up) -C(shiftrightsigned_loop_up:) // Input in %o0,%o1,%o2, verändert %g1, Output in %o0 +C(shiftrightsigned_loop_up:) // Input in %o0,%o1,%o2, verändert %g1, Output in %o0 // srl %o1,0,%o1 // zero-extend %o1 = count ldx [%o0],%o4 // erstes Digit sub %g0,%o2,%g1 // 64-i (mod 64) @@ -1308,7 +1308,7 @@ C(shiftrightsigned_loop_up:) // Input in %o0,%o1,%o2, ver // extern uintD shiftrightcopy_loop_up (uintD* sourceptr, uintD* destptr, uintC count, uintC i, uintD carry); DECLARE_FUNCTION(shiftrightcopy_loop_up) -C(shiftrightcopy_loop_up:) // Input in %o0,%o1,%o2,%o3,%o4, verändert %g1,%g2, Output in %o0 +C(shiftrightcopy_loop_up:) // Input in %o0,%o1,%o2,%o3,%o4, verändert %g1,%g2, Output in %o0 // srl %o2,0,%o2 // zero-extend %o2 = count sub %g0,%o3,%g1 // 64-i (mod 64) brz,pn %o2,2f @@ -1327,11 +1327,11 @@ C(shiftrightcopy_loop_up:) // Input in %o0,%o1,%o2,%o3,%o4, ver // extern uintD mulusmall_loop_down (uintD digit, uintD* ptr, uintC len, uintD newdigit); DECLARE_FUNCTION(mulusmall_loop_down) -C(mulusmall_loop_down:) // Input in %o0,%o1,%o2,%o3, Output in %o0, verändert %g1 +C(mulusmall_loop_down:) // Input in %o0,%o1,%o2,%o3, Output in %o0, verändert %g1 // srl %o2,0,%o2 // zero-extend %o2 = len brz,pn %o2,2f _ sub %o1,8,%o1 -1: // nächstes Digit [%o1] mit der 6-Bit-Zahl %o0 multiplizieren +1: // nächstes Digit [%o1] mit der 6-Bit-Zahl %o0 multiplizieren // und kleinen Carry %o3 dazu: ldx [%o1],%o4 sub %o2,1,%o2 @@ -1362,7 +1362,7 @@ C(mulu_loop_down:) // Input in %i0,%i1,%i2,%i3 sllx %l3,32,%l3 // %l3 = 2^32 sub %i1,%i2,%i1 // %i1 = sourceptr - destptr 1: sub %i2,8,%i2 - ldx [%i1+%i2],%o0 // nächstes Digit + ldx [%i1+%i2],%o0 // nächstes Digit subcc %i3,1,%i3 // mit digit multiplizieren: (%l1*2^32+%l2) * %o0 + %l0 -> %l0|%o0 srlx %o0,32,%o1 @@ -1402,7 +1402,7 @@ C(muluadd_loop_down:) // Input in %i0,%i1,%i2,%i3, Output in %i0 sllx %l3,32,%l3 // %l3 = 2^32 sub %i1,%i2,%i1 // %i1 = sourceptr - destptr 1: sub %i2,8,%i2 - ldx [%i1+%i2],%o0 // nächstes Digit + ldx [%i1+%i2],%o0 // nächstes Digit ldx [%i2],%i4 // *destptr subcc %i3,1,%i3 // mit digit multiplizieren: (%l1*2^32+%l2) * %o0 + %l0 -> %l0|%o0 @@ -1446,7 +1446,7 @@ C(mulusub_loop_down:) // Input in %i0,%i1,%i2,%i3, Output in %i0 sllx %l3,32,%l3 // %l3 = 2^32 sub %i1,%i2,%i1 // %i1 = sourceptr - destptr 1: sub %i2,8,%i2 - ldx [%i1+%i2],%o0 // nächstes Digit + ldx [%i1+%i2],%o0 // nächstes Digit ldx [%i2],%i4 // *destptr subcc %i3,1,%i3 // mit digit multiplizieren: (%l1*2^32+%l2) * %o0 + %l0 -> %l0|%o0 @@ -1494,7 +1494,7 @@ C(or_loop_down:) // Input in %o0,%o1,%o2 1: ldx [%o0],%o3 // *xptr ldx [%o0+%o1],%o4 // *yptr subcc %o2,1,%o2 - or %o3,%o4,%o3 // verknüpfen + or %o3,%o4,%o3 // verknüpfen stx %o3,[%o0] // =: *xptr bne,pt %xcc,1b _ sub %o0,8,%o0 // xptr++, yptr++ @@ -1507,10 +1507,10 @@ C(or_loop_down:) // Input in %o0,%o1,%o2 _ sllx %o2,3,%o2 // %o2 = 8*count sub %o0,%o2,%o0 // %o0 = &xptr[-count] sub %o1,%o2,%o1 // %o1 = &yptr[-count] -1: subcc %o2,8,%o2 // Zähler erniedrigen, Pointer erniedrigen - ldx [%o1+%o2],%o3 // nächstes Digit holen +1: subcc %o2,8,%o2 // Zähler erniedrigen, Pointer erniedrigen + ldx [%o1+%o2],%o3 // nächstes Digit holen ldx [%o0+%o2],%o4 // noch ein Digit holen - or %o4,%o3,%o3 // beide verknüpfen + or %o4,%o3,%o3 // beide verknüpfen bne,pt %xcc,1b _ stx %o3,[%o1+%o2] // Digit ablegen 2: retl @@ -1528,7 +1528,7 @@ C(xor_loop_down:) // Input in %o0,%o1,%o2 1: ldx [%o0],%o3 // *xptr ldx [%o0+%o1],%o4 // *yptr subcc %o2,1,%o2 - xor %o3,%o4,%o3 // verknüpfen + xor %o3,%o4,%o3 // verknüpfen stx %o3,[%o0] // =: *xptr bne,pt %xcc,1b _ sub %o0,8,%o0 // xptr++, yptr++ @@ -1541,10 +1541,10 @@ C(xor_loop_down:) // Input in %o0,%o1,%o2 _ sllx %o2,3,%o2 // %o2 = 8*count sub %o0,%o2,%o0 // %o0 = &xptr[-count] sub %o1,%o2,%o1 // %o1 = &yptr[-count] -1: subcc %o2,8,%o2 // Zähler erniedrigen, Pointer erniedrigen - ldx [%o1+%o2],%o3 // nächstes Digit holen +1: subcc %o2,8,%o2 // Zähler erniedrigen, Pointer erniedrigen + ldx [%o1+%o2],%o3 // nächstes Digit holen ldx [%o0+%o2],%o4 // noch ein Digit holen - xor %o4,%o3,%o3 // beide verknüpfen + xor %o4,%o3,%o3 // beide verknüpfen bne,pt %xcc,1b _ stx %o3,[%o1+%o2] // Digit ablegen 2: retl @@ -1562,7 +1562,7 @@ C(and_loop_down:) // Input in %o0,%o1,%o2 1: ldx [%o0],%o3 // *xptr ldx [%o0+%o1],%o4 // *yptr subcc %o2,1,%o2 - and %o3,%o4,%o3 // verknüpfen + and %o3,%o4,%o3 // verknüpfen stx %o3,[%o0] // =: *xptr bne,pt %xcc,1b _ sub %o0,8,%o0 // xptr++, yptr++ @@ -1575,10 +1575,10 @@ C(and_loop_down:) // Input in %o0,%o1,%o2 _ sllx %o2,3,%o2 // %o2 = 8*count sub %o0,%o2,%o0 // %o0 = &xptr[-count] sub %o1,%o2,%o1 // %o1 = &yptr[-count] -1: subcc %o2,8,%o2 // Zähler erniedrigen, Pointer erniedrigen - ldx [%o1+%o2],%o3 // nächstes Digit holen +1: subcc %o2,8,%o2 // Zähler erniedrigen, Pointer erniedrigen + ldx [%o1+%o2],%o3 // nächstes Digit holen ldx [%o0+%o2],%o4 // noch ein Digit holen - and %o4,%o3,%o3 // beide verknüpfen + and %o4,%o3,%o3 // beide verknüpfen bne,pt %xcc,1b _ stx %o3,[%o1+%o2] // Digit ablegen 2: retl @@ -1596,7 +1596,7 @@ C(eqv_loop_down:) // Input in %o0,%o1,%o2 1: ldx [%o0],%o3 // *xptr ldx [%o0+%o1],%o4 // *yptr subcc %o2,1,%o2 - xnor %o3,%o4,%o3 // verknüpfen + xnor %o3,%o4,%o3 // verknüpfen stx %o3,[%o0] // =: *xptr bne,pt %xcc,1b _ sub %o0,8,%o0 // xptr++, yptr++ @@ -1609,10 +1609,10 @@ C(eqv_loop_down:) // Input in %o0,%o1,%o2 _ sllx %o2,3,%o2 // %o2 = 8*count sub %o0,%o2,%o0 // %o0 = &xptr[-count] sub %o1,%o2,%o1 // %o1 = &yptr[-count] -1: subcc %o2,8,%o2 // Zähler erniedrigen, Pointer erniedrigen - ldx [%o1+%o2],%o3 // nächstes Digit holen +1: subcc %o2,8,%o2 // Zähler erniedrigen, Pointer erniedrigen + ldx [%o1+%o2],%o3 // nächstes Digit holen ldx [%o0+%o2],%o4 // noch ein Digit holen - xnor %o4,%o3,%o3 // beide verknüpfen + xnor %o4,%o3,%o3 // beide verknüpfen bne,pt %xcc,1b _ stx %o3,[%o1+%o2] // Digit ablegen 2: retl @@ -1630,7 +1630,7 @@ C(nand_loop_down:) // Input in %o0,%o1,%o2 1: ldx [%o0],%o3 // *xptr ldx [%o0+%o1],%o4 // *yptr subcc %o2,1,%o2 - and %o3,%o4,%o3 // verknüpfen + and %o3,%o4,%o3 // verknüpfen xnor %g0,%o3,%o3 stx %o3,[%o0] // =: *xptr bne,pt %xcc,1b @@ -1644,10 +1644,10 @@ C(nand_loop_down:) // Input in %o0,%o1,%o2 _ sllx %o2,3,%o2 // %o2 = 8*count sub %o0,%o2,%o0 // %o0 = &xptr[-count] sub %o1,%o2,%o1 // %o1 = &yptr[-count] -1: subcc %o2,8,%o2 // Zähler erniedrigen, Pointer erniedrigen - ldx [%o1+%o2],%o3 // nächstes Digit holen +1: subcc %o2,8,%o2 // Zähler erniedrigen, Pointer erniedrigen + ldx [%o1+%o2],%o3 // nächstes Digit holen ldx [%o0+%o2],%o4 // noch ein Digit holen - and %o4,%o3,%o3 // beide verknüpfen + and %o4,%o3,%o3 // beide verknüpfen xnor %g0,%o3,%o3 bne,pt %xcc,1b _ stx %o3,[%o1+%o2] // Digit ablegen @@ -1666,7 +1666,7 @@ C(nor_loop_down:) // Input in %o0,%o1,%o2 1: ldx [%o0],%o3 // *xptr ldx [%o0+%o1],%o4 // *yptr subcc %o2,1,%o2 - or %o3,%o4,%o3 // verknüpfen + or %o3,%o4,%o3 // verknüpfen xnor %g0,%o3,%o3 stx %o3,[%o0] // =: *xptr bne,pt %xcc,1b @@ -1680,10 +1680,10 @@ C(nor_loop_down:) // Input in %o0,%o1,%o2 _ sllx %o2,3,%o2 // %o2 = 8*count sub %o0,%o2,%o0 // %o0 = &xptr[-count] sub %o1,%o2,%o1 // %o1 = &yptr[-count] -1: subcc %o2,8,%o2 // Zähler erniedrigen, Pointer erniedrigen - ldx [%o1+%o2],%o3 // nächstes Digit holen +1: subcc %o2,8,%o2 // Zähler erniedrigen, Pointer erniedrigen + ldx [%o1+%o2],%o3 // nächstes Digit holen ldx [%o0+%o2],%o4 // noch ein Digit holen - or %o4,%o3,%o3 // beide verknüpfen + or %o4,%o3,%o3 // beide verknüpfen xnor %g0,%o3,%o3 bne,pt %xcc,1b _ stx %o3,[%o1+%o2] // Digit ablegen @@ -1702,7 +1702,7 @@ C(andc2_loop_down:) // Input in %o0,%o1,%o2 1: ldx [%o0],%o3 // *xptr ldx [%o0+%o1],%o4 // *yptr subcc %o2,1,%o2 - andn %o3,%o4,%o3 // verknüpfen + andn %o3,%o4,%o3 // verknüpfen stx %o3,[%o0] // =: *xptr bne,pt %xcc,1b _ sub %o0,8,%o0 // xptr++, yptr++ @@ -1715,10 +1715,10 @@ C(andc2_loop_down:) // Input in %o0,%o1,%o2 _ sllx %o2,3,%o2 // %o2 = 8*count sub %o0,%o2,%o0 // %o0 = &xptr[-count] sub %o1,%o2,%o1 // %o1 = &yptr[-count] -1: subcc %o2,8,%o2 // Zähler erniedrigen, Pointer erniedrigen - ldx [%o1+%o2],%o3 // nächstes Digit holen +1: subcc %o2,8,%o2 // Zähler erniedrigen, Pointer erniedrigen + ldx [%o1+%o2],%o3 // nächstes Digit holen ldx [%o0+%o2],%o4 // noch ein Digit holen - andn %o4,%o3,%o3 // beide verknüpfen + andn %o4,%o3,%o3 // beide verknüpfen bne,pt %xcc,1b _ stx %o3,[%o1+%o2] // Digit ablegen 2: retl @@ -1736,7 +1736,7 @@ C(orc2_loop_down:) // Input in %o0,%o1,%o2 1: ldx [%o0],%o3 // *xptr ldx [%o0+%o1],%o4 // *yptr subcc %o2,1,%o2 - orn %o3,%o4,%o3 // verknüpfen + orn %o3,%o4,%o3 // verknüpfen stx %o3,[%o0] // =: *xptr bne,pt %xcc,1b _ sub %o0,8,%o0 // xptr++, yptr++ @@ -1749,10 +1749,10 @@ C(orc2_loop_down:) // Input in %o0,%o1,%o2 _ sllx %o2,3,%o2 // %o2 = 8*count sub %o0,%o2,%o0 // %o0 = &xptr[-count] sub %o1,%o2,%o1 // %o1 = &yptr[-count] -1: subcc %o2,8,%o2 // Zähler erniedrigen, Pointer erniedrigen - ldx [%o1+%o2],%o3 // nächstes Digit holen +1: subcc %o2,8,%o2 // Zähler erniedrigen, Pointer erniedrigen + ldx [%o1+%o2],%o3 // nächstes Digit holen ldx [%o0+%o2],%o4 // noch ein Digit holen - orn %o4,%o3,%o3 // beide verknüpfen + orn %o4,%o3,%o3 // beide verknüpfen bne,pt %xcc,1b _ stx %o3,[%o1+%o2] // Digit ablegen 2: retl @@ -1780,8 +1780,8 @@ C(not_loop_down:) // Input in %o0,%o1 brz,pn %o1,2f _ sllx %o1,3,%o1 // %o1 = 8*count sub %o0,%o1,%o0 // %o0 = &destptr[-count] -1: subcc %o1,8,%o1 // Zähler erniedrigen, Pointer erniedrigen - ldx [%o0+%o1],%o2 // nächstes Digit holen +1: subcc %o1,8,%o1 // Zähler erniedrigen, Pointer erniedrigen + ldx [%o0+%o1],%o2 // nächstes Digit holen xnor %g0,%o2,%o2 bne,pt %xcc,1b _ stx %o2,[%o0+%o1] // Digit ablegen @@ -1819,13 +1819,13 @@ C(and_test_loop_down:) // Input in %o0,%o1,%o2, Output in %o0 subcc %o2,8,%o2 bcs,pn %xcc,2f _ nop - ldx [%o0+%o2],%o3 // nächstes Digit holen + ldx [%o0+%o2],%o3 // nächstes Digit holen 1: ldx [%o1+%o2],%o4 // noch ein Digit holen - andcc %o3,%o4,%g0 // beide verknüpfen + andcc %o3,%o4,%g0 // beide verknüpfen bne,pn %xcc,3f - _ subcc %o2,8,%o2 // Zähler erniedrigen, Pointer erniedrigen + _ subcc %o2,8,%o2 // Zähler erniedrigen, Pointer erniedrigen bcc,a,pt %xcc,1b - __ ldx [%o0+%o2],%o3 // nächstes Digit holen + __ ldx [%o0+%o2],%o3 // nächstes Digit holen 2: retl _ mov 0,%o0 3: retl @@ -1862,13 +1862,13 @@ C(compare_loop_down:) // Input in %o0,%o1,%o2, Output in %o0 subcc %o2,8,%o2 bcs,pn %xcc,4f _ nop - ldx [%o0+%o2],%o3 // nächstes Digit holen + ldx [%o0+%o2],%o3 // nächstes Digit holen 1: ldx [%o1+%o2],%o4 // noch ein Digit holen - subcc %o2,8,%o2 // Zähler erniedrigen, Pointer erniedrigen + subcc %o2,8,%o2 // Zähler erniedrigen, Pointer erniedrigen bcs,pn %xcc,3f _ subcc %o3,%o4,%g0 // vergleichen be,a,pt %xcc,1b - __ ldx [%o0+%o2],%o3 // nächstes Digit holen + __ ldx [%o0+%o2],%o3 // nächstes Digit holen 2: mov 1,%o0 movlu %xcc,-1,%o0 retl @@ -1881,7 +1881,7 @@ C(compare_loop_down:) // Input in %o0,%o1,%o2, Output in %o0 // extern uintD add_loop_up (uintD* sourceptr1, uintD* sourceptr2, uintD* destptr, uintC count); DECLARE_FUNCTION(add_loop_up) -C(add_loop_up:) // Input in %o0,%o1,%o2,%o3, verändert %g1, Output in %o0 +C(add_loop_up:) // Input in %o0,%o1,%o2,%o3, verändert %g1, Output in %o0 #if STANDARD_LOOPS // srl %o3,0,%o3 // zero-extend %o3 = count brz,pn %o3,2f @@ -1917,7 +1917,7 @@ C(add_loop_up:) // Input in %o0,%o1,%o2,%o3, ver movcc %xcc,0,%g1 // %g1|%o4 := %o4 + alter Carry %g1 addcc %o4,%o5,%o4 movcs %xcc,1,%g1 // %g1|%o4 := %o4 + alter Carry %g1 + %o5 - addcc %o3,8,%o3 // Zähler erniedrigen, Pointer erhöhen + addcc %o3,8,%o3 // Zähler erniedrigen, Pointer erhöhen bne,pt %xcc,1b _ stx %o4,[%o2+%o3] // Digit ablegen 2: retl @@ -1960,7 +1960,7 @@ C(addto_loop_up:) // Input in %o0,%o1,%o2, Output in %o0 addcc %o3,%o4,%o4 movcs %xcc,1,%o5 // %o5|%o4 := %o3 + alter Carry %o5 + %o4 stx %o4,[%o1+%o2] // Digit ablegen - addcc %o2,8,%o2 // Zähler erniedrigen, Pointer erhöhen + addcc %o2,8,%o2 // Zähler erniedrigen, Pointer erhöhen bne,a,pt %xcc,1b __ ldx [%o0+%o2],%o3 // source-digit 2: retl @@ -1997,7 +1997,7 @@ C(inc_loop_up:) // Input in %o0,%o1, Output in %o0 1: addcc %o2,1,%o2 // incrementieren bne,pn %xcc,3f _ stx %o2,[%o0+%o1] // ablegen - addcc %o1,8,%o1 // Zähler erniedrigen, Pointer erhöhen + addcc %o1,8,%o1 // Zähler erniedrigen, Pointer erhöhen bne,a,pt %xcc,1b __ ldx [%o0+%o1],%o2 2: retl @@ -2008,7 +2008,7 @@ C(inc_loop_up:) // Input in %o0,%o1, Output in %o0 // extern uintD sub_loop_up (uintD* sourceptr1, uintD* sourceptr2, uintD* destptr, uintC count); DECLARE_FUNCTION(sub_loop_up) -C(sub_loop_up:) // Input in %o0,%o1,%o2,%o3, verändert %g1, Output in %o0 +C(sub_loop_up:) // Input in %o0,%o1,%o2,%o3, verändert %g1, Output in %o0 #if STANDARD_LOOPS // srl %o3,0,%o3 // zero-extend %o3 = count brz,pn %o3,2f @@ -2053,7 +2053,7 @@ C(sub_loop_up:) // Input in %o0,%o1,%o2,%o3, ver // extern uintD subx_loop_up (uintD* sourceptr1, uintD* sourceptr2, uintD* destptr, uintC count, uintD carry); DECLARE_FUNCTION(subx_loop_up) -C(subx_loop_up:) // Input in %o0,%o1,%o2,%o3,%o4, verändert %g1, Output in %o0 +C(subx_loop_up:) // Input in %o0,%o1,%o2,%o3,%o4, verändert %g1, Output in %o0 #if STANDARD_LOOPS // srl %o3,0,%o3 // zero-extend %o3 = count brz,pn %o3,2f @@ -2169,7 +2169,7 @@ C(dec_loop_up:) // Input in %o0,%o1, Output in %o0 1: subcc %o2,1,%o2 // decrementieren bcc,pn %xcc,3f _ stx %o2,[%o0+%o1] // ablegen - addcc %o1,8,%o1 // Zähler erniedrigen, Pointer erhöhen + addcc %o1,8,%o1 // Zähler erniedrigen, Pointer erhöhen bne,a,pt %xcc,1b __ ldx [%o0+%o1],%o2 2: retl @@ -2217,7 +2217,7 @@ C(neg_loop_up:) // Input in %o0,%o1, Output in %o0 ldx [%o0+%o1],%o2 // digit holen 1: subcc %g0,%o2,%o2 // negieren, testen bne,pn %xcc,3f - _ addcc %o1,8,%o1 // Zähler erniedrigen, Pointer erhöhen + _ addcc %o1,8,%o1 // Zähler erniedrigen, Pointer erhöhen bne,a,pt %xcc,1b __ ldx [%o0+%o1],%o2 2: retl @@ -2258,7 +2258,7 @@ C(shift1left_loop_up:) // Input in %o0,%o1, Output in %o0 // extern uintD shiftleft_loop_up (uintD* ptr, uintC count, uintC i, uintD carry); DECLARE_FUNCTION(shiftleft_loop_up) -C(shiftleft_loop_up:) // Input in %o0,%o1,%o2,%o3, verändert %g1, Output in %o0 +C(shiftleft_loop_up:) // Input in %o0,%o1,%o2,%o3, verändert %g1, Output in %o0 // srl %o1,0,%o1 // zero-extend %o1 = count brz,pn %o1,2f _ sub %g0,%o2,%g1 // 64-i (mod 64) @@ -2267,7 +2267,7 @@ C(shiftleft_loop_up:) // Input in %o0,%o1,%o2,%o3, ver sllx %o4,%o2,%o5 // dessen niedere (64-i) Bits or %o3,%o5,%o5 // mit dem alten Carry kombinieren stx %o5,[%o0] // Digit ablegen - srlx %o4,%g1,%o3 // dessen höchste i Bits liefern den neuen Carry + srlx %o4,%g1,%o3 // dessen höchste i Bits liefern den neuen Carry bne,pt %xcc,1b _ add %o0,8,%o0 2: retl @@ -2277,7 +2277,7 @@ C(shiftleft_loop_up:) // Input in %o0,%o1,%o2,%o3, ver // extern uintD shiftleftcopy_loop_up (uintD* sourceptr, uintD* destptr, uintC count, uintC i); DECLARE_FUNCTION(shiftleftcopy_loop_up) -C(shiftleftcopy_loop_up:) // Input in %o0,%o1,%o2,%o3, verändert %g1,%g2, Output in %o0 +C(shiftleftcopy_loop_up:) // Input in %o0,%o1,%o2,%o3, verändert %g1,%g2, Output in %o0 // srl %o2,0,%o2 // zero-extend %o2 = count brz,pn %o2,2f _ mov 0,%o4 // Carry := 0 @@ -2288,7 +2288,7 @@ C(shiftleftcopy_loop_up:) // Input in %o0,%o1,%o2,%o3, ver or %o4,%g2,%g2 // mit dem alten Carry kombinieren stx %g2,[%o1] // Digit ablegen add %o1,8,%o1 - srlx %o5,%g1,%o4 // dessen höchste i Bits liefern den neuen Carry + srlx %o5,%g1,%o4 // dessen höchste i Bits liefern den neuen Carry bne,pt %xcc,1b _ add %o0,8,%o0 2: retl @@ -2316,7 +2316,7 @@ C(shift1right_loop_down:) // Input in %o0,%o1,%o2, Output in %o0 // extern uintD shiftright_loop_down (uintD* ptr, uintC count, uintC i); DECLARE_FUNCTION(shiftright_loop_down) -C(shiftright_loop_down:) // Input in %o0,%o1,%o2, verändert %g1, Output in %o0 +C(shiftright_loop_down:) // Input in %o0,%o1,%o2, verändert %g1, Output in %o0 // srl %o1,0,%o1 // zero-extend %o1 = count sub %g0,%o2,%g1 // 64-i (mod 64) brz,pn %o1,2f @@ -2335,7 +2335,7 @@ C(shiftright_loop_down:) // Input in %o0,%o1,%o2, ver // extern uintD shiftrightsigned_loop_down (uintD* ptr, uintC count, uintC i); DECLARE_FUNCTION(shiftrightsigned_loop_down) -C(shiftrightsigned_loop_down:) // Input in %o0,%o1,%o2, verändert %g1, Output in %o0 +C(shiftrightsigned_loop_down:) // Input in %o0,%o1,%o2, verändert %g1, Output in %o0 // srl %o1,0,%o1 // zero-extend %o1 = count ldx [%o0-8],%o4 // erstes Digit sub %g0,%o2,%g1 // 64-i (mod 64) @@ -2358,7 +2358,7 @@ C(shiftrightsigned_loop_down:) // Input in %o0,%o1,%o2, ver // extern uintD shiftrightcopy_loop_down (uintD* sourceptr, uintD* destptr, uintC count, uintC i, uintD carry); DECLARE_FUNCTION(shiftrightcopy_loop_down) -C(shiftrightcopy_loop_down:) // Input in %o0,%o1,%o2,%o3,%o4, verändert %g1,%g2, Output in %o0 +C(shiftrightcopy_loop_down:) // Input in %o0,%o1,%o2,%o3,%o4, verändert %g1,%g2, Output in %o0 // srl %o2,0,%o2 // zero-extend %o2 = count sub %g0,%o3,%g1 // 64-i (mod 64) brz,pn %o2,2f @@ -2378,11 +2378,11 @@ C(shiftrightcopy_loop_down:) // Input in %o0,%o1,%o2,%o3,%o4, ver // extern uintD mulusmall_loop_up (uintD digit, uintD* ptr, uintC len, uintD newdigit); DECLARE_FUNCTION(mulusmall_loop_up) -C(mulusmall_loop_up:) // Input in %o0,%o1,%o2,%o3, Output in %o0, verändert %g1 +C(mulusmall_loop_up:) // Input in %o0,%o1,%o2,%o3, Output in %o0, verändert %g1 // srl %o2,0,%o2 // zero-extend %o2 = len brz,pn %o2,2f _ nop -1: // nächstes Digit [%o1] mit der 6-Bit-Zahl %o0 multiplizieren +1: // nächstes Digit [%o1] mit der 6-Bit-Zahl %o0 multiplizieren // und kleinen Carry %o3 dazu: ldx [%o1],%o4 sub %o2,1,%o2 @@ -2412,7 +2412,7 @@ C(mulu_loop_up:) // Input in %i0,%i1,%i2,%i3 mov 1,%l3 sllx %l3,32,%l3 // %l3 = 2^32 sub %i1,%i2,%i1 // %i1 = sourceptr - destptr -1: ldx [%i1+%i2],%o0 // nächstes Digit +1: ldx [%i1+%i2],%o0 // nächstes Digit subcc %i3,1,%i3 // mit digit multiplizieren: (%l1*2^32+%l2) * %o0 + %l0 -> %l0|%o0 srlx %o0,32,%o1 @@ -2452,7 +2452,7 @@ C(muluadd_loop_up:) // Input in %i0,%i1,%i2,%i3, Output in %i0 mov 1,%l3 sllx %l3,32,%l3 // %l3 = 2^32 sub %i1,%i2,%i1 // %i1 = sourceptr - destptr -1: ldx [%i1+%i2],%o0 // nächstes Digit +1: ldx [%i1+%i2],%o0 // nächstes Digit ldx [%i2],%i4 // *destptr subcc %i3,1,%i3 // mit digit multiplizieren: (%l1*2^32+%l2) * %o0 + %l0 -> %l0|%o0 @@ -2496,7 +2496,7 @@ C(mulusub_loop_up:) // Input in %i0,%i1,%i2,%i3, Output in %i0 mov 1,%l3 sllx %l3,32,%l3 // %l3 = 2^32 sub %i1,%i2,%i1 // %i1 = sourceptr - destptr -1: ldx [%i1+%i2],%o0 // nächstes Digit +1: ldx [%i1+%i2],%o0 // nächstes Digit ldx [%i2],%i4 // *destptr subcc %i3,1,%i3 // mit digit multiplizieren: (%l1*2^32+%l2) * %o0 + %l0 -> %l0|%o0 @@ -2534,7 +2534,7 @@ C(mulusub_loop_up:) // Input in %i0,%i1,%i2,%i3, Output in %i0 // extern void shiftxor_loop_up (uintD* xptr, const uintD* yptr, uintC count, uintC i); DECLARE_FUNCTION(shiftxor_loop_up) -C(shiftxor_loop_up:) // Input in %o0,%o1,%o2,%o3, verändert %g1,%g2 +C(shiftxor_loop_up:) // Input in %o0,%o1,%o2,%o3, verändert %g1,%g2 // srl %o2,0,%o2 // zero-extend %o2 = count brz,pn %o2,2f _ sub %g0,%o3,%g1 // 64-i (mod 64) @@ -2546,10 +2546,10 @@ C(shiftxor_loop_up:) // Input in %o0,%o1,%o2,%o3, ver xor %o4,%g2,%o4 // mit dem modifizierten *xptr kombinieren stx %o4,[%o0] // und ablegen add %o0,8,%o0 - srlx %o5,%g1,%g2 // höchste i Bits von *yptr - ldx [%o0],%o4 // schon mal mit dem nächsten *xptr + srlx %o5,%g1,%g2 // höchste i Bits von *yptr + ldx [%o0],%o4 // schon mal mit dem nächsten *xptr bne,pt %xcc,1b - _ xor %o4,%g2,%o4 // verknüpfen + _ xor %o4,%g2,%o4 // verknüpfen stx %o4,[%o0] // und ablegen 2: retl _ nop diff --git a/src/base/digitseq/cl_asm_sparc_.cc b/src/base/digitseq/cl_asm_sparc_.cc index aac70ae..01c6431 100644 --- a/src/base/digitseq/cl_asm_sparc_.cc +++ b/src/base/digitseq/cl_asm_sparc_.cc @@ -1,7 +1,7 @@ // Externe Routinen zu ARILEV1.D // Prozessor: SPARC // Compiler: GNU-C oder SUN-C -// Parameter-Übergabe: in Registern %o0-%o5. +// Parameter-Übergabe: in Registern %o0-%o5. // Einstellungen: intCsize=32, intDsize=32. #if defined(sparc_v8) || defined(__sparc_v8) || defined(__sparc_v8__) @@ -31,11 +31,11 @@ #define DECLARE_FUNCTION(name) #endif - // Indikatoren für Anweisungen (Instruktionen) in Delay-Slots - // (diese werden VOR der vorigen Instruktion ausgeführt): - #define _ // Instruktion, die stets ausgeführt wird - #define __ // Instruktion, die nur im Sprung-Fall ausgeführt wird - // Abkürzungen für Anweisungen: + // Indikatoren für Anweisungen (Instruktionen) in Delay-Slots + // (diese werden VOR der vorigen Instruktion ausgeführt): + #define _ // Instruktion, die stets ausgeführt wird + #define __ // Instruktion, die nur im Sprung-Fall ausgeführt wird + // Abkürzungen für Anweisungen: #define ret jmp %i7+8 // return from subroutine #define retl jmp %o7+8 // return from leaf subroutine (no save/restore) @@ -74,7 +74,7 @@ #endif #define LOOP_TYPE 1 // 1: Standard-Schleifen - // 2: Schleifen ohne Pointer, nur mit Zähler + // 2: Schleifen ohne Pointer, nur mit Zähler // 3: entrollte Schleifen #define SLOW_LOOPS 0 #define STANDARD_LOOPS (LOOP_TYPE==1) @@ -92,7 +92,7 @@ C(mulu16_:) // Input in %o0,%o1, Output in %o0 _ nop #else mov %o1,%y - nop // Wartetakt, nötig z.B. für SUN SPARCstation IPC + nop // Wartetakt, nötig z.B. für SUN SPARCstation IPC andcc %g0,%g0,%o2 mulscc %o2,%o0,%o2 mulscc %o2,%o0,%o2 @@ -129,7 +129,7 @@ C(mulu32_:) // Input in %o0,%o1, Output in %o0,%g1 _ rd %y,%g1 #else mov %o1,%y - sra %o0,31,%o3 // Wartetakt, nötig z.B. für SUN SPARCstation IPC + sra %o0,31,%o3 // Wartetakt, nötig z.B. für SUN SPARCstation IPC andcc %g0,%g0,%o2 mulscc %o2,%o0,%o2 mulscc %o2,%o0,%o2 @@ -184,7 +184,7 @@ C(mulu32_unchecked:) // Input in %o0,%o1, Output in %o0 __ mov %o1,%y // arg1 < arg2, also kann man arg1 < 2^16 annehmen. mov %o0,%y - nop // Wartetakt, nötig z.B. für SUN SPARCstation IPC + nop // Wartetakt, nötig z.B. für SUN SPARCstation IPC andcc %g0,%g0,%o2 mulscc %o2,%o1,%o2 mulscc %o2,%o1,%o2 @@ -210,7 +210,7 @@ C(mulu32_unchecked:) // Input in %o0,%o1, Output in %o0 retl _ or %o2,%o0,%o0 1: // arg1 >= arg2, also kann man arg2 < 2^16 annehmen. - nop // Wartetakt, nötig z.B. für SUN SPARCstation IPC + nop // Wartetakt, nötig z.B. für SUN SPARCstation IPC andcc %g0,%g0,%o2 mulscc %o2,%o0,%o2 mulscc %o2,%o0,%o2 @@ -238,7 +238,7 @@ C(mulu32_unchecked:) // Input in %o0,%o1, Output in %o0 #endif // extern struct { uint32 q; uint32 r; } divu_6432_3232_ (uint32 xhi, uint32 xlo, uint32 y); -// x = 2^32*xhi+xlo = q*y+r schreiben. Sei bekannt, daß 0 <= x < 2^32*y . +// x = 2^32*xhi+xlo = q*y+r schreiben. Sei bekannt, daß 0 <= x < 2^32*y . DECLARE_FUNCTION(divu_6432_3232_) C(divu_6432_3232_:) // Input in %o0,%o1,%o2, Output in %o0,%g1 #if defined(sparcv8) @@ -255,9 +255,9 @@ C(divu_6432_3232_:) // Input in %o0,%o1,%o2, Output in %o0,%g1 // %o0 = xhi, %o1 = xlo, %o2 = y // Divisions-Einzelschritte: // %o0|%o1 wird jeweils um 1 Bit nach links geschoben, -// dafür wird rechts in %o1 ein Ergebnisbit (negiert!) reingeschoben. +// dafür wird rechts in %o1 ein Ergebnisbit (negiert!) reingeschoben. // Je nachdem wird mit %o3|%o1 statt %o0|%o1 weitergemacht (spart 1 'mov'). -// Deswegen muß man den Code doppelt vorsehen: einmal mit %o0, einmal mit %o3. +// Deswegen muß man den Code doppelt vorsehen: einmal mit %o0, einmal mit %o3. #define SA0(label) /* Vergleichsschritt mit %o0 */\ subcc %o0,%o2,%o3; \ bcc label; \ @@ -283,7 +283,7 @@ C(divu_6432_3232_:) // Input in %o0,%o1,%o2, Output in %o0,%g1 add %o2,1,%o2 // %o2 = ceiling(y/2) = y' // Man spart im Vergleich zu Lsmalldiv // zu Beginn eine Verdoppelung von %o0|%o1 : addcc %o1,%o1,%o1; SB0() - // dafür am Schluß mehr zu tun... + // dafür am Schluß mehr zu tun... SA0(Lb01) // Bit 31 des Quotienten bestimmen La01: SB0(); SA0(Lb02) // Bit 30 des Quotienten bestimmen La02: SB0(); SA0(Lb03) // Bit 29 des Quotienten bestimmen @@ -325,20 +325,20 @@ La32: SB0() // %o0 = x mod (2*y') // Also Quotient = %o1, Rest = %o0+%o1. // Noch maximal 2 mal: Quotient += 1, Rest -= y. addcc %o1,%o0,%o0 // Rest mod y bestimmen - bcc 1f // Additions-Überlauf -> Quotient erhöhen + bcc 1f // Additions-Überlauf -> Quotient erhöhen _ subcc %o0,%o2,%o3 - subcc %o3,%o2,%o0 // muß der Quotient nochmals erhöht werden? + subcc %o3,%o2,%o0 // muß der Quotient nochmals erhöht werden? bcs 2f _ mov %o3,%g1 - // Quotient 2 mal erhöhen, Rest %o0 + // Quotient 2 mal erhöhen, Rest %o0 mov %o0,%g1 retl _ add %o1,2,%o0 -1: // kein Additions-Überlauf. - // Wegen y>=2^31 muß der Quotient noch höchstens 1 mal erhöht werden: +1: // kein Additions-Überlauf. + // Wegen y>=2^31 muß der Quotient noch höchstens 1 mal erhöht werden: bcs 3f // %o0 < %o2 -> Rest %o0 und Quotient %o1 OK _ mov %o3,%g1 -2: // Quotient %o1 erhöhen, Rest = %o0-%o2 = %o3 +2: // Quotient %o1 erhöhen, Rest = %o0-%o2 = %o3 retl _ add %o1,1,%o0 3: // Quotient %o1 und Rest %o0 OK @@ -386,20 +386,20 @@ Lb32: SB1() // %o3 = x mod (2*y') // Also Quotient = %o1, Rest = %o3+%o1. // Noch maximal 2 mal: Quotient += 1, Rest -= y. addcc %o1,%o3,%o3 // Rest mod y bestimmen - bcc 1f // Additions-Überlauf -> Quotient erhöhen + bcc 1f // Additions-Überlauf -> Quotient erhöhen _ subcc %o3,%o2,%o0 - subcc %o0,%o2,%o3 // muß der Quotient nochmals erhöht werden? + subcc %o0,%o2,%o3 // muß der Quotient nochmals erhöht werden? bcs 2f _ mov %o0,%g1 - // Quotient 2 mal erhöhen, Rest %o3 + // Quotient 2 mal erhöhen, Rest %o3 mov %o3,%g1 retl _ add %o1,2,%o0 -1: // kein Additions-Überlauf. - // Wegen y>=2^31 muß der Quotient noch höchstens 1 mal erhöht werden: +1: // kein Additions-Überlauf. + // Wegen y>=2^31 muß der Quotient noch höchstens 1 mal erhöht werden: bcs 3f // %o3 < %o2 -> Rest %o3 und Quotient %o1 OK _ mov %o0,%g1 -2: // Quotient %o1 erhöhen, Rest = %o3-%o2 = %o0 +2: // Quotient %o1 erhöhen, Rest = %o3-%o2 = %o0 retl _ add %o1,1,%o0 3: // Quotient %o1 und Rest %o3 OK @@ -483,7 +483,7 @@ Levendiv: // Division durch gerades y. // Es ist schon %o2 = y/2. // Man spart im Vergleich zu Lsmalldiv // zu Beginn eine Verdoppelung von %o0|%o1 : addcc %o1,%o1,%o1; SB0() - // dafür am Schluß Bit 0 von x zum Rest dazuschieben. + // dafür am Schluß Bit 0 von x zum Rest dazuschieben. SA0(Lf01) // Bit 31 des Quotienten bestimmen Le01: SB0(); SA0(Lf02) // Bit 30 des Quotienten bestimmen Le02: SB0(); SA0(Lf03) // Bit 29 des Quotienten bestimmen @@ -559,7 +559,7 @@ Lf32: SB1() #endif // extern struct { uint16 q; uint16 r; } divu_3216_1616_ (uint32 x, uint16 y); -// x = q*y+r schreiben. Sei bekannt, daß 0 <= x < 2^16*y . +// x = q*y+r schreiben. Sei bekannt, daß 0 <= x < 2^16*y . DECLARE_FUNCTION(divu_3216_1616_) C(divu_3216_1616_:) // Input in %o0,%o1, Output in %o0 (Rest und Quotient). #if defined(sparcv8) @@ -577,19 +577,19 @@ C(divu_3216_1616_:) // Input in %o0,%o1, Output in %o0 (Rest und Quotient). // %o0 = x, %o1 = y // Divisions-Einzelschritte: // %o0 wird jeweils um 1 Bit nach links geschoben, -// dafür wird rechts in %o1 ein Ergebnisbit (negiert!) reingeschoben. +// dafür wird rechts in %o1 ein Ergebnisbit (negiert!) reingeschoben. // Dann wird auf >= 2^15*y verglichen (nicht auf >= 2^16*y, weil man dann das -// links herausgeschobene Bit mit vergleichen müßte!) +// links herausgeschobene Bit mit vergleichen müßte!) sll %o1,16,%o1 srl %o1,1,%o1 // 2^15*y sub %g0,%o1,%o2 // zum Addieren statt Subtrahieren: -2^15*y // SC0(label) subtrahiert y, schiebt Carry-Bit rechts in %o0 rein // (1 falls Subtraktion aufging, 0 sonst). - // Ging die Subtraktion nicht auf, so müßte man noch 2*y addieren. - // Das faßt man mit der nächsten Operation zusammen, indem man - statt + // Ging die Subtraktion nicht auf, so müßte man noch 2*y addieren. + // Das faßt man mit der nächsten Operation zusammen, indem man - statt // y zu subtrahieren - y addiert: // SC1(label) addiert y, schiebt Carry-Bit rechts in %o0 rein - // (1 falls Subtraktion aufgegangen wäre, man also wieder im + // (1 falls Subtraktion aufgegangen wäre, man also wieder im // "positiven Bereich" landet, 0 sonst). #define SC0(label) \ addcc %o0,%o2,%o0; \ @@ -672,8 +672,8 @@ C(copy_loop_up:) // Input in %o0,%o1,%o2, Output in %o0 sll %o2,2,%o2 // %o2 = -4*count sub %o0,%o2,%o0 // %o0 = &sourceptr[count] sub %o1,%o2,%o1 // %o1 = &destptr[count-1] -1: ld [%o0+%o2],%o3 // nächstes Digit holen - addcc %o2,4,%o2 // Zähler "erniedrigen", Pointer erhöhen +1: ld [%o0+%o2],%o3 // nächstes Digit holen + addcc %o2,4,%o2 // Zähler "erniedrigen", Pointer erhöhen bne 1b _ st %o3,[%o1+%o2] // Digit ablegen 2: retl @@ -703,8 +703,8 @@ C(copy_loop_down:) // Input in %o0,%o1,%o2, Output in %o0 sll %o2,2,%o2 // %o2 = 4*count sub %o0,%o2,%o0 // %o0 = &sourceptr[-count-1] sub %o1,%o2,%o1 // %o1 = &destptr[-count] -1: ld [%o0+%o2],%o3 // nächstes Digit holen - subcc %o2,4,%o2 // Zähler erniedrigen, Pointer erniedrigen +1: ld [%o0+%o2],%o3 // nächstes Digit holen + subcc %o2,4,%o2 // Zähler erniedrigen, Pointer erniedrigen bne 1b _ st %o3,[%o1+%o2] // Digit ablegen 2: retl @@ -731,7 +731,7 @@ C(fill_loop_up:) // Input in %o0,%o1,%o2, Output in %o0 _ sub %o0,4,%o0 sll %o1,2,%o1 // %o1 = -4*count sub %o0,%o1,%o0 // %o0 = &destptr[count-1] -1: addcc %o1,4,%o1 // Zähler "erniedrigen", Pointer erhöhen +1: addcc %o1,4,%o1 // Zähler "erniedrigen", Pointer erhöhen bne 1b _ st %o2,[%o0+%o1] // Digit ablegen 2: retl @@ -757,7 +757,7 @@ C(fill_loop_down:) // Input in %o0,%o1,%o2, Output in %o0 be 2f _ sll %o1,2,%o1 // %o1 = 4*count sub %o0,%o1,%o0 // %o0 = &destptr[-count] -1: subcc %o1,4,%o1 // Zähler erniedrigen, Pointer erniedrigen +1: subcc %o1,4,%o1 // Zähler erniedrigen, Pointer erniedrigen bne 1b _ st %o2,[%o0+%o1] // Digit ablegen 2: retl @@ -784,7 +784,7 @@ C(clear_loop_up:) // Input in %o0,%o1, Output in %o0 _ sub %o0,4,%o0 sll %o1,2,%o1 // %o1 = -4*count sub %o0,%o1,%o0 // %o0 = &destptr[count-1] -1: addcc %o1,4,%o1 // Zähler "erniedrigen", Pointer erhöhen +1: addcc %o1,4,%o1 // Zähler "erniedrigen", Pointer erhöhen bne 1b _ st %g0,[%o0+%o1] // Digit 0 ablegen 2: retl @@ -810,7 +810,7 @@ C(clear_loop_down:) // Input in %o0,%o1, Output in %o0 be 2f _ sll %o1,2,%o1 // %o1 = 4*count sub %o0,%o1,%o0 // %o0 = &destptr[-count] -1: subcc %o1,4,%o1 // Zähler erniedrigen, Pointer erniedrigen +1: subcc %o1,4,%o1 // Zähler erniedrigen, Pointer erniedrigen bne 1b _ st %g0,[%o0+%o1] // Digit 0 ablegen 2: retl @@ -841,12 +841,12 @@ C(test_loop_up:) // Input in %o0,%o1, Output in %o0 be 2f _ sll %o1,2,%o1 // %o1 = -4*count sub %o0,%o1,%o0 // %o0 = &ptr[count] - ld [%o0+%o1],%o2 // nächstes Digit holen + ld [%o0+%o1],%o2 // nächstes Digit holen 1: andcc %o2,%o2,%g0 // testen bne 3f - _ addcc %o1,4,%o1 // Zähler "erniedrigen", Pointer erhöhen + _ addcc %o1,4,%o1 // Zähler "erniedrigen", Pointer erhöhen bne,a 1b - __ ld [%o0+%o1],%o2 // nächstes Digit holen + __ ld [%o0+%o1],%o2 // nächstes Digit holen 2: retl _ mov 0,%o0 3: retl @@ -878,12 +878,12 @@ C(test_loop_down:) // Input in %o0,%o1, Output in %o0 subcc %o1,4,%o1 bcs 4f _ nop - ld [%o0+%o1],%o2 // nächstes Digit holen -1: subcc %o1,4,%o1 // Zähler erniedrigen, Pointer erniedrigen + ld [%o0+%o1],%o2 // nächstes Digit holen +1: subcc %o1,4,%o1 // Zähler erniedrigen, Pointer erniedrigen bcs 3f _ andcc %o2,%o2,%g0 // testen be,a 1b - __ ld [%o0+%o1],%o2 // nächstes Digit holen + __ ld [%o0+%o1],%o2 // nächstes Digit holen 2: retl _ mov 1,%o0 3: bne 2b @@ -919,7 +919,7 @@ C(or_loop_up:) // Input in %o0,%o1,%o2 1: ld [%o0],%o3 // *xptr ld [%o0+%o1],%o4 // *yptr subcc %o2,1,%o2 - or %o3,%o4,%o3 // verknüpfen + or %o3,%o4,%o3 // verknüpfen st %o3,[%o0] // =: *xptr bne 1b _ add %o0,4,%o0 // xptr++, yptr++ @@ -933,10 +933,10 @@ C(or_loop_up:) // Input in %o0,%o1,%o2 sll %o2,2,%o2 // %o2 = -4*count sub %o0,%o2,%o0 // %o0 = &xptr[count-1] sub %o1,%o2,%o1 // %o1 = &yptr[count] -1: ld [%o1+%o2],%o3 // nächstes Digit holen - addcc %o2,4,%o2 // Zähler "erniedrigen", Pointer erhöhen +1: ld [%o1+%o2],%o3 // nächstes Digit holen + addcc %o2,4,%o2 // Zähler "erniedrigen", Pointer erhöhen ld [%o0+%o2],%o4 // noch ein Digit holen - or %o4,%o3,%o3 // beide verknüpfen + or %o4,%o3,%o3 // beide verknüpfen bne 1b _ st %o3,[%o1+%o2] // Digit ablegen 2: retl @@ -970,7 +970,7 @@ C(xor_loop_up:) // Input in %o0,%o1,%o2 1: ld [%o0],%o3 // *xptr ld [%o0+%o1],%o4 // *yptr subcc %o2,1,%o2 - xor %o3,%o4,%o3 // verknüpfen + xor %o3,%o4,%o3 // verknüpfen st %o3,[%o0] // =: *xptr bne 1b _ add %o0,4,%o0 // xptr++, yptr++ @@ -984,10 +984,10 @@ C(xor_loop_up:) // Input in %o0,%o1,%o2 sll %o2,2,%o2 // %o2 = -4*count sub %o0,%o2,%o0 // %o0 = &xptr[count-1] sub %o1,%o2,%o1 // %o1 = &yptr[count] -1: ld [%o1+%o2],%o3 // nächstes Digit holen - addcc %o2,4,%o2 // Zähler "erniedrigen", Pointer erhöhen +1: ld [%o1+%o2],%o3 // nächstes Digit holen + addcc %o2,4,%o2 // Zähler "erniedrigen", Pointer erhöhen ld [%o0+%o2],%o4 // noch ein Digit holen - xor %o4,%o3,%o3 // beide verknüpfen + xor %o4,%o3,%o3 // beide verknüpfen bne 1b _ st %o3,[%o1+%o2] // Digit ablegen 2: retl @@ -1021,7 +1021,7 @@ C(and_loop_up:) // Input in %o0,%o1,%o2 1: ld [%o0],%o3 // *xptr ld [%o0+%o1],%o4 // *yptr subcc %o2,1,%o2 - and %o3,%o4,%o3 // verknüpfen + and %o3,%o4,%o3 // verknüpfen st %o3,[%o0] // =: *xptr bne 1b _ add %o0,4,%o0 // xptr++, yptr++ @@ -1035,10 +1035,10 @@ C(and_loop_up:) // Input in %o0,%o1,%o2 sll %o2,2,%o2 // %o2 = -4*count sub %o0,%o2,%o0 // %o0 = &xptr[count-1] sub %o1,%o2,%o1 // %o1 = &yptr[count] -1: ld [%o1+%o2],%o3 // nächstes Digit holen - addcc %o2,4,%o2 // Zähler "erniedrigen", Pointer erhöhen +1: ld [%o1+%o2],%o3 // nächstes Digit holen + addcc %o2,4,%o2 // Zähler "erniedrigen", Pointer erhöhen ld [%o0+%o2],%o4 // noch ein Digit holen - and %o4,%o3,%o3 // beide verknüpfen + and %o4,%o3,%o3 // beide verknüpfen bne 1b _ st %o3,[%o1+%o2] // Digit ablegen 2: retl @@ -1070,7 +1070,7 @@ C(eqv_loop_up:) // Input in %o0,%o1,%o2 1: ld [%o0],%o3 // *xptr ld [%o0+%o1],%o4 // *yptr subcc %o2,1,%o2 - xnor %o3,%o4,%o3 // verknüpfen + xnor %o3,%o4,%o3 // verknüpfen st %o3,[%o0] // =: *xptr bne 1b _ add %o0,4,%o0 // xptr++, yptr++ @@ -1084,10 +1084,10 @@ C(eqv_loop_up:) // Input in %o0,%o1,%o2 sll %o2,2,%o2 // %o2 = -4*count sub %o0,%o2,%o0 // %o0 = &xptr[count-1] sub %o1,%o2,%o1 // %o1 = &yptr[count] -1: ld [%o1+%o2],%o3 // nächstes Digit holen - addcc %o2,4,%o2 // Zähler "erniedrigen", Pointer erhöhen +1: ld [%o1+%o2],%o3 // nächstes Digit holen + addcc %o2,4,%o2 // Zähler "erniedrigen", Pointer erhöhen ld [%o0+%o2],%o4 // noch ein Digit holen - xnor %o4,%o3,%o3 // beide verknüpfen + xnor %o4,%o3,%o3 // beide verknüpfen bne 1b _ st %o3,[%o1+%o2] // Digit ablegen 2: retl @@ -1120,7 +1120,7 @@ C(nand_loop_up:) // Input in %o0,%o1,%o2 1: ld [%o0],%o3 // *xptr ld [%o0+%o1],%o4 // *yptr subcc %o2,1,%o2 - and %o3,%o4,%o3 // verknüpfen + and %o3,%o4,%o3 // verknüpfen xor %o3,-1,%o3 st %o3,[%o0] // =: *xptr bne 1b @@ -1135,10 +1135,10 @@ C(nand_loop_up:) // Input in %o0,%o1,%o2 sll %o2,2,%o2 // %o2 = -4*count sub %o0,%o2,%o0 // %o0 = &xptr[count-1] sub %o1,%o2,%o1 // %o1 = &yptr[count] -1: ld [%o1+%o2],%o3 // nächstes Digit holen - addcc %o2,4,%o2 // Zähler "erniedrigen", Pointer erhöhen +1: ld [%o1+%o2],%o3 // nächstes Digit holen + addcc %o2,4,%o2 // Zähler "erniedrigen", Pointer erhöhen ld [%o0+%o2],%o4 // noch ein Digit holen - and %o4,%o3,%o3 // beide verknüpfen + and %o4,%o3,%o3 // beide verknüpfen xor %o3,-1,%o3 bne 1b _ st %o3,[%o1+%o2] // Digit ablegen @@ -1172,7 +1172,7 @@ C(nor_loop_up:) // Input in %o0,%o1,%o2 1: ld [%o0],%o3 // *xptr ld [%o0+%o1],%o4 // *yptr subcc %o2,1,%o2 - or %o3,%o4,%o3 // verknüpfen + or %o3,%o4,%o3 // verknüpfen xor %o3,-1,%o3 st %o3,[%o0] // =: *xptr bne 1b @@ -1187,10 +1187,10 @@ C(nor_loop_up:) // Input in %o0,%o1,%o2 sll %o2,2,%o2 // %o2 = -4*count sub %o0,%o2,%o0 // %o0 = &xptr[count-1] sub %o1,%o2,%o1 // %o1 = &yptr[count] -1: ld [%o1+%o2],%o3 // nächstes Digit holen - addcc %o2,4,%o2 // Zähler "erniedrigen", Pointer erhöhen +1: ld [%o1+%o2],%o3 // nächstes Digit holen + addcc %o2,4,%o2 // Zähler "erniedrigen", Pointer erhöhen ld [%o0+%o2],%o4 // noch ein Digit holen - or %o4,%o3,%o3 // beide verknüpfen + or %o4,%o3,%o3 // beide verknüpfen xor %o3,-1,%o3 bne 1b _ st %o3,[%o1+%o2] // Digit ablegen @@ -1223,7 +1223,7 @@ C(andc2_loop_up:) // Input in %o0,%o1,%o2 1: ld [%o0],%o3 // *xptr ld [%o0+%o1],%o4 // *yptr subcc %o2,1,%o2 - andn %o3,%o4,%o3 // verknüpfen + andn %o3,%o4,%o3 // verknüpfen st %o3,[%o0] // =: *xptr bne 1b _ add %o0,4,%o0 // xptr++, yptr++ @@ -1237,10 +1237,10 @@ C(andc2_loop_up:) // Input in %o0,%o1,%o2 sll %o2,2,%o2 // %o2 = -4*count sub %o0,%o2,%o0 // %o0 = &xptr[count-1] sub %o1,%o2,%o1 // %o1 = &yptr[count] -1: ld [%o1+%o2],%o3 // nächstes Digit holen - addcc %o2,4,%o2 // Zähler "erniedrigen", Pointer erhöhen +1: ld [%o1+%o2],%o3 // nächstes Digit holen + addcc %o2,4,%o2 // Zähler "erniedrigen", Pointer erhöhen ld [%o0+%o2],%o4 // noch ein Digit holen - andn %o4,%o3,%o3 // beide verknüpfen + andn %o4,%o3,%o3 // beide verknüpfen bne 1b _ st %o3,[%o1+%o2] // Digit ablegen 2: retl @@ -1272,7 +1272,7 @@ C(orc2_loop_up:) // Input in %o0,%o1,%o2 1: ld [%o0],%o3 // *xptr ld [%o0+%o1],%o4 // *yptr subcc %o2,1,%o2 - orn %o3,%o4,%o3 // verknüpfen + orn %o3,%o4,%o3 // verknüpfen st %o3,[%o0] // =: *xptr bne 1b _ add %o0,4,%o0 // xptr++, yptr++ @@ -1286,10 +1286,10 @@ C(orc2_loop_up:) // Input in %o0,%o1,%o2 sll %o2,2,%o2 // %o2 = -4*count sub %o0,%o2,%o0 // %o0 = &xptr[count-1] sub %o1,%o2,%o1 // %o1 = &yptr[count] -1: ld [%o1+%o2],%o3 // nächstes Digit holen - addcc %o2,4,%o2 // Zähler "erniedrigen", Pointer erhöhen +1: ld [%o1+%o2],%o3 // nächstes Digit holen + addcc %o2,4,%o2 // Zähler "erniedrigen", Pointer erhöhen ld [%o0+%o2],%o4 // noch ein Digit holen - orn %o4,%o3,%o3 // beide verknüpfen + orn %o4,%o3,%o3 // beide verknüpfen bne 1b _ st %o3,[%o1+%o2] // Digit ablegen 2: retl @@ -1318,8 +1318,8 @@ C(not_loop_up:) // Input in %o0,%o1 _ sub %o0,4,%o0 sll %o1,2,%o1 // %o1 = -4*count sub %o0,%o1,%o0 // %o0 = &destptr[count-1] -1: addcc %o1,4,%o1 // Zähler "erniedrigen", Pointer erhöhen - ld [%o0+%o1],%o2 // nächstes Digit holen +1: addcc %o1,4,%o1 // Zähler "erniedrigen", Pointer erhöhen + ld [%o0+%o1],%o2 // nächstes Digit holen xor %o2,-1,%o2 bne 1b _ st %o2,[%o0+%o1] // Digit ablegen @@ -1353,13 +1353,13 @@ C(and_test_loop_up:) // Input in %o0,%o1,%o2, Output in %o0 _ sll %o2,2,%o2 // %o2 = -4*count sub %o0,%o2,%o0 // %o0 = &xptr[count] sub %o1,%o2,%o1 // %o1 = &yptr[count] - ld [%o0+%o2],%o3 // nächstes Digit holen + ld [%o0+%o2],%o3 // nächstes Digit holen 1: ld [%o1+%o2],%o4 // noch ein Digit holen - andcc %o3,%o4,%g0 // beide verknüpfen + andcc %o3,%o4,%g0 // beide verknüpfen bne 3f - _ addcc %o2,4,%o2 // Zähler "erniedrigen", Pointer erhöhen + _ addcc %o2,4,%o2 // Zähler "erniedrigen", Pointer erhöhen bne,a 1b - __ ld [%o0+%o2],%o3 // nächstes Digit holen + __ ld [%o0+%o2],%o3 // nächstes Digit holen 2: retl _ mov 0,%o0 3: retl @@ -1399,13 +1399,13 @@ C(compare_loop_up:) // Input in %o0,%o1,%o2, Output in %o0 _ sll %o2,2,%o2 // %o2 = -4*count sub %o0,%o2,%o0 // %o0 = &xptr[count] sub %o1,%o2,%o1 // %o1 = &yptr[count] - ld [%o0+%o2],%o3 // nächstes Digit holen + ld [%o0+%o2],%o3 // nächstes Digit holen 1: ld [%o1+%o2],%o4 // noch ein Digit holen subcc %o3,%o4,%g0 // vergleichen bne 3f - _ addcc %o2,4,%o2 // Zähler "erniedrigen", Pointer erhöhen + _ addcc %o2,4,%o2 // Zähler "erniedrigen", Pointer erhöhen bne,a 1b - __ ld [%o0+%o2],%o3 // nächstes Digit holen + __ ld [%o0+%o2],%o3 // nächstes Digit holen 2: retl _ mov 0,%o0 3: subcc %o3,%o4,%g0 // nochmals vergleichen @@ -1421,7 +1421,7 @@ C(compare_loop_up:) // Input in %o0,%o1,%o2, Output in %o0 // extern uintD add_loop_down (uintD* sourceptr1, uintD* sourceptr2, uintD* destptr, uintC count); DECLARE_FUNCTION(add_loop_down) -C(add_loop_down:) // Input in %o0,%o1,%o2,%o3, verändert %g1, Output in %o0 +C(add_loop_down:) // Input in %o0,%o1,%o2,%o3, verändert %g1, Output in %o0 #if STANDARD_LOOPS andcc %o3,%o3,%g0 be 2f @@ -1479,7 +1479,7 @@ C(add_loop_down:) // Input in %o0,%o1,%o2,%o3, ver #endif sub %o5,%o4,%o5 jmp %o5 // Sprung nach (label 1)+4*(1+4*8-4*(count mod 8)) - _ subcc %g0,%g0,%g0 // carry löschen + _ subcc %g0,%g0,%g0 // carry löschen 1: subcc %g0,%g1,%g0 // carry ld [%o0+28],%o4 // source1-digit ld [%o1+28],%o5 // source2-digit @@ -1585,7 +1585,7 @@ C(addto_loop_down:) // Input in %o0,%o1,%o2, Output in %o0 #endif sub %o4,%o3,%o4 jmp %o4 // Sprung nach (label 1)+4*(1+4*8-4*(count mod 8)) - _ subcc %g0,%g0,%g0 // carry löschen + _ subcc %g0,%g0,%g0 // carry löschen 1: subcc %g0,%o5,%g0 // carry ld [%o0+28],%o3 // source-digit ld [%o1+28],%o4 // dest-digit @@ -1661,7 +1661,7 @@ C(inc_loop_down:) // Input in %o0,%o1, Output in %o0 1: addcc %o2,1,%o2 // incrementieren bne 3f _ st %o2,[%o0+%o1] // ablegen - subcc %o1,4,%o1 // Zähler erniedrigen, Pointer erniedrigen + subcc %o1,4,%o1 // Zähler erniedrigen, Pointer erniedrigen bne,a 1b __ ld [%o0+%o1],%o2 2: retl @@ -1672,7 +1672,7 @@ C(inc_loop_down:) // Input in %o0,%o1, Output in %o0 // extern uintD sub_loop_down (uintD* sourceptr1, uintD* sourceptr2, uintD* destptr, uintC count); DECLARE_FUNCTION(sub_loop_down) -C(sub_loop_down:) // Input in %o0,%o1,%o2,%o3, verändert %g1, Output in %o0 +C(sub_loop_down:) // Input in %o0,%o1,%o2,%o3, verändert %g1, Output in %o0 #if STANDARD_LOOPS andcc %o3,%o3,%g0 be 2f @@ -1730,7 +1730,7 @@ C(sub_loop_down:) // Input in %o0,%o1,%o2,%o3, ver #endif sub %o5,%o4,%o5 jmp %o5 // Sprung nach (label 1)+4*(1+4*8-4*(count mod 8)) - _ subcc %g0,%g0,%g0 // carry löschen + _ subcc %g0,%g0,%g0 // carry löschen 1: subcc %g0,%g1,%g0 // carry ld [%o0+28],%o4 // source1-digit ld [%o1+28],%o5 // source2-digit @@ -1780,7 +1780,7 @@ C(sub_loop_down:) // Input in %o0,%o1,%o2,%o3, ver // extern uintD subx_loop_down (uintD* sourceptr1, uintD* sourceptr2, uintD* destptr, uintC count, uintD carry); DECLARE_FUNCTION(subx_loop_down) -C(subx_loop_down:) // Input in %o0,%o1,%o2,%o3,%o4, verändert %g1, Output in %o0 +C(subx_loop_down:) // Input in %o0,%o1,%o2,%o3,%o4, verändert %g1, Output in %o0 #if STANDARD_LOOPS andcc %o3,%o3,%g0 be 2f @@ -1944,7 +1944,7 @@ C(subfrom_loop_down:) // Input in %o0,%o1,%o2, Output in %o0 #endif sub %o4,%o3,%o4 jmp %o4 // Sprung nach (label 1)+4*(1+4*8-4*(count mod 8)) - _ subcc %g0,%g0,%g0 // carry löschen + _ subcc %g0,%g0,%g0 // carry löschen 1: subcc %g0,%o5,%g0 // carry ld [%o0+28],%o3 // source-digit ld [%o1+28],%o4 // dest-digit @@ -2020,7 +2020,7 @@ C(dec_loop_down:) // Input in %o0,%o1, Output in %o0 1: subcc %o2,1,%o2 // decrementieren bcc 3f _ st %o2,[%o0+%o1] // ablegen - subcc %o1,4,%o1 // Zähler erniedrigen, Pointer erniedrigen + subcc %o1,4,%o1 // Zähler erniedrigen, Pointer erniedrigen bne,a 1b __ ld [%o0+%o1],%o2 2: retl @@ -2069,7 +2069,7 @@ C(neg_loop_down:) // Input in %o0,%o1, Output in %o0 ld [%o0+%o1],%o2 // digit holen 1: subcc %g0,%o2,%o2 // negieren, testen bne 3f - _ subcc %o1,4,%o1 // Zähler erniedrigen, Pointer erniedrigen + _ subcc %o1,4,%o1 // Zähler erniedrigen, Pointer erniedrigen bne,a 1b __ ld [%o0+%o1],%o2 2: retl @@ -2111,7 +2111,7 @@ C(shift1left_loop_down:) // Input in %o0,%o1, Output in %o0 // extern uintD shiftleft_loop_down (uintD* ptr, uintC count, uintC i, uintD carry); DECLARE_FUNCTION(shiftleft_loop_down) -C(shiftleft_loop_down:) // Input in %o0,%o1,%o2,%o3, verändert %g1, Output in %o0 +C(shiftleft_loop_down:) // Input in %o0,%o1,%o2,%o3, verändert %g1, Output in %o0 andcc %o1,%o1,%g0 be 2f _ sub %g0,%o2,%g1 // 32-i (mod 32) @@ -2121,7 +2121,7 @@ C(shiftleft_loop_down:) // Input in %o0,%o1,%o2,%o3, ver sll %o4,%o2,%o5 // dessen niedere (32-i) Bits or %o3,%o5,%o5 // mit dem alten Carry kombinieren st %o5,[%o0] // Digit ablegen - srl %o4,%g1,%o3 // dessen höchste i Bits liefern den neuen Carry + srl %o4,%g1,%o3 // dessen höchste i Bits liefern den neuen Carry bne 1b _ sub %o0,4,%o0 2: retl @@ -2129,7 +2129,7 @@ C(shiftleft_loop_down:) // Input in %o0,%o1,%o2,%o3, ver // extern uintD shiftleftcopy_loop_down (uintD* sourceptr, uintD* destptr, uintC count, uintC i); DECLARE_FUNCTION(shiftleftcopy_loop_down) -C(shiftleftcopy_loop_down:) // Input in %o0,%o1,%o2,%o3, verändert %g1,%g2, Output in %o0 +C(shiftleftcopy_loop_down:) // Input in %o0,%o1,%o2,%o3, verändert %g1,%g2, Output in %o0 andcc %o2,%o2,%g0 be 2f _ mov 0,%o4 // Carry := 0 @@ -2141,7 +2141,7 @@ C(shiftleftcopy_loop_down:) // Input in %o0,%o1,%o2,%o3, ver or %o4,%g2,%g2 // mit dem alten Carry kombinieren sub %o1,4,%o1 st %g2,[%o1] // Digit ablegen - srl %o5,%g1,%o4 // dessen höchste i Bits liefern den neuen Carry + srl %o5,%g1,%o4 // dessen höchste i Bits liefern den neuen Carry bne 1b _ sub %o0,4,%o0 2: retl @@ -2166,7 +2166,7 @@ C(shift1right_loop_up:) // Input in %o0,%o1,%o2, Output in %o0 // extern uintD shiftright_loop_up (uintD* ptr, uintC count, uintC i); DECLARE_FUNCTION(shiftright_loop_up) -C(shiftright_loop_up:) // Input in %o0,%o1,%o2, verändert %g1, Output in %o0 +C(shiftright_loop_up:) // Input in %o0,%o1,%o2, verändert %g1, Output in %o0 sub %g0,%o2,%g1 // 32-i (mod 32) andcc %o1,%o1,%g0 be 2f @@ -2184,7 +2184,7 @@ C(shiftright_loop_up:) // Input in %o0,%o1,%o2, ver // extern uintD shiftrightsigned_loop_up (uintD* ptr, uintC count, uintC i); DECLARE_FUNCTION(shiftrightsigned_loop_up) -C(shiftrightsigned_loop_up:) // Input in %o0,%o1,%o2, verändert %g1, Output in %o0 +C(shiftrightsigned_loop_up:) // Input in %o0,%o1,%o2, verändert %g1, Output in %o0 ld [%o0],%o4 // erstes Digit sub %g0,%o2,%g1 // 32-i (mod 32) sra %o4,%o2,%o5 // shiften @@ -2206,7 +2206,7 @@ C(shiftrightsigned_loop_up:) // Input in %o0,%o1,%o2, ver // extern uintD shiftrightcopy_loop_up (uintD* sourceptr, uintD* destptr, uintC count, uintC i, uintD carry); DECLARE_FUNCTION(shiftrightcopy_loop_up) -C(shiftrightcopy_loop_up:) // Input in %o0,%o1,%o2,%o3,%o4, verändert %g1,%g2, Output in %o0 +C(shiftrightcopy_loop_up:) // Input in %o0,%o1,%o2,%o3,%o4, verändert %g1,%g2, Output in %o0 sub %g0,%o3,%g1 // 32-i (mod 32) andcc %o2,%o2,%g0 be 2f @@ -2229,7 +2229,7 @@ C(mulusmall_loop_down:) // Input in %o0,%o1,%o2,%o3, Output in %o0 andcc %o2,%o2,%g0 be 3f _ sub %o1,4,%o1 -1: // nächstes Digit [%o1] mit der 6-Bit-Zahl %o0 multiplizieren +1: // nächstes Digit [%o1] mit der 6-Bit-Zahl %o0 multiplizieren // und kleinen Carry %o3 dazu: mov %o0,%y ld [%o1],%o4 // Wartetakt! @@ -2265,7 +2265,7 @@ C(mulu_loop_down:) // Input in %i0,%i1,%i2,%i3 save %sp,-96,%sp mov 0,%l0 // Carry 1: sub %i1,4,%i1 - ld [%i1],%o1 // nächstes Digit + ld [%i1],%o1 // nächstes Digit call _mulu32_ // mit digit multiplizieren _ mov %i0,%o0 addcc %l0,%o0,%o0 // und bisherigen Carry addieren @@ -2279,9 +2279,9 @@ C(mulu_loop_down:) // Input in %i0,%i1,%i2,%i3 _ restore #else DECLARE_FUNCTION(mulu_loop_down) -C(mulu_loop_down:) // Input in %o0,%o1,%o2,%o3, verändert %g1 +C(mulu_loop_down:) // Input in %o0,%o1,%o2,%o3, verändert %g1 mov 0,%o4 // Carry -1: ld [%o1-4],%g1 // nächstes Digit +1: ld [%o1-4],%g1 // nächstes Digit // mit digit multiplizieren: %o0 * %g1 -> %o5|%g1 #ifdef sparcv8 sub %o1,4,%o1 @@ -2346,11 +2346,11 @@ C(muluadd_loop_down:) // Input in %i0,%i1,%i2,%i3, Output in %i0 save %sp,-96,%sp mov 0,%l0 // Carry 1: sub %i1,4,%i1 - ld [%i1],%o1 // nächstes source-Digit + ld [%i1],%o1 // nächstes source-Digit call _mulu32_ // mit digit multiplizieren _ mov %i0,%o0 sub %i2,4,%i2 - ld [%i2],%o1 // nächstes dest-digit + ld [%i2],%o1 // nächstes dest-digit addcc %l0,%o0,%o0 // und bisherigen Carry addieren addx %g0,%g1,%l0 // High-Digit gibt neuen Carry addcc %o1,%o0,%o0 // addieren @@ -2367,7 +2367,7 @@ C(muluadd_loop_down:) // Input in %i0,%i1,%i2,%i3, Output in %i0 #ifndef sparcv8 sra %i0,31,%l1 // 0 falls %i0>=0, -1 falls %i0<0 #endif -1: ld [%i1-4],%o1 // nächstes source-Digit +1: ld [%i1-4],%o1 // nächstes source-Digit sub %i1,4,%i1 // mit digit multiplizieren: %i0 * %o1 -> %o2|%o0 #ifdef sparcv8 @@ -2414,7 +2414,7 @@ C(muluadd_loop_down:) // Input in %i0,%i1,%i2,%i3, Output in %i0 rd %y,%o0 #endif sub %i2,4,%i2 - ld [%i2],%o1 // nächstes dest-digit + ld [%i2],%o1 // nächstes dest-digit addcc %l0,%o0,%o0 // und bisherigen Carry addieren addx %g0,%o2,%l0 // High-Digit gibt neuen Carry addcc %o1,%o0,%o0 // addieren @@ -2434,11 +2434,11 @@ C(mulusub_loop_down:) // Input in %i0,%i1,%i2,%i3, Output in %i0 save %sp,-96,%sp mov 0,%l0 // Carry 1: sub %i1,4,%i1 - ld [%i1],%o1 // nächstes source-Digit + ld [%i1],%o1 // nächstes source-Digit call _mulu32_ // mit digit multiplizieren _ mov %i0,%o0 sub %i2,4,%i2 - ld [%i2],%o1 // nächstes dest-digit + ld [%i2],%o1 // nächstes dest-digit addcc %l0,%o0,%o0 // und bisherigen Carry addieren addx %g0,%g1,%l0 // High-Digit gibt neuen Carry subcc %o1,%o0,%o1 // davon das Low-Digit subtrahieren @@ -2455,7 +2455,7 @@ C(mulusub_loop_down:) // Input in %i0,%i1,%i2,%i3, Output in %i0 #ifndef sparcv8 sra %i0,31,%l1 // 0 falls %i0>=0, -1 falls %i0<0 #endif -1: ld [%i1-4],%o1 // nächstes source-Digit +1: ld [%i1-4],%o1 // nächstes source-Digit sub %i1,4,%i1 // mit digit multiplizieren: %i0 * %o1 -> %o2|%o0 #ifdef sparcv8 @@ -2502,7 +2502,7 @@ C(mulusub_loop_down:) // Input in %i0,%i1,%i2,%i3, Output in %i0 rd %y,%o0 #endif sub %i2,4,%i2 - ld [%i2],%o1 // nächstes dest-digit + ld [%i2],%o1 // nächstes dest-digit addcc %l0,%o0,%o0 // und bisherigen Carry addieren addx %g0,%o2,%l0 // High-Digit gibt neuen Carry subcc %o1,%o0,%o1 // davon das Low-Digit subtrahieren @@ -2523,7 +2523,7 @@ C(divu_loop_up:) // Input in %i0,%i1,%i2, Output in %i0 be 2f _ mov 0,%g1 // Rest 1: mov %g1,%o0 // Rest als High-Digit - ld [%i1],%o1 // nächstes Digit als Low-Digit + ld [%i1],%o1 // nächstes Digit als Low-Digit call C(divu_6432_3232_) // zusammen durch digit dividieren _ mov %i0,%o2 st %o0,[%i1] // Quotient ablegen, Rest in %g1 @@ -2542,7 +2542,7 @@ C(divucopy_loop_up:) // Input in %i0,%i1,%i2,%i3, Output in %i0 be 2f _ mov 0,%g1 // Rest 1: mov %g1,%o0 // Rest als High-Digit - ld [%i1],%o1 // nächstes Digit als Low-Digit + ld [%i1],%o1 // nächstes Digit als Low-Digit call C(divu_6432_3232_) // zusammen durch digit dividieren _ mov %i0,%o2 st %o0,[%i2] // Quotient ablegen, Rest in %g1 @@ -2584,7 +2584,7 @@ C(or_loop_down:) // Input in %o0,%o1,%o2 1: ld [%o0],%o3 // *xptr ld [%o0+%o1],%o4 // *yptr subcc %o2,1,%o2 - or %o3,%o4,%o3 // verknüpfen + or %o3,%o4,%o3 // verknüpfen st %o3,[%o0] // =: *xptr bne 1b _ sub %o0,4,%o0 // xptr++, yptr++ @@ -2597,10 +2597,10 @@ C(or_loop_down:) // Input in %o0,%o1,%o2 _ sll %o2,2,%o2 // %o2 = 4*count sub %o0,%o2,%o0 // %o0 = &xptr[-count] sub %o1,%o2,%o1 // %o1 = &yptr[-count] -1: subcc %o2,4,%o2 // Zähler erniedrigen, Pointer erniedrigen - ld [%o1+%o2],%o3 // nächstes Digit holen +1: subcc %o2,4,%o2 // Zähler erniedrigen, Pointer erniedrigen + ld [%o1+%o2],%o3 // nächstes Digit holen ld [%o0+%o2],%o4 // noch ein Digit holen - or %o4,%o3,%o3 // beide verknüpfen + or %o4,%o3,%o3 // beide verknüpfen bne 1b _ st %o3,[%o1+%o2] // Digit ablegen 2: retl @@ -2633,7 +2633,7 @@ C(xor_loop_down:) // Input in %o0,%o1,%o2 1: ld [%o0],%o3 // *xptr ld [%o0+%o1],%o4 // *yptr subcc %o2,1,%o2 - xor %o3,%o4,%o3 // verknüpfen + xor %o3,%o4,%o3 // verknüpfen st %o3,[%o0] // =: *xptr bne 1b _ sub %o0,4,%o0 // xptr++, yptr++ @@ -2646,10 +2646,10 @@ C(xor_loop_down:) // Input in %o0,%o1,%o2 _ sll %o2,2,%o2 // %o2 = 4*count sub %o0,%o2,%o0 // %o0 = &xptr[-count] sub %o1,%o2,%o1 // %o1 = &yptr[-count] -1: subcc %o2,4,%o2 // Zähler erniedrigen, Pointer erniedrigen - ld [%o1+%o2],%o3 // nächstes Digit holen +1: subcc %o2,4,%o2 // Zähler erniedrigen, Pointer erniedrigen + ld [%o1+%o2],%o3 // nächstes Digit holen ld [%o0+%o2],%o4 // noch ein Digit holen - xor %o4,%o3,%o3 // beide verknüpfen + xor %o4,%o3,%o3 // beide verknüpfen bne 1b _ st %o3,[%o1+%o2] // Digit ablegen 2: retl @@ -2682,7 +2682,7 @@ C(and_loop_down:) // Input in %o0,%o1,%o2 1: ld [%o0],%o3 // *xptr ld [%o0+%o1],%o4 // *yptr subcc %o2,1,%o2 - and %o3,%o4,%o3 // verknüpfen + and %o3,%o4,%o3 // verknüpfen st %o3,[%o0] // =: *xptr bne 1b _ sub %o0,4,%o0 // xptr++, yptr++ @@ -2695,10 +2695,10 @@ C(and_loop_down:) // Input in %o0,%o1,%o2 _ sll %o2,2,%o2 // %o2 = 4*count sub %o0,%o2,%o0 // %o0 = &xptr[-count] sub %o1,%o2,%o1 // %o1 = &yptr[-count] -1: subcc %o2,4,%o2 // Zähler erniedrigen, Pointer erniedrigen - ld [%o1+%o2],%o3 // nächstes Digit holen +1: subcc %o2,4,%o2 // Zähler erniedrigen, Pointer erniedrigen + ld [%o1+%o2],%o3 // nächstes Digit holen ld [%o0+%o2],%o4 // noch ein Digit holen - and %o4,%o3,%o3 // beide verknüpfen + and %o4,%o3,%o3 // beide verknüpfen bne 1b _ st %o3,[%o1+%o2] // Digit ablegen 2: retl @@ -2731,7 +2731,7 @@ C(eqv_loop_down:) // Input in %o0,%o1,%o2 1: ld [%o0],%o3 // *xptr ld [%o0+%o1],%o4 // *yptr subcc %o2,1,%o2 - xnor %o3,%o4,%o3 // verknüpfen + xnor %o3,%o4,%o3 // verknüpfen st %o3,[%o0] // =: *xptr bne 1b _ sub %o0,4,%o0 // xptr++, yptr++ @@ -2744,10 +2744,10 @@ C(eqv_loop_down:) // Input in %o0,%o1,%o2 _ sll %o2,2,%o2 // %o2 = 4*count sub %o0,%o2,%o0 // %o0 = &xptr[-count] sub %o1,%o2,%o1 // %o1 = &yptr[-count] -1: subcc %o2,4,%o2 // Zähler erniedrigen, Pointer erniedrigen - ld [%o1+%o2],%o3 // nächstes Digit holen +1: subcc %o2,4,%o2 // Zähler erniedrigen, Pointer erniedrigen + ld [%o1+%o2],%o3 // nächstes Digit holen ld [%o0+%o2],%o4 // noch ein Digit holen - xnor %o4,%o3,%o3 // beide verknüpfen + xnor %o4,%o3,%o3 // beide verknüpfen bne 1b _ st %o3,[%o1+%o2] // Digit ablegen 2: retl @@ -2781,7 +2781,7 @@ C(nand_loop_down:) // Input in %o0,%o1,%o2 1: ld [%o0],%o3 // *xptr ld [%o0+%o1],%o4 // *yptr subcc %o2,1,%o2 - and %o3,%o4,%o3 // verknüpfen + and %o3,%o4,%o3 // verknüpfen xor %o3,-1,%o3 st %o3,[%o0] // =: *xptr bne 1b @@ -2795,10 +2795,10 @@ C(nand_loop_down:) // Input in %o0,%o1,%o2 _ sll %o2,2,%o2 // %o2 = 4*count sub %o0,%o2,%o0 // %o0 = &xptr[-count] sub %o1,%o2,%o1 // %o1 = &yptr[-count] -1: subcc %o2,4,%o2 // Zähler erniedrigen, Pointer erniedrigen - ld [%o1+%o2],%o3 // nächstes Digit holen +1: subcc %o2,4,%o2 // Zähler erniedrigen, Pointer erniedrigen + ld [%o1+%o2],%o3 // nächstes Digit holen ld [%o0+%o2],%o4 // noch ein Digit holen - and %o4,%o3,%o3 // beide verknüpfen + and %o4,%o3,%o3 // beide verknüpfen xor %o3,-1,%o3 bne 1b _ st %o3,[%o1+%o2] // Digit ablegen @@ -2833,7 +2833,7 @@ C(nor_loop_down:) // Input in %o0,%o1,%o2 1: ld [%o0],%o3 // *xptr ld [%o0+%o1],%o4 // *yptr subcc %o2,1,%o2 - or %o3,%o4,%o3 // verknüpfen + or %o3,%o4,%o3 // verknüpfen xor %o3,-1,%o3 st %o3,[%o0] // =: *xptr bne 1b @@ -2847,10 +2847,10 @@ C(nor_loop_down:) // Input in %o0,%o1,%o2 _ sll %o2,2,%o2 // %o2 = 4*count sub %o0,%o2,%o0 // %o0 = &xptr[-count] sub %o1,%o2,%o1 // %o1 = &yptr[-count] -1: subcc %o2,4,%o2 // Zähler erniedrigen, Pointer erniedrigen - ld [%o1+%o2],%o3 // nächstes Digit holen +1: subcc %o2,4,%o2 // Zähler erniedrigen, Pointer erniedrigen + ld [%o1+%o2],%o3 // nächstes Digit holen ld [%o0+%o2],%o4 // noch ein Digit holen - or %o4,%o3,%o3 // beide verknüpfen + or %o4,%o3,%o3 // beide verknüpfen xor %o3,-1,%o3 bne 1b _ st %o3,[%o1+%o2] // Digit ablegen @@ -2884,7 +2884,7 @@ C(andc2_loop_down:) // Input in %o0,%o1,%o2 1: ld [%o0],%o3 // *xptr ld [%o0+%o1],%o4 // *yptr subcc %o2,1,%o2 - andn %o3,%o4,%o3 // verknüpfen + andn %o3,%o4,%o3 // verknüpfen st %o3,[%o0] // =: *xptr bne 1b _ sub %o0,4,%o0 // xptr++, yptr++ @@ -2897,10 +2897,10 @@ C(andc2_loop_down:) // Input in %o0,%o1,%o2 _ sll %o2,2,%o2 // %o2 = 4*count sub %o0,%o2,%o0 // %o0 = &xptr[-count] sub %o1,%o2,%o1 // %o1 = &yptr[-count] -1: subcc %o2,4,%o2 // Zähler erniedrigen, Pointer erniedrigen - ld [%o1+%o2],%o3 // nächstes Digit holen +1: subcc %o2,4,%o2 // Zähler erniedrigen, Pointer erniedrigen + ld [%o1+%o2],%o3 // nächstes Digit holen ld [%o0+%o2],%o4 // noch ein Digit holen - andn %o4,%o3,%o3 // beide verknüpfen + andn %o4,%o3,%o3 // beide verknüpfen bne 1b _ st %o3,[%o1+%o2] // Digit ablegen 2: retl @@ -2933,7 +2933,7 @@ C(orc2_loop_down:) // Input in %o0,%o1,%o2 1: ld [%o0],%o3 // *xptr ld [%o0+%o1],%o4 // *yptr subcc %o2,1,%o2 - orn %o3,%o4,%o3 // verknüpfen + orn %o3,%o4,%o3 // verknüpfen st %o3,[%o0] // =: *xptr bne 1b _ sub %o0,4,%o0 // xptr++, yptr++ @@ -2946,10 +2946,10 @@ C(orc2_loop_down:) // Input in %o0,%o1,%o2 _ sll %o2,2,%o2 // %o2 = 4*count sub %o0,%o2,%o0 // %o0 = &xptr[-count] sub %o1,%o2,%o1 // %o1 = &yptr[-count] -1: subcc %o2,4,%o2 // Zähler erniedrigen, Pointer erniedrigen - ld [%o1+%o2],%o3 // nächstes Digit holen +1: subcc %o2,4,%o2 // Zähler erniedrigen, Pointer erniedrigen + ld [%o1+%o2],%o3 // nächstes Digit holen ld [%o0+%o2],%o4 // noch ein Digit holen - orn %o4,%o3,%o3 // beide verknüpfen + orn %o4,%o3,%o3 // beide verknüpfen bne 1b _ st %o3,[%o1+%o2] // Digit ablegen 2: retl @@ -2977,8 +2977,8 @@ C(not_loop_down:) // Input in %o0,%o1 be 2f _ sll %o1,2,%o1 // %o1 = 4*count sub %o0,%o1,%o0 // %o0 = &destptr[-count] -1: subcc %o1,4,%o1 // Zähler erniedrigen, Pointer erniedrigen - ld [%o0+%o1],%o2 // nächstes Digit holen +1: subcc %o1,4,%o1 // Zähler erniedrigen, Pointer erniedrigen + ld [%o0+%o1],%o2 // nächstes Digit holen xor %o2,-1,%o2 bne 1b _ st %o2,[%o0+%o1] // Digit ablegen @@ -3015,13 +3015,13 @@ C(and_test_loop_down:) // Input in %o0,%o1,%o2, Output in %o0 subcc %o2,4,%o2 bcs 2f _ nop - ld [%o0+%o2],%o3 // nächstes Digit holen + ld [%o0+%o2],%o3 // nächstes Digit holen 1: ld [%o1+%o2],%o4 // noch ein Digit holen - andcc %o3,%o4,%g0 // beide verknüpfen + andcc %o3,%o4,%g0 // beide verknüpfen bne 3f - _ subcc %o2,4,%o2 // Zähler erniedrigen, Pointer erniedrigen + _ subcc %o2,4,%o2 // Zähler erniedrigen, Pointer erniedrigen bcc,a 1b - __ ld [%o0+%o2],%o3 // nächstes Digit holen + __ ld [%o0+%o2],%o3 // nächstes Digit holen 2: retl _ mov 0,%o0 3: retl @@ -3059,13 +3059,13 @@ C(compare_loop_down:) // Input in %o0,%o1,%o2, Output in %o0 subcc %o2,4,%o2 bcs 5f _ nop - ld [%o0+%o2],%o3 // nächstes Digit holen + ld [%o0+%o2],%o3 // nächstes Digit holen 1: ld [%o1+%o2],%o4 // noch ein Digit holen - subcc %o2,4,%o2 // Zähler erniedrigen, Pointer erniedrigen + subcc %o2,4,%o2 // Zähler erniedrigen, Pointer erniedrigen bcs 4f _ subcc %o3,%o4,%g0 // vergleichen be,a 1b - __ ld [%o0+%o2],%o3 // nächstes Digit holen + __ ld [%o0+%o2],%o3 // nächstes Digit holen 2: blu 3f _ nop retl @@ -3080,7 +3080,7 @@ C(compare_loop_down:) // Input in %o0,%o1,%o2, Output in %o0 // extern uintD add_loop_up (uintD* sourceptr1, uintD* sourceptr2, uintD* destptr, uintC count); DECLARE_FUNCTION(add_loop_up) -C(add_loop_up:) // Input in %o0,%o1,%o2,%o3, verändert %g1, Output in %o0 +C(add_loop_up:) // Input in %o0,%o1,%o2,%o3, verändert %g1, Output in %o0 #if STANDARD_LOOPS andcc %o3,%o3,%g0 be 2f @@ -3113,7 +3113,7 @@ C(add_loop_up:) // Input in %o0,%o1,%o2,%o3, ver subcc %g0,%g1,%g0 // carry addxcc %o4,%o5,%o4 // addieren addx %g0,%g0,%g1 // neuer Carry - addcc %o3,4,%o3 // Zähler erniedrigen, Pointer erhöhen + addcc %o3,4,%o3 // Zähler erniedrigen, Pointer erhöhen bne 1b _ st %o4,[%o2+%o3] // Digit ablegen 2: retl @@ -3136,7 +3136,7 @@ C(add_loop_up:) // Input in %o0,%o1,%o2,%o3, ver #endif sub %o5,%o4,%o5 jmp %o5 // Sprung nach (label 1)+4*(1+4*8-4*(count mod 8)) - _ subcc %g0,%g0,%g0 // carry löschen + _ subcc %g0,%g0,%g0 // carry löschen 1: subcc %g0,%g1,%g0 // carry ld [%o0-32],%o4 // source1-digit ld [%o1-32],%o5 // source2-digit @@ -3217,7 +3217,7 @@ C(addto_loop_up:) // Input in %o0,%o1,%o2, Output in %o0 addxcc %o4,%o3,%o4 // addieren addx %g0,%g0,%o5 // neuer Carry st %o4,[%o1+%o2] // Digit ablegen - addcc %o2,4,%o2 // Zähler erniedrigen, Pointer erhöhen + addcc %o2,4,%o2 // Zähler erniedrigen, Pointer erhöhen bne,a 1b __ ld [%o0+%o2],%o3 // source-digit 2: retl @@ -3239,7 +3239,7 @@ C(addto_loop_up:) // Input in %o0,%o1,%o2, Output in %o0 #endif sub %o4,%o3,%o4 jmp %o4 // Sprung nach (label 1)+4*(1+4*8-4*(count mod 8)) - _ subcc %g0,%g0,%g0 // carry löschen + _ subcc %g0,%g0,%g0 // carry löschen 1: subcc %g0,%o5,%g0 // carry ld [%o0-32],%o3 // source-digit ld [%o1-32],%o4 // dest-digit @@ -3315,7 +3315,7 @@ C(inc_loop_up:) // Input in %o0,%o1, Output in %o0 1: addcc %o2,1,%o2 // incrementieren bne 3f _ st %o2,[%o0+%o1] // ablegen - addcc %o1,4,%o1 // Zähler erniedrigen, Pointer erhöhen + addcc %o1,4,%o1 // Zähler erniedrigen, Pointer erhöhen bne,a 1b __ ld [%o0+%o1],%o2 2: retl @@ -3326,7 +3326,7 @@ C(inc_loop_up:) // Input in %o0,%o1, Output in %o0 // extern uintD sub_loop_up (uintD* sourceptr1, uintD* sourceptr2, uintD* destptr, uintC count); DECLARE_FUNCTION(sub_loop_up) -C(sub_loop_up:) // Input in %o0,%o1,%o2,%o3, verändert %g1, Output in %o0 +C(sub_loop_up:) // Input in %o0,%o1,%o2,%o3, verändert %g1, Output in %o0 #if STANDARD_LOOPS andcc %o3,%o3,%g0 be 2f @@ -3382,7 +3382,7 @@ C(sub_loop_up:) // Input in %o0,%o1,%o2,%o3, ver #endif sub %o5,%o4,%o5 jmp %o5 // Sprung nach (label 1)+4*(1+4*8-4*(count mod 8)) - _ subcc %g0,%g0,%g0 // carry löschen + _ subcc %g0,%g0,%g0 // carry löschen 1: subcc %g0,%g1,%g0 // carry ld [%o0-32],%o4 // source1-digit ld [%o1-32],%o5 // source2-digit @@ -3432,7 +3432,7 @@ C(sub_loop_up:) // Input in %o0,%o1,%o2,%o3, ver // extern uintD subx_loop_up (uintD* sourceptr1, uintD* sourceptr2, uintD* destptr, uintC count, uintD carry); DECLARE_FUNCTION(subx_loop_up) -C(subx_loop_up:) // Input in %o0,%o1,%o2,%o3,%o4, verändert %g1, Output in %o0 +C(subx_loop_up:) // Input in %o0,%o1,%o2,%o3,%o4, verändert %g1, Output in %o0 #if STANDARD_LOOPS andcc %o3,%o3,%g0 be 2f @@ -3591,7 +3591,7 @@ C(subfrom_loop_up:) // Input in %o0,%o1,%o2, Output in %o0 #endif sub %o4,%o3,%o4 jmp %o4 // Sprung nach _subfrom_loop_up+4*(11+4*8-4*(count mod 8)) - _ subcc %g0,%g0,%g0 // carry löschen + _ subcc %g0,%g0,%g0 // carry löschen 1: subcc %g0,%o5,%g0 // carry ld [%o0-32],%o3 // source-digit ld [%o1-32],%o4 // dest-digit @@ -3667,7 +3667,7 @@ C(dec_loop_up:) // Input in %o0,%o1, Output in %o0 1: subcc %o2,1,%o2 // decrementieren bcc 3f _ st %o2,[%o0+%o1] // ablegen - addcc %o1,4,%o1 // Zähler erniedrigen, Pointer erhöhen + addcc %o1,4,%o1 // Zähler erniedrigen, Pointer erhöhen bne,a 1b __ ld [%o0+%o1],%o2 2: retl @@ -3714,7 +3714,7 @@ C(neg_loop_up:) // Input in %o0,%o1, Output in %o0 ld [%o0+%o1],%o2 // digit holen 1: subcc %g0,%o2,%o2 // negieren, testen bne 3f - _ addcc %o1,4,%o1 // Zähler erniedrigen, Pointer erhöhen + _ addcc %o1,4,%o1 // Zähler erniedrigen, Pointer erhöhen bne,a 1b __ ld [%o0+%o1],%o2 2: retl @@ -3755,7 +3755,7 @@ C(shift1left_loop_up:) // Input in %o0,%o1, Output in %o0 // extern uintD shiftleft_loop_up (uintD* ptr, uintC count, uintC i, uintD carry); DECLARE_FUNCTION(shiftleft_loop_up) -C(shiftleft_loop_up:) // Input in %o0,%o1,%o2,%o3, verändert %g1, Output in %o0 +C(shiftleft_loop_up:) // Input in %o0,%o1,%o2,%o3, verändert %g1, Output in %o0 andcc %o1,%o1,%g0 be 2f _ sub %g0,%o2,%g1 // 32-i (mod 32) @@ -3764,7 +3764,7 @@ C(shiftleft_loop_up:) // Input in %o0,%o1,%o2,%o3, ver sll %o4,%o2,%o5 // dessen niedere (32-i) Bits or %o3,%o5,%o5 // mit dem alten Carry kombinieren st %o5,[%o0] // Digit ablegen - srl %o4,%g1,%o3 // dessen höchste i Bits liefern den neuen Carry + srl %o4,%g1,%o3 // dessen höchste i Bits liefern den neuen Carry bne 1b _ add %o0,4,%o0 2: retl @@ -3774,7 +3774,7 @@ C(shiftleft_loop_up:) // Input in %o0,%o1,%o2,%o3, ver // extern uintD shiftleftcopy_loop_up (uintD* sourceptr, uintD* destptr, uintC count, uintC i); DECLARE_FUNCTION(shiftleftcopy_loop_up) -C(shiftleftcopy_loop_up:) // Input in %o0,%o1,%o2,%o3, verändert %g1,%g2, Output in %o0 +C(shiftleftcopy_loop_up:) // Input in %o0,%o1,%o2,%o3, verändert %g1,%g2, Output in %o0 andcc %o2,%o2,%g0 be 2f _ mov 0,%o4 // Carry := 0 @@ -3785,7 +3785,7 @@ C(shiftleftcopy_loop_up:) // Input in %o0,%o1,%o2,%o3, ver or %o4,%g2,%g2 // mit dem alten Carry kombinieren st %g2,[%o1] // Digit ablegen add %o1,4,%o1 - srl %o5,%g1,%o4 // dessen höchste i Bits liefern den neuen Carry + srl %o5,%g1,%o4 // dessen höchste i Bits liefern den neuen Carry bne 1b _ add %o0,4,%o0 2: retl @@ -3813,7 +3813,7 @@ C(shift1right_loop_down:) // Input in %o0,%o1,%o2, Output in %o0 // extern uintD shiftright_loop_down (uintD* ptr, uintC count, uintC i); DECLARE_FUNCTION(shiftright_loop_down) -C(shiftright_loop_down:) // Input in %o0,%o1,%o2, verändert %g1, Output in %o0 +C(shiftright_loop_down:) // Input in %o0,%o1,%o2, verändert %g1, Output in %o0 sub %g0,%o2,%g1 // 32-i (mod 32) andcc %o1,%o1,%g0 be 2f @@ -3832,7 +3832,7 @@ C(shiftright_loop_down:) // Input in %o0,%o1,%o2, ver // extern uintD shiftrightsigned_loop_down (uintD* ptr, uintC count, uintC i); DECLARE_FUNCTION(shiftrightsigned_loop_down) -C(shiftrightsigned_loop_down:) // Input in %o0,%o1,%o2, verändert %g1, Output in %o0 +C(shiftrightsigned_loop_down:) // Input in %o0,%o1,%o2, verändert %g1, Output in %o0 ld [%o0-4],%o4 // erstes Digit sub %g0,%o2,%g1 // 32-i (mod 32) sra %o4,%o2,%o5 // shiften @@ -3854,7 +3854,7 @@ C(shiftrightsigned_loop_down:) // Input in %o0,%o1,%o2, ver // extern uintD shiftrightcopy_loop_down (uintD* sourceptr, uintD* destptr, uintC count, uintC i, uintD carry); DECLARE_FUNCTION(shiftrightcopy_loop_down) -C(shiftrightcopy_loop_down:) // Input in %o0,%o1,%o2,%o3,%o4, verändert %g1,%g2, Output in %o0 +C(shiftrightcopy_loop_down:) // Input in %o0,%o1,%o2,%o3,%o4, verändert %g1,%g2, Output in %o0 sub %g0,%o3,%g1 // 32-i (mod 32) andcc %o2,%o2,%g0 be 2f @@ -3878,7 +3878,7 @@ C(mulusmall_loop_up:) // Input in %o0,%o1,%o2,%o3, Output in %o0 andcc %o2,%o2,%g0 be 3f _ nop -1: // nächstes Digit [%o1] mit der 6-Bit-Zahl %o0 multiplizieren +1: // nächstes Digit [%o1] mit der 6-Bit-Zahl %o0 multiplizieren // und kleinen Carry %o3 dazu: mov %o0,%y ld [%o1],%o4 // Wartetakt! @@ -3913,7 +3913,7 @@ C(mulusmall_loop_up:) // Input in %o0,%o1,%o2,%o3, Output in %o0 C(mulu_loop_up:) // Input in %i0,%i1,%i2,%i3 save %sp,-96,%sp mov 0,%l0 // Carry -1: ld [%i1],%o1 // nächstes Digit +1: ld [%i1],%o1 // nächstes Digit add %i1,4,%i1 call _mulu32_ // mit digit multiplizieren _ mov %i0,%o0 @@ -3928,9 +3928,9 @@ C(mulu_loop_up:) // Input in %i0,%i1,%i2,%i3 _ restore #else DECLARE_FUNCTION(mulu_loop_up) -C(mulu_loop_up:) // Input in %o0,%o1,%o2,%o3, verändert %g1 +C(mulu_loop_up:) // Input in %o0,%o1,%o2,%o3, verändert %g1 mov 0,%o4 // Carry -1: ld [%o1],%g1 // nächstes Digit +1: ld [%o1],%g1 // nächstes Digit // mit digit multiplizieren: %o0 * %g1 -> %o5|%g1 #ifdef sparcv8 add %o1,4,%o1 @@ -3994,11 +3994,11 @@ C(muluadd_loop_up:) // Input in %i0,%i1,%i2,%i3, Output in %i0 #if !MULU32_INLINE save %sp,-96,%sp mov 0,%l0 // Carry -1: ld [%i1],%o1 // nächstes source-Digit +1: ld [%i1],%o1 // nächstes source-Digit add %i1,4,%i1 call _mulu32_ // mit digit multiplizieren _ mov %i0,%o0 - ld [%i2],%o1 // nächstes dest-digit + ld [%i2],%o1 // nächstes dest-digit addcc %l0,%o0,%o0 // und bisherigen Carry addieren addx %g0,%g1,%l0 // High-Digit gibt neuen Carry addcc %o1,%o0,%o0 // addieren @@ -4016,7 +4016,7 @@ C(muluadd_loop_up:) // Input in %i0,%i1,%i2,%i3, Output in %i0 #ifndef sparcv8 sra %i0,31,%l1 // 0 falls %i0>=0, -1 falls %i0<0 #endif -1: ld [%i1],%o1 // nächstes source-Digit +1: ld [%i1],%o1 // nächstes source-Digit add %i1,4,%i1 // mit digit multiplizieren: %i0 * %o1 -> %o2|%o0 #ifdef sparcv8 @@ -4062,7 +4062,7 @@ C(muluadd_loop_up:) // Input in %i0,%i1,%i2,%i3, Output in %i0 add %o2,%o3,%o2 // %o3 = (0 falls %i0>=0, %o1 falls %i0<0) rd %y,%o0 #endif - ld [%i2],%o1 // nächstes dest-digit + ld [%i2],%o1 // nächstes dest-digit addcc %l0,%o0,%o0 // und bisherigen Carry addieren addx %g0,%o2,%l0 // High-Digit gibt neuen Carry addcc %o1,%o0,%o0 // addieren @@ -4082,11 +4082,11 @@ C(mulusub_loop_up:) // Input in %i0,%i1,%i2,%i3, Output in %i0 #if !MULU32_INLINE save %sp,-96,%sp mov 0,%l0 // Carry -1: ld [%i1],%o1 // nächstes source-Digit +1: ld [%i1],%o1 // nächstes source-Digit add %i1,4,%i1 call _mulu32_ // mit digit multiplizieren _ mov %i0,%o0 - ld [%i2],%o1 // nächstes dest-digit + ld [%i2],%o1 // nächstes dest-digit addcc %l0,%o0,%o0 // und bisherigen Carry addieren addx %g0,%g1,%l0 // High-Digit gibt neuen Carry subcc %o1,%o0,%o1 // davon das Low-Digit subtrahieren @@ -4104,7 +4104,7 @@ C(mulusub_loop_up:) // Input in %i0,%i1,%i2,%i3, Output in %i0 #ifndef sparcv8 sra %i0,31,%l1 // 0 falls %i0>=0, -1 falls %i0<0 #endif -1: ld [%i1],%o1 // nächstes source-Digit +1: ld [%i1],%o1 // nächstes source-Digit add %i1,4,%i1 // mit digit multiplizieren: %i0 * %o1 -> %o2|%o0 #ifdef sparcv8 @@ -4150,7 +4150,7 @@ C(mulusub_loop_up:) // Input in %i0,%i1,%i2,%i3, Output in %i0 add %o2,%o3,%o2 // %o3 = (0 falls %i0>=0, %o1 falls %i0<0) rd %y,%o0 #endif - ld [%i2],%o1 // nächstes dest-digit + ld [%i2],%o1 // nächstes dest-digit addcc %l0,%o0,%o0 // und bisherigen Carry addieren addx %g0,%o2,%l0 // High-Digit gibt neuen Carry subcc %o1,%o0,%o1 // davon das Low-Digit subtrahieren @@ -4172,7 +4172,7 @@ C(divu_loop_down:) // Input in %i0,%i1,%i2, Output in %i0 be 2f _ mov 0,%g1 // Rest 1: mov %g1,%o0 // Rest als High-Digit - ld [%i1-4],%o1 // nächstes Digit als Low-Digit + ld [%i1-4],%o1 // nächstes Digit als Low-Digit call C(divu_6432_3232_) // zusammen durch digit dividieren _ mov %i0,%o2 st %o0,[%i1-4] // Quotient ablegen, Rest in %g1 @@ -4191,7 +4191,7 @@ C(divucopy_loop_down:) // Input in %i0,%i1,%i2,%i3, Output in %i0 be 2f _ mov 0,%g1 // Rest 1: mov %g1,%o0 // Rest als High-Digit - ld [%i1-4],%o1 // nächstes Digit als Low-Digit + ld [%i1-4],%o1 // nächstes Digit als Low-Digit call C(divu_6432_3232_) // zusammen durch digit dividieren _ mov %i0,%o2 sub %i2,4,%i2 @@ -4207,7 +4207,7 @@ C(divucopy_loop_down:) // Input in %i0,%i1,%i2,%i3, Output in %i0 // extern void shiftxor_loop_up (uintD* xptr, const uintD* yptr, uintC count, uintC i); DECLARE_FUNCTION(shiftxor_loop_up) -C(shiftxor_loop_up:) // Input in %o0,%o1,%o2,%o3, verändert %g1,%g2 +C(shiftxor_loop_up:) // Input in %o0,%o1,%o2,%o3, verändert %g1,%g2 andcc %o2,%o2,%g0 be 2f _ sub %g0,%o3,%g1 // 32-i (mod 32) @@ -4219,10 +4219,10 @@ C(shiftxor_loop_up:) // Input in %o0,%o1,%o2,%o3, ver xor %o4,%g2,%o4 // mit dem modifizierten *xptr kombinieren st %o4,[%o0] // und ablegen add %o0,4,%o0 - srl %o5,%g1,%g2 // höchste i Bits von *yptr - ld [%o0],%o4 // schon mal mit dem nächsten *xptr + srl %o5,%g1,%g2 // höchste i Bits von *yptr + ld [%o0],%o4 // schon mal mit dem nächsten *xptr bne 1b - _ xor %o4,%g2,%o4 // verknüpfen + _ xor %o4,%g2,%o4 // verknüpfen st %o4,[%o0] // und ablegen 2: retl _ nop diff --git a/src/base/low/cl_low_div.cc b/src/base/low/cl_low_div.cc index f631a51..41550d6 100644 --- a/src/base/low/cl_low_div.cc +++ b/src/base/low/cl_low_div.cc @@ -89,8 +89,8 @@ uint16 divu_3216_1616_ (uint32 x, uint16 y) #ifdef NEED_FUNCTION_divu_3232_3232_ namespace cln { -// Dies dient nur noch als Hilfsfunktion für floorD(). -// Die Rückgabe des Restes in divu_32_rest ist also hier nicht nötig. +// Dies dient nur noch als Hilfsfunktion für floorD(). +// Die Rückgabe des Restes in divu_32_rest ist also hier nicht nötig. uint32 divu_3232_3232_(uint32 x, uint32 y) { var uint32 q; @@ -130,12 +130,12 @@ uint32 divu_6432_3232_(uint32 xhi, uint32 xlo, uint32 y) { xhi = (xhi << s) | (xlo >> (32-s)); xlo = xlo << s; } // 64-durch-32-Bit-Division, // aufgebaut aus zwei 48-durch-32-Bit-Divisionen. - // Methode für eine 48-durch-32-Bit-Division x/y mit 0 <= x < 2^16*y : + // Methode für eine 48-durch-32-Bit-Division x/y mit 0 <= x < 2^16*y : // (beta = 2^n = 2^16, n = 16) // Wir wissen beta^2/2 <= y < beta^2, Quotient q = floor(x/y) < beta. // Schreibe x = beta*x1 + x0 mit x1 := floor(x/beta) // und y = beta*y1 + y0 mit y1 := floor(y/beta) - // und bilde den Näherungs-Quotienten floor(x1/y1) + // und bilde den Näherungs-Quotienten floor(x1/y1) // oder (noch besser) floor(x1/(y1+1)). // Wegen 0 <= x1 < 2^(2n) und 0 < 2^(n-1) <= y1 < 2^n // und x1/(y1+1) <= x/y < x1/(y1+1) + 2 @@ -147,7 +147,7 @@ uint32 divu_6432_3232_(uint32 xhi, uint32 xlo, uint32 y) // gilt floor(x1/(y1+1)) <= floor(x/y) <= floor(x1/(y1+1)) + 2 . // Man bildet also q:=floor(x1/(y1+1)) (ein Shift um n Bit oder // eine (2n)-durch-n-Bit-Division, mit Ergebnis q <= floor(x/y) < beta) - // und x-q*y und muß hiervon noch höchstens 2 mal y abziehen und q + // und x-q*y und muß hiervon noch höchstens 2 mal y abziehen und q // incrementieren, um den Quotienten q = floor(x/y) und den Rest // x-floor(x/y)*y der Division zu bekommen. { var uint16 y1_1 = high16(y)+1; // y1+1 @@ -165,7 +165,7 @@ uint32 divu_6432_3232_(uint32 xhi, uint32 xlo, uint32 y) // Bilde r := (2^16*xhi+high16(xlo)) - y*q1 // = 2^16*(xhi-y1*q1) + high16(xlo) - y0*q1 // = 2^16*r16 + 2^16*q1 + high16(xlo) - y0*q1 (>=0) - // Dies ist < 2^16*y1 + 2^32 <= y + 2^32 <= 3*y, kann überlaufen! + // Dies ist < 2^16*y1 + 2^32 <= y + 2^32 <= 3*y, kann überlaufen! r = highlow32(r16,high16(xlo)); // 2^16*r16 + high16(xlo) < 2^32 r2 = highlow32_0(q1) - mulu16(low16(y),q1); // 2^16*q1 - y0*q1 < 2^32 // 0 <= r+r2 < 3*y. Bei der Addition auf Carry testen! @@ -188,7 +188,7 @@ uint32 divu_6432_3232_(uint32 xhi, uint32 xlo, uint32 y) // Bilde r := (2^16*r+low16(xlo)) - y*q0 // = 2^16*(r-y1*q0) + low16(xlo) - y0*q0 // = 2^16*r16 + 2^16*q0 + low16(xlo) - y0*q0 (>=0) - // Dies ist < 2^16*y1 + 2^32 <= y + 2^32 <= 3*y, kann überlaufen! + // Dies ist < 2^16*y1 + 2^32 <= y + 2^32 <= 3*y, kann überlaufen! r = highlow32(r16,low16(xlo)); // 2^16*r16 + low16(xlo) < 2^32 r2 = highlow32_0(q0) - mulu16(low16(y),q0); // 2^16*q0 - y0*q0 < 2^32 // 0 <= r+r2 < 3*y. Bei der Addition auf Carry testen! @@ -220,7 +220,7 @@ uint64 divu_6464_6464_(uint64 x, uint64 y) // y habe genau n+k Bits (1 <= k <= n), d.h. 2^(n+k-1) <= y < 2^(n+k). // Schreibe x = 2^k*x1 + x0 mit x1 := floor(x/2^k) // und y = 2^k*y1 + y0 mit y1 := floor(y/2^k) -// und bilde den Näherungs-Quotienten floor(x1/y1) +// und bilde den Näherungs-Quotienten floor(x1/y1) // oder (noch besser) floor(x1/(y1+1)). // Wegen 0 <= x1 < 2^(2n) und 0 < 2^(n-1) <= y1 < 2^n // und x1/(y1+1) <= x/y < x1/(y1+1) + 2 @@ -233,7 +233,7 @@ uint64 divu_6464_6464_(uint64 x, uint64 y) // gilt floor(x1/(y1+1)) <= floor(x/y) <= floor(x1/(y1+1)) + 2 . // Man bildet also q:=floor(x1/(y1+1)) (ein Shift um n Bit oder // eine (2n)-durch-n-Bit-Division, mit Ergebnis q <= floor(x/y) < beta) -// und x-q*y und muss hiervon noch höchstens 2 mal y abziehen und q +// und x-q*y und muss hiervon noch höchstens 2 mal y abziehen und q // incrementieren, um den Quotienten q = floor(x/y) und den Rest // x-floor(x/y)*y der Division zu bekommen. { @@ -249,7 +249,7 @@ uint64 divu_6464_6464_(uint64 x, uint64 y) { var uint64 x1 = x; // x1 := x var uint64 y1 = y; // y1 := y var uint32 q; - do { x1 = floor(x1,2); y1 = floor(y1,2); } // k erhöhen + do { x1 = floor(x1,2); y1 = floor(y1,2); } // k erhöhen while (!(y1 <= (uint64)(((uint64)1<<32)-1))); // bis y1 < beta { var uint32 y2 = low32(y1)+1; // y1+1 bilden if (y2==0) @@ -258,12 +258,12 @@ uint64 divu_6464_6464_(uint64 x, uint64 y) { divu_6432_3232(high32(x1),low32(x1),y2,q=,); } // Division von x1 durch y1+1 } // q = floor(x1/(y1+1)) - // x-q*y bilden (eine 32-mal-64-Bit-Multiplikation ohne Überlauf): + // x-q*y bilden (eine 32-mal-64-Bit-Multiplikation ohne Überlauf): x -= highlow64_0(mulu32_64(q,high32(y))); // q * high32(y) * beta // gefahrlos, da q*high32(y) <= q*y/beta <= x/beta < beta x -= mulu32_64(q,low32(y)); // q * low32(y) // gefahrlos, da q*high32(y)*beta + q*low32(y) = q*y <= x - // Noch höchstens 2 mal y abziehen: + // Noch höchstens 2 mal y abziehen: if (x >= y) { q += 1; x -= y; if (x >= y) @@ -301,12 +301,12 @@ uint64 divu_12864_6464_(uint64 xhi, uint64 xlo, uint64 y) { xhi = (xhi << s) | (xlo >> (64-s)); xlo = xlo << s; } // 128-durch-64-Bit-Division, // aufgebaut aus zwei 96-durch-64-Bit-Divisionen. - // Methode für eine 96-durch-64-Bit-Division x/y mit 0 <= x < 2^32*y : + // Methode für eine 96-durch-64-Bit-Division x/y mit 0 <= x < 2^32*y : // (beta = 2^n = 2^32, n = 32) // Wir wissen beta^2/2 <= y < beta^2, Quotient q = floor(x/y) < beta. // Schreibe x = beta*x1 + x0 mit x1 := floor(x/beta) // und y = beta*y1 + y0 mit y1 := floor(y/beta) - // und bilde den Näherungs-Quotienten floor(x1/y1) + // und bilde den Näherungs-Quotienten floor(x1/y1) // oder (noch besser) floor(x1/(y1+1)). // Wegen 0 <= x1 < 2^(2n) und 0 < 2^(n-1) <= y1 < 2^n // und x1/(y1+1) <= x/y < x1/(y1+1) + 2 @@ -318,7 +318,7 @@ uint64 divu_12864_6464_(uint64 xhi, uint64 xlo, uint64 y) // gilt floor(x1/(y1+1)) <= floor(x/y) <= floor(x1/(y1+1)) + 2 . // Man bildet also q:=floor(x1/(y1+1)) (ein Shift um n Bit oder // eine (2n)-durch-n-Bit-Division, mit Ergebnis q <= floor(x/y) < beta) - // und x-q*y und muß hiervon noch höchstens 2 mal y abziehen und q + // und x-q*y und muß hiervon noch höchstens 2 mal y abziehen und q // incrementieren, um den Quotienten q = floor(x/y) und den Rest // x-floor(x/y)*y der Division zu bekommen. { var uint32 y1_1 = high32(y)+1; // y1+1 @@ -336,7 +336,7 @@ uint64 divu_12864_6464_(uint64 xhi, uint64 xlo, uint64 y) // Bilde r := (2^32*xhi+high32(xlo)) - y*q1 // = 2^32*(xhi-y1*q1) + high32(xlo) - y0*q1 // = 2^32*r32 + 2^32*q1 + high32(xlo) - y0*q1 (>=0) - // Dies ist < 2^32*y1 + 2^64 <= y + 2^64 <= 3*y, kann überlaufen! + // Dies ist < 2^32*y1 + 2^64 <= y + 2^64 <= 3*y, kann überlaufen! r = highlow64(r32,high32(xlo)); // 2^32*r32 + high32(xlo) < 2^64 r2 = highlow64_0(q1) - mulu32_w(low32(y),q1); // 2^32*q1 - y0*q1 < 2^64 // 0 <= r+r2 < 3*y. Bei der Addition auf Carry testen! @@ -359,7 +359,7 @@ uint64 divu_12864_6464_(uint64 xhi, uint64 xlo, uint64 y) // Bilde r := (2^32*r+low32(xlo)) - y*q0 // = 2^32*(r-y1*q0) + low32(xlo) - y0*q0 // = 2^32*r32 + 2^32*q0 + low32(xlo) - y0*q0 (>=0) - // Dies ist < 2^32*y1 + 2^64 <= y + 2^64 <= 3*y, kann überlaufen! + // Dies ist < 2^32*y1 + 2^64 <= y + 2^64 <= 3*y, kann überlaufen! r = highlow64(r32,low32(xlo)); // 2^32*r32 + low32(xlo) < 2^64 r2 = highlow64_0(q0) - mulu32_w(low32(y),q0); // 2^32*q0 - y0*q0 < 2^64 // 0 <= r+r2 < 3*y. Bei der Addition auf Carry testen! diff --git a/src/base/low/cl_low_isqrt.cc b/src/base/low/cl_low_isqrt.cc index 2588c0a..19e5752 100644 --- a/src/base/low/cl_low_isqrt.cc +++ b/src/base/low/cl_low_isqrt.cc @@ -21,15 +21,15 @@ uintL isqrt (uintL x) // Methode: // x=0 -> y=0, fertig. // y := 2^k als Anfangswert, wobei k>0, k<=16 mit 2^(2k-2) <= x < 2^(2k) sei. - // y := floor((y + floor(x/y))/2) als nächster Wert, + // y := floor((y + floor(x/y))/2) als nächster Wert, // solange z := floor(x/y) < y, setze y := floor((y+z)/2). // y ist fertig. // (Beweis: // 1. Die Folge der y ist streng monoton fallend. - // 2. Stets gilt y >= floor(sqrt(x)) (denn für alle y>0 ist + // 2. Stets gilt y >= floor(sqrt(x)) (denn für alle y>0 ist // y + x/y >= 2*sqrt(x) und daher floor((y + floor(x/y))/2) = // floor(y/2 + x/(2*y)) >= floor(sqrt(x)) ). - // 3. Am Schluß gilt x >= y^2. + // 3. Am Schluß gilt x >= y^2. // ) if (x==0) return 0; // x=0 -> y=0 { var uintC k2; integerlength32(x,k2=); // 2^(k2-1) <= x < 2^k2 @@ -51,7 +51,7 @@ uintL isqrt (uintL x) var uintL y = (x >> (16+1)) | bit(16-1); // stets 2^(k-1) <= y < 2^k loop { var uintL z; - if (x1 >= y) break; // Division x/y ergäbe Überlauf -> z > y + if (x1 >= y) break; // Division x/y ergäbe Überlauf -> z > y divu_3216_1616(x,y, z=,); // Dividiere x/y if (z >= y) break; y = floor(z+y,2); diff --git a/src/base/low/cl_low_isqrt2.cc b/src/base/low/cl_low_isqrt2.cc index eb68d48..ccb06ff 100644 --- a/src/base/low/cl_low_isqrt2.cc +++ b/src/base/low/cl_low_isqrt2.cc @@ -21,15 +21,15 @@ uintL isqrt (uintL x1, uintL x0) // Methode: // x=0 -> y=0, fertig. // y := 2^k als Anfangswert, wobei k>0, k<=32 mit 2^(2k-2) <= x < 2^(2k) sei. - // y := floor((y + floor(x/y))/2) als nächster Wert, + // y := floor((y + floor(x/y))/2) als nächster Wert, // solange z := floor(x/y) < y, setze y := floor((y+z)/2). // y ist fertig. // (Beweis: // 1. Die Folge der y ist streng monoton fallend. - // 2. Stets gilt y >= floor(sqrt(x)) (denn für alle y>0 ist + // 2. Stets gilt y >= floor(sqrt(x)) (denn für alle y>0 ist // y + x/y >= 2*sqrt(x) und daher floor((y + floor(x/y))/2) = // floor(y/2 + x/(2*y)) >= floor(sqrt(x)) ). - // 3. Am Schluß gilt x >= y^2. + // 3. Am Schluß gilt x >= y^2. // ) if (x1==0) { return isqrt(x0); } // x klein? { var uintC k2; integerlength32(x1,k2=); // 2^(k2+32-1) <= x < 2^(k2+32) @@ -50,10 +50,10 @@ uintL isqrt (uintL x1, uintL x0) { var uintL y = (x1 >> 1) | bit(32-1); // stets 2^(k-1) <= y < 2^k loop { var uintL z; - if (x1 >= y) break; // Division x/y ergäbe Überlauf -> z > y + if (x1 >= y) break; // Division x/y ergäbe Überlauf -> z > y divu_6432_3232(x1,x0,y, z=,); // Dividiere x/y if (z >= y) break; - y = floor(z+y,2) | bit(32-1); // y muß >= 2^(k-1) bleiben + y = floor(z+y,2) | bit(32-1); // y muß >= 2^(k-1) bleiben } return y; } diff --git a/src/base/random/cl_UL_random.cc b/src/base/random/cl_UL_random.cc index 689d5f6..7ff6ede 100644 --- a/src/base/random/cl_UL_random.cc +++ b/src/base/random/cl_UL_random.cc @@ -29,7 +29,7 @@ uint32 random32 (random_state& randomstate) mulu64(seed,a, , newseed =); // c addieren: newseed += 1; - // seed neu füllen: + // seed neu füllen: randomstate.seed.hi = high32(newseed); randomstate.seed.lo = low32(newseed); // mittlere 32 Bits als Ergebnis: @@ -48,8 +48,8 @@ uint32 random32 (random_state& randomstate) mulu32(seed_lo,a_hi, , newseed_hi +=); mulu32(seed_hi,a_lo, , newseed_hi +=); // c addieren: - newseed_lo += 1; if (newseed_lo==0) { newseed_hi += 1; } // um 1 erhöhen - // seed neu füllen: + newseed_lo += 1; if (newseed_lo==0) { newseed_hi += 1; } // um 1 erhöhen + // seed neu füllen: randomstate.seed.hi = newseed_hi; randomstate.seed.lo = newseed_lo; // mittlere 32 Bits als Ergebnis: diff --git a/src/base/random/cl_random_from.cc b/src/base/random/cl_random_from.cc index eb9552a..2e91b7a 100644 --- a/src/base/random/cl_random_from.cc +++ b/src/base/random/cl_random_from.cc @@ -37,7 +37,7 @@ inline uint32 get_seed (void) { var struct timeval tv; gettimeofday(&tv,0); - return highlow32(tv.tv_sec,tv.tv_usec); // 16+16 zufällige Bits + return highlow32(tv.tv_sec,tv.tv_usec); // 16+16 zufällige Bits } } // namespace cln @@ -88,7 +88,7 @@ random_state::random_state () var uint32 seed_lo; #if defined(unix) || defined(__unix) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(_AIX) || defined(sinix) || (defined(__MACH__) && defined(__APPLE__)) || (defined(__CYGWIN__) && defined(__GNUC__)) || defined(__BEOS__) seed_lo = get_seed(); - seed_hi = (rand() // zufällige 31 Bit (bei UNIX_BSD) bzw. 16 Bit (bei UNIX_SYSV) + seed_hi = (rand() // zufällige 31 Bit (bei UNIX_BSD) bzw. 16 Bit (bei UNIX_SYSV) << 8) ^ (uintL)(getpid()); // ca. 8 Bit von der Process ID #elif defined(__OpenBSD__) seed_lo = arc4random(); @@ -97,13 +97,13 @@ random_state::random_state () seed_lo = get_seed(); seed_hi = (rand() << 8) ^ (uintL)(GetCurrentProcessId()); #elif defined(__atarist) - seed_lo = highlow32(GEMDOS_GetDate(),GEMDOS_GetTime()); // 16+16 zufällige Bits - seed_hi = XBIOS_Random(); // 24 Bit zufällig vom XBIOS, vorne 8 Nullbits + seed_lo = highlow32(GEMDOS_GetDate(),GEMDOS_GetTime()); // 16+16 zufällige Bits + seed_hi = XBIOS_Random(); // 24 Bit zufällig vom XBIOS, vorne 8 Nullbits #elif defined(amiga) || defined(AMIGA) seed_lo = get_real_time(); // Uhrzeit seed_hi = FindTask(NULL); // Pointer auf eigene Task #elif defined(__MSDOS__) || defined(__EMX__) || defined(__riscos) - // Keine Zufallszahlen, keine PID, nichts Zufälliges da. + // Keine Zufallszahlen, keine PID, nichts Zufälliges da. seed_lo = get_real_time(); // Uhrzeit, 100 Hz seed_hi = time(NULL); #else diff --git a/src/base/random/cl_random_impl.h b/src/base/random/cl_random_impl.h index f4dc0d4..5f5d510 100644 --- a/src/base/random/cl_random_impl.h +++ b/src/base/random/cl_random_impl.h @@ -7,18 +7,18 @@ namespace cln { -// random_UDS(randomstate,MSDptr,len) füllt die UDS MSDptr/len/.. +// random_UDS(randomstate,MSDptr,len) füllt die UDS MSDptr/len/.. // mit len Zufallsdigits. -// > randomstate: ein Random-State, wird verändert +// > randomstate: ein Random-State, wird verändert // > MSDptr/len/..: wo die Zufallsdigits abgelegt werden sollen -// > len: gewünschte Anzahl von Zufallsdigits +// > len: gewünschte Anzahl von Zufallsdigits extern void random_UDS (random_state& randomstate, uintD* MSDptr, uintC len); -// testrandom_UDS(randomstate,MSDptr,len) füllt die UDS MSDptr/len/.. -// mit len Zufallsdigits, mit relativ langen Blöcken von Nullen und Einsen. -// > randomstate: ein Random-State, wird verändert +// testrandom_UDS(randomstate,MSDptr,len) füllt die UDS MSDptr/len/.. +// mit len Zufallsdigits, mit relativ langen Blöcken von Nullen und Einsen. +// > randomstate: ein Random-State, wird verändert // > MSDptr/len/..: wo die Zufallsdigits abgelegt werden sollen -// > len: gewünschte Anzahl von Zufallsdigits +// > len: gewünschte Anzahl von Zufallsdigits extern void testrandom_UDS (random_state& randomstate, uintD* MSDptr, uintC len); } // namespace cln diff --git a/src/complex/algebraic/cl_C_sqrt.cc b/src/complex/algebraic/cl_C_sqrt.cc index a79b7f6..29abf4a 100644 --- a/src/complex/algebraic/cl_C_sqrt.cc +++ b/src/complex/algebraic/cl_C_sqrt.cc @@ -17,7 +17,7 @@ namespace cln { const cl_N sqrt (const cl_N& x) { // Methode: -// x reell -> Für x>=0 klar, für x<0: sqrt(-x)*i. +// x reell -> Für x>=0 klar, für x<0: sqrt(-x)*i. // x=a+bi -> // Bestimme r=abs(x)=sqrt(a*a+b*b). // Falls a>=0: Setze c:=sqrt((r+a)/2), d:=(b/(2*c) falls c>0, c falls c=0). diff --git a/src/complex/algebraic/cl_DF_hypot.cc b/src/complex/algebraic/cl_DF_hypot.cc index fb6dba2..2c56951 100644 --- a/src/complex/algebraic/cl_DF_hypot.cc +++ b/src/complex/algebraic/cl_DF_hypot.cc @@ -23,10 +23,10 @@ const cl_DF cl_hypot (const cl_DF& a, const cl_DF& b) // a=0.0 -> liefere abs(b). // b=0.0 -> liefere abs(a). // e:=max(exponent(a),exponent(b)). -// a':=a/2^e bzw. 0.0 bei Underflowmöglichkeit (beim Skalieren a':=a/2^e +// a':=a/2^e bzw. 0.0 bei Underflowmöglichkeit (beim Skalieren a':=a/2^e // oder beim Quadrieren a'*a': 2*(e-exponent(a))>exp_mid-exp_low-1 // d.h. exponent(b)-exponent(a)>floor((exp_mid-exp_low-1)/2) ). -// b':=b/2^e bzw. 0.0 bei Underflowmöglichkeit (beim Skalieren b':=b/2^e +// b':=b/2^e bzw. 0.0 bei Underflowmöglichkeit (beim Skalieren b':=b/2^e // oder beim Quadrieren b'*b': 2*(e-exponent(b))>exp_mid-exp_low-1 // d.h. exponent(a)-exponent(b)>floor((exp_mid-exp_low-1)/2) ). // c':=a'*a'+b'*b', c':=sqrt(c'), liefere 2^e*c'. diff --git a/src/complex/algebraic/cl_FF_hypot.cc b/src/complex/algebraic/cl_FF_hypot.cc index f52ba0d..c6224ef 100644 --- a/src/complex/algebraic/cl_FF_hypot.cc +++ b/src/complex/algebraic/cl_FF_hypot.cc @@ -23,10 +23,10 @@ const cl_FF cl_hypot (const cl_FF& a, const cl_FF& b) // a=0.0 -> liefere abs(b). // b=0.0 -> liefere abs(a). // e:=max(exponent(a),exponent(b)). -// a':=a/2^e bzw. 0.0 bei Underflowmöglichkeit (beim Skalieren a':=a/2^e +// a':=a/2^e bzw. 0.0 bei Underflowmöglichkeit (beim Skalieren a':=a/2^e // oder beim Quadrieren a'*a': 2*(e-exponent(a))>exp_mid-exp_low-1 // d.h. exponent(b)-exponent(a)>floor((exp_mid-exp_low-1)/2) ). -// b':=b/2^e bzw. 0.0 bei Underflowmöglichkeit (beim Skalieren b':=b/2^e +// b':=b/2^e bzw. 0.0 bei Underflowmöglichkeit (beim Skalieren b':=b/2^e // oder beim Quadrieren b'*b': 2*(e-exponent(b))>exp_mid-exp_low-1 // d.h. exponent(a)-exponent(b)>floor((exp_mid-exp_low-1)/2) ). // c':=a'*a'+b'*b', c':=sqrt(c'), liefere 2^e*c'. diff --git a/src/complex/algebraic/cl_LF_hypot.cc b/src/complex/algebraic/cl_LF_hypot.cc index cec82df..1273488 100644 --- a/src/complex/algebraic/cl_LF_hypot.cc +++ b/src/complex/algebraic/cl_LF_hypot.cc @@ -23,14 +23,14 @@ ALL_cl_LF_OPERATIONS_SAME_PRECISION() const cl_LF cl_hypot (const cl_LF& a, const cl_LF& b) { -// Zuerst a und b auf gleiche Länge bringen: den längeren runden. +// Zuerst a und b auf gleiche Länge bringen: den längeren runden. // a=0.0 -> liefere abs(b). // b=0.0 -> liefere abs(a). // e:=max(exponent(a),exponent(b)). -// a':=a/2^e bzw. 0.0 bei Underflowmöglichkeit (beim Skalieren a':=a/2^e +// a':=a/2^e bzw. 0.0 bei Underflowmöglichkeit (beim Skalieren a':=a/2^e // oder beim Quadrieren a'*a': 2*(e-exponent(a))>exp_mid-exp_low-1 // d.h. exponent(b)-exponent(a)>floor((exp_mid-exp_low-1)/2) ). -// b':=b/2^e bzw. 0.0 bei Underflowmöglichkeit (beim Skalieren b':=b/2^e +// b':=b/2^e bzw. 0.0 bei Underflowmöglichkeit (beim Skalieren b':=b/2^e // oder beim Quadrieren b'*b': 2*(e-exponent(b))>exp_mid-exp_low-1 // d.h. exponent(a)-exponent(b)>floor((exp_mid-exp_low-1)/2) ). // c':=a'*a'+b'*b', c':=sqrt(c'), liefere 2^e*c'. diff --git a/src/complex/algebraic/cl_R_hypot.cc b/src/complex/algebraic/cl_R_hypot.cc index 431705c..78ebf8c 100644 --- a/src/complex/algebraic/cl_R_hypot.cc +++ b/src/complex/algebraic/cl_R_hypot.cc @@ -30,18 +30,18 @@ const cl_R cl_hypot (const cl_R& a, const cl_R& b) // c:=a*a+b*b, liefere (sqrt c). // Falls a oder b Floats sind: // Falls einer von beiden rational ist, runde ihn zum selben Float-Typ -// wie der andere und führe das UP durch. -// Falls beide Floats sind, erweitere auf den genaueren, führe das UP +// wie der andere und führe das UP durch. +// Falls beide Floats sind, erweitere auf den genaueren, führe das UP // durch und runde wieder auf den ungenaueren. // Das Ergebnis ist ein Float >=0. // UP: [a,b Floats vom selben Typ] // a=0.0 -> liefere abs(b). // b=0.0 -> liefere abs(a). // e:=max(exponent(a),exponent(b)). -// a':=a/2^e bzw. 0.0 bei Underflowmöglichkeit (beim Skalieren a':=a/2^e +// a':=a/2^e bzw. 0.0 bei Underflowmöglichkeit (beim Skalieren a':=a/2^e // oder beim Quadrieren a'*a': 2*(e-exponent(a))>exp_mid-exp_low-1 // d.h. exponent(b)-exponent(a)>floor((exp_mid-exp_low-1)/2) ). -// b':=b/2^e bzw. 0.0 bei Underflowmöglichkeit (beim Skalieren b':=b/2^e +// b':=b/2^e bzw. 0.0 bei Underflowmöglichkeit (beim Skalieren b':=b/2^e // oder beim Quadrieren b'*b': 2*(e-exponent(b))>exp_mid-exp_low-1 // d.h. exponent(a)-exponent(b)>floor((exp_mid-exp_low-1)/2) ). // c':=a'*a'+b'*b', c':=sqrt(c'), liefere 2^e*c'. diff --git a/src/complex/algebraic/cl_SF_hypot.cc b/src/complex/algebraic/cl_SF_hypot.cc index d410bea..bcf742f 100644 --- a/src/complex/algebraic/cl_SF_hypot.cc +++ b/src/complex/algebraic/cl_SF_hypot.cc @@ -23,10 +23,10 @@ const cl_SF cl_hypot (const cl_SF& a, const cl_SF& b) // a=0.0 -> liefere abs(b). // b=0.0 -> liefere abs(a). // e:=max(exponent(a),exponent(b)). -// a':=a/2^e bzw. 0.0 bei Underflowmöglichkeit (beim Skalieren a':=a/2^e +// a':=a/2^e bzw. 0.0 bei Underflowmöglichkeit (beim Skalieren a':=a/2^e // oder beim Quadrieren a'*a': 2*(e-exponent(a))>exp_mid-exp_low-1 // d.h. exponent(b)-exponent(a)>floor((exp_mid-exp_low-1)/2) ). -// b':=b/2^e bzw. 0.0 bei Underflowmöglichkeit (beim Skalieren b':=b/2^e +// b':=b/2^e bzw. 0.0 bei Underflowmöglichkeit (beim Skalieren b':=b/2^e // oder beim Quadrieren b'*b': 2*(e-exponent(b))>exp_mid-exp_low-1 // d.h. exponent(a)-exponent(b)>floor((exp_mid-exp_low-1)/2) ). // c':=a'*a'+b'*b', c':=sqrt(c'), liefere 2^e*c'. diff --git a/src/complex/cl_C.h b/src/complex/cl_C.h index 4089808..23cbd01 100644 --- a/src/complex/cl_C.h +++ b/src/complex/cl_C.h @@ -93,7 +93,7 @@ inline bool complexp (const cl_C& x) extern const cl_N complex_C (const cl_R& a, const cl_R& b); // realpart(x) liefert den Realteil der Zahl x. -// imagpart(x) liefert den Imaginärteil der Zahl x. +// imagpart(x) liefert den Imaginärteil der Zahl x. inline const cl_R& realpart (const cl_C& x) { return TheComplex(x)->realpart; @@ -182,10 +182,10 @@ struct cl_C_R { cl_C_R (const cl_R& re, const cl_R& im) : realpart(re), imagpart(im) {} }; -// Hilfsfunktion für atanh und atan: u+iv := artanh(x+iy). Liefert cl_C_R(u,v). +// Hilfsfunktion für atanh und atan: u+iv := artanh(x+iy). Liefert cl_C_R(u,v). extern const cl_C_R atanh (const cl_R& x, const cl_R& y); -// Hilfsfunktion für asinh und asin: u+iv := arsinh(x+iy). Liefert cl_C_R(u,v). +// Hilfsfunktion für asinh und asin: u+iv := arsinh(x+iy). Liefert cl_C_R(u,v). extern const cl_C_R asinh (const cl_R& x, const cl_R& y); } // namespace cln diff --git a/src/complex/elem/cl_C_equal.cc b/src/complex/elem/cl_C_equal.cc index 813b8c4..4263956 100644 --- a/src/complex/elem/cl_C_equal.cc +++ b/src/complex/elem/cl_C_equal.cc @@ -20,7 +20,7 @@ bool equal (const cl_N& x, const cl_N& y) // Falls beide reell, klar. // Falls x reell, y komplex: (= x (realpart y)) und (zerop (imagpart y)). // Falls x komplex, y reell: analog -// Falls beide komplex: Realteile und Imaginärteile jeweils gleich? +// Falls beide komplex: Realteile und Imaginärteile jeweils gleich? if (realp(x)) { DeclareType(cl_R,x); if (realp(y)) { diff --git a/src/complex/elem/cl_C_zerop.cc b/src/complex/elem/cl_C_zerop.cc index 3dd6c7c..b9344c8 100644 --- a/src/complex/elem/cl_C_zerop.cc +++ b/src/complex/elem/cl_C_zerop.cc @@ -21,7 +21,7 @@ bool zerop (const cl_N& x) return zerop(x); } else { DeclareType(cl_C,x); - // x komplex, teste ob Real- und Imaginärteil beide = 0 sind. + // x komplex, teste ob Real- und Imaginärteil beide = 0 sind. var const cl_R& a = realpart(x); var const cl_R& b = imagpart(x); if (zerop(a)) diff --git a/src/complex/elem/division/cl_C_DF_recip.cc b/src/complex/elem/division/cl_C_DF_recip.cc index 8fd42dd..ac22fb0 100644 --- a/src/complex/elem/division/cl_C_DF_recip.cc +++ b/src/complex/elem/division/cl_C_DF_recip.cc @@ -19,10 +19,10 @@ const cl_C_DF cl_C_recip (const cl_DF& a, const cl_DF& b) // a=0.0 -> liefere die Komponenten a=0.0 und -1/b. // b=0.0 -> liefere die Komponenten 1/a und b=0.0. // e:=max(exponent(a),exponent(b)). -// a':=a/2^e bzw. 0.0 bei Underflowmöglichkeit (beim Skalieren a':=a/2^e +// a':=a/2^e bzw. 0.0 bei Underflowmöglichkeit (beim Skalieren a':=a/2^e // oder beim Quadrieren a'*a': 2*(e-exponent(a))>exp_mid-exp_low-1 // d.h. exponent(b)-exponent(a)>floor((exp_mid-exp_low-1)/2) ). -// b':=b/2^e bzw. 0.0 bei Underflowmöglichkeit (beim Skalieren b':=b/2^e +// b':=b/2^e bzw. 0.0 bei Underflowmöglichkeit (beim Skalieren b':=b/2^e // oder beim Quadrieren b'*b': 2*(e-exponent(b))>exp_mid-exp_low-1 // d.h. exponent(a)-exponent(b)>floor((exp_mid-exp_low-1)/2) ). // c':=a'*a'+b'*b', diff --git a/src/complex/elem/division/cl_C_FF_recip.cc b/src/complex/elem/division/cl_C_FF_recip.cc index ea9e448..ea9179a 100644 --- a/src/complex/elem/division/cl_C_FF_recip.cc +++ b/src/complex/elem/division/cl_C_FF_recip.cc @@ -19,10 +19,10 @@ const cl_C_FF cl_C_recip (const cl_FF& a, const cl_FF& b) // a=0.0 -> liefere die Komponenten a=0.0 und -1/b. // b=0.0 -> liefere die Komponenten 1/a und b=0.0. // e:=max(exponent(a),exponent(b)). -// a':=a/2^e bzw. 0.0 bei Underflowmöglichkeit (beim Skalieren a':=a/2^e +// a':=a/2^e bzw. 0.0 bei Underflowmöglichkeit (beim Skalieren a':=a/2^e // oder beim Quadrieren a'*a': 2*(e-exponent(a))>exp_mid-exp_low-1 // d.h. exponent(b)-exponent(a)>floor((exp_mid-exp_low-1)/2) ). -// b':=b/2^e bzw. 0.0 bei Underflowmöglichkeit (beim Skalieren b':=b/2^e +// b':=b/2^e bzw. 0.0 bei Underflowmöglichkeit (beim Skalieren b':=b/2^e // oder beim Quadrieren b'*b': 2*(e-exponent(b))>exp_mid-exp_low-1 // d.h. exponent(a)-exponent(b)>floor((exp_mid-exp_low-1)/2) ). // c':=a'*a'+b'*b', diff --git a/src/complex/elem/division/cl_C_LF_recip.cc b/src/complex/elem/division/cl_C_LF_recip.cc index 0bf2d7f..9808185 100644 --- a/src/complex/elem/division/cl_C_LF_recip.cc +++ b/src/complex/elem/division/cl_C_LF_recip.cc @@ -19,14 +19,14 @@ ALL_cl_LF_OPERATIONS_SAME_PRECISION() const cl_C_LF cl_C_recip (const cl_LF& a, const cl_LF& b) { -// Zuerst a und b auf gleiche Länge bringen: den längeren runden. +// Zuerst a und b auf gleiche Länge bringen: den längeren runden. // a=0.0 -> liefere die Komponenten a=0.0 und -1/b. // b=0.0 -> liefere die Komponenten 1/a und b=0.0. // e:=max(exponent(a),exponent(b)). -// a':=a/2^e bzw. 0.0 bei Underflowmöglichkeit (beim Skalieren a':=a/2^e +// a':=a/2^e bzw. 0.0 bei Underflowmöglichkeit (beim Skalieren a':=a/2^e // oder beim Quadrieren a'*a': 2*(e-exponent(a))>exp_mid-exp_low-1 // d.h. exponent(b)-exponent(a)>floor((exp_mid-exp_low-1)/2) ). -// b':=b/2^e bzw. 0.0 bei Underflowmöglichkeit (beim Skalieren b':=b/2^e +// b':=b/2^e bzw. 0.0 bei Underflowmöglichkeit (beim Skalieren b':=b/2^e // oder beim Quadrieren b'*b': 2*(e-exponent(b))>exp_mid-exp_low-1 // d.h. exponent(a)-exponent(b)>floor((exp_mid-exp_low-1)/2) ). // c':=a'*a'+b'*b', diff --git a/src/complex/elem/division/cl_C_SF_recip.cc b/src/complex/elem/division/cl_C_SF_recip.cc index 609b91d..ea00945 100644 --- a/src/complex/elem/division/cl_C_SF_recip.cc +++ b/src/complex/elem/division/cl_C_SF_recip.cc @@ -19,10 +19,10 @@ const cl_C_SF cl_C_recip (const cl_SF& a, const cl_SF& b) // a=0.0 -> liefere die Komponenten a=0.0 und -1/b. // b=0.0 -> liefere die Komponenten 1/a und b=0.0. // e:=max(exponent(a),exponent(b)). -// a':=a/2^e bzw. 0.0 bei Underflowmöglichkeit (beim Skalieren a':=a/2^e +// a':=a/2^e bzw. 0.0 bei Underflowmöglichkeit (beim Skalieren a':=a/2^e // oder beim Quadrieren a'*a': 2*(e-exponent(a))>exp_mid-exp_low-1 // d.h. exponent(b)-exponent(a)>floor((exp_mid-exp_low-1)/2) ). -// b':=b/2^e bzw. 0.0 bei Underflowmöglichkeit (beim Skalieren b':=b/2^e +// b':=b/2^e bzw. 0.0 bei Underflowmöglichkeit (beim Skalieren b':=b/2^e // oder beim Quadrieren b'*b': 2*(e-exponent(b))>exp_mid-exp_low-1 // d.h. exponent(a)-exponent(b)>floor((exp_mid-exp_low-1)/2) ). // c':=a'*a'+b'*b', diff --git a/src/complex/elem/division/cl_C_recip.cc b/src/complex/elem/division/cl_C_recip.cc index 50eb025..4c222fd 100644 --- a/src/complex/elem/division/cl_C_recip.cc +++ b/src/complex/elem/division/cl_C_recip.cc @@ -42,18 +42,18 @@ const cl_N recip (const cl_N& x) // c:=a*a+b*b, c:=1/c, liefere a*c+(-b*c)i. // Falls a oder b Floats sind: // Falls einer von beiden rational ist, runde ihn zum selben Float-Typ -// wie der andere und führe das UP durch. -// Falls beide Floats sind, erweitere auf den genaueren, führe das UP +// wie der andere und führe das UP durch. +// Falls beide Floats sind, erweitere auf den genaueren, führe das UP // durch und runde wieder auf den ungenaueren. // Das Ergebnis ist eine komplexe Zahl, da beide Komponenten Floats sind. // UP: [a,b Floats vom selben Typ] // a=0.0 -> liefere die Komponenten a=0.0 und -1/b. // b=0.0 -> liefere die Komponenten 1/a und b=0.0. // e:=max(exponent(a),exponent(b)). -// a':=a/2^e bzw. 0.0 bei Underflowmöglichkeit (beim Skalieren a':=a/2^e +// a':=a/2^e bzw. 0.0 bei Underflowmöglichkeit (beim Skalieren a':=a/2^e // oder beim Quadrieren a'*a': 2*(e-exponent(a))>exp_mid-exp_low-1 // d.h. exponent(b)-exponent(a)>floor((exp_mid-exp_low-1)/2) ). -// b':=b/2^e bzw. 0.0 bei Underflowmöglichkeit (beim Skalieren b':=b/2^e +// b':=b/2^e bzw. 0.0 bei Underflowmöglichkeit (beim Skalieren b':=b/2^e // oder beim Quadrieren b'*b': 2*(e-exponent(b))>exp_mid-exp_low-1 // d.h. exponent(a)-exponent(b)>floor((exp_mid-exp_low-1)/2) ). // c':=a'*a'+b'*b', diff --git a/src/complex/misc/cl_C_conjugate.cc b/src/complex/misc/cl_C_conjugate.cc index 4c33e04..1db942c 100644 --- a/src/complex/misc/cl_C_conjugate.cc +++ b/src/complex/misc/cl_C_conjugate.cc @@ -22,7 +22,7 @@ const cl_N conjugate (const cl_N& x) DeclareType(cl_C,x); var const cl_R& a = realpart(x); var const cl_R& b = imagpart(x); - // Vorzeichenwechsel beim Imaginärteil + // Vorzeichenwechsel beim Imaginärteil return complex_C(a,-b); } } diff --git a/src/complex/misc/cl_C_expt.cc b/src/complex/misc/cl_C_expt.cc index f6badde..160ad59 100644 --- a/src/complex/misc/cl_C_expt.cc +++ b/src/complex/misc/cl_C_expt.cc @@ -15,15 +15,15 @@ namespace cln { // Methode: -// Für y>0: +// Für y>0: // a:=x, b:=y. // Solange b gerade, setze a:=a*a, b:=b/2. [a^b bleibt invariant, = x^y.] // c:=a. // Solange b:=floor(b/2) >0 ist, // setze a:=a*a, und falls b ungerade, setze c:=a*c. // Ergebnis c. -// Für y=0: Ergebnis 1. -// Für y<0: (/ (expt x (- y))). +// Für y=0: Ergebnis 1. +// Für y<0: (/ (expt x (- y))). // Assume y>0. inline const cl_N expt_pos (const cl_N& x, uintL y) diff --git a/src/complex/misc/cl_C_expt_I.cc b/src/complex/misc/cl_C_expt_I.cc index 1143dea..9e0bfd6 100644 --- a/src/complex/misc/cl_C_expt_I.cc +++ b/src/complex/misc/cl_C_expt_I.cc @@ -16,15 +16,15 @@ namespace cln { // Methode: -// Für y>0: +// Für y>0: // a:=x, b:=y. // Solange b gerade, setze a:=a*a, b:=b/2. [a^b bleibt invariant, = x^y.] // c:=a. // Solange b:=floor(b/2) >0 ist, // setze a:=a*a, und falls b ungerade, setze c:=a*c. // Ergebnis c. -// Für y=0: Ergebnis 1. -// Für y<0: (/ (expt x (- y))). +// Für y=0: Ergebnis 1. +// Für y<0: (/ (expt x (- y))). // Assume y>0. inline const cl_N expt_pos (const cl_N& x, const cl_I& y) diff --git a/src/complex/transcendental/cl_C_acosh.cc b/src/complex/transcendental/cl_C_acosh.cc index 8c30669..2fb952f 100644 --- a/src/complex/transcendental/cl_C_acosh.cc +++ b/src/complex/transcendental/cl_C_acosh.cc @@ -40,13 +40,13 @@ const cl_N acosh (const cl_N& z) // Sonst nach (!) mit u = sqrt((z+1)/2) und v = sqrt((z-1)/2) : // arcosh(z) = 4 artanh(v/(u+1)) = 4 artanh(sqrt((z-1)/2)/(1+sqrt((z+1)/2))) -// Um für zwei Zahlen u,v mit u^2-v^2=1 und u,v beide in Bild(sqrt) -// (d.h. Realteil>0.0 oder Realteil=0.0 und Imaginärteil>=0.0) +// Um für zwei Zahlen u,v mit u^2-v^2=1 und u,v beide in Bild(sqrt) +// (d.h. Realteil>0.0 oder Realteil=0.0 und Imaginärteil>=0.0) // log(u+v) zu berechnen: // log(u+v) = 2 artanh(v/(u+1)) (!) // (Beweis: 2 artanh(v/(u+1)) = log(1+(v/(u+1))) - log(1-(v/(u+1))) // = log((1+u+v)/(u+1)) - log((1+u-v)/(u+1)) == log((1+u+v)/(1+u-v)) -// = log(u+v) mod 2 pi i, und beider Imaginärteil ist > -pi und <= pi.) +// = log(u+v) mod 2 pi i, und beider Imaginärteil ist > -pi und <= pi.) cl_C_R u_v; if (realp(z)) { @@ -81,7 +81,7 @@ const cl_N acosh (const cl_N& z) var cl_F xf = cl_float(x); var cl_F& x = xf; // x Float <= -1 - // log(sqrt(x^2-1)-x), ein Float >=0, Imaginärteil pi + // log(sqrt(x^2-1)-x), ein Float >=0, Imaginärteil pi return complex_C(ln(sqrt(square(x)-1)-x),pi()); } } diff --git a/src/complex/transcendental/cl_C_asin.cc b/src/complex/transcendental/cl_C_asin.cc index f121c7f..4698e3d 100644 --- a/src/complex/transcendental/cl_C_asin.cc +++ b/src/complex/transcendental/cl_C_asin.cc @@ -18,8 +18,8 @@ namespace cln { // Wert und Branch Cuts nach der Formel CLTL2, S. 311: // arcsin(z) = log(iz+sqrt(1-z^2))/i // Sei z=x+iy, errechne u+iv = arsinh(-y+ix) wie oben, Ergebnis v-iu. -// Real- und Imaginärteil des Ergebnisses sind Floats, außer wenn z reell oder -// rein imaginär ist. +// Real- und Imaginärteil des Ergebnisses sind Floats, außer wenn z reell oder +// rein imaginär ist. inline const cl_C_R _asin (const cl_N& z) { diff --git a/src/complex/transcendental/cl_C_asinh.cc b/src/complex/transcendental/cl_C_asinh.cc index d028f31..a11100f 100644 --- a/src/complex/transcendental/cl_C_asinh.cc +++ b/src/complex/transcendental/cl_C_asinh.cc @@ -48,19 +48,19 @@ namespace cln { // arsinh(z) = -arsinh(-z). // (Denn arsinh(z)+arsinh(-z) == log((z+sqrt(1+z^2))(-z+sqrt(1+z^2))) // = log((1+z^2)-z^2) = log(1) = 0 mod 2 pi i, und links ist -// der Imaginärteil betragsmäßig <=pi.) +// der Imaginärteil betragsmäßig <=pi.) // Also arsinh(z) = -arsinh(-z) = - 2 artanh(-z/(1+sqrt(1+z^2))) // = (wegen -artanh(-w) = artanh(w)) = 2 artanh(z/(1+sqrt(1+z^2))). -// Real- und Imaginärteil des Ergebnisses sind Floats, außer wenn z reell oder -// rein imaginär ist. +// Real- und Imaginärteil des Ergebnisses sind Floats, außer wenn z reell oder +// rein imaginär ist. -// Um für zwei Zahlen u,v mit u^2-v^2=1 und u,v beide in Bild(sqrt) -// (d.h. Realteil>0.0 oder Realteil=0.0 und Imaginärteil>=0.0) +// Um für zwei Zahlen u,v mit u^2-v^2=1 und u,v beide in Bild(sqrt) +// (d.h. Realteil>0.0 oder Realteil=0.0 und Imaginärteil>=0.0) // log(u+v) zu berechnen: // log(u+v) = 2 artanh(v/(u+1)) (!) // (Beweis: 2 artanh(v/(u+1)) = log(1+(v/(u+1))) - log(1-(v/(u+1))) // = log((1+u+v)/(u+1)) - log((1+u-v)/(u+1)) == log((1+u+v)/(1+u-v)) -// = log(u+v) mod 2 pi i, und beider Imaginärteil ist > -pi und <= pi.) +// = log(u+v) mod 2 pi i, und beider Imaginärteil ist > -pi und <= pi.) inline const cl_C_R _asinh (const cl_N& z) { diff --git a/src/complex/transcendental/cl_C_asinh_aux.cc b/src/complex/transcendental/cl_C_asinh_aux.cc index 0ee1461..623ab30 100644 --- a/src/complex/transcendental/cl_C_asinh_aux.cc +++ b/src/complex/transcendental/cl_C_asinh_aux.cc @@ -22,7 +22,7 @@ namespace cln { -// Hilfsfunktion für asinh und asin: u+iv := arsinh(x+iy). Liefert cl_C_R(u,v). +// Hilfsfunktion für asinh und asin: u+iv := arsinh(x+iy). Liefert cl_C_R(u,v). const cl_C_R asinh (const cl_R& x, const cl_R& y) { @@ -60,19 +60,19 @@ const cl_C_R asinh (const cl_R& x, const cl_R& y) // arsinh(z) = -arsinh(-z). // (Denn arsinh(z)+arsinh(-z) == log((z+sqrt(1+z^2))(-z+sqrt(1+z^2))) // = log((1+z^2)-z^2) = log(1) = 0 mod 2 pi i, und links ist -// der Imaginärteil betragsmäßig <=pi.) +// der Imaginärteil betragsmäßig <=pi.) // Also arsinh(z) = -arsinh(-z) = - 2 artanh(-z/(1+sqrt(1+z^2))) // = (wegen -artanh(-w) = artanh(w)) = 2 artanh(z/(1+sqrt(1+z^2))). -// Real- und Imaginärteil des Ergebnisses sind Floats, außer wenn z reell oder -// rein imaginär ist. +// Real- und Imaginärteil des Ergebnisses sind Floats, außer wenn z reell oder +// rein imaginär ist. -// Um für zwei Zahlen u,v mit u^2-v^2=1 und u,v beide in Bild(sqrt) -// (d.h. Realteil>0.0 oder Realteil=0.0 und Imaginärteil>=0.0) +// Um für zwei Zahlen u,v mit u^2-v^2=1 und u,v beide in Bild(sqrt) +// (d.h. Realteil>0.0 oder Realteil=0.0 und Imaginärteil>=0.0) // log(u+v) zu berechnen: // log(u+v) = 2 artanh(v/(u+1)) (!) // (Beweis: 2 artanh(v/(u+1)) = log(1+(v/(u+1))) - log(1-(v/(u+1))) // = log((1+u+v)/(u+1)) - log((1+u-v)/(u+1)) == log((1+u+v)/(1+u-v)) -// = log(u+v) mod 2 pi i, und beider Imaginärteil ist > -pi und <= pi.) +// = log(u+v) mod 2 pi i, und beider Imaginärteil ist > -pi und <= pi.) if (eq(x,0)) { // x=0 @@ -155,15 +155,15 @@ const cl_C_R asinh (const cl_R& x, const cl_R& y) } var cl_N z = complex_C(x,y); // z=x+iy var cl_N w = z/(1+sqrt(1+square(z))); // z/(1+sqrt(1+z^2)) - // Da z=x+iy weder reell noch rein imaginär ist, ist auch - // w := z/(1+sqrt(1+z^2)) weder reell noch rein imaginär. - // (Beweis: Sollte sqrt(1+z^2) rationalen Real- und Imaginärteil haben, - // so auch z, also auch w, und die Formel z = 2w/(1-w^2) zeigt, daß dann - // z reell oder rein imaginär sein müßte. Also hat sqrt(1+z^2) ein - // Float als Real- oder Imaginärteil, das Betragsquadrat des Nenners - // ist also ein Float, und da Real- und Imaginärteil von z /=0 sind, - // sind Real- und Imaginärteil von w Floats.) - // Daher hat dann atanh(...) Floats als Realteil u und Imaginärteil v. + // Da z=x+iy weder reell noch rein imaginär ist, ist auch + // w := z/(1+sqrt(1+z^2)) weder reell noch rein imaginär. + // (Beweis: Sollte sqrt(1+z^2) rationalen Real- und Imaginärteil haben, + // so auch z, also auch w, und die Formel z = 2w/(1-w^2) zeigt, daß dann + // z reell oder rein imaginär sein müßte. Also hat sqrt(1+z^2) ein + // Float als Real- oder Imaginärteil, das Betragsquadrat des Nenners + // ist also ein Float, und da Real- und Imaginärteil von z /=0 sind, + // sind Real- und Imaginärteil von w Floats.) + // Daher hat dann atanh(...) Floats als Realteil u und Imaginärteil v. { DeclareType(cl_C,w); cl_C_R u_v = atanh(realpart(w),imagpart(w)); var cl_R& u = u_v.realpart; diff --git a/src/complex/transcendental/cl_C_atan.cc b/src/complex/transcendental/cl_C_atan.cc index eeffdf6..95ceadc 100644 --- a/src/complex/transcendental/cl_C_atan.cc +++ b/src/complex/transcendental/cl_C_atan.cc @@ -18,8 +18,8 @@ namespace cln { // Wert und Branch Cuts nach der Formel CLTL2, S. 307/312/313: // arctan(z) = (log(1+iz)-log(1-iz)) / 2i // Sei z=x+iy, errechne u+iv = artanh(-y+ix) wie oben, Ergebnis v-iu. -// Real- und Imaginärteil des Ergebnisses sind Floats, außer wenn z reell oder -// rein imaginär ist. +// Real- und Imaginärteil des Ergebnisses sind Floats, außer wenn z reell oder +// rein imaginär ist. inline const cl_C_R _atan (const cl_N& z) { diff --git a/src/complex/transcendental/cl_C_atanh.cc b/src/complex/transcendental/cl_C_atanh.cc index 7bddef7..5d7c2d1 100644 --- a/src/complex/transcendental/cl_C_atanh.cc +++ b/src/complex/transcendental/cl_C_atanh.cc @@ -27,20 +27,20 @@ namespace cln { // =0 -> Error, // >0 (also |x|<1) -> u = 1/2 log((1+x)/(1-x)), v = 0. // <0 (also |x|>1) -> u = 1/2 log(-(1+x)/(1-x)), -// v = (-pi/2 für x>1, pi/2 für x<-1). +// v = (-pi/2 für x>1, pi/2 für x<-1). // Sonst: // 1+x und 1-x errechnen. // x und y in Floats umwandeln. // |4x| und 1+x^2+y^2 errechnen, // |4x| < 1+x^2+y^2 -> u = 1/2 atanh(2x/(1+x^2+y^2)), // |4x| >= 1+x^2+y^2 -> u = 1/4 ln ((1+x^2+y^2)+2x)/((1+x^2+y^2)-2x) -// oder besser (an der Singularität: |x|-1,|y| klein): +// oder besser (an der Singularität: |x|-1,|y| klein): // u = 1/4 ln ((1+x)^2+y^2)/((1-x)^2+y^2). // v = 1/2 atan(X=(1-x)(1+x)-y^2,Y=2y) * (-1 falls Y=0.0 und X<0.0 und x>=0.0, // 1 sonst) // Ergebnis ist reell nur, wenn z reell. -// Real- und Imaginärteil des Ergebnisses sind Floats, außer wenn z reell oder -// rein imaginär ist. +// Real- und Imaginärteil des Ergebnisses sind Floats, außer wenn z reell oder +// rein imaginär ist. inline const cl_C_R _atanh (const cl_N& z) { diff --git a/src/complex/transcendental/cl_C_atanh_aux.cc b/src/complex/transcendental/cl_C_atanh_aux.cc index 3b3014c..2435495 100644 --- a/src/complex/transcendental/cl_C_atanh_aux.cc +++ b/src/complex/transcendental/cl_C_atanh_aux.cc @@ -20,7 +20,7 @@ namespace cln { -// Hilfsfunktion für atanh und atan: u+iv := artanh(x+iy). Liefert cl_C_R(u,v). +// Hilfsfunktion für atanh und atan: u+iv := artanh(x+iy). Liefert cl_C_R(u,v). const cl_C_R atanh (const cl_R& x, const cl_R& y) { @@ -37,20 +37,20 @@ const cl_C_R atanh (const cl_R& x, const cl_R& y) // =0 -> Error, // >0 (also |x|<1) -> u = 1/2 log((1+x)/(1-x)), v = 0. // <0 (also |x|>1) -> u = 1/2 log(-(1+x)/(1-x)), -// v = (-pi/2 für x>1, pi/2 für x<-1). +// v = (-pi/2 für x>1, pi/2 für x<-1). // Sonst: // 1+x und 1-x errechnen. // x und y in Floats umwandeln. // |4x| und 1+x^2+y^2 errechnen, // |4x| < 1+x^2+y^2 -> u = 1/2 atanh(2x/(1+x^2+y^2)), // |4x| >= 1+x^2+y^2 -> u = 1/4 ln ((1+x^2+y^2)+2x)/((1+x^2+y^2)-2x) -// oder besser (an der Singularität: |x|-1,|y| klein): +// oder besser (an der Singularität: |x|-1,|y| klein): // u = 1/4 ln ((1+x)^2+y^2)/((1-x)^2+y^2). // v = 1/2 atan(X=(1-x)(1+x)-y^2,Y=2y) * (-1 falls Y=0.0 und X<0.0 und x>=0.0, // 1 sonst) // Ergebnis ist reell nur, wenn z reell. -// Real- und Imaginärteil des Ergebnisses sind Floats, außer wenn z reell oder -// rein imaginär ist. +// Real- und Imaginärteil des Ergebnisses sind Floats, außer wenn z reell oder +// rein imaginär ist. if (eq(x,0)) // x=0 -> u=0, v=atan(X=1,Y=y) (Fall y=0 ist inbegriffen) @@ -74,7 +74,7 @@ const cl_C_R atanh (const cl_R& x, const cl_R& y) { throw division_by_0_exception(); } v = 0; } else { - // (1+x)/(1-x) < 0 -> Betrag nehmen, Imaginärteil berechnen: + // (1+x)/(1-x) < 0 -> Betrag nehmen, Imaginärteil berechnen: xx = - xx; v = scale_float(pi(),-1); // (scale-float pi -1) = pi/2 if (minusp(xx_den)) diff --git a/src/complex/transcendental/cl_C_expt_C.cc b/src/complex/transcendental/cl_C_expt_C.cc index 16d6d83..a09f5e1 100644 --- a/src/complex/transcendental/cl_C_expt_C.cc +++ b/src/complex/transcendental/cl_C_expt_C.cc @@ -22,13 +22,13 @@ namespace cln { // Falls y rational: // Falls y Integer: // Falls y=0: Ergebnis 1, -// [Nach CLTL folgendermaßen: +// [Nach CLTL folgendermaßen: // x reell: // x rational -> Fixnum 1 // x Float -> (float 1 x) // x komplex: // x komplex rational -> Fixnum 1 -// sonst: #C(1.0 0.0) im Float-Format des Real- bzw. Imaginärteils von x +// sonst: #C(1.0 0.0) im Float-Format des Real- bzw. Imaginärteils von x // ] // Falls x rational oder komplex rational oder |y| klein: // x^|y| durch wiederholtes Quadrieren und Multiplizieren und evtl. @@ -58,7 +58,7 @@ namespace cln { // liefere 1.0 falls x und y reell, #C(1.0 0.0) sonst. // Sonst: (exp (* (log x) y)) // Das Ergebnis liegt in Q(i), falls x in Q(i) liegt und 4y ein Integer ist.?? -// Genauigkeit erhöhen, log2(|y|) Bits mehr?? +// Genauigkeit erhöhen, log2(|y|) Bits mehr?? // Bei x oder y rational und der andere Long-Float: bitte kein Single-Float!?? // Liefert x^0. @@ -130,7 +130,7 @@ const cl_N expt (const cl_N& x, const cl_N& y) if (rationalp(realpart(x)) && rationalp(imagpart(x))) return expt(x,y); // exakt ausrechnen } - // x nicht exakt und |y| groß + // x nicht exakt und |y| groß } else { DeclareType(cl_RT,y); // y Ratio @@ -187,7 +187,7 @@ const cl_N expt (const cl_N& x, const cl_N& y) throw division_by_0_exception(); else { var cl_R f = contagion(contagion(x),contagion(y)); - // ein Float, da sonst x = Fixnum 0 gewesen wäre + // ein Float, da sonst x = Fixnum 0 gewesen wäre { DeclareType(cl_F,f); var cl_F f0 = cl_float(0,f); return complex_C(f0,f0); // #C(0.0 0.0) diff --git a/src/complex/transcendental/cl_C_log2.cc b/src/complex/transcendental/cl_C_log2.cc index 0232c22..f474011 100644 --- a/src/complex/transcendental/cl_C_log2.cc +++ b/src/complex/transcendental/cl_C_log2.cc @@ -26,9 +26,9 @@ const cl_N log (const cl_N& a, const cl_N& b) // falls (= a 0): Error // sonst: (phase a) errechnen, ein Float. // b (falls rational) ins selbe Float-Format umwandeln, -// Imaginärteil := (/ (phase a) (log dieses_b)). +// Imaginärteil := (/ (phase a) (log dieses_b)). // Falls a rational: (log (abs a) b). -// Falls a komplex mit rationalem Real- und Imaginärteil, +// Falls a komplex mit rationalem Real- und Imaginärteil, // Betragsquadrat (expt (abs a) 2) exakt ausrechnen als // (+ (expt (realpart a) 2) (expt (imagpart a) 2)). // Setze Realteil := (/ (log Betragsquadrat b) 2). @@ -50,7 +50,7 @@ const cl_N log (const cl_N& a, const cl_N& b) } // b ist reell und >0, a aber nicht. - // Imaginärteil (/ (phase a) (log b)) errechnen: + // Imaginärteil (/ (phase a) (log b)) errechnen: var cl_F im; { var cl_R angle = phase(a); @@ -73,14 +73,14 @@ const cl_N log (const cl_N& a, const cl_N& b) } else { DeclareType(cl_C,a); if (rationalp(realpart(a)) && rationalp(imagpart(a))) { - // a komplex mit rationalem Real- und Imaginärteil a1,a2 + // a komplex mit rationalem Real- und Imaginärteil a1,a2 var const cl_R& a1 = realpart(a); var const cl_R& a2 = imagpart(a); re = log(square(a1)+square(a2),b) / 2; goto re_ok; } } - // Keine Chance für rationalen Realteil. + // Keine Chance für rationalen Realteil. { var cl_F abs_a = The(cl_F)(abs(a)); var cl_F log_abs_a = ln(abs_a); diff --git a/src/complex/transcendental/cl_C_phase.cc b/src/complex/transcendental/cl_C_phase.cc index fe7b242..cce43cb 100644 --- a/src/complex/transcendental/cl_C_phase.cc +++ b/src/complex/transcendental/cl_C_phase.cc @@ -17,7 +17,7 @@ namespace cln { const cl_R phase (const cl_N& x) { // Methode: -// (= x 0) -> willkürliches Ergebnis 0 +// (= x 0) -> willkürliches Ergebnis 0 // x reell -> Winkel von (x,0) in Polarkoordinaten // x komplex -> Winkel von ((realpart x),(imagpart x)) in Polarkoordinaten if (zerop(x)) diff --git a/src/float/cl_F.h b/src/float/cl_F.h index 900b01f..5a74c98 100644 --- a/src/float/cl_F.h +++ b/src/float/cl_F.h @@ -33,18 +33,18 @@ extern const cl_FF cl_SF_to_FF (const cl_SF& x); extern const cl_DF cl_SF_to_DF (const cl_SF& x); // cl_SF_to_LF(x,len) wandelt ein Short-Float x in ein Long-Float mit len Digits um. -// > uintC len: gewünschte Anzahl Digits, >=LF_minlen +// > uintC len: gewünschte Anzahl Digits, >=LF_minlen extern const cl_LF cl_SF_to_LF (const cl_SF& x, uintC len); // cl_FF_to_DF(x) wandelt ein Single-Float x in ein Double-Float um. extern const cl_DF cl_FF_to_DF (const cl_FF& x); // cl_FF_to_LF(x,len) wandelt ein Single-Float x in ein Long-Float mit len Digits um. -// > uintC len: gewünschte Anzahl Digits, >=LF_minlen +// > uintC len: gewünschte Anzahl Digits, >=LF_minlen extern const cl_LF cl_FF_to_LF (const cl_FF& x, uintC len); // cl_DF_to_LF(x,len) wandelt ein Double-Float x in ein Long-Float mit len Digits um. -// > uintC len: gewünschte Anzahl Digits, >=LF_minlen +// > uintC len: gewünschte Anzahl Digits, >=LF_minlen extern const cl_LF cl_DF_to_LF (const cl_DF& x, uintC len); @@ -115,7 +115,7 @@ inline bool longfloatp (const cl_F& x) #endif // Macro: verteilt je nach Float-Typ eines Floats x auf 4 Statements, -// die x vom jeweiligen Float-Typ benutzen dürfen. +// die x vom jeweiligen Float-Typ benutzen dürfen. // floatcase(x, SF_statement,FF_statement,DF_statement,LF_statement); // x sollte eine Variable sein. #define floatcase(x, SF_statement,FF_statement,DF_statement,LF_statement) \ @@ -218,13 +218,13 @@ inline bool longfloatp (const cl_F& x) #define GEN_LF_OP2_AUX0(arg1,arg2,F_OP,r,ergebnis_zuweisung) \ var uintC len1 = TheLfloat(arg1)->len; \ var uintC len2 = TheLfloat(arg2)->len; \ - if (len1 == len2) /* gleich -> direkt ausführen */ \ + if (len1 == len2) /* gleich -> direkt ausführen */ \ { ergebnis_zuweisung CONCAT(NOMAP,r) (LF, F_OP(arg1,arg2)); } \ - elif (len1 > len2) /* -> arg2 auf die Länge von arg1 bringen */ \ + elif (len1 > len2) /* -> arg2 auf die Länge von arg1 bringen */ \ { ergebnis_zuweisung CONCAT(MAP,r) (LF, LF_shorten_len2, \ F_OP(arg1,extend(arg2,len1)) ); \ } \ - else /* (len1 < len2) -> arg1 auf die Länge von arg2 bringen */ \ + else /* (len1 < len2) -> arg1 auf die Länge von arg2 bringen */ \ { ergebnis_zuweisung CONCAT(MAP,r) (LF, LF_shorten_len1, \ F_OP(extend(arg1,len2),arg2) ); \ } @@ -263,7 +263,7 @@ extern const cl_F cl_F_shortenrelative (const cl_F& x, const cl_F& y); // Macro: dispatches according to a float_format_t value. // floatformatcase(value, SF_statement,FF_statement,DF_statement,LF_statement) // LF_statement darf auf `len' zugreifen, die zu `value' korrespondierende -// Mantissenlänge (gemessen in Digits). +// Mantissenlänge (gemessen in Digits). #define floatformatcase(value, SF_statement,FF_statement,DF_statement,LF_statement) \ { if ((value) <= float_format_sfloat) { SF_statement } \ elif ((value) <= float_format_ffloat) { FF_statement } \ diff --git a/src/float/conv/cl_DF_to_FF.cc b/src/float/conv/cl_DF_to_FF.cc index 5f6768f..18abcde 100644 --- a/src/float/conv/cl_DF_to_FF.cc +++ b/src/float/conv/cl_DF_to_FF.cc @@ -36,7 +36,7 @@ const cl_FF cl_DF_to_FF (const cl_DF& x) { mant = mant >> shiftcount; mant = mant+1; if (mant >= bit(FF_mant_len+1)) - // Überlauf durchs Runden + // Überlauf durchs Runden { mant = mant>>1; exp = exp+1; } // Mantisse rechts schieben } return encode_FF(sign,exp,mant); @@ -58,7 +58,7 @@ const cl_FF cl_DF_to_FF (const cl_DF& x) // aufrunden { manthi = manthi+1; if (manthi >= bit(FF_mant_len+1)) - // Überlauf durchs Runden + // Überlauf durchs Runden { manthi = manthi>>1; exp = exp+1; } // Mantisse rechts schieben } return encode_FF(sign,exp,manthi); diff --git a/src/float/conv/cl_DF_to_LF.cc b/src/float/conv/cl_DF_to_LF.cc index cb1ae3a..260d005 100644 --- a/src/float/conv/cl_DF_to_LF.cc +++ b/src/float/conv/cl_DF_to_LF.cc @@ -30,10 +30,10 @@ const cl_LF cl_DF_to_LF (const cl_DF& x, uintC len) DF_decode2(x, { return encode_LF0(len); }, sign=,exp=(sintL),manthi=,mantlo=); #endif // Long-Float allozieren, - // Mantisse mit intDsize*len-DF_mant_len-1 Nullbits auffüllen: + // Mantisse mit intDsize*len-DF_mant_len-1 Nullbits auffüllen: var Lfloat y = allocate_lfloat(len,exp+LF_exp_mid,sign); var uintD* ptr = arrayMSDptr(TheLfloat(y)->data,len); - // erste k := ceiling(DF_mant_len+1,intDsize) Digits mit mant füllen: + // erste k := ceiling(DF_mant_len+1,intDsize) Digits mit mant füllen: var const int shiftcount = (ceiling(DF_mant_len+1,intDsize)*intDsize-(DF_mant_len+1)); #if (cl_word_size==64) mant = mant<> shiftcount; mant = mant+1; if (mant >= bit(SF_mant_len+1)) - // Überlauf durchs Runden + // Überlauf durchs Runden { mant = mant>>1; exp = exp+1; } // Mantisse rechts schieben } return encode_SF(sign,exp,mant); @@ -59,7 +59,7 @@ const cl_SF cl_DF_to_SF (const cl_DF& x) { manthi = manthi >> shiftcount; manthi = manthi+1; if (manthi >= bit(SF_mant_len+1)) - // Überlauf durchs Runden + // Überlauf durchs Runden { manthi = manthi>>1; exp = exp+1; } // Mantisse rechts schieben } return encode_SF(sign,exp,manthi); diff --git a/src/float/conv/cl_DF_to_double.cc b/src/float/conv/cl_DF_to_double.cc index 044de05..94645d2 100644 --- a/src/float/conv/cl_DF_to_double.cc +++ b/src/float/conv/cl_DF_to_double.cc @@ -18,7 +18,7 @@ double double_approx (const cl_DF& obj) union { dfloat eksplicit; double machine_double; } u; #define val u.eksplicit val = TheDfloat(obj)->dfloat_value; - // Der Exponent muß um DF_exp_mid-1022 erniedrigt werden. + // Der Exponent muß um DF_exp_mid-1022 erniedrigt werden. if (DF_exp_mid>1022) #if (cl_word_size==64) { var uintL exp = (val >> DF_mant_len) & (bit(DF_exp_len)-1); // e diff --git a/src/float/conv/cl_DF_to_float.cc b/src/float/conv/cl_DF_to_float.cc index bad7982..c4f64d3 100644 --- a/src/float/conv/cl_DF_to_float.cc +++ b/src/float/conv/cl_DF_to_float.cc @@ -37,7 +37,7 @@ float float_approx (const cl_DF& x) { mant = mant >> shiftcount; mant = mant+1; if (mant >= bit(FF_mant_len+1)) - // Überlauf durchs Runden + // Überlauf durchs Runden { mant = mant>>1; exp = exp+1; } // Mantisse rechts schieben } #else @@ -58,7 +58,7 @@ float float_approx (const cl_DF& x) // aufrunden { manthi = manthi+1; if (manthi >= bit(FF_mant_len+1)) - // Überlauf durchs Runden + // Überlauf durchs Runden { manthi = manthi>>1; exp = exp+1; } // Mantisse rechts schieben } #define mant manthi diff --git a/src/float/conv/cl_FF_to_LF.cc b/src/float/conv/cl_FF_to_LF.cc index be24790..1462519 100644 --- a/src/float/conv/cl_FF_to_LF.cc +++ b/src/float/conv/cl_FF_to_LF.cc @@ -28,10 +28,10 @@ const cl_LF cl_FF_to_LF (const cl_FF& x, uintC len) #endif FF_decode(x, { return encode_LF0(len); }, sign=,exp=(sintL),mant=); // Long-Float allozieren, - // Mantisse mit intDsize*len-FF_mant_len-1 Nullbits auffüllen: + // Mantisse mit intDsize*len-FF_mant_len-1 Nullbits auffüllen: var Lfloat y = allocate_lfloat(len,exp+LF_exp_mid,sign); var uintD* ptr = arrayMSDptr(TheLfloat(y)->data,len); - // erste k := ceiling(FF_mant_len+1,intDsize) Digits mit mant füllen: + // erste k := ceiling(FF_mant_len+1,intDsize) Digits mit mant füllen: mant = mant << (ceiling(FF_mant_len+1,intDsize)*intDsize-(FF_mant_len+1)); #if (intDsize==64) set_max64_Dptr(FF_mant_len+1,ptr,mant); diff --git a/src/float/conv/cl_FF_to_SF.cc b/src/float/conv/cl_FF_to_SF.cc index eaad04e..d9b36e2 100644 --- a/src/float/conv/cl_FF_to_SF.cc +++ b/src/float/conv/cl_FF_to_SF.cc @@ -35,7 +35,7 @@ const cl_SF cl_FF_to_SF (const cl_FF& x) { mant = mant >> shiftcount; mant = mant+1; if (mant >= bit(SF_mant_len+1)) - // Überlauf durchs Runden + // Überlauf durchs Runden { mant = mant>>1; exp = exp+1; } // Mantisse rechts schieben } return encode_SF(sign,exp,mant); diff --git a/src/float/conv/cl_FF_to_float.cc b/src/float/conv/cl_FF_to_float.cc index d5fd5b9..a044aae 100644 --- a/src/float/conv/cl_FF_to_float.cc +++ b/src/float/conv/cl_FF_to_float.cc @@ -18,7 +18,7 @@ float float_approx (const cl_FF& obj) union { ffloat eksplicit; float machine_float; } u; #define val u.eksplicit val = cl_ffloat_value(obj); - // Der Exponent muß um FF_exp_mid-126 erniedrigt werden. + // Der Exponent muß um FF_exp_mid-126 erniedrigt werden. if (FF_exp_mid>126) { var uintL exp = (val >> FF_mant_len) & (bit(FF_exp_len)-1); // e if (exp < FF_exp_mid-126+1) diff --git a/src/float/conv/cl_LF_to_DF.cc b/src/float/conv/cl_LF_to_DF.cc index 91fa51b..2ee8b68 100644 --- a/src/float/conv/cl_LF_to_DF.cc +++ b/src/float/conv/cl_LF_to_DF.cc @@ -43,7 +43,7 @@ const cl_DF cl_LF_to_DF (const cl_LF& x) { mant = mant >> shiftcount; mant = mant+1; if (mant >= bit(DF_mant_len+1)) - // Überlauf durchs Runden + // Überlauf durchs Runden { mant = mant>>1; exp = exp+1; } // Mantisse rechts schieben } return encode_DF(sign,exp,mant); @@ -69,7 +69,7 @@ const cl_DF cl_LF_to_DF (const cl_LF& x) if (mantlo==0) { manthi = manthi+1; if (manthi >= bit(DF_mant_len+1-32)) - // Überlauf durchs Runden + // Überlauf durchs Runden { manthi = manthi>>1; exp = exp+1; } // Mantisse rechts schieben } } return encode_DF(sign,exp,manthi,mantlo); diff --git a/src/float/conv/cl_LF_to_FF.cc b/src/float/conv/cl_LF_to_FF.cc index 28d1567..662042a 100644 --- a/src/float/conv/cl_LF_to_FF.cc +++ b/src/float/conv/cl_LF_to_FF.cc @@ -46,7 +46,7 @@ const cl_FF cl_LF_to_FF (const cl_LF& x) { mant = mant >> shiftcount; mant = mant+1; if (mant >= bit(FF_mant_len+1)) - // Überlauf durchs Runden + // Überlauf durchs Runden { mant = mant>>1; exp = exp+1; } // Mantisse rechts schieben } return encode_FF(sign,exp,mant); diff --git a/src/float/conv/cl_LF_to_SF.cc b/src/float/conv/cl_LF_to_SF.cc index ff880ab..843a52d 100644 --- a/src/float/conv/cl_LF_to_SF.cc +++ b/src/float/conv/cl_LF_to_SF.cc @@ -46,7 +46,7 @@ const cl_SF cl_LF_to_SF (const cl_LF& x) { mant = mant >> shiftcount; mant = mant+1; if (mant >= bit(SF_mant_len+1)) - // Überlauf durchs Runden + // Überlauf durchs Runden { mant = mant>>1; exp = exp+1; } // Mantisse rechts schieben } return encode_SF(sign,exp,mant); diff --git a/src/float/conv/cl_LF_to_double.cc b/src/float/conv/cl_LF_to_double.cc index 8458760..5231944 100644 --- a/src/float/conv/cl_LF_to_double.cc +++ b/src/float/conv/cl_LF_to_double.cc @@ -44,7 +44,7 @@ double double_approx (const cl_LF& x) { mant = mant >> shiftcount; mant = mant+1; if (mant >= bit(DF_mant_len+1)) - // Überlauf durchs Runden + // Überlauf durchs Runden { mant = mant>>1; exp = exp+1; } // Mantisse rechts schieben } if (exp > (sintL)(DF_exp_high-DF_exp_mid)) @@ -83,7 +83,7 @@ double double_approx (const cl_LF& x) if (mantlo==0) { manthi = manthi+1; if (manthi >= bit(DF_mant_len+1-32)) - // Überlauf durchs Runden + // Überlauf durchs Runden { manthi = manthi>>1; exp = exp+1; } // Mantisse rechts schieben } } if (exp > (sintL)(DF_exp_high-DF_exp_mid)) diff --git a/src/float/conv/cl_LF_to_float.cc b/src/float/conv/cl_LF_to_float.cc index 6f1f826..1cad328 100644 --- a/src/float/conv/cl_LF_to_float.cc +++ b/src/float/conv/cl_LF_to_float.cc @@ -46,7 +46,7 @@ float float_approx (const cl_LF& x) { mant = mant >> shiftcount; mant = mant+1; if (mant >= bit(FF_mant_len+1)) - // Überlauf durchs Runden + // Überlauf durchs Runden { mant = mant>>1; exp = exp+1; } // Mantisse rechts schieben } union { ffloat eksplicit; float machine_float; } u; diff --git a/src/float/conv/cl_SF_to_LF.cc b/src/float/conv/cl_SF_to_LF.cc index 540aaf4..50fe938 100644 --- a/src/float/conv/cl_SF_to_LF.cc +++ b/src/float/conv/cl_SF_to_LF.cc @@ -28,10 +28,10 @@ const cl_LF cl_SF_to_LF (const cl_SF& x, uintC len) #endif SF_decode(x, { return encode_LF0(len); }, sign=,exp=(sintL),mant=); // Long-Float allozieren, - // Mantisse mit intDsize*len-SF_mant_len-1 Nullbits auffüllen: + // Mantisse mit intDsize*len-SF_mant_len-1 Nullbits auffüllen: var Lfloat y = allocate_lfloat(len,exp+LF_exp_mid,sign); var uintD* ptr = arrayMSDptr(TheLfloat(y)->data,len); - // erste k := ceiling(SF_mant_len+1,intDsize) Digits mit mant füllen: + // erste k := ceiling(SF_mant_len+1,intDsize) Digits mit mant füllen: mant = mant << (ceiling(SF_mant_len+1,intDsize)*intDsize-(SF_mant_len+1)); #if (intDsize==64) set_max64_Dptr(SF_mant_len+1,ptr,mant); diff --git a/src/float/dfloat/algebraic/cl_DF_sqrt.cc b/src/float/dfloat/algebraic/cl_DF_sqrt.cc index 42af650..ff9688e 100644 --- a/src/float/dfloat/algebraic/cl_DF_sqrt.cc +++ b/src/float/dfloat/algebraic/cl_DF_sqrt.cc @@ -25,7 +25,7 @@ const cl_DF sqrt (const cl_DF& x) // Ergebnis-Mantisse: // Bilde aus [1,m51,...,m0,(55 Nullbits)] bei geradem e, // aus [0,1,m51,...,m0,(54 Nullbits)] bei ungeradem e -// die Ganzzahl-Wurzel, eine 54-Bit-Zahl mit einer führenden 1. +// die Ganzzahl-Wurzel, eine 54-Bit-Zahl mit einer führenden 1. // Runde das letzte Bit weg: // Bit 0 = 0 -> abrunden, // Bit 0 = 1 und Wurzel exakt -> round-to-even, @@ -38,7 +38,7 @@ const cl_DF sqrt (const cl_DF& x) var sintL exp; var uint64 mantx; DF_decode(x, { return x; }, ,exp=,mantx=); - // Um die 128-Bit-Ganzzahl-Wurzel ausnutzen zu können, fügen wir beim + // Um die 128-Bit-Ganzzahl-Wurzel ausnutzen zu können, fügen wir beim // Radikanden 74 bzw. 75 statt 54 bzw. 55 Nullbits an. if (exp & bit(0)) // e ungerade @@ -87,7 +87,7 @@ const cl_DF sqrt (const cl_DF& x) var uint32 manthi; var uint32 mantlo; DF_decode2(x, { return x; }, ,exp=,manthi=,mantlo=); - // Um die 128-Bit-Ganzzahl-Wurzel ausnutzen zu können, fügen wir beim + // Um die 128-Bit-Ganzzahl-Wurzel ausnutzen zu können, fügen wir beim // Radikanden 74 bzw. 75 statt 54 bzw. 55 Nullbits an. if (exp & bit(0)) // e ungerade diff --git a/src/float/dfloat/cl_DF.h b/src/float/dfloat/cl_DF.h index 988553d..701a0b7 100644 --- a/src/float/dfloat/cl_DF.h +++ b/src/float/dfloat/cl_DF.h @@ -108,7 +108,7 @@ inline cl_heap_dfloat* allocate_dfloat (uint32 semhi, uint32 mlo) #if (cl_word_size==64) // DF_decode(obj, zero_statement, sign=,exp=,mant=); // zerlegt ein Double-Float obj. -// Ist obj=0.0, wird zero_statement ausgeführt. +// Ist obj=0.0, wird zero_statement ausgeführt. // Sonst: cl_signean sign = Vorzeichen (0 = +, -1 = -), // sintL exp = Exponent (vorzeichenbehaftet), // uintQ mant = Mantisse (>= 2^DF_mant_len, < 2^(DF_mant_len+1)) @@ -127,7 +127,7 @@ inline cl_heap_dfloat* allocate_dfloat (uint32 semhi, uint32 mlo) #else // DF_decode2(obj, zero_statement, sign=,exp=,manthi=,mantlo=); // zerlegt ein Double-Float obj. -// Ist obj=0.0, wird zero_statement ausgeführt. +// Ist obj=0.0, wird zero_statement ausgeführt. // Sonst: cl_signean sign = Vorzeichen (0 = +, -1 = -), // sintL exp = Exponent (vorzeichenbehaftet), // uintL manthi,mantlo = Mantisse 2^32*manthi+mantlo @@ -152,11 +152,11 @@ inline cl_heap_dfloat* allocate_dfloat (uint32 semhi, uint32 mlo) #if (cl_word_size==64) // encode_DF(sign,exp,mant) // liefert ein Double-Float. -// > cl_signean sign: Vorzeichen, 0 für +, -1 für negativ. +// > cl_signean sign: Vorzeichen, 0 für +, -1 für negativ. // > sintL exp: Exponent // > uintQ mant: Mantisse, sollte >= 2^DF_mant_len und < 2^(DF_mant_len+1) sein. // < cl_DF ergebnis: ein Double-Float -// Der Exponent wird auf Überlauf/Unterlauf getestet. +// Der Exponent wird auf Überlauf/Unterlauf getestet. inline const cl_DF encode_DF (cl_signean sign, sintL exp, uintQ mant) { if (exp < (sintL)(DF_exp_low-DF_exp_mid)) @@ -178,12 +178,12 @@ inline const cl_DF encode_DF (cl_signean sign, sintL exp, uintQ mant) #else // encode_DF(sign,exp,manthi,mantlo) // liefert ein Double-Float. -// > cl_signean sign: Vorzeichen, 0 für +, -1 für negativ. +// > cl_signean sign: Vorzeichen, 0 für +, -1 für negativ. // > sintL exp: Exponent // > uintL manthi,mantlo: Mantisse 2^32*manthi+mantlo, // sollte >= 2^DF_mant_len und < 2^(DF_mant_len+1) sein. // < cl_DF ergebnis: ein Double-Float -// Der Exponent wird auf Überlauf/Unterlauf getestet. +// Der Exponent wird auf Überlauf/Unterlauf getestet. inline const cl_DF encode_DF (cl_signean sign, sintL exp, uintL manthi, uintL mantlo) { if (exp < (sintL)(DF_exp_low-DF_exp_mid)) @@ -211,7 +211,7 @@ inline double DF_to_double (const cl_DF& obj) { return TheDfloat(obj)->representation.machine_double; } -// Überprüfen und Einpacken eines von den 'double'-Routinen gelieferten +// Überprüfen und Einpacken eines von den 'double'-Routinen gelieferten // IEEE-Floats. // Klassifikation: // 1 <= e <= 2046 : normalisierte Zahl @@ -219,8 +219,8 @@ inline double DF_to_double (const cl_DF& obj) // e=0, m=0: vorzeichenbehaftete 0.0 // e=2047, m=0: vorzeichenbehaftete Infinity // e=2047, m/=0: NaN -// Angabe der möglicherweise auftretenden Sonderfälle: -// maybe_overflow: Operation läuft über, liefert IEEE-Infinity +// Angabe der möglicherweise auftretenden Sonderfälle: +// maybe_overflow: Operation läuft über, liefert IEEE-Infinity // maybe_subnormal: Ergebnis sehr klein, liefert IEEE-subnormale Zahl // maybe_underflow: Ergebnis sehr klein und /=0, liefert IEEE-Null // maybe_divide_0: Ergebnis unbestimmt, liefert IEEE-Infinity @@ -242,7 +242,7 @@ inline double DF_to_double (const cl_DF& obj) && (((~_erg.eksplicit) & ((uint64)bit(DF_exp_len+DF_mant_len)-bit(DF_mant_len))) == 0) /* e=2047 ? */\ ) \ { if (maybe_nan && !((_erg.eksplicit<<(64-DF_mant_len)) == 0)) \ - { throw division_by_0_exception(); } /* NaN, also Singularität -> "Division durch 0" */\ + { throw division_by_0_exception(); } /* NaN, also Singularität -> "Division durch 0" */\ else /* Infinity */ \ if (!maybe_overflow || maybe_divide_0) \ { throw division_by_0_exception(); } /* Infinity, Division durch 0 */\ @@ -270,7 +270,7 @@ inline double DF_to_double (const cl_DF& obj) && (((~_erg.eksplicit.semhi) & ((uint32)bit(DF_exp_len+DF_mant_len-32)-bit(DF_mant_len-32))) == 0) /* e=2047 ? */\ ) \ { if (maybe_nan && !(((_erg.eksplicit.semhi<<(64-DF_mant_len)) == 0) && (_erg.eksplicit.mlo==0))) \ - { throw division_by_0_exception(); } /* NaN, also Singularität -> "Division durch 0" */\ + { throw division_by_0_exception(); } /* NaN, also Singularität -> "Division durch 0" */\ else /* Infinity */\ if (!maybe_overflow || maybe_divide_0) \ { throw division_by_0_exception(); } /* Infinity, Division durch 0 */\ @@ -284,7 +284,7 @@ inline double DF_to_double (const cl_DF& obj) #endif // Liefert zu einem Double-Float x : (futruncate x), ein DF. -// x wird von der 0 weg zur nächsten ganzen Zahl gerundet. +// x wird von der 0 weg zur nächsten ganzen Zahl gerundet. extern const cl_DF futruncate (const cl_DF& x); // DF_to_I(x) wandelt ein Double-Float x, das eine ganze Zahl darstellt, diff --git a/src/float/dfloat/conv/cl_DF_from_double.cc b/src/float/dfloat/conv/cl_DF_from_double.cc index 7e3ffe9..eeb5fb4 100644 --- a/src/float/dfloat/conv/cl_DF_from_double.cc +++ b/src/float/dfloat/conv/cl_DF_from_double.cc @@ -30,7 +30,7 @@ cl_heap_dfloat* cl_double_to_DF_pointer (const dfloatjanus& val_) { throw floating_point_overflow_exception(); } // Infinity, Overflow } else - { // Der Exponent muß um DF_exp_mid-1022 erhöht werden. + { // Der Exponent muß um DF_exp_mid-1022 erhöht werden. if ((DF_exp_mid>1022) && (exp > DF_exp_high-DF_exp_mid+1022)) { throw floating_point_overflow_exception(); } // Overflow val += (sint64)(DF_exp_mid - 1022) << DF_mant_len; @@ -52,7 +52,7 @@ cl_heap_dfloat* cl_double_to_DF_pointer (const dfloatjanus& val_) { throw floating_point_overflow_exception(); } // Infinity, Overflow } else - { // Der Exponent muß um DF_exp_mid-1022 erhöht werden. + { // Der Exponent muß um DF_exp_mid-1022 erhöht werden. if ((DF_exp_mid>1022) && (exp > DF_exp_high-DF_exp_mid+1022)) { throw floating_point_overflow_exception(); } // Overflow val.semhi += (sint32)(DF_exp_mid - 1022) << (DF_mant_len-32); diff --git a/src/float/dfloat/conv/cl_DF_to_doublej.cc b/src/float/dfloat/conv/cl_DF_to_doublej.cc index e82d45a..a8a571a 100644 --- a/src/float/dfloat/conv/cl_DF_to_doublej.cc +++ b/src/float/dfloat/conv/cl_DF_to_doublej.cc @@ -14,7 +14,7 @@ namespace cln { void cl_DF_to_double (const cl_DF& obj, dfloatjanus* val_) { var dfloat val = TheDfloat(obj)->dfloat_value; - // Der Exponent muß um DF_exp_mid-1022 erniedrigt werden. + // Der Exponent muß um DF_exp_mid-1022 erniedrigt werden. if (DF_exp_mid>1022) #if (cl_word_size==64) { var uintL exp = (val >> DF_mant_len) & (bit(DF_exp_len)-1); // e diff --git a/src/float/dfloat/conv/cl_I_to_double.cc b/src/float/dfloat/conv/cl_I_to_double.cc index 285e189..94cb5a5 100644 --- a/src/float/dfloat/conv/cl_I_to_double.cc +++ b/src/float/dfloat/conv/cl_I_to_double.cc @@ -28,7 +28,7 @@ double double_approx (const cl_I& x) var uintC len; 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 + // Führende Digits holen: Brauche DF_mant_len+1 Bits, dazu intDsize // Bits (die NDS kann mit bis zu intDsize Nullbits anfangen). // Dann werden diese Bits um (exp mod intDsize) nach rechts geschoben. var uintD msd = msprefnext(MSDptr); // erstes Digit @@ -59,15 +59,15 @@ double double_approx (const cl_I& x) --len; ok: #if (cl_word_size==64) // Die NDS besteht aus msd, msdd und len weiteren Digits. - // Das höchste in 2^64*msd+msdd gesetzte Bit ist Bit Nummer + // Das höchste in 2^64*msd+msdd gesetzte Bit ist Bit Nummer // 63 + (exp mod intDsize). var uintL shiftcount = exp % intDsize; - var uint64 mant = // führende 64 Bits + var uint64 mant = // führende 64 Bits (shiftcount==0 ? msdd : (((uint64)msd << (64-shiftcount)) | (msdd >> shiftcount)) ); - // Das höchste in mant gesetzte Bit ist Bit Nummer 63. + // Das höchste in mant gesetzte Bit ist Bit Nummer 63. if ( ((mant & bit(62-DF_mant_len)) ==0) // Bit 10 =0 -> abrunden || ( ((mant & (bit(62-DF_mant_len)-1)) ==0) // Bit 10 =1 und Bits 9..0 =0 && ((msdd & (bit(shiftcount)-1)) ==0) // und weitere Bits aus msddf =0 @@ -99,18 +99,18 @@ double double_approx (const cl_I& x) return u.machine_double; #else // Die NDS besteht aus msd, msdd, msddf und len weiteren Digits. - // Das höchste in 2^64*msd+2^32*msdd+msddf gesetzte Bit ist Bit Nummer + // Das höchste in 2^64*msd+2^32*msdd+msddf gesetzte Bit ist Bit Nummer // 63 + (exp mod intDsize). var uintL shiftcount = exp % intDsize; - var uint32 manthi; // führende 32 Bits - var uint32 mantlo; // nächste 32 Bits + var uint32 manthi; // führende 32 Bits + var uint32 mantlo; // nächste 32 Bits if (shiftcount==0) { manthi = msdd; mantlo = msddf; } else { manthi = ((uint32)msd << (32-shiftcount)) | (msdd >> shiftcount); mantlo = (msdd << (32-shiftcount)) | (msddf >> shiftcount); } - // Das höchste in mant gesetzte Bit ist Bit Nummer 63. + // Das höchste in mant gesetzte Bit ist Bit Nummer 63. if ( ((mantlo & bit(62-DF_mant_len)) ==0) // Bit 10 =0 -> abrunden || ( ((mantlo & (bit(62-DF_mant_len)-1)) ==0) // Bit 10 =1 und Bits 9..0 =0 && ((msddf & (bit(shiftcount)-1)) ==0) // und weitere Bits aus msddf =0 diff --git a/src/float/dfloat/conv/cl_RA_to_double.cc b/src/float/dfloat/conv/cl_RA_to_double.cc index 373702d..eb29114 100644 --- a/src/float/dfloat/conv/cl_RA_to_double.cc +++ b/src/float/dfloat/conv/cl_RA_to_double.cc @@ -68,7 +68,7 @@ double double_approx (const cl_RA& x) { zaehler = ash(a,(DF_mant_len+2) - lendiff); // (ash a -n+m+54) nenner = b; // b } - // Division zaehler/nenner durchführen: + // Division zaehler/nenner durchführen: var cl_I_div_t q_r = cl_divide(zaehler,nenner); var cl_I& q = q_r.quotient; var cl_I& r = q_r.remainder; diff --git a/src/float/dfloat/elem/cl_DF_div.cc b/src/float/dfloat/elem/cl_DF_div.cc index 786b866..e1da684 100644 --- a/src/float/dfloat/elem/cl_DF_div.cc +++ b/src/float/dfloat/elem/cl_DF_div.cc @@ -37,11 +37,11 @@ const cl_DF operator/ (const cl_DF& x1, const cl_DF& x2) // nach Rundung mant1/mant2 >=1/2, <=2*mant1<2. // Bei mant1/mant2 >=1 brauche 52 Nachkommabits, // bei mant1/mant2 <1 brauche 53 Nachkommabits. -// Fürs Runden: brauche ein Rundungsbit (Rest gibt an, ob exakt). +// Fürs Runden: brauche ein Rundungsbit (Rest gibt an, ob exakt). // Brauche daher insgesamt 54 Nachkommabits von mant1/mant2. // Dividiere daher (als Unsigned Integers) 2^54*(2^53*mant1) durch (2^53*mant2). // Falls der Quotient >=2^54 ist, runde die letzten zwei Bits weg und -// erhöhe den Exponenten um 1. +// erhöhe den Exponenten um 1. // Falls der Quotient <2^54 ist, runde das letzte Bit weg. Bei rounding // overflow schiebe um ein weiteres Bit nach rechts, incr. Exponenten. #if defined(FAST_DOUBLE) && !defined(__i386__) @@ -50,7 +50,7 @@ const cl_DF operator/ (const cl_DF& x1, const cl_DF& x2) !zerop(x1), // ein Ergebnis +/- 0.0 // ist genau dann in Wirklichkeit ein Underflow zerop(x2), // Division durch Null abfangen - FALSE // kein NaN als Ergebnis möglich + FALSE // kein NaN als Ergebnis möglich ); #else // x1,x2 entpacken: @@ -77,9 +77,9 @@ const cl_DF operator/ (const cl_DF& x1, const cl_DF& x2) #endif exp1 = exp1 - exp2; // Differenz der Exponenten sign1 = sign1 ^ sign2; // Ergebnis-Vorzeichen - // Dividiere 2^54*mant1 durch mant2 oder (äquivalent) - // 2^i*2^54*mant1 durch 2^i*mant2 für irgendein i mit 0 <= i <= 64-53 : - // wähle i = 64-(DF_mant_len+1), also i+(DF_mant_len+2) = 65. + // Dividiere 2^54*mant1 durch mant2 oder (äquivalent) + // 2^i*2^54*mant1 durch 2^i*mant2 für irgendein i mit 0 <= i <= 64-53 : + // wähle i = 64-(DF_mant_len+1), also i+(DF_mant_len+2) = 65. #if (cl_word_size==64) mantx1 = mantx1 << 1; mantx2 = mantx2 << (64-(DF_mant_len+1)); diff --git a/src/float/dfloat/elem/cl_DF_from_I.cc b/src/float/dfloat/elem/cl_DF_from_I.cc index e07071a..9a14b3e 100644 --- a/src/float/dfloat/elem/cl_DF_from_I.cc +++ b/src/float/dfloat/elem/cl_DF_from_I.cc @@ -23,7 +23,7 @@ const cl_DF cl_I_to_DF (const cl_I& x) // Merke Vorzeichen von x. // x:=(abs x) // Exponent:=(integer-length x) -// Greife die 54 höchstwertigen Bits heraus (angeführt von einer 1). +// Greife die 54 höchstwertigen Bits heraus (angeführt von einer 1). // Runde das letzte Bit weg: // Bit 0 = 0 -> abrunden, // Bit 0 = 1 und Rest =0 -> round-to-even, @@ -40,7 +40,7 @@ const cl_DF cl_I_to_DF (const cl_I& x) var uintC len; 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 + // Führende Digits holen: Brauche DF_mant_len+1 Bits, dazu intDsize // Bits (die NDS kann mit bis zu intDsize Nullbits anfangen). // Dann werden diese Bits um (exp mod intDsize) nach rechts geschoben. var uintD msd = msprefnext(MSDptr); // erstes Digit @@ -71,15 +71,15 @@ const cl_DF cl_I_to_DF (const cl_I& x) --len; ok: #if (cl_word_size==64) // Die NDS besteht aus msd, msdd und len weiteren Digits. - // Das höchste in 2^64*msd+msdd gesetzte Bit ist Bit Nummer + // Das höchste in 2^64*msd+msdd gesetzte Bit ist Bit Nummer // 63 + (exp mod intDsize). var uintL shiftcount = exp % intDsize; - var uint64 mant = // führende 64 Bits + var uint64 mant = // führende 64 Bits (shiftcount==0 ? msdd : (((uint64)msd << (64-shiftcount)) | (msdd >> shiftcount)) ); - // Das höchste in mant gesetzte Bit ist Bit Nummer 63. + // Das höchste in mant gesetzte Bit ist Bit Nummer 63. if ( ((mant & bit(62-DF_mant_len)) ==0) // Bit 10 =0 -> abrunden || ( ((mant & (bit(62-DF_mant_len)-1)) ==0) // Bit 10 =1 und Bits 9..0 =0 && ((msdd & (bit(shiftcount)-1)) ==0) // und weitere Bits aus msddf =0 @@ -99,18 +99,18 @@ const cl_DF cl_I_to_DF (const cl_I& x) return encode_DF(sign,(sintL)exp,mant); #else // Die NDS besteht aus msd, msdd, msddf und len weiteren Digits. - // Das höchste in 2^64*msd+2^32*msdd+msddf gesetzte Bit ist Bit Nummer + // Das höchste in 2^64*msd+2^32*msdd+msddf gesetzte Bit ist Bit Nummer // 63 + (exp mod intDsize). var uintL shiftcount = exp % intDsize; - var uint32 manthi; // führende 32 Bits - var uint32 mantlo; // nächste 32 Bits + var uint32 manthi; // führende 32 Bits + var uint32 mantlo; // nächste 32 Bits if (shiftcount==0) { manthi = msdd; mantlo = msddf; } else { manthi = ((uint32)msd << (32-shiftcount)) | (msdd >> shiftcount); mantlo = (msdd << (32-shiftcount)) | (msddf >> shiftcount); } - // Das höchste in mant gesetzte Bit ist Bit Nummer 63. + // Das höchste in mant gesetzte Bit ist Bit Nummer 63. if ( ((mantlo & bit(62-DF_mant_len)) ==0) // Bit 10 =0 -> abrunden || ( ((mantlo & (bit(62-DF_mant_len)-1)) ==0) // Bit 10 =1 und Bits 9..0 =0 && ((msddf & (bit(shiftcount)-1)) ==0) // und weitere Bits aus msddf =0 diff --git a/src/float/dfloat/elem/cl_DF_from_RA.cc b/src/float/dfloat/elem/cl_DF_from_RA.cc index 6e9cbf7..efc66cf 100644 --- a/src/float/dfloat/elem/cl_DF_from_RA.cc +++ b/src/float/dfloat/elem/cl_DF_from_RA.cc @@ -21,7 +21,7 @@ const cl_DF cl_RA_to_DF (const cl_RA& x) // Methode: // x ganz -> klar. // x = +/- a/b mit Integers a,b>0: -// Seien n,m so gewählt, daß +// Seien n,m so gewählt, daß // 2^(n-1) <= a < 2^n, 2^(m-1) <= b < 2^m. // Dann ist 2^(n-m-1) < a/b < 2^(n-m+1). // Berechne n=(integer-length a) und m=(integer-length b) und @@ -62,7 +62,7 @@ const cl_DF cl_RA_to_DF (const cl_RA& x) { zaehler = ash(a,(DF_mant_len+2) - lendiff); // (ash a -n+m+54) nenner = b; // b } - // Division zaehler/nenner durchführen: + // Division zaehler/nenner durchführen: var cl_I_div_t q_r = cl_divide(zaehler,nenner); var cl_I& q = q_r.quotient; var cl_I& r = q_r.remainder; diff --git a/src/float/dfloat/elem/cl_DF_fround.cc b/src/float/dfloat/elem/cl_DF_fround.cc index ac0add5..4efdb8f 100644 --- a/src/float/dfloat/elem/cl_DF_fround.cc +++ b/src/float/dfloat/elem/cl_DF_fround.cc @@ -30,9 +30,9 @@ const cl_DF fround (const cl_DF& x) { return x; } else if (uexp > DF_exp_mid+1) // e>1 ? - { var uint64 bitmask = // Bitmaske: Bit 52-e gesetzt, alle anderen gelöscht + { var uint64 bitmask = // Bitmaske: Bit 52-e gesetzt, alle anderen gelöscht bit(DF_mant_len+DF_exp_mid-uexp); - var uint64 mask = // Bitmaske: Bits 51-e..0 gesetzt, alle anderen gelöscht + var uint64 mask = // Bitmaske: Bits 51-e..0 gesetzt, alle anderen gelöscht bitmask-1; if ( ((x_ & bitmask) ==0) // Bit 52-e =0 -> abrunden || ( ((x_ & mask) ==0) // Bit 52-e =1 und Bits 51-e..0 >0 -> aufrunden @@ -40,19 +40,19 @@ const cl_DF fround (const cl_DF& x) && ((x_ & (bitmask<<1)) ==0) ) ) // abrunden - { mask |= bitmask; // Bitmaske: Bits 52-e..0 gesetzt, alle anderen gelöscht + { mask |= bitmask; // Bitmaske: Bits 52-e..0 gesetzt, alle anderen gelöscht return allocate_dfloat( x_ & ~mask ); } else // aufrunden { return allocate_dfloat ((x_ | mask) // alle diese Bits 51-e..0 setzen (Bit 52-e schon gesetzt) - + 1 // letzte Stelle erhöhen, dabei evtl. Exponenten incrementieren + + 1 // letzte Stelle erhöhen, dabei evtl. Exponenten incrementieren ); } } elif (uexp == DF_exp_mid+1) // e=1 ? - // Wie bei 1 < e <= 52, nur daß Bit 53-e stets gesetzt ist. + // Wie bei 1 < e <= 52, nur daß Bit 53-e stets gesetzt ist. { if ((x_ & bit(DF_mant_len-1)) ==0) // Bit 52-e =0 -> abrunden // abrunden { return allocate_dfloat( x_ & ~(bit(DF_mant_len)-1) ); } @@ -60,13 +60,13 @@ const cl_DF fround (const cl_DF& x) // aufrunden { return allocate_dfloat ((x_ | (bit(DF_mant_len)-1)) // alle diese Bits 52-e..0 setzen - + 1 // letzte Stelle erhöhen, dabei evtl. Exponenten incrementieren + + 1 // letzte Stelle erhöhen, dabei evtl. Exponenten incrementieren ); } } else // e=0 ? - // Wie bei 1 < e <= 52, nur daß Bit 52-e stets gesetzt - // und Bit 53-e stets gelöscht ist. + // Wie bei 1 < e <= 52, nur daß Bit 52-e stets gesetzt + // und Bit 53-e stets gelöscht ist. { if ((x_ & (bit(DF_mant_len)-1)) ==0) // abrunden von +-0.5 zu 0.0 { return cl_DF_0; } @@ -74,7 +74,7 @@ const cl_DF fround (const cl_DF& x) // aufrunden { return allocate_dfloat ((x_ | (bit(DF_mant_len)-1)) // alle Bits 51-e..0 setzen - + 1 // letzte Stelle erhöhen, dabei Exponenten incrementieren + + 1 // letzte Stelle erhöhen, dabei Exponenten incrementieren ); } } } @@ -90,9 +90,9 @@ const cl_DF fround (const cl_DF& x) else if (uexp > DF_exp_mid+1) // e>1 ? { if (uexp > DF_exp_mid+DF_mant_len-32) // e > 20 ? - { var uint32 bitmask = // Bitmaske: Bit 52-e gesetzt, alle anderen gelöscht + { var uint32 bitmask = // Bitmaske: Bit 52-e gesetzt, alle anderen gelöscht bit(DF_mant_len+DF_exp_mid-uexp); - var uint32 mask = // Bitmaske: Bits 51-e..0 gesetzt, alle anderen gelöscht + var uint32 mask = // Bitmaske: Bits 51-e..0 gesetzt, alle anderen gelöscht bitmask-1; if ( ((mlo & bitmask) ==0) // Bit 52-e =0 -> abrunden || ( ((mlo & mask) ==0) // Bit 52-e =1 und Bits 51-e..0 >0 -> aufrunden @@ -102,21 +102,21 @@ const cl_DF fround (const cl_DF& x) : ((mlo & (bitmask<<1)) ==0) ) ) ) // abrunden - { mask |= bitmask; // Bitmaske: Bits 52-e..0 gesetzt, alle anderen gelöscht + { mask |= bitmask; // Bitmaske: Bits 52-e..0 gesetzt, alle anderen gelöscht return allocate_dfloat(semhi, mlo & ~mask ); } else // aufrunden { mlo = (mlo | mask) // alle diese Bits 51-e..0 setzen (Bit 52-e schon gesetzt) - + 1; // letzte Stelle erhöhen, + + 1; // letzte Stelle erhöhen, if (mlo==0) { semhi += 1; } // dabei evtl. Exponenten incrementieren return allocate_dfloat(semhi,mlo); } } else - { var uint32 bitmask = // Bitmaske: Bit 20-e gesetzt, alle anderen gelöscht + { var uint32 bitmask = // Bitmaske: Bit 20-e gesetzt, alle anderen gelöscht bit(DF_mant_len+DF_exp_mid-32-uexp); - var uint32 mask = // Bitmaske: Bits 19-e..0 gesetzt, alle anderen gelöscht + var uint32 mask = // Bitmaske: Bits 19-e..0 gesetzt, alle anderen gelöscht bitmask-1; if ( ((semhi & bitmask) ==0) // Bit 52-e =0 -> abrunden || ( (mlo==0) && ((semhi & mask) ==0) // Bit 52-e =1 und Bits 51-e..0 >0 -> aufrunden @@ -124,21 +124,21 @@ const cl_DF fround (const cl_DF& x) && ((semhi & (bitmask<<1)) ==0) ) ) // abrunden - { mask |= bitmask; // Bitmaske: Bits 20-e..0 gesetzt, alle anderen gelöscht + { mask |= bitmask; // Bitmaske: Bits 20-e..0 gesetzt, alle anderen gelöscht return allocate_dfloat( semhi & ~mask, 0 ); } else // aufrunden { return allocate_dfloat ((semhi | mask) // alle diese Bits 19-e..0 setzen (Bit 20-e schon gesetzt) - + 1, // letzte Stelle erhöhen, dabei evtl. Exponenten incrementieren + + 1, // letzte Stelle erhöhen, dabei evtl. Exponenten incrementieren 0 ); } } } elif (uexp == DF_exp_mid+1) // e=1 ? - // Wie bei 1 < e <= 20, nur daß Bit 53-e stets gesetzt ist. + // Wie bei 1 < e <= 20, nur daß Bit 53-e stets gesetzt ist. { if ((semhi & bit(DF_mant_len-32-1)) ==0) // Bit 52-e =0 -> abrunden // abrunden { return allocate_dfloat( semhi & ~(bit(DF_mant_len-32)-1) , 0 ); } @@ -146,14 +146,14 @@ const cl_DF fround (const cl_DF& x) // aufrunden { return allocate_dfloat ((semhi | (bit(DF_mant_len-32)-1)) // alle diese Bits 52-e..0 setzen - + 1, // letzte Stelle erhöhen, dabei evtl. Exponenten incrementieren + + 1, // letzte Stelle erhöhen, dabei evtl. Exponenten incrementieren 0 ); } } else // e=0 ? - // Wie bei 1 < e <= 20, nur daß Bit 52-e stets gesetzt - // und Bit 53-e stets gelöscht ist. + // Wie bei 1 < e <= 20, nur daß Bit 52-e stets gesetzt + // und Bit 53-e stets gelöscht ist. { if ((mlo==0) && ((semhi & (bit(DF_mant_len-32)-1)) ==0)) // abrunden von +-0.5 zu 0.0 { return cl_DF_0; } @@ -161,7 +161,7 @@ const cl_DF fround (const cl_DF& x) // aufrunden { return allocate_dfloat ((semhi | (bit(DF_mant_len-32)-1)) // alle Bits 51-e..0 setzen - + 1, // letzte Stelle erhöhen, dabei Exponenten incrementieren + + 1, // letzte Stelle erhöhen, dabei Exponenten incrementieren 0 ); } } diff --git a/src/float/dfloat/elem/cl_DF_ftrunc.cc b/src/float/dfloat/elem/cl_DF_ftrunc.cc index 23d5f4d..fa5e126 100644 --- a/src/float/dfloat/elem/cl_DF_ftrunc.cc +++ b/src/float/dfloat/elem/cl_DF_ftrunc.cc @@ -31,7 +31,7 @@ const cl_DF ftruncate (const cl_DF& x) else // 1<=e<=52 { return allocate_dfloat - ( x_ & // Bitmaske: Bits 52-e..0 gelöscht, alle anderen gesetzt + ( x_ & // Bitmaske: Bits 52-e..0 gelöscht, alle anderen gesetzt ~(bit(DF_mant_len+1+DF_exp_mid-uexp)-1) ); } } @@ -49,13 +49,13 @@ const cl_DF ftruncate (const cl_DF& x) if (uexp > DF_exp_mid+DF_mant_len+1-32) // e > 21 ? { return allocate_dfloat ( semhi, - mlo & // Bitmaske: Bits 52-e..0 gelöscht, alle anderen gesetzt + mlo & // Bitmaske: Bits 52-e..0 gelöscht, alle anderen gesetzt ~(bit(DF_mant_len+1+DF_exp_mid-uexp)-1) ); } else { return allocate_dfloat - ( semhi & // Bitmaske: Bits 20-e..0 gelöscht, alle anderen gesetzt + ( semhi & // Bitmaske: Bits 20-e..0 gelöscht, alle anderen gesetzt ~(bit(DF_mant_len+1+DF_exp_mid-32-uexp)-1), 0 ); diff --git a/src/float/dfloat/elem/cl_DF_futrunc.cc b/src/float/dfloat/elem/cl_DF_futrunc.cc index 35c2576..6a7a227 100644 --- a/src/float/dfloat/elem/cl_DF_futrunc.cc +++ b/src/float/dfloat/elem/cl_DF_futrunc.cc @@ -18,10 +18,10 @@ const cl_DF futruncate (const cl_DF& x) // e<=0 -> Ergebnis 1.0 oder -1.0, je nach Vorzeichen von x. // 1<=e<=52 -> Greife die letzten (53-e) Bits von x heraus. // Sind sie alle =0 -> Ergebnis x. -// Sonst setze sie alle und erhöhe dann die letzte Stelle um 1. -// Kein Überlauf der 52 Bit -> fertig. +// Sonst setze sie alle und erhöhe dann die letzte Stelle um 1. +// Kein Überlauf der 52 Bit -> fertig. // Sonst (Ergebnis eine Zweierpotenz): Mantisse := .1000...000, -// e:=e+1. (Test auf Überlauf wegen e<=53 überflüssig) +// e:=e+1. (Test auf Überlauf wegen e<=53 überflüssig) // e>=53 -> Ergebnis x. #if (cl_word_size==64) var dfloat x_ = TheDfloat(x)->dfloat_value; @@ -36,13 +36,13 @@ const cl_DF futruncate (const cl_DF& x) { if (uexp > DF_exp_mid+DF_mant_len) // e > 52 ? { return x; } else - { var uint64 mask = // Bitmaske: Bits 52-e..0 gesetzt, alle anderen gelöscht + { var uint64 mask = // Bitmaske: Bits 52-e..0 gesetzt, alle anderen gelöscht bit(DF_mant_len+1+DF_exp_mid-uexp)-1; if ((x_ & mask)==0) // alle diese Bits =0 ? { return x; } return allocate_dfloat ((x_ | mask) // alle diese Bits setzen - + 1 // letzte Stelle erhöhen, dabei evtl. Exponenten incrementieren + + 1 // letzte Stelle erhöhen, dabei evtl. Exponenten incrementieren ); } } #else @@ -60,23 +60,23 @@ const cl_DF futruncate (const cl_DF& x) { return x; } else if (uexp > DF_exp_mid+DF_mant_len+1-32) // e > 21 ? - { var uint32 mask = // Bitmaske: Bits 52-e..0 gesetzt, alle anderen gelöscht + { var uint32 mask = // Bitmaske: Bits 52-e..0 gesetzt, alle anderen gelöscht bit(DF_mant_len+1+DF_exp_mid-uexp)-1; if ((mlo & mask)==0) // alle diese Bits =0 ? { return x; } mlo = (mlo | mask) // alle diese Bits setzen - + 1; // letzte Stelle erhöhen, + + 1; // letzte Stelle erhöhen, if (mlo==0) { semhi += 1; } // dabei evtl. Exponenten incrementieren return allocate_dfloat(semhi,mlo); } else - { var uint32 mask = // Bitmaske: Bits 20-e..0 gesetzt, alle anderen gelöscht + { var uint32 mask = // Bitmaske: Bits 20-e..0 gesetzt, alle anderen gelöscht bit(DF_mant_len+1+DF_exp_mid-32-uexp)-1; if ((mlo==0) && ((semhi & mask)==0)) // alle diese Bits und mlo =0 ? { return x; } return allocate_dfloat ((semhi | mask) // alle diese Bits setzen - + 1, // letzte Stelle erhöhen, dabei evtl. Exponenten incrementieren + + 1, // letzte Stelle erhöhen, dabei evtl. Exponenten incrementieren 0 ); } } diff --git a/src/float/dfloat/elem/cl_DF_minus.cc b/src/float/dfloat/elem/cl_DF_minus.cc index ba4bd55..5c26083 100644 --- a/src/float/dfloat/elem/cl_DF_minus.cc +++ b/src/float/dfloat/elem/cl_DF_minus.cc @@ -23,9 +23,9 @@ const cl_DF operator- (const cl_DF& x1, const cl_DF& x2) #ifdef FAST_DOUBLE double_to_DF(DF_to_double(x1) - DF_to_double(x2), return , TRUE, TRUE, // Overflow und subnormale Zahl abfangen - FALSE, // kein Underflow mit Ergebnis +/- 0.0 möglich + FALSE, // kein Underflow mit Ergebnis +/- 0.0 möglich // (nach Definition der subnormalen Zahlen) - FALSE, FALSE // keine Singularität, kein NaN als Ergebnis möglich + FALSE, FALSE // keine Singularität, kein NaN als Ergebnis möglich ); #else #if (cl_word_size==64) diff --git a/src/float/dfloat/elem/cl_DF_mul.cc b/src/float/dfloat/elem/cl_DF_mul.cc index de8cb7b..efe1ecb 100644 --- a/src/float/dfloat/elem/cl_DF_mul.cc +++ b/src/float/dfloat/elem/cl_DF_mul.cc @@ -45,7 +45,7 @@ const cl_DF operator* (const cl_DF& x1, const cl_DF& x2) TRUE, TRUE, // Overflow und subnormale Zahl abfangen !(zerop(x1) || zerop(x2)), // ein Ergebnis +/- 0.0 // ist genau dann in Wirklichkeit ein Underflow - FALSE, FALSE // keine Singularität, kein NaN als Ergebnis möglich + FALSE, FALSE // keine Singularität, kein NaN als Ergebnis möglich ); #else // x1,x2 entpacken: diff --git a/src/float/dfloat/elem/cl_DF_plus.cc b/src/float/dfloat/elem/cl_DF_plus.cc index bae86a1..90cb6ce 100644 --- a/src/float/dfloat/elem/cl_DF_plus.cc +++ b/src/float/dfloat/elem/cl_DF_plus.cc @@ -27,11 +27,11 @@ const cl_DF operator+ (const cl_DF& x1, const cl_DF& x2) // Also e1 >= e2. // Falls e1 - e2 >= 52 + 3, Ergebnis x1. // Schiebe beide Mantissen um 3 Bits nach links (Vorbereitung der Rundung: -// Bei e1-e2=0,1 ist keine Rundung nötig, bei e1-e2>1 ist der Exponent des +// Bei e1-e2=0,1 ist keine Rundung nötig, bei e1-e2>1 ist der Exponent des // Ergebnisses =e1-1, =e1 oder =e1+1. Brauche daher 1 Schutzbit und zwei -// Rundungsbits: 00 exakt, 01 1.Hälfte, 10 exakte Mitte, 11 2.Hälfte.) +// Rundungsbits: 00 exakt, 01 1.Hälfte, 10 exakte Mitte, 11 2.Hälfte.) // Schiebe die Mantisse von x2 um e0-e1 Bits nach rechts. (Dabei die Rundung -// ausführen: Bit 0 ist das logische Oder der Bits 0,-1,-2,...) +// ausführen: Bit 0 ist das logische Oder der Bits 0,-1,-2,...) // Falls x1,x2 selbes Vorzeichen haben: Addiere dieses zur Mantisse von x1. // Falls x1,x2 verschiedenes Vorzeichen haben: Subtrahiere dieses von der // Mantisse von x1. <0 -> (Es war e1=e2) Vertausche die Vorzeichen, negiere. @@ -41,9 +41,9 @@ const cl_DF operator+ (const cl_DF& x1, const cl_DF& x2) #ifdef FAST_DOUBLE double_to_DF(DF_to_double(x1) + DF_to_double(x2), return , TRUE, TRUE, // Overflow und subnormale Zahl abfangen - FALSE, // kein Underflow mit Ergebnis +/- 0.0 möglich + FALSE, // kein Underflow mit Ergebnis +/- 0.0 möglich // (nach Definition der subnormalen Zahlen) - FALSE, FALSE // keine Singularität, kein NaN als Ergebnis möglich + FALSE, FALSE // keine Singularität, kein NaN als Ergebnis möglich ); #else #if (cl_word_size==64) @@ -87,10 +87,10 @@ const cl_DF operator+ (const cl_DF& x1, const cl_DF& x2) { mant1 = mant1 + mant2; } // mant1 = Ergebnis-Mantisse >0, sign1 = Ergebnis-Vorzeichen, // exp1 = Ergebnis-Exponent. - // Außerdem: Bei expdiff=0,1 sind die zwei letzten Bits von mant1 Null, + // Außerdem: Bei expdiff=0,1 sind die zwei letzten Bits von mant1 Null, // bei expdiff>=2 ist mant1 >= 2^(DF_mant_len+2). // Stets ist mant1 < 2^(DF_mant_len+5). (Daher werden die 2 Rundungsbits - // nachher um höchstens eine Position nach links geschoben werden.) + // nachher um höchstens eine Position nach links geschoben werden.) // [Knuth, S.201, leicht modifiziert: // N1. m>=1 -> goto N4. // N2. [Hier m<1] m>=1/2 -> goto N5. @@ -129,8 +129,8 @@ const cl_DF operator+ (const cl_DF& x1, const cl_DF& x2) // aufrunden { mant1 = mant1+1; if (mant1 >= bit(DF_mant_len+1)) - // Bei Überlauf während der Rundung nochmals rechts schieben - // (Runden ist hier überflüssig): + // Bei Überlauf während der Rundung nochmals rechts schieben + // (Runden ist hier überflüssig): { mant1 = mant1>>1; exp1 = exp1+1; } // Mantisse rechts schieben } }// Runden fertig @@ -205,10 +205,10 @@ const cl_DF operator+ (const cl_DF& x1, const cl_DF& x2) } // mant1 = Ergebnis-Mantisse >0, sign1 = Ergebnis-Vorzeichen, // exp1 = Ergebnis-Exponent. - // Außerdem: Bei expdiff=0,1 sind die zwei letzten Bits von mant1 Null, + // Außerdem: Bei expdiff=0,1 sind die zwei letzten Bits von mant1 Null, // bei expdiff>=2 ist mant1 >= 2^(DF_mant_len+2). // Stets ist mant1 < 2^(DF_mant_len+5). (Daher werden die 2 Rundungsbits - // nachher um höchstens eine Position nach links geschoben werden.) + // nachher um höchstens eine Position nach links geschoben werden.) // [Knuth, S.201, leicht modifiziert: // N1. m>=1 -> goto N4. // N2. [Hier m<1] m>=1/2 -> goto N5. @@ -252,8 +252,8 @@ const cl_DF operator+ (const cl_DF& x1, const cl_DF& x2) if (mantlo1==0) { manthi1 = manthi1+1; if (manthi1 >= bit(DF_mant_len-32+1)) - // Bei Überlauf während der Rundung nochmals rechts schieben - // (Runden ist hier überflüssig): + // Bei Überlauf während der Rundung nochmals rechts schieben + // (Runden ist hier überflüssig): { manthi1 = manthi1>>1; exp1 = exp1+1; } // Mantisse rechts schieben } } }// Runden fertig diff --git a/src/float/dfloat/elem/cl_DF_scale.cc b/src/float/dfloat/elem/cl_DF_scale.cc index a932408..138d0c6 100644 --- a/src/float/dfloat/elem/cl_DF_scale.cc +++ b/src/float/dfloat/elem/cl_DF_scale.cc @@ -18,8 +18,8 @@ const cl_DF scale_float (const cl_DF& x, sintC delta) { // Methode: // x=0.0 -> x als Ergebnis - // delta muß betragsmäßig <= DF_exp_high-DF_exp_low sein. - // Neues DF mit um delta vergrößertem Exponenten bilden. + // delta muß betragsmäßig <= DF_exp_high-DF_exp_low sein. + // Neues DF mit um delta vergrößertem Exponenten bilden. // x entpacken: var cl_signean sign; var sintL exp; diff --git a/src/float/dfloat/elem/cl_DF_scale_I.cc b/src/float/dfloat/elem/cl_DF_scale_I.cc index 1c60c86..00e26a8 100644 --- a/src/float/dfloat/elem/cl_DF_scale_I.cc +++ b/src/float/dfloat/elem/cl_DF_scale_I.cc @@ -19,8 +19,8 @@ const cl_DF scale_float (const cl_DF& x, const cl_I& delta) { // Methode: // x=0.0 -> x als Ergebnis - // delta muß ein Fixnum betragsmäßig <= DF_exp_high-DF_exp_low sein. - // Neues DF mit um delta vergrößertem Exponenten bilden. + // delta muß ein Fixnum betragsmäßig <= DF_exp_high-DF_exp_low sein. + // Neues DF mit um delta vergrößertem Exponenten bilden. // x entpacken: var cl_signean sign; var sintL exp; diff --git a/src/float/ffloat/algebraic/cl_FF_sqrt.cc b/src/float/ffloat/algebraic/cl_FF_sqrt.cc index 611f946..e0cdd2e 100644 --- a/src/float/ffloat/algebraic/cl_FF_sqrt.cc +++ b/src/float/ffloat/algebraic/cl_FF_sqrt.cc @@ -24,7 +24,7 @@ const cl_FF sqrt (const cl_FF& x) // Ergebnis-Mantisse: // Bilde aus [1,m22,...,m0,(26 Nullbits)] bei geradem e, // aus [0,1,m22,...,m0,(25 Nullbits)] bei ungeradem e -// die Ganzzahl-Wurzel, eine 25-Bit-Zahl mit einer führenden 1. +// die Ganzzahl-Wurzel, eine 25-Bit-Zahl mit einer führenden 1. // Runde das letzte Bit weg: // Bit 0 = 0 -> abrunden, // Bit 0 = 1 und Wurzel exakt -> round-to-even, @@ -36,7 +36,7 @@ const cl_FF sqrt (const cl_FF& x) var sintL exp; var uint32 mant; FF_decode(x, { return x; }, ,exp=,mant=); - // Um die 64-Bit-Ganzzahl-Wurzel ausnutzen zu können, fügen wir beim + // Um die 64-Bit-Ganzzahl-Wurzel ausnutzen zu können, fügen wir beim // Radikanden 39 bzw. 40 statt 25 bzw. 26 Nullbits an. if (exp & bit(0)) // e ungerade diff --git a/src/float/ffloat/cl_FF.h b/src/float/ffloat/cl_FF.h index ecbc702..4ca25cc 100644 --- a/src/float/ffloat/cl_FF.h +++ b/src/float/ffloat/cl_FF.h @@ -116,7 +116,7 @@ inline const cl_FF make_FF (cl_sint sign, unsigned int exp, cl_uint mant) // Entpacken eines Single-Float: // FF_decode(obj, zero_statement, sign=,exp=,mant=); // zerlegt ein Single-Float obj. -// Ist obj=0.0, wird zero_statement ausgeführt. +// Ist obj=0.0, wird zero_statement ausgeführt. // Sonst: cl_signean sign = Vorzeichen (0 = +, -1 = -), // sintL exp = Exponent (vorzeichenbehaftet), // uintL mant = Mantisse (>= 2^FF_mant_len, < 2^(FF_mant_len+1)) @@ -135,11 +135,11 @@ inline const cl_FF make_FF (cl_sint sign, unsigned int exp, cl_uint mant) // Einpacken eines Single-Float: // encode_FF(sign,exp,mant); // liefert ein Single-Float. -// > cl_signean sign: Vorzeichen, 0 für +, -1 für negativ. +// > cl_signean sign: Vorzeichen, 0 für +, -1 für negativ. // > sintL exp: Exponent // > uintL mant: Mantisse, sollte >= 2^FF_mant_len und < 2^(FF_mant_len+1) sein. // < object ergebnis: ein Single-Float -// Der Exponent wird auf Überlauf/Unterlauf getestet. +// Der Exponent wird auf Überlauf/Unterlauf getestet. inline const cl_FF encode_FF (cl_signean sign, sintL exp, uintL mant) { if (exp < (sintL)(FF_exp_low-FF_exp_mid)) @@ -159,7 +159,7 @@ inline const cl_FF encode_FF (cl_signean sign, sintL exp, uintL mant) // Auspacken eines Floats: inline float FF_to_float (const cl_FF& obj) { - #if defined(CL_WIDE_POINTERS) // eines der beiden 32-Bit-Wörter + #if defined(CL_WIDE_POINTERS) // eines der beiden 32-Bit-Wörter #if defined(__GNUC__) return ((ffloatjanus) { eksplicit: cl_ffloat_value(obj) }).machine_float; #else @@ -169,7 +169,7 @@ inline float FF_to_float (const cl_FF& obj) return TheFfloat(obj)->representation.machine_float; #endif } -// Überprüfen und Einpacken eines von den 'float'-Routinen gelieferten +// Überprüfen und Einpacken eines von den 'float'-Routinen gelieferten // IEEE-Floats. // Klassifikation: // 1 <= e <= 254 : normalisierte Zahl @@ -177,8 +177,8 @@ inline float FF_to_float (const cl_FF& obj) // e=0, m=0: vorzeichenbehaftete 0.0 // e=255, m=0: vorzeichenbehaftete Infinity // e=255, m/=0: NaN -// Angabe der möglicherweise auftretenden Sonderfälle: -// maybe_overflow: Operation läuft über, liefert IEEE-Infinity +// Angabe der möglicherweise auftretenden Sonderfälle: +// maybe_overflow: Operation läuft über, liefert IEEE-Infinity // maybe_subnormal: Ergebnis sehr klein, liefert IEEE-subnormale Zahl // maybe_underflow: Ergebnis sehr klein und /=0, liefert IEEE-Null // maybe_divide_0: Ergebnis unbestimmt, liefert IEEE-Infinity @@ -199,7 +199,7 @@ inline float FF_to_float (const cl_FF& obj) && (((~_erg.eksplicit) & ((uint32)bit(FF_exp_len+FF_mant_len)-bit(FF_mant_len))) == 0) /* e=255 ? */\ ) \ { if (maybe_nan && !((_erg.eksplicit << (32-FF_mant_len)) == 0)) \ - { throw division_by_0_exception(); } /* NaN, also Singularität -> "Division durch 0" */\ + { throw division_by_0_exception(); } /* NaN, also Singularität -> "Division durch 0" */\ else /* Infinity */ \ if (!maybe_overflow || maybe_divide_0) \ { throw division_by_0_exception(); } /* Infinity, Division durch 0 */\ @@ -212,7 +212,7 @@ inline float FF_to_float (const cl_FF& obj) #endif // Liefert zu einem Single-Float x : (futruncate x), ein FF. -// x wird von der 0 weg zur nächsten ganzen Zahl gerundet. +// x wird von der 0 weg zur nächsten ganzen Zahl gerundet. extern const cl_FF futruncate (const cl_FF& x); // FF_to_I(x) wandelt ein Single-Float x, das eine ganze Zahl darstellt, diff --git a/src/float/ffloat/conv/cl_FF_from_float.cc b/src/float/ffloat/conv/cl_FF_from_float.cc index 29be439..479b6e2 100644 --- a/src/float/ffloat/conv/cl_FF_from_float.cc +++ b/src/float/ffloat/conv/cl_FF_from_float.cc @@ -28,7 +28,7 @@ cl_private_thing cl_float_to_FF_pointer (const ffloatjanus& val_) { throw floating_point_overflow_exception(); } // Infinity, Overflow } else - { // Der Exponent muß um FF_exp_mid-126 erhöht werden. + { // Der Exponent muß um FF_exp_mid-126 erhöht werden. if ((FF_exp_mid>126) && (exp > FF_exp_high-FF_exp_mid+126)) { throw floating_point_overflow_exception(); } // Overflow val += (FF_exp_mid - 126) << FF_mant_len; diff --git a/src/float/ffloat/conv/cl_FF_to_floatj.cc b/src/float/ffloat/conv/cl_FF_to_floatj.cc index a1898fd..8e04817 100644 --- a/src/float/ffloat/conv/cl_FF_to_floatj.cc +++ b/src/float/ffloat/conv/cl_FF_to_floatj.cc @@ -13,7 +13,7 @@ namespace cln { void cl_FF_to_float (const cl_FF& obj, ffloatjanus* val_) { var ffloat val = cl_ffloat_value(obj); - // Der Exponent muß um FF_exp_mid-126 erniedrigt werden. + // Der Exponent muß um FF_exp_mid-126 erniedrigt werden. if (FF_exp_mid>126) { var uintL exp = (val >> FF_mant_len) & (bit(FF_exp_len)-1); // e if (exp < FF_exp_mid-126+1) diff --git a/src/float/ffloat/conv/cl_I_to_float.cc b/src/float/ffloat/conv/cl_I_to_float.cc index 043c118..39827ff 100644 --- a/src/float/ffloat/conv/cl_I_to_float.cc +++ b/src/float/ffloat/conv/cl_I_to_float.cc @@ -28,7 +28,7 @@ float float_approx (const cl_I& x) var uintC len; 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 + // Führende Digits holen: Brauche FF_mant_len+1 Bits, dazu intDsize // Bits (die NDS kann mit bis zu intDsize Nullbits anfangen). // Dann werden diese Bits um (exp mod intDsize) nach rechts geschoben. var uintD msd = msprefnext(MSDptr); // erstes Digit @@ -48,15 +48,15 @@ float float_approx (const cl_I& x) --len; ok: #if (intDsize==64) // Die NDS besteht aus msd, msdd, und len weiteren Digits. - // Das höchste in 2^intDsize*msd+msdd gesetzte Bit ist Bit Nummer + // Das höchste in 2^intDsize*msd+msdd gesetzte Bit ist Bit Nummer // intDsize-1 + (exp mod intDsize). var uintL shiftcount = exp % intDsize; - var uint64 mant = // führende 64 Bits + var uint64 mant = // führende 64 Bits (shiftcount==0 ? msdd : ((msd << (64-shiftcount)) | (msdd >> shiftcount)) ); - // Das höchste in mant gesetzte Bit ist Bit Nummer 63. + // Das höchste in mant gesetzte Bit ist Bit Nummer 63. if ( ((mant & bit(62-FF_mant_len)) ==0) // Bit 39 =0 -> abrunden || ( ((mant & (bit(62-FF_mant_len)-1)) ==0) // Bit 39 =1 und Bits 38..0 =0 && ((msdd & (bit(shiftcount)-1)) ==0) // und weitere Bits aus msdd =0 @@ -75,15 +75,15 @@ float float_approx (const cl_I& x) } #else // Die NDS besteht aus msd, msdd, und len weiteren Digits. - // Das höchste in 2^32*msd+msdd gesetzte Bit ist Bit Nummer + // Das höchste in 2^32*msd+msdd gesetzte Bit ist Bit Nummer // 31 + (exp mod intDsize). var uintL shiftcount = exp % intDsize; - var uint32 mant = // führende 32 Bits + var uint32 mant = // führende 32 Bits (shiftcount==0 ? msdd : (((uint32)msd << (32-shiftcount)) | (msdd >> shiftcount)) ); - // Das höchste in mant gesetzte Bit ist Bit Nummer 31. + // Das höchste in mant gesetzte Bit ist Bit Nummer 31. if ( ((mant & bit(30-FF_mant_len)) ==0) // Bit 7 =0 -> abrunden || ( ((mant & (bit(30-FF_mant_len)-1)) ==0) // Bit 7 =1 und Bits 6..0 =0 && ((msdd & (bit(shiftcount)-1)) ==0) // und weitere Bits aus msdd =0 diff --git a/src/float/ffloat/conv/cl_RA_to_float.cc b/src/float/ffloat/conv/cl_RA_to_float.cc index 74a146d..8153e9d 100644 --- a/src/float/ffloat/conv/cl_RA_to_float.cc +++ b/src/float/ffloat/conv/cl_RA_to_float.cc @@ -52,7 +52,7 @@ float float_approx (const cl_RA& x) { zaehler = ash(a,(FF_mant_len+2) - lendiff); // (ash a -n+m+25) nenner = b; // b } - // Division zaehler/nenner durchführen: + // Division zaehler/nenner durchführen: var cl_I_div_t q_r = cl_divide(zaehler,nenner); var cl_I& q = q_r.quotient; var cl_I& r = q_r.remainder; diff --git a/src/float/ffloat/elem/cl_FF_div.cc b/src/float/ffloat/elem/cl_FF_div.cc index bc9f21f..1544eb7 100644 --- a/src/float/ffloat/elem/cl_FF_div.cc +++ b/src/float/ffloat/elem/cl_FF_div.cc @@ -36,11 +36,11 @@ const cl_FF operator/ (const cl_FF& x1, const cl_FF& x2) // nach Rundung mant1/mant2 >=1/2, <=2*mant1<2. // Bei mant1/mant2 >=1 brauche 23 Nachkommabits, // bei mant1/mant2 <1 brauche 24 Nachkommabits. -// Fürs Runden: brauche ein Rundungsbit (Rest gibt an, ob exakt). +// Fürs Runden: brauche ein Rundungsbit (Rest gibt an, ob exakt). // Brauche daher insgesamt 25 Nachkommabits von mant1/mant2. // Dividiere daher (als Unsigned Integers) 2^25*(2^24*mant1) durch (2^24*mant2). // Falls der Quotient >=2^25 ist, runde die letzten zwei Bits weg und -// erhöhe den Exponenten um 1. +// erhöhe den Exponenten um 1. // Falls der Quotient <2^25 ist, runde das letzte Bit weg. Bei rounding // overflow schiebe um ein weiteres Bit nach rechts, incr. Exponenten. #if defined(FAST_FLOAT) && !defined(__i386__) @@ -49,7 +49,7 @@ const cl_FF operator/ (const cl_FF& x1, const cl_FF& x2) !zerop(x1), // ein Ergebnis +/- 0.0 // ist genau dann in Wirklichkeit ein Underflow zerop(x2), // Division durch Null abfangen - FALSE // kein NaN als Ergebnis möglich + FALSE // kein NaN als Ergebnis möglich ); #else // x1,x2 entpacken: @@ -63,11 +63,11 @@ const cl_FF operator/ (const cl_FF& x1, const cl_FF& x2) FF_decode(x1, { return x1; }, sign1=,exp1=,mant1=); exp1 = exp1 - exp2; // Differenz der Exponenten sign1 = sign1 ^ sign2; // Ergebnis-Vorzeichen - // Dividiere 2^25*mant1 durch mant2 oder (äquivalent) - // 2^i*2^25*mant1 durch 2^i*mant2 für irgendein i mit 0 <= i <= 32-24 : + // Dividiere 2^25*mant1 durch mant2 oder (äquivalent) + // 2^i*2^25*mant1 durch 2^i*mant2 für irgendein i mit 0 <= i <= 32-24 : var uintL mant; var uintL rest; - // wähle i = 32-(FF_mant_len+1), also i+(FF_mant_len+2) = 33. + // wähle i = 32-(FF_mant_len+1), also i+(FF_mant_len+2) = 33. divu_6432_3232(mant1<<1,0, mant2<<(32-(FF_mant_len+1)), mant=,rest=); if (mant >= bit(FF_mant_len+2)) // Quotient >=2^25 -> 2 Bits wegrunden diff --git a/src/float/ffloat/elem/cl_FF_from_I.cc b/src/float/ffloat/elem/cl_FF_from_I.cc index 9e44d16..ca12ca5 100644 --- a/src/float/ffloat/elem/cl_FF_from_I.cc +++ b/src/float/ffloat/elem/cl_FF_from_I.cc @@ -23,7 +23,7 @@ const cl_FF cl_I_to_FF (const cl_I& x) // Merke Vorzeichen von x. // x:=(abs x) // Exponent:=(integer-length x) -// Greife die 25 höchstwertigen Bits heraus (angeführt von einer 1). +// Greife die 25 höchstwertigen Bits heraus (angeführt von einer 1). // Runde das letzte Bit weg: // Bit 0 = 0 -> abrunden, // Bit 0 = 1 und Rest =0 -> round-to-even, @@ -40,7 +40,7 @@ const cl_FF cl_I_to_FF (const cl_I& x) var uintC len; 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 + // Führende Digits holen: Brauche FF_mant_len+1 Bits, dazu intDsize // Bits (die NDS kann mit bis zu intDsize Nullbits anfangen). // Dann werden diese Bits um (exp mod intDsize) nach rechts geschoben. var uintD msd = msprefnext(MSDptr); // erstes Digit @@ -60,15 +60,15 @@ const cl_FF cl_I_to_FF (const cl_I& x) --len; ok: #if (intDsize==64) // Die NDS besteht aus msd, msdd, und len weiteren Digits. - // Das höchste in 2^intDsize*msd+msdd gesetzte Bit ist Bit Nummer + // Das höchste in 2^intDsize*msd+msdd gesetzte Bit ist Bit Nummer // intDsize-1 + (exp mod intDsize). var uintL shiftcount = exp % intDsize; - var uint64 mant = // führende 64 Bits + var uint64 mant = // führende 64 Bits (shiftcount==0 ? msdd : ((msd << (64-shiftcount)) | (msdd >> shiftcount)) ); - // Das höchste in mant gesetzte Bit ist Bit Nummer 63. + // Das höchste in mant gesetzte Bit ist Bit Nummer 63. if ( ((mant & bit(62-FF_mant_len)) ==0) // Bit 39 =0 -> abrunden || ( ((mant & (bit(62-FF_mant_len)-1)) ==0) // Bit 39 =1 und Bits 38..0 =0 && ((msdd & (bit(shiftcount)-1)) ==0) // und weitere Bits aus msdd =0 @@ -87,15 +87,15 @@ const cl_FF cl_I_to_FF (const cl_I& x) } #else // Die NDS besteht aus msd, msdd, und len weiteren Digits. - // Das höchste in 2^32*msd+msdd gesetzte Bit ist Bit Nummer + // Das höchste in 2^32*msd+msdd gesetzte Bit ist Bit Nummer // 31 + (exp mod intDsize). var uintL shiftcount = exp % intDsize; - var uint32 mant = // führende 32 Bits + var uint32 mant = // führende 32 Bits (shiftcount==0 ? msdd : (((uint32)msd << (32-shiftcount)) | (msdd >> shiftcount)) ); - // Das höchste in mant gesetzte Bit ist Bit Nummer 31. + // Das höchste in mant gesetzte Bit ist Bit Nummer 31. if ( ((mant & bit(30-FF_mant_len)) ==0) // Bit 7 =0 -> abrunden || ( ((mant & (bit(30-FF_mant_len)-1)) ==0) // Bit 7 =1 und Bits 6..0 =0 && ((msdd & (bit(shiftcount)-1)) ==0) // und weitere Bits aus msdd =0 diff --git a/src/float/ffloat/elem/cl_FF_from_RA.cc b/src/float/ffloat/elem/cl_FF_from_RA.cc index d3c7565..a36de45 100644 --- a/src/float/ffloat/elem/cl_FF_from_RA.cc +++ b/src/float/ffloat/elem/cl_FF_from_RA.cc @@ -21,7 +21,7 @@ const cl_FF cl_RA_to_FF (const cl_RA& x) // Methode: // x ganz -> klar. // x = +/- a/b mit Integers a,b>0: -// Seien n,m so gewählt, daß +// Seien n,m so gewählt, daß // 2^(n-1) <= a < 2^n, 2^(m-1) <= b < 2^m. // Dann ist 2^(n-m-1) < a/b < 2^(n-m+1). // Berechne n=(integer-length a) und m=(integer-length b) und @@ -62,7 +62,7 @@ const cl_FF cl_RA_to_FF (const cl_RA& x) { zaehler = ash(a,(FF_mant_len+2) - lendiff); // (ash a -n+m+25) nenner = b; // b } - // Division zaehler/nenner durchführen: + // Division zaehler/nenner durchführen: var cl_I_div_t q_r = cl_divide(zaehler,nenner); var cl_I& q = q_r.quotient; var cl_I& r = q_r.remainder; diff --git a/src/float/ffloat/elem/cl_FF_fround.cc b/src/float/ffloat/elem/cl_FF_fround.cc index d4dc255..b5e81d3 100644 --- a/src/float/ffloat/elem/cl_FF_fround.cc +++ b/src/float/ffloat/elem/cl_FF_fround.cc @@ -29,9 +29,9 @@ const cl_FF fround (const cl_FF& x) { return x; } else if (uexp > FF_exp_mid+1) // e>1 ? - { var uint32 bitmask = // Bitmaske: Bit 23-e gesetzt, alle anderen gelöscht + { var uint32 bitmask = // Bitmaske: Bit 23-e gesetzt, alle anderen gelöscht bit(FF_mant_len+FF_exp_mid-uexp); - var uint32 mask = // Bitmaske: Bits 22-e..0 gesetzt, alle anderen gelöscht + var uint32 mask = // Bitmaske: Bits 22-e..0 gesetzt, alle anderen gelöscht bitmask-1; if ( ((x_ & bitmask) ==0) // Bit 23-e =0 -> abrunden || ( ((x_ & mask) ==0) // Bit 23-e =1 und Bits 22-e..0 >0 -> aufrunden @@ -39,19 +39,19 @@ const cl_FF fround (const cl_FF& x) && ((x_ & (bitmask<<1)) ==0) ) ) // abrunden - { mask |= bitmask; // Bitmaske: Bits 23-e..0 gesetzt, alle anderen gelöscht + { mask |= bitmask; // Bitmaske: Bits 23-e..0 gesetzt, alle anderen gelöscht return allocate_ffloat( x_ & ~mask ); } else // aufrunden { return allocate_ffloat ((x_ | mask) // alle diese Bits 22-e..0 setzen (Bit 23-e schon gesetzt) - + 1 // letzte Stelle erhöhen, dabei evtl. Exponenten incrementieren + + 1 // letzte Stelle erhöhen, dabei evtl. Exponenten incrementieren ); } } elif (uexp == FF_exp_mid+1) // e=1 ? - // Wie bei 1 < e <= 23, nur daß Bit 24-e stets gesetzt ist. + // Wie bei 1 < e <= 23, nur daß Bit 24-e stets gesetzt ist. { if ((x_ & bit(FF_mant_len-1)) ==0) // Bit 23-e =0 -> abrunden // abrunden { return allocate_ffloat( x_ & ~(bit(FF_mant_len)-1) ); } @@ -59,13 +59,13 @@ const cl_FF fround (const cl_FF& x) // aufrunden { return allocate_ffloat ((x_ | (bit(FF_mant_len)-1)) // alle diese Bits 23-e..0 setzen - + 1 // letzte Stelle erhöhen, dabei evtl. Exponenten incrementieren + + 1 // letzte Stelle erhöhen, dabei evtl. Exponenten incrementieren ); } } else // e=0 ? - // Wie bei 1 < e <= 23, nur daß Bit 23-e stets gesetzt - // und Bit 24-e stets gelöscht ist. + // Wie bei 1 < e <= 23, nur daß Bit 23-e stets gesetzt + // und Bit 24-e stets gelöscht ist. { if ((x_ & (bit(FF_mant_len)-1)) ==0) // abrunden von +-0.5 zu 0.0 { return cl_FF_0; } @@ -73,7 +73,7 @@ const cl_FF fround (const cl_FF& x) // aufrunden { return allocate_ffloat ((x_ | (bit(FF_mant_len)-1)) // alle Bits 22-e..0 setzen - + 1 // letzte Stelle erhöhen, dabei Exponenten incrementieren + + 1 // letzte Stelle erhöhen, dabei Exponenten incrementieren ); } } } diff --git a/src/float/ffloat/elem/cl_FF_ftrunc.cc b/src/float/ffloat/elem/cl_FF_ftrunc.cc index a3171b8..6340c8c 100644 --- a/src/float/ffloat/elem/cl_FF_ftrunc.cc +++ b/src/float/ffloat/elem/cl_FF_ftrunc.cc @@ -29,7 +29,7 @@ const cl_FF ftruncate (const cl_FF& x) { return x; } else { return allocate_ffloat - ( x_ & // Bitmaske: Bits 23-e..0 gelöscht, alle anderen gesetzt + ( x_ & // Bitmaske: Bits 23-e..0 gelöscht, alle anderen gesetzt ~(bit(FF_mant_len+1+FF_exp_mid-uexp)-1) ); } } diff --git a/src/float/ffloat/elem/cl_FF_futrunc.cc b/src/float/ffloat/elem/cl_FF_futrunc.cc index a8538ea..198f9de 100644 --- a/src/float/ffloat/elem/cl_FF_futrunc.cc +++ b/src/float/ffloat/elem/cl_FF_futrunc.cc @@ -18,10 +18,10 @@ const cl_FF futruncate (const cl_FF& x) // e<=0 -> Ergebnis 1.0 oder -1.0, je nach Vorzeichen von x. // 1<=e<=23 -> Greife die letzten (24-e) Bits von x heraus. // Sind sie alle =0 -> Ergebnis x. -// Sonst setze sie alle und erhöhe dann die letzte Stelle um 1. -// Kein Überlauf der 23 Bit -> fertig. +// Sonst setze sie alle und erhöhe dann die letzte Stelle um 1. +// Kein Überlauf der 23 Bit -> fertig. // Sonst (Ergebnis eine Zweierpotenz): Mantisse := .1000...000, -// e:=e+1. (Test auf Überlauf wegen e<=24 überflüssig) +// e:=e+1. (Test auf Überlauf wegen e<=24 überflüssig) // e>=24 -> Ergebnis x. var ffloat x_ = cl_ffloat_value(x); var uintL uexp = FF_uexp(x_); // e + FF_exp_mid @@ -35,13 +35,13 @@ const cl_FF futruncate (const cl_FF& x) { if (uexp > FF_exp_mid+FF_mant_len) // e > 23 ? { return x; } else - { var uint32 mask = // Bitmaske: Bits 23-e..0 gesetzt, alle anderen gelöscht + { var uint32 mask = // Bitmaske: Bits 23-e..0 gesetzt, alle anderen gelöscht bit(FF_mant_len+1+FF_exp_mid-uexp)-1; if ((x_ & mask)==0) // alle diese Bits =0 ? { return x; } return allocate_ffloat ((x_ | mask) // alle diese Bits setzen - + 1 // letzte Stelle erhöhen, dabei evtl. Exponenten incrementieren + + 1 // letzte Stelle erhöhen, dabei evtl. Exponenten incrementieren ); } } } diff --git a/src/float/ffloat/elem/cl_FF_minus.cc b/src/float/ffloat/elem/cl_FF_minus.cc index 73df3a8..fbcd72d 100644 --- a/src/float/ffloat/elem/cl_FF_minus.cc +++ b/src/float/ffloat/elem/cl_FF_minus.cc @@ -21,9 +21,9 @@ const cl_FF operator- (const cl_FF& x1, const cl_FF& x2) #ifdef FAST_FLOAT float_to_FF(FF_to_float(x1) - FF_to_float(x2), return , TRUE, TRUE, // Overflow und subnormale Zahl abfangen - FALSE, // kein Underflow mit Ergebnis +/- 0.0 möglich + FALSE, // kein Underflow mit Ergebnis +/- 0.0 möglich // (nach Definition der subnormalen Zahlen) - FALSE, FALSE // keine Singularität, kein NaN als Ergebnis möglich + FALSE, FALSE // keine Singularität, kein NaN als Ergebnis möglich ); #else var ffloat x2_ = cl_ffloat_value(x2); diff --git a/src/float/ffloat/elem/cl_FF_mul.cc b/src/float/ffloat/elem/cl_FF_mul.cc index 08cafac..8f8d14d 100644 --- a/src/float/ffloat/elem/cl_FF_mul.cc +++ b/src/float/ffloat/elem/cl_FF_mul.cc @@ -44,7 +44,7 @@ const cl_FF operator* (const cl_FF& x1, const cl_FF& x2) TRUE, TRUE, // Overflow und subnormale Zahl abfangen !(zerop(x1) || zerop(x2)), // ein Ergebnis +/- 0.0 // ist genau dann in Wirklichkeit ein Underflow - FALSE, FALSE // keine Singularität, kein NaN als Ergebnis möglich + FALSE, FALSE // keine Singularität, kein NaN als Ergebnis möglich ); #else // x1,x2 entpacken: diff --git a/src/float/ffloat/elem/cl_FF_plus.cc b/src/float/ffloat/elem/cl_FF_plus.cc index b42e80d..f84954b 100644 --- a/src/float/ffloat/elem/cl_FF_plus.cc +++ b/src/float/ffloat/elem/cl_FF_plus.cc @@ -27,11 +27,11 @@ const cl_FF operator+ (const cl_FF& x1, const cl_FF& x2) // Also e1 >= e2. // Falls e1 - e2 >= 23 + 3, Ergebnis x1. // Schiebe beide Mantissen um 3 Bits nach links (Vorbereitung der Rundung: -// Bei e1-e2=0,1 ist keine Rundung nötig, bei e1-e2>1 ist der Exponent des +// Bei e1-e2=0,1 ist keine Rundung nötig, bei e1-e2>1 ist der Exponent des // Ergebnisses =e1-1, =e1 oder =e1+1. Brauche daher 1 Schutzbit und zwei -// Rundungsbits: 00 exakt, 01 1.Hälfte, 10 exakte Mitte, 11 2.Hälfte.) +// Rundungsbits: 00 exakt, 01 1.Hälfte, 10 exakte Mitte, 11 2.Hälfte.) // Schiebe die Mantisse von x2 um e0-e1 Bits nach rechts. (Dabei die Rundung -// ausführen: Bit 0 ist das logische Oder der Bits 0,-1,-2,...) +// ausführen: Bit 0 ist das logische Oder der Bits 0,-1,-2,...) // Falls x1,x2 selbes Vorzeichen haben: Addiere dieses zur Mantisse von x1. // Falls x1,x2 verschiedenes Vorzeichen haben: Subtrahiere dieses von der // Mantisse von x1. <0 -> (Es war e1=e2) Vertausche die Vorzeichen, negiere. @@ -41,9 +41,9 @@ const cl_FF operator+ (const cl_FF& x1, const cl_FF& x2) #ifdef FAST_FLOAT float_to_FF(FF_to_float(x1) + FF_to_float(x2), return , TRUE, TRUE, // Overflow und subnormale Zahl abfangen - FALSE, // kein Underflow mit Ergebnis +/- 0.0 möglich + FALSE, // kein Underflow mit Ergebnis +/- 0.0 möglich // (nach Definition der subnormalen Zahlen) - FALSE, FALSE // keine Singularität, kein NaN als Ergebnis möglich + FALSE, FALSE // keine Singularität, kein NaN als Ergebnis möglich ); #else @@ -87,10 +87,10 @@ const cl_FF operator+ (const cl_FF& x1, const cl_FF& x2) { mant1 = mant1 + mant2; } // mant1 = Ergebnis-Mantisse >0, sign1 = Ergebnis-Vorzeichen, // exp1 = Ergebnis-Exponent. - // Außerdem: Bei expdiff=0,1 sind die zwei letzten Bits von mant1 Null, + // Außerdem: Bei expdiff=0,1 sind die zwei letzten Bits von mant1 Null, // bei expdiff>=2 ist mant1 >= 2^(FF_mant_len+2). // Stets ist mant1 < 2^(FF_mant_len+5). (Daher werden die 2 Rundungsbits - // nachher um höchstens eine Position nach links geschoben werden.) + // nachher um höchstens eine Position nach links geschoben werden.) // [Knuth, S.201, leicht modifiziert: // N1. m>=1 -> goto N4. // N2. [Hier m<1] m>=1/2 -> goto N5. @@ -129,8 +129,8 @@ const cl_FF operator+ (const cl_FF& x1, const cl_FF& x2) // aufrunden { mant1 = mant1+1; if (mant1 >= bit(FF_mant_len+1)) - // Bei Überlauf während der Rundung nochmals rechts schieben - // (Runden ist hier überflüssig): + // Bei Überlauf während der Rundung nochmals rechts schieben + // (Runden ist hier überflüssig): { mant1 = mant1>>1; exp1 = exp1+1; } // Mantisse rechts schieben } }// Runden fertig diff --git a/src/float/ffloat/elem/cl_FF_scale.cc b/src/float/ffloat/elem/cl_FF_scale.cc index 688cf61..51ff589 100644 --- a/src/float/ffloat/elem/cl_FF_scale.cc +++ b/src/float/ffloat/elem/cl_FF_scale.cc @@ -18,8 +18,8 @@ const cl_FF scale_float (const cl_FF& x, sintC delta) { // Methode: // x=0.0 -> x als Ergebnis - // delta muß betragsmäßig <= FF_exp_high-FF_exp_low sein. - // Neues FF mit um delta vergrößertem Exponenten bilden. + // delta muß betragsmäßig <= FF_exp_high-FF_exp_low sein. + // Neues FF mit um delta vergrößertem Exponenten bilden. // x entpacken: var cl_signean sign; var sintL exp; diff --git a/src/float/ffloat/elem/cl_FF_scale_I.cc b/src/float/ffloat/elem/cl_FF_scale_I.cc index 2f444d7..63d0332 100644 --- a/src/float/ffloat/elem/cl_FF_scale_I.cc +++ b/src/float/ffloat/elem/cl_FF_scale_I.cc @@ -19,8 +19,8 @@ const cl_FF scale_float (const cl_FF& x, const cl_I& delta) { // Methode: // x=0.0 -> x als Ergebnis - // delta muß ein Fixnum betragsmäßig <= FF_exp_high-FF_exp_low sein. - // Neues FF mit um delta vergrößertem Exponenten bilden. + // delta muß ein Fixnum betragsmäßig <= FF_exp_high-FF_exp_low sein. + // Neues FF mit um delta vergrößertem Exponenten bilden. // x entpacken: var cl_signean sign; var sintL exp; diff --git a/src/float/input/cl_F_readparsed.cc b/src/float/input/cl_F_readparsed.cc index 4610724..18c858f 100644 --- a/src/float/input/cl_F_readparsed.cc +++ b/src/float/input/cl_F_readparsed.cc @@ -33,11 +33,11 @@ const cl_F read_float (unsigned int base, float_format_t prec, cl_signean sign, var uintL exp_len = index2-index4; // Anzahl Stellen des Exponenten if (exp_len > 0) { var const char * ptr = &string[index4]; // zeigt auf den Exponentmarker - ptr++; exp_len--; // Exponentmarker überlesen + ptr++; exp_len--; // Exponentmarker überlesen var cl_signean exp_sign = 0; // Exponenten-Vorzeichen switch (*ptr) { case '-': exp_sign = ~exp_sign; // Vorzeichen := negativ - case '+': ptr++; exp_len--; // Exponenten-Vorzeichen überlesen + case '+': ptr++; exp_len--; // Exponenten-Vorzeichen überlesen default: ; } exponent = digits_to_I(ptr,exp_len,(uintD)base); // Exponent in Integer umwandeln @@ -58,8 +58,8 @@ const cl_F read_float (unsigned int base, float_format_t prec, cl_signean sign, DeclareType(cl_I,base_power); ratvalue = mantisse * base_power; } else { - // falls mantisse/=0, in exponent=1/10^i den Zähler durch mantisse - // ersetzen (liefert ungekürzten Bruch, Vorsicht!) + // falls mantisse/=0, in exponent=1/10^i den Zähler durch mantisse + // ersetzen (liefert ungekürzten Bruch, Vorsicht!) DeclareType(cl_RT,base_power); if (zerop(mantisse)) ratvalue = 0; @@ -69,7 +69,7 @@ const cl_F read_float (unsigned int base, float_format_t prec, cl_signean sign, ratvalue = base_power; } } - // ratvalue = Mantisse * Zehnerpotenz, als ungekürzte rationale Zahl! + // ratvalue = Mantisse * Zehnerpotenz, als ungekürzte rationale Zahl! floatformatcase(prec , // in Short-Float umwandeln { diff --git a/src/float/lfloat/algebraic/cl_LF_sqrt.cc b/src/float/lfloat/algebraic/cl_LF_sqrt.cc index 1acb1ba..16c946e 100644 --- a/src/float/lfloat/algebraic/cl_LF_sqrt.cc +++ b/src/float/lfloat/algebraic/cl_LF_sqrt.cc @@ -42,21 +42,21 @@ const cl_LF sqrt (const cl_LF& x) CL_ALLOCA_STACK; var uintD* r_MSDptr; var uintD* r_LSDptr; - var uintC r_len = 2*len+2; // Länge des Radikanden + var uintC r_len = 2*len+2; // Länge des Radikanden num_stack_alloc(r_len, r_MSDptr=,r_LSDptr=); if ((uexp & bit(0)) == (LF_exp_mid & bit(0))) // Exponent gerade {var uintD* ptr = copy_loop_msp(arrayMSDptr(TheLfloat(x)->data,len),r_MSDptr,len); // n Digits kopieren - clear_loop_msp(ptr,len+2); // n+2 Nulldigits anh�gen + clear_loop_msp(ptr,len+2); // n+2 Nulldigits anh�gen } else // Exponent ungerade {var uintD carry_rechts = // n Digits kopieren und um 1 Bit rechts shiften shiftrightcopy_loop_msp(arrayMSDptr(TheLfloat(x)->data,len),r_MSDptr,len,1,0); var uintD* ptr = r_MSDptr mspop len; - msprefnext(ptr) = carry_rechts; // �ertrag und - clear_loop_msp(ptr,len+1); // n+1 Nulldigits anh�gen + msprefnext(ptr) = carry_rechts; // �ertrag und + clear_loop_msp(ptr,len+1); // n+1 Nulldigits anh�gen } // Compute ((uexp - LF_exp_mid + 1) >> 1) + LF_exp_mid without risking // uintE overflow. @@ -81,7 +81,7 @@ const cl_LF sqrt (const cl_LF& x) // Ablegen und runden: copy_loop_msp(p_MSDptr mspop 1,y_mantMSDptr,len); // NUDS nach y kopieren if (mspref(p_MSDptr,0) == 0) - { if ( ((sintD)mspref(p_MSDptr,len+1) >= 0) // n�hstes Bit =0 -> abrunden + { if ( ((sintD)mspref(p_MSDptr,len+1) >= 0) // n�hstes Bit =0 -> abrunden || ( ((mspref(p_MSDptr,len+1) & ((uintD)bit(intDsize-1)-1)) ==0) // =1 und weitere Bits >0 -> aufrunden && !test_loop_msp(p_MSDptr mspop (len+2),len+1) // round-to-even (etwas witzlos, da eh alles ungenau ist) @@ -92,13 +92,13 @@ const cl_LF sqrt (const cl_LF& x) else // aufrunden { if ( inc_loop_lsp(y_mantMSDptr mspop len,len) ) - // �ertrag durchs Aufrunden + // �ertrag durchs Aufrunden { mspref(y_mantMSDptr,0) = bit(intDsize-1); // Mantisse := 10...0 (TheLfloat(y)->expo)++; // Exponenten incrementieren } } } else - // �ertrag durch Rundungsfehler + // �ertrag durch Rundungsfehler { if (test_loop_msp(y_mantMSDptr,len)) throw runtime_exception(); mspref(y_mantMSDptr,0) = bit(intDsize-1); // Mantisse := 10...0 (TheLfloat(y)->expo)++; // Exponenten incrementieren @@ -112,7 +112,7 @@ const cl_LF sqrt (const cl_LF& x) // w ist die Ganzzahl-Wurzel, eine n+1-Digit-Zahl. copy_loop_msp(w.MSDptr,y_mantMSDptr,len); // NUDS nach y kopieren // Runden: - if ( ((sintD)lspref(w.LSDptr,0) >= 0) // n�hstes Bit =0 -> abrunden + if ( ((sintD)lspref(w.LSDptr,0) >= 0) // n�hstes Bit =0 -> abrunden || ( ((lspref(w.LSDptr,0) & ((uintD)bit(intDsize-1)-1)) ==0) // =1 und weitere Bits >0 oder Rest >0 -> aufrunden && exactp // round-to-even @@ -123,7 +123,7 @@ const cl_LF sqrt (const cl_LF& x) else // aufrunden { if ( inc_loop_lsp(y_mantMSDptr mspop len,len) ) - // �ertrag durchs Aufrunden + // �ertrag durchs Aufrunden { mspref(y_mantMSDptr,0) = bit(intDsize-1); // Mantisse := 10...0 (TheLfloat(y)->expo)++; // Exponenten incrementieren } } diff --git a/src/float/lfloat/cl_LF.h b/src/float/lfloat/cl_LF.h index df93d75..a7e0d59 100644 --- a/src/float/lfloat/cl_LF.h +++ b/src/float/lfloat/cl_LF.h @@ -37,27 +37,27 @@ inline cl_heap_lfloat* TheLfloat (const cl_number& obj) // Liefert zu einem Long-Float x : (futruncate x), ein LF. -// x wird von der 0 weg zur nächsten ganzen Zahl gerundet. +// x wird von der 0 weg zur nächsten ganzen Zahl gerundet. extern const cl_LF futruncate (const cl_LF& x); -// shorten(x,len) verkürzt ein Long-Float x auf gegebene Länge len +// shorten(x,len) verkürzt ein Long-Float x auf gegebene Länge len // und rundet dabei. // > cl_LF x: ein Long-FLoat -// > uintC len: gewünschte Länge (>= LF_minlen, < TheLfloat(x)->len) -// < cl_LF ergebnis: verkürztes Long-Float +// > uintC len: gewünschte Länge (>= LF_minlen, < TheLfloat(x)->len) +// < cl_LF ergebnis: verkürztes Long-Float extern const cl_LF shorten (const cl_LF& x, uintC len); -// extend(x,len) verlängert ein Long-Float x auf gegebene Länge len. +// extend(x,len) verlängert ein Long-Float x auf gegebene Länge len. // > cl_LF x: ein Long-FLoat -// > uintC len: gewünschte Länge (> TheLfloat(x)->len) -// < cl_LF ergebnis: verlängertes Long-Float +// > uintC len: gewünschte Länge (> TheLfloat(x)->len) +// < cl_LF ergebnis: verlängertes Long-Float extern const cl_LF extend (const cl_LF& x, uintC len); -// LF_to_LF(x,len) wandelt ein Long-Float x in ein Long-Float gegebener Länge -// len um und rundet dabei nötigenfalls. +// LF_to_LF(x,len) wandelt ein Long-Float x in ein Long-Float gegebener Länge +// len um und rundet dabei nötigenfalls. // > cl_LF x: ein Long-FLoat -// > uintC len: gewünschte Länge (>= LF_minlen) -// < cl_LF ergebnis: Long-Float gegebener Länge +// > uintC len: gewünschte Länge (>= LF_minlen) +// < cl_LF ergebnis: Long-Float gegebener Länge extern const cl_LF LF_to_LF (const cl_LF& x, uintC len); // GEN_LF_OP2(arg1,arg2,LF_OP,ergebnis_zuweisung) @@ -69,11 +69,11 @@ extern const cl_LF LF_to_LF (const cl_LF& x, uintC len); { \ var uintC len1 = TheLfloat(arg1)->len; \ var uintC len2 = TheLfloat(arg2)->len; \ - if (len1==len2) /* gleich -> direkt ausführen */ \ + if (len1==len2) /* gleich -> direkt ausführen */ \ return LF_OP(arg1,arg2); \ - elif (len1>len2) /* -> arg2 auf die Länge von arg1 bringen */ \ + elif (len1>len2) /* -> arg2 auf die Länge von arg1 bringen */ \ return shorten(LF_OP(arg1,extend(arg2,len1)),len2); \ - else /* (len1 arg1 auf die Länge von arg2 bringen */ \ + else /* (len1 arg1 auf die Länge von arg2 bringen */ \ return shorten(LF_OP(extend(arg1,len2),arg2),len1); \ } @@ -128,11 +128,11 @@ extern const cl_LF cl_LF_RA_div (const cl_LF& x, const cl_RA& y); // cl_RA_LF_div(x,y) dividiert eine rationale Zahl x durch ein Long-Float y. extern const cl_R cl_RA_LF_div (const cl_RA& x, const cl_LF& y); -// Vergrößert eine Long-Float-Länge n, so daß aus d = intDsize*n +// Vergrößert eine Long-Float-Länge n, so daß aus d = intDsize*n // mindestens d+sqrt(d)+2 wird. extern uintC cl_LF_len_incsqrt (uintC len); -// Vergrößert eine Long-Float-Länge n, so daß aus d = intDsize*n +// Vergrößert eine Long-Float-Länge n, so daß aus d = intDsize*n // mindestens d+sqrt(d)+2+(LF_exp_len-1) wird. extern uintC cl_LF_len_incsqrtx (uintC len); diff --git a/src/float/lfloat/cl_LF_impl.h b/src/float/lfloat/cl_LF_impl.h index 617a5ba..078b2ff 100644 --- a/src/float/lfloat/cl_LF_impl.h +++ b/src/float/lfloat/cl_LF_impl.h @@ -58,7 +58,7 @@ inline cl_LF::cl_LF (cl_heap_lfloat* ptr) : cl_F ((cl_private_thing) ptr) {} // Entpacken eines Long-Float: // LF_decode(obj, zero_statement, sign=,exp=,mantMSDptr=,mantlen=,mantLSDptr=); // zerlegt ein Long-Float obj. -// Ist obj=0.0, wird zero_statement ausgeführt. +// Ist obj=0.0, wird zero_statement ausgeführt. // Sonst: cl_signean sign = Vorzeichen (0 = +, -1 = -), // sintE exp = Exponent (vorzeichenbehaftet), // UDS mantMSDptr/mantlen/mantLSDptr = Mantisse @@ -113,14 +113,14 @@ inline const cl_LF encode_LF1 (uintC len) // encode_LFu(sign,uexp,mantMSDptr,mantlen) liefert ein Long-Float // > cl_signean sign: Vorzeichen // > uintE exp: Exponent + LF_exp_mid -// > uintD* mantMSDptr: Pointer auf eine NUDS mit gesetztem höchstem Bit +// > uintD* mantMSDptr: Pointer auf eine NUDS mit gesetztem höchstem Bit // > uintC mantlen: Anzahl der Digits, >= LF_minlen // < cl_LF erg: neues Long-Float mit der UDS mantMSDptr/mantlen/.. als Mantisse -// Der Exponent wird nicht auf Überlauf/Unterlauf getestet. +// Der Exponent wird nicht auf Überlauf/Unterlauf getestet. inline const cl_LF encode_LFu (cl_signean sign, uintE uexp, const uintD* mantMSDptr, uintC mantlen) { var Lfloat erg = allocate_lfloat(mantlen,uexp,sign); /* Exponent */ - copy_loop_msp(mantMSDptr,arrayMSDptr(TheLfloat(erg)->data,mantlen),mantlen); /* Mantisse übertragen */ + copy_loop_msp(mantMSDptr,arrayMSDptr(TheLfloat(erg)->data,mantlen),mantlen); /* Mantisse übertragen */ return erg; } @@ -128,10 +128,10 @@ inline const cl_LF encode_LFu (cl_signean sign, uintE uexp, const uintD* mantMSD // encode_LF(sign,exp,mantMSDptr,mantlen) liefert ein Long-Float // > cl_signean sign: Vorzeichen // > sintE exp: Exponent -// > uintD* mantMSDptr: Pointer auf eine NUDS mit gesetztem höchstem Bit +// > uintD* mantMSDptr: Pointer auf eine NUDS mit gesetztem höchstem Bit // > uintC mantlen: Anzahl der Digits, >= LF_minlen // < cl_LF erg: neues Long-Float mit der UDS mantMSDptr/mantlen/.. als Mantisse -// Der Exponent wird nicht auf Überlauf/Unterlauf getestet. +// Der Exponent wird nicht auf Überlauf/Unterlauf getestet. inline const cl_LF encode_LF (cl_signean sign, sintE exp, const uintD* mantMSDptr, uintC mantlen) { return encode_LFu(sign,LF_exp_mid+(uintE)exp,mantMSDptr,mantlen); @@ -141,10 +141,10 @@ inline const cl_LF encode_LF (cl_signean sign, sintE exp, const uintD* mantMSDpt // encode_LF_array(sign,exp,mantarr,mantlen) liefert ein Long-Float // > cl_signean sign: Vorzeichen // > sintE exp: Exponent -// > uintD mantarr[]: NUDS mit gesetztem höchstem Bit +// > uintD mantarr[]: NUDS mit gesetztem höchstem Bit // > uintC mantlen: Anzahl der Digits, >= LF_minlen // < cl_LF erg: neues Long-Float mit der UDS mantarr[] als Mantisse -// Der Exponent wird nicht auf Überlauf/Unterlauf getestet. +// Der Exponent wird nicht auf Überlauf/Unterlauf getestet. #define encode_LF_array(sign,exp,mantarr,mantlen) \ encode_LF(sign,exp,arrayMSDptr(mantarr,mantlen),mantlen) diff --git a/src/float/lfloat/elem/cl_LF_1plus.cc b/src/float/lfloat/elem/cl_LF_1plus.cc index 596a4dd..da7e887 100644 --- a/src/float/lfloat/elem/cl_LF_1plus.cc +++ b/src/float/lfloat/elem/cl_LF_1plus.cc @@ -24,9 +24,9 @@ const cl_LF LF_LF_plus_LF (const cl_LF& arg1, const cl_LF& arg2) // Falls e2=0, also x2=0.0, Ergebnis x1. // Falls e1 - e2 >= 16n+2, Ergebnis x1. // Erweitere die Mantissen rechts um 3 Bits (Bit -1 als Schutzbit, Bits -2,-3 -// als Rundungsbits: 00 exakt, 01 1.Hälfte, 10 exakte Mitte, 11 2.Hälfte.) +// als Rundungsbits: 00 exakt, 01 1.Hälfte, 10 exakte Mitte, 11 2.Hälfte.) // Schiebe die Mantisse von x2 um e0-e1 Bits nach rechts. (Dabei die Rundung -// ausführen: Bit -3 ist das logische Oder der Bits -3,-4,-5,...) +// ausführen: Bit -3 ist das logische Oder der Bits -3,-4,-5,...) // Falls x1,x2 selbes Vorzeichen haben: Addiere dieses zur Mantisse von x1. // Falls x1,x2 verschiedenes Vorzeichen haben: Subtrahiere dieses von der // Mantisse von x1. <0 -> (Es war e1=e2) Vertausche die Vorzeichen, negiere. @@ -42,7 +42,7 @@ const cl_LF LF_LF_plus_LF (const cl_LF& arg1, const cl_LF& arg2) { x1 = arg2; x2 = arg1; swap(uintE, uexp1,uexp2); } // uexp1 >= uexp2 if (uexp2==0) { return x1; } // x2=0.0 -> x1 als Ergebnis - var uintC len = TheLfloat(x1)->len; // Länge n von x1 und x2 + var uintC len = TheLfloat(x1)->len; // Länge n von x1 und x2 var uintE expdiff = uexp1-uexp2; // e1-e2 if ((expdiff == 0) && (TheLfloat(x1)->sign != TheLfloat(x2)->sign)) // verschiedene Vorzeichen, aber gleicher Exponent @@ -63,7 +63,7 @@ const cl_LF LF_LF_plus_LF (const cl_LF& arg1, const cl_LF& arg2) var Lfloat y = allocate_lfloat(len,uexp1,TheLfloat(x1)->sign); var uintL i = floor(expdiff,intDsize); // e1-e2 div 16 (>=0, <=n) var uintL j = expdiff % intDsize; // e1-e2 mod 16 (>=0, <16) - // Mantisse von x2 muß um intDsize*i+j Bits nach rechts geschoben werden. + // Mantisse von x2 muß um intDsize*i+j Bits nach rechts geschoben werden. var uintC x2_len = len - i; // n-i Digits von x2 gebraucht // x2_len Digits um j Bits nach rechts schieben und dabei kopieren: CL_ALLOCA_STACK; @@ -76,8 +76,8 @@ const cl_LF LF_LF_plus_LF (const cl_LF& arg1, const cl_LF& arg2) else { rounding_bits = shiftrightcopy_loop_msp(arrayMSDptr(TheLfloat(x2)->data,len),x2_MSDptr,x2_len,j,0); } // x2_MSDptr/x2_len/x2_LSDptr sind die essentiellen Digits von x2. - // rounding_bits enthält die letzten j herausgeschobenen Bits. - // Aus rounding_bits und den nächsten i Digits die 3 Rundungsbits + // rounding_bits enthält die letzten j herausgeschobenen Bits. + // Aus rounding_bits und den nächsten i Digits die 3 Rundungsbits // (als Bits intDsize-1..intDsize-3 von rounding_bits) aufbauen: if (j>=2) // j>=2 -> Bits -1,-2 sind OK, Bit -3 bestimmen: @@ -87,14 +87,14 @@ const cl_LF LF_LF_plus_LF (const cl_LF& arg1, const cl_LF& arg2) } else { rounding_bits |= bit(intDsize-3); // Rundungsbit -3 setzen - rounding_bits &= bitm(intDsize)-bit(intDsize-3); // andere Bits löschen + rounding_bits &= bitm(intDsize)-bit(intDsize-3); // andere Bits löschen } } else // j<=3 -> Bits intDsize-4..0 von rounding_bits sind bereits Null. - // nächstes und weitere i-1 Digits heranziehen: + // nächstes und weitere i-1 Digits heranziehen: { if (i > 0) // i=0 -> Bits -1,-2,-3 sind OK. { var uintD* ptr = arrayMSDptr(TheLfloat(x2)->data,len) mspop x2_len; - rounding_bits |= (mspref(ptr,0) >> j); // weitere relevante Bits des nächsten Digit dazu + rounding_bits |= (mspref(ptr,0) >> j); // weitere relevante Bits des nächsten Digit dazu if ((rounding_bits & (bit(intDsize-3)-1)) ==0) // Alle Bits -3,-4,... =0 ? { if ( (!((mspref(ptr,0) & (bit(3)-1)) ==0)) // j (<=3) untere Bits von ptr[0] alle =0 ? || test_loop_msp(ptr mspop 1,i-1) @@ -103,7 +103,7 @@ const cl_LF LF_LF_plus_LF (const cl_LF& arg1, const cl_LF& arg2) } else { rounding_bits |= bit(intDsize-3); // Rundungsbit -3 setzen - rounding_bits &= bitm(intDsize)-bit(intDsize-3); // andere Bits löschen + rounding_bits &= bitm(intDsize)-bit(intDsize-3); // andere Bits löschen } } } // x2 liegt in verschobener Form in der UDS x2_MSDptr/x2_len/x2_LSDptr // vor, mit Rundungsbits in Bit intDsize-1..intDsize-3 von rounding_bits. @@ -119,10 +119,10 @@ const cl_LF LF_LF_plus_LF (const cl_LF& arg1, const cl_LF& arg2) // dann linken Mantissenteil (i Digits) direkt kopieren: var uintD* ptr = copy_loop_msp(arrayMSDptr(TheLfloat(x1)->data,len),y_mantMSDptr,i); - // dann Übertrag vom rechten zum linken Mantissenteil addieren: + // dann Übertrag vom rechten zum linken Mantissenteil addieren: if (!(carry==0)) { if ( inc_loop_lsp(ptr,i) ) - // Übertrag über das erste Digit hinaus + // Übertrag über das erste Digit hinaus { // Exponent von y incrementieren: if ( ++(TheLfloat(y)->expo) == LF_exp_high+1 ) { throw floating_point_overflow_exception(); } // normalisiere durch Schieben um 1 Bit nach rechts: @@ -144,10 +144,10 @@ const cl_LF LF_LF_plus_LF (const cl_LF& arg1, const cl_LF& arg2) // dann linken Mantissenteil (i Digits) direkt kopieren: var uintD* ptr = copy_loop_msp(arrayMSDptr(TheLfloat(x1)->data,len),y_mantMSDptr,i); - // dann Übertrag des rechten vom linken Mantissenteil subtrahieren: + // dann Übertrag des rechten vom linken Mantissenteil subtrahieren: if (!(carry==0)) { if ( dec_loop_lsp(ptr,i) ) - // Übertrag über das erste Digit hinaus, also e1=e2 + // Übertrag über das erste Digit hinaus, also e1=e2 { NOTREACHED } // diesen Fall haben wir schon behandelt } } @@ -165,7 +165,7 @@ const cl_LF LF_LF_plus_LF (const cl_LF& arg1, const cl_LF& arg2) nonzero_found: // Digit /=0 gefunden // UDS von ptr nach y_mantMSDptr um k Digits nach unten kopieren: if (k>0) - // mindestens ein führendes Nulldigit. Also war e1-e2 = 0 oder 1. + // mindestens ein führendes Nulldigit. Also war e1-e2 = 0 oder 1. { ptr = copy_loop_msp(ptr,y_mantMSDptr,len-k); // len-k Digits verschieben msprefnext(ptr) = rounding_bits; // Rundungsbits als weiteres Digit clear_loop_msp(ptr,k-1); // dann k-1 Nulldigits @@ -189,11 +189,11 @@ const cl_LF LF_LF_plus_LF (const cl_LF& arg1, const cl_LF& arg2) // NUDS y_mantMSDptr/len/y_mantLSDptr/rounding_bits normalisieren: {var uintL s; integerlengthD(mspref(y_mantMSDptr,0), s = intDsize - ); - // s = Anzahl der führenden Nullbits im ersten Word (>=0, =0, 0) - { // Muß die NUDS y_mantMSDptr/len/y_mantLSDptr/rounding_bits + { // Muß die NUDS y_mantMSDptr/len/y_mantLSDptr/rounding_bits // um s Bits nach links schieben. - // (Bei e1-e2>1 ist dabei zwangsläufig s=1.) + // (Bei e1-e2>1 ist dabei zwangsläufig s=1.) if (s==1) { shift1left_loop_lsp(y_mantLSDptr,len); if (rounding_bits & bit(intDsize-1)) @@ -219,19 +219,19 @@ const cl_LF LF_LF_plus_LF (const cl_LF& arg1, const cl_LF& arg2) TheLfloat(y)->expo = uexp - s; }} } } - // Hier enthält rounding_bits Bit -1 als Bit intDsize-1, Bit -2 als + // Hier enthält rounding_bits Bit -1 als Bit intDsize-1, Bit -2 als // Bit intDsize-2, Bit -3 als Oder(Bits intDsize-3..0) ! // Runden. Dazu rounding_bits inspizieren: - if ((rounding_bits & bit(intDsize-1)) ==0) goto ab; // Bit -1 gelöscht -> abrunden + if ((rounding_bits & bit(intDsize-1)) ==0) goto ab; // Bit -1 gelöscht -> abrunden rounding_bits = rounding_bits<<1; // Bits -2,-3 if (!(rounding_bits==0)) goto auf; // Bit -2 oder Bit -3 gesetzt -> aufrunden // round-to-even: if ((lspref(y_mantLSDptr,0) & bit(0)) ==0) goto ab; auf: // aufrunden if ( inc_loop_lsp(y_mantLSDptr,len) ) - { // Übertrag durchs Aufrunden + { // Übertrag durchs Aufrunden mspref(y_mantMSDptr,0) = bit(intDsize-1); // Mantisse := 10...0 - // Exponent erhöhen: + // Exponent erhöhen: if (++(TheLfloat(y)->expo) == LF_exp_high+1) { throw floating_point_overflow_exception(); } } ab: // abrunden diff --git a/src/float/lfloat/elem/cl_LF_I_div.cc b/src/float/lfloat/elem/cl_LF_I_div.cc index fbfa52c..e60b394 100644 --- a/src/float/lfloat/elem/cl_LF_I_div.cc +++ b/src/float/lfloat/elem/cl_LF_I_div.cc @@ -39,14 +39,14 @@ const cl_LF cl_LF_I_div (const cl_LF& x, const cl_I& y) if (ceiling(y_exp,intDsize) > len) return x / cl_I_to_LF(y,len); #endif - // x länger als y, direkt dividieren. + // x länger als y, direkt dividieren. CL_ALLOCA_STACK; 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=,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) + // Zähler bilden: x * 2^(intDsize*y_len) var uintD* z_MSDptr; var uintC z_len; var uintD* z_LSDptr; @@ -82,7 +82,7 @@ const cl_LF cl_LF_I_div (const cl_LF& x, const cl_I& y) } msshrink(MSDptr); } - // Quotient MSDptr/len/.. ist nun normalisiert: höchstes Bit =1. + // Quotient MSDptr/len/.. ist nun normalisiert: höchstes Bit =1. // exponent := exponent(x) - intDsize*y_len + shiftcount var uintE uexp = TheLfloat(x)->expo; var uintE dexp = intDsize*y_len - shiftcount; // >= 0 ! @@ -104,7 +104,7 @@ const cl_LF cl_LF_I_div (const cl_LF& x, const cl_I& y) else // aufrunden { if ( inc_loop_lsp(MSDptr mspop len,len) ) - // Übertrag durchs Aufrunden + // Übertrag durchs Aufrunden { mspref(MSDptr,0) = bit(intDsize-1); // Mantisse := 10...0 // Exponenten incrementieren: if (++uexp == LF_exp_high+1) { throw floating_point_overflow_exception(); } diff --git a/src/float/lfloat/elem/cl_LF_I_mul.cc b/src/float/lfloat/elem/cl_LF_I_mul.cc index f6992a0..b707d67 100644 --- a/src/float/lfloat/elem/cl_LF_I_mul.cc +++ b/src/float/lfloat/elem/cl_LF_I_mul.cc @@ -34,7 +34,7 @@ const cl_R cl_LF_I_mul (const cl_LF& x, const cl_I& y) if (ceiling(y_exp,intDsize) > len) return x * cl_I_to_LF(y,len); #endif - // x länger als y, direkt multiplizieren. + // x länger als y, direkt multiplizieren. CL_ALLOCA_STACK; var const uintD* y_MSDptr; var uintC y_len; @@ -48,7 +48,7 @@ const cl_R cl_LF_I_mul (const cl_LF& x, const cl_I& y) y_len,y_LSDptr, prodMSDptr=,prodlen=,); // x fing mit 0 Nullbits an, y mit maximal intDsize-1 Nullbits, - // daher fängt das Produkt mit maximal intDsize Nullbits an. + // daher fängt das Produkt mit maximal intDsize Nullbits an. var uintL shiftcount; if (mspref(prodMSDptr,0)==0) { shiftcount = intDsize; @@ -58,7 +58,7 @@ const cl_R cl_LF_I_mul (const cl_LF& x, const cl_I& y) if (shiftcount > 0) shiftleft_loop_lsp(prodMSDptr mspop (len+1),len+1,shiftcount,0); } - // Produkt ist nun normalisiert: höchstes Bit =1. + // Produkt ist nun normalisiert: höchstes Bit =1. // exponent := exponent(x) + intDsize*y_len - shiftcount var uintE uexp = TheLfloat(x)->expo; var uintE iexp = intDsize*y_len - shiftcount; // >= 0 ! @@ -69,7 +69,7 @@ const cl_R cl_LF_I_mul (const cl_LF& x, const cl_I& y) var uintD* midptr = prodMSDptr mspop len; var uintC restlen = prodlen - len; if ( (restlen==0) - || ((sintD)mspref(midptr,0) >= 0) // nächstes Bit =0 -> abrunden + || ((sintD)mspref(midptr,0) >= 0) // nächstes Bit =0 -> abrunden || ( ((mspref(midptr,0) & ((uintD)bit(intDsize-1)-1)) ==0) // Bit =1, weitere Bits >0 -> aufrunden && !test_loop_msp(midptr mspop 1,restlen-1) // round-to-even @@ -80,7 +80,7 @@ const cl_R cl_LF_I_mul (const cl_LF& x, const cl_I& y) else // aufrunden { if ( inc_loop_lsp(midptr,len) ) - // Übertrag durchs Aufrunden + // Übertrag durchs Aufrunden { mspref(prodMSDptr,0) = bit(intDsize-1); // Mantisse := 10...0 if (++uexp == LF_exp_high+1) { throw floating_point_overflow_exception(); } } } diff --git a/src/float/lfloat/elem/cl_LF_compare.cc b/src/float/lfloat/elem/cl_LF_compare.cc index 9d64f59..79e4ba5 100644 --- a/src/float/lfloat/elem/cl_LF_compare.cc +++ b/src/float/lfloat/elem/cl_LF_compare.cc @@ -44,17 +44,17 @@ cl_signean compare (const cl_LF& x, const cl_LF& y) var cl_signean erg = compare_loop_msp(arrayMSDptr(TheLfloat(x)->data,x_len),arrayMSDptr(TheLfloat(y)->data,y_len),len); if (!(erg==0)) { return erg; } // verschieden -> fertig - // gemeinsames Teilstück war gleich - if (x_len == y_len) { return signean_null; } // gleiche Länge -> fertig + // gemeinsames Teilstück war gleich + if (x_len == y_len) { return signean_null; } // gleiche Länge -> fertig if (x_len > y_len) - // x länger als y + // x länger als y { if (DS_test_loop(arrayMSDptr(TheLfloat(x)->data,x_len) mspop y_len,x_len-y_len,arrayLSDptr(TheLfloat(x)->data,x_len))) { return signean_plus; } // x>y else { return signean_null; } } else - // y länger als x + // y länger als x { if (DS_test_loop(arrayMSDptr(TheLfloat(y)->data,y_len) mspop x_len,y_len-x_len,arrayLSDptr(TheLfloat(y)->data,y_len))) { return signean_minus; } // xdata,y_len),arrayMSDptr(TheLfloat(x)->data,x_len),len); if (!(erg==0)) { return erg; } // verschieden -> fertig - // gemeinsames Teilstück war gleich - if (x_len == y_len) { return signean_null; } // gleiche Länge -> fertig + // gemeinsames Teilstück war gleich + if (x_len == y_len) { return signean_null; } // gleiche Länge -> fertig if (x_len > y_len) - // x länger als y + // x länger als y { if (DS_test_loop(arrayMSDptr(TheLfloat(x)->data,x_len) mspop y_len,x_len-y_len,arrayLSDptr(TheLfloat(x)->data,x_len))) { return signean_minus; } // |x|>|y| -> xdata,y_len) mspop x_len,y_len-x_len,arrayLSDptr(TheLfloat(y)->data,y_len))) { return signean_plus; } // |x|<|y| -> x>y else diff --git a/src/float/lfloat/elem/cl_LF_div.cc b/src/float/lfloat/elem/cl_LF_div.cc index 3b9f1fa..291b3a1 100644 --- a/src/float/lfloat/elem/cl_LF_div.cc +++ b/src/float/lfloat/elem/cl_LF_div.cc @@ -30,17 +30,17 @@ const cl_LF operator/ (const cl_LF& x1, const cl_LF& x2) // nach Rundung mant1/mant2 >=1/2, <=2*mant1<2. // Bei mant1/mant2 >=1 brauche 16n-1 Nachkommabits, // bei mant1/mant2 <1 brauche 16n Nachkommabits. -// Fürs Runden: brauche ein Rundungsbit (Rest gibt an, ob exakt). +// Fürs Runden: brauche ein Rundungsbit (Rest gibt an, ob exakt). // Brauche daher insgesamt 16n+1 Nachkommabits von mant1/mant2. // Dividiere daher (als Unsigned Integers) // 2^16(n+1)*(2^16n*m0) durch (2^16n*m1). // Falls der Quotient >=2^16(n+1) ist, schiebe ihn um 1 Bit nach rechts, -// erhöhe den Exponenten um 1 und runde das letzte Digit weg. +// erhöhe den Exponenten um 1 und runde das letzte Digit weg. // Falls der Quotient <2^16(n+1) ist, runde das letzte Digit weg. Bei rounding -// overflow schiebe um 1 Bit nach rechts und erhöhe den Exponenten um 1. +// overflow schiebe um 1 Bit nach rechts und erhöhe den Exponenten um 1. var uintC len1 = TheLfloat(x1)->len; var uintC len2 = TheLfloat(x2)->len; - var uintC len = (len1 < len2 ? len1 : len2); // min. Länge n von x1 und x2 + var uintC len = (len1 < len2 ? len1 : len2); // min. Länge n von x1 und x2 var uintE uexp2 = TheLfloat(x2)->expo; if (uexp2==0) { throw division_by_0_exception(); } // x2=0.0 -> Error var uintE uexp1 = TheLfloat(x1)->expo; @@ -74,7 +74,7 @@ const cl_LF operator/ (const cl_LF& x1, const cl_LF& x2) #ifndef CL_LF_PEDANTIC if (n_len > len) { n_len = len+1; } #endif - // Zähler bilden: + // Zähler bilden: CL_ALLOCA_STACK; var uintD* z_MSDptr; var uintC z_len; @@ -124,7 +124,7 @@ const cl_LF operator/ (const cl_LF& x1, const cl_LF& x2) { var uintD* y_mantMSDptr = arrayMSDptr(TheLfloat(y)->data,len); copy_loop_msp(q.MSDptr,y_mantMSDptr,len); // Runden: - if ( ((sintD)lspref(q.LSDptr,0) >= 0) // nächstes Bit =0 -> abrunden + if ( ((sintD)lspref(q.LSDptr,0) >= 0) // nächstes Bit =0 -> abrunden || ( ((lspref(q.LSDptr,0) & ((uintD)bit(intDsize-1)-1)) ==0) // =1 und weitere Bits >0 oder Rest >0 -> aufrunden && (r.len==0) // round-to-even @@ -135,7 +135,7 @@ const cl_LF operator/ (const cl_LF& x1, const cl_LF& x2) else // aufrunden { if ( inc_loop_lsp(y_mantMSDptr mspop len,len) ) - // Übertrag durchs Aufrunden + // Übertrag durchs Aufrunden { mspref(y_mantMSDptr,0) = bit(intDsize-1); // Mantisse := 10...0 // Exponenten incrementieren: if (++(TheLfloat(y)->expo) == LF_exp_high+1) { throw floating_point_overflow_exception(); } diff --git a/src/float/lfloat/elem/cl_LF_from_I.cc b/src/float/lfloat/elem/cl_LF_from_I.cc index 4d919c4..bbb4cec 100644 --- a/src/float/lfloat/elem/cl_LF_from_I.cc +++ b/src/float/lfloat/elem/cl_LF_from_I.cc @@ -24,13 +24,13 @@ const cl_LF cl_I_to_LF (const cl_I& x, uintC len) // Merke Vorzeichen von x. // x:=(abs x) // Exponent:=(integer-length x) -// Mantisse enthalte die höchstwertigen 16n Bits des Integers x (wobei die -// führenden 16-(e mod 16) Nullbits zu streichen sind). +// Mantisse enthalte die höchstwertigen 16n Bits des Integers x (wobei die +// führenden 16-(e mod 16) Nullbits zu streichen sind). // Runde die weiteren Bits weg: // Kommen keine mehr -> abrunden, -// nächstes Bit = 0 -> abrunden, -// nächstes Bit = 1 und Rest =0 -> round-to-even, -// nächstes Bit = 1 und Rest >0 -> aufrunden. +// nächstes Bit = 0 -> abrunden, +// nächstes Bit = 1 und Rest =0 -> round-to-even, +// nächstes Bit = 1 und Rest >0 -> aufrunden. // Bei Aufrundung: rounding overflow -> Mantisse um 1 Bit nach rechts schieben // und Exponent incrementieren. if (eq(x,0)) { return encode_LF0(len); } // x=0 -> Ergebnis 0.0 @@ -51,16 +51,16 @@ const cl_LF cl_I_to_LF (const cl_I& x, uintC len) var uintC x_len; 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): + // y einfüllen (genauer: nur maximal len Digits davon): {var uintL shiftcount = exp % intDsize; - // Die NDS fängt mit intDsize-shiftcount Nullbits an, dann kommt eine 1. + // Die NDS fängt mit intDsize-shiftcount Nullbits an, dann kommt eine 1. if (x_len > len) { x_len -= 1+len; if (shiftcount>0) { var uintD carry_rechts = shiftrightcopy_loop_msp(x_MSDptr mspop 1,y_mantMSDptr,len,shiftcount,mspref(x_MSDptr,0)); - // Mantisse ist gefüllt. Runden: - if ( ((sintD)carry_rechts >= 0) // nächstes Bit =0 -> abrunden + // Mantisse ist gefüllt. Runden: + if ( ((sintD)carry_rechts >= 0) // nächstes Bit =0 -> abrunden || ( ((carry_rechts & ((uintD)bit(intDsize-1)-1)) ==0) // =1, Rest >0 -> aufrunden && !test_loop_msp(x_MSDptr mspop 1 mspop len,x_len) // round-to-even @@ -72,10 +72,10 @@ const cl_LF cl_I_to_LF (const cl_I& x, uintC len) } else { copy_loop_msp(x_MSDptr mspop 1,y_mantMSDptr,len); - // Mantisse ist gefüllt. Runden: + // Mantisse ist gefüllt. Runden: var const uintD* ptr = x_MSDptr mspop 1 mspop len; if ( (x_len==0) // keine Bits mehr -> abrunden - || ((sintD)mspref(ptr,0) >= 0) // nächstes Bit =0 -> abrunden + || ((sintD)mspref(ptr,0) >= 0) // nächstes Bit =0 -> abrunden || ( ((mspref(ptr,0) & ((uintD)bit(intDsize-1)-1)) ==0) // =1, Rest >0 -> aufrunden && !test_loop_msp(ptr mspop 1,x_len-1) // round-to-even @@ -87,7 +87,7 @@ const cl_LF cl_I_to_LF (const cl_I& x, uintC len) } auf: // aufrunden if ( inc_loop_lsp(y_mantMSDptr mspop len,len) ) - // Übertrag durchs Aufrunden + // Übertrag durchs Aufrunden { mspref(y_mantMSDptr,0) = bit(intDsize-1); // Mantisse := 10...0 // Exponenten incrementieren: if ( (log2_intDsize+intCsize < 32) @@ -110,7 +110,7 @@ const cl_LF cl_I_to_LF (const cl_I& x, uintC len) else { copy_loop_msp(x_MSDptr mspop 1,y_mantMSDptr,x_len); carry_rechts = 0; } {var uintD* y_ptr = y_mantMSDptr mspop x_len; - msprefnext(y_ptr) = carry_rechts; // Carry als nächstes Digit + msprefnext(y_ptr) = carry_rechts; // Carry als nächstes Digit clear_loop_msp(y_ptr,len); // dann len-x_len Nulldigits }} } diff --git a/src/float/lfloat/elem/cl_LF_from_RA.cc b/src/float/lfloat/elem/cl_LF_from_RA.cc index e180872..b66647b 100644 --- a/src/float/lfloat/elem/cl_LF_from_RA.cc +++ b/src/float/lfloat/elem/cl_LF_from_RA.cc @@ -22,7 +22,7 @@ const cl_LF cl_RA_to_LF (const cl_RA& x, uintC len) // Methode: // x ganz -> klar. // x = +/- a/b mit Integers a,b>0: -// Sei k,m so gewählt, daß +// Sei k,m so gewählt, daß // 2^(k-1) <= a < 2^k, 2^(m-1) <= b < 2^m. // Dann ist 2^(k-m-1) < a/b < 2^(k-m+1). // Ergebnis-Vorzeichen := Vorzeichen von x. @@ -33,18 +33,18 @@ const cl_LF cl_RA_to_LF (const cl_RA& x, uintC len) // Bei k-m>=16n+1 dividiere a durch (ash b (k-m-16n-1)), // bei k-m<16n+1 dividiere (ash a (-k+m+16n+1)) durch b. // Der erste Wert ist >=2^16n, <2^(16n+2). -// Falls er >=2^(16n+1) ist, erhöhe Exponent um 1, +// Falls er >=2^(16n+1) ist, erhöhe Exponent um 1, // runde 2 Bits weg und schiebe dabei um 2 Bits nach rechts; // falls er <2^(16n+1) ist, // runde 1 Bit weg und schiebe dabei um 1 Bit nach rechts. -// NB: Wenn a und b länger sind als len, ist dieser Algorithmus weniger +// NB: Wenn a und b länger sind als len, ist dieser Algorithmus weniger // effizient, als cl_float(a,len)/cl_float(b,len) zu berechnen. Aber // es ist wichtig, dass cl_RA_to_LF nicht mehr als 0.5 ulp Fehler hat, // deswegen belassen wir es beim ineffizienten aber exakten Algorithmus. // Wenn es auf Rundungsfehler nicht ankommt, muss der Aufrufer im Fall // ceiling(integer_length(a),intDsize) >= len // && ceiling(integer_length(b),intDsize) >= len -// einen anderen Algorithmus wählen. +// einen anderen Algorithmus wählen. if (integerp(x)) { DeclareType(cl_I,x); return cl_I_to_LF(x,len); @@ -57,8 +57,8 @@ const cl_LF cl_RA_to_LF (const cl_RA& x, uintC len) if (!(sign==0)) { a = -a; } // Betrag nehmen, liefert a var sintC lendiff = (sintC)integer_length(a) // (integer-length a) - (sintC)integer_length(b); // (integer-length b) - // |lendiff| < intDsize*2^intCsize. Da für LF-Exponenten ein sintL zur - // Verfügung steht, braucht man keinen Test auf Overflow oder Underflow. + // |lendiff| < intDsize*2^intCsize. Da für LF-Exponenten ein sintL zur + // Verfügung steht, braucht man keinen Test auf Overflow oder Underflow. var uintC difflimit = intDsize*len + 1; // 16n+1 var cl_I zaehler; var cl_I nenner; @@ -72,7 +72,7 @@ const cl_LF cl_RA_to_LF (const cl_RA& x, uintC len) { zaehler = ash(a,(uintC)(difflimit - lendiff)); // (ash a -k+m+16n+1) nenner = b; // b } - // Division zaehler/nenner durchführen: + // Division zaehler/nenner durchführen: var cl_I_div_t q_r = cl_divide(zaehler,nenner); var cl_I& q = q_r.quotient; var cl_I& r = q_r.remainder; @@ -82,7 +82,7 @@ const cl_LF cl_RA_to_LF (const cl_RA& x, uintC len) {var uintD* q_MSDptr = arrayMSDptr(TheBignum(q)->data,len+1); if (mspref(q_MSDptr,0) == 1) // erstes Digit =1 oder =2,3 ? // 2^16n <= q < 2^(16n+1), also 2^(k-m-1) < a/b < 2^(k-m). - { // Mantisse mit einer Schiebeschleife um 1 Bit nach rechts füllen: + { // Mantisse mit einer Schiebeschleife um 1 Bit nach rechts füllen: var uintD rounding_bit = shiftrightcopy_loop_msp(q_MSDptr mspop 1,y_mantMSDptr,len,1,1); if ( (rounding_bit == 0) // herausgeschobenes Bit =0 -> abrunden @@ -96,12 +96,12 @@ const cl_LF cl_RA_to_LF (const cl_RA& x, uintC len) } else // 2^(16n+1) <= q < 2^(16n+2), also 2^(k-m) < a/b < 2^(k-m+1). - { // Mantisse mit einer Schiebeschleife um 2 Bit nach rechts füllen: + { // Mantisse mit einer Schiebeschleife um 2 Bit nach rechts füllen: var uintD rounding_bits = shiftrightcopy_loop_msp(q_MSDptr mspop 1,y_mantMSDptr,len,2,mspref(q_MSDptr,0)); (TheLfloat(y)->expo)++; // Exponenten incrementieren auf k-m+1 if ( ((sintD)rounding_bits >= 0) // herausgeschobenes Bit =0 -> abrunden - || ( ((rounding_bits & bit(intDsize-2)) ==0) // =1 und nächstes Bit =1 oder Rest r > 0 -> aufrunden + || ( ((rounding_bits & bit(intDsize-2)) ==0) // =1 und nächstes Bit =1 oder Rest r > 0 -> aufrunden && eq(r,0) // round-to-even && ((mspref(y_mantMSDptr,len-1) & bit(0)) ==0) @@ -113,7 +113,7 @@ const cl_LF cl_RA_to_LF (const cl_RA& x, uintC len) } auf: // aufrunden { if ( inc_loop_lsp(y_mantMSDptr mspop len,len) ) - // Übertrag durchs Aufrunden + // Übertrag durchs Aufrunden { mspref(y_mantMSDptr,0) = bit(intDsize-1); // Mantisse := 10...0 (TheLfloat(y)->expo)++; // Exponenten incrementieren } } diff --git a/src/float/lfloat/elem/cl_LF_fround.cc b/src/float/lfloat/elem/cl_LF_fround.cc index 979a2e7..f2b40b2 100644 --- a/src/float/lfloat/elem/cl_LF_fround.cc +++ b/src/float/lfloat/elem/cl_LF_fround.cc @@ -56,7 +56,7 @@ const cl_LF fround (const cl_LF& x) {var uintD* ptr = copy_loop_msp(mantMSDptr,MSDptr,count); // count ganze Digits kopieren msprefnext(ptr) = mspref(mantptr,0) & mask; // dann bitcount Bits kopieren - clear_loop_msp(ptr,mantlen-count-1); // Rest mit Nullen füllen + clear_loop_msp(ptr,mantlen-count-1); // Rest mit Nullen füllen return encode_LF(sign,exp,MSDptr,mantlen); }} auf: // aufrunden @@ -67,9 +67,9 @@ const cl_LF fround (const cl_LF& x) copy_loop_msp(mantMSDptr,MSDptr,count); // count ganze Digits kopieren if ((mspref(ptr,0) = ((mspref(mantptr,0) & mask) - mask)) == 0) // dann bitcount Bits kopieren und incrementieren { if (!( inc_loop_lsp(ptr,count) ==0)) // evtl. weiterincrementieren - { mspref(MSDptr,0) = bit(intDsize-1); exp = exp+1; } // evtl. Exponenten erhöhen + { mspref(MSDptr,0) = bit(intDsize-1); exp = exp+1; } // evtl. Exponenten erhöhen } - clear_loop_msp(ptr mspop 1,mantlen-count-1); // Rest mit Nullen füllen + clear_loop_msp(ptr mspop 1,mantlen-count-1); // Rest mit Nullen füllen return encode_LF(sign,exp,MSDptr,mantlen); }} } @@ -113,7 +113,7 @@ const cl_LF fround (const cl_LF& x) var uintD* ptr = copy_loop_msp(x_mantMSDptr,arrayMSDptr(TheLfloat(y)->data,len),count); // count ganze Digits kopieren msprefnext(ptr) = mspref(x_mantMSDptr,count) & mask; // dann bitcount Bits kopieren - clear_loop_msp(ptr,len-count-1); // Rest mit Nullen füllen + clear_loop_msp(ptr,len-count-1); // Rest mit Nullen füllen } return y; } @@ -126,9 +126,9 @@ const cl_LF fround (const cl_LF& x) copy_loop_msp(x_mantMSDptr,y_mantMSDptr,count); // count ganze Digits kopieren if ((mspref(ptr,0) = ((mspref(x_mantMSDptr,count) & mask) - mask)) == 0) // dann bitcount Bits kopieren und incrementieren { if (!( inc_loop_lsp(ptr,count) ==0)) // evtl. weiterincrementieren - { mspref(y_mantMSDptr,0) = bit(intDsize-1); (TheLfloat(y)->expo)++; } // evtl. Exponenten erhöhen + { mspref(y_mantMSDptr,0) = bit(intDsize-1); (TheLfloat(y)->expo)++; } // evtl. Exponenten erhöhen } - clear_loop_msp(ptr mspop 1,len-count-1); // Rest mit Nullen füllen + clear_loop_msp(ptr mspop 1,len-count-1); // Rest mit Nullen füllen } return y; } diff --git a/src/float/lfloat/elem/cl_LF_ftrunc.cc b/src/float/lfloat/elem/cl_LF_ftrunc.cc index f0f204e..73eba4a 100644 --- a/src/float/lfloat/elem/cl_LF_ftrunc.cc +++ b/src/float/lfloat/elem/cl_LF_ftrunc.cc @@ -42,7 +42,7 @@ const cl_LF ftruncate (const cl_LF& x) var uintD* ptr = copy_loop_msp(mantMSDptr,MSDptr,count); // count ganze Digits kopieren msprefnext(ptr) = mspref(mantMSDptr,count) & minus_bitm(intDsize-bitcount); // dann bitcount Bits kopieren - clear_loop_msp(ptr,mantlen-count-1); // Rest mit Nullen füllen + clear_loop_msp(ptr,mantlen-count-1); // Rest mit Nullen füllen } return encode_LF(sign,exp,MSDptr,mantlen); } @@ -65,7 +65,7 @@ const cl_LF ftruncate (const cl_LF& x) var uintD* ptr = copy_loop_msp(x_mantMSDptr,arrayMSDptr(TheLfloat(y)->data,len),count); // count ganze Digits kopieren msprefnext(ptr) = mspref(x_mantMSDptr,count) & minus_bitm(intDsize-bitcount); // dann bitcount Bits kopieren - clear_loop_msp(ptr,len-count-1); // Rest mit Nullen füllen + clear_loop_msp(ptr,len-count-1); // Rest mit Nullen füllen } return y; #endif diff --git a/src/float/lfloat/elem/cl_LF_futrunc.cc b/src/float/lfloat/elem/cl_LF_futrunc.cc index 0afe85c..3a7d4cd 100644 --- a/src/float/lfloat/elem/cl_LF_futrunc.cc +++ b/src/float/lfloat/elem/cl_LF_futrunc.cc @@ -21,11 +21,11 @@ const cl_LF futruncate (const cl_LF& x) // e<=0 -> Ergebnis 1.0 oder -1.0, je nach Vorzeichen von x. // 1<=e<16n -> Greife die letzten (16n-e) Bits von x heraus. // Sind sie alle =0 -> Ergebnis x. -// Sonst setze sie alle auf 0 und erhöhe dann die vorderen e Bits +// Sonst setze sie alle auf 0 und erhöhe dann die vorderen e Bits // um 1. -// Kein Überlauf -> fertig. +// Kein Überlauf -> fertig. // Sonst (Ergebnis eine Zweierpotenz): Mantisse := .1000...000, -// e:=e+1. (Test auf Überlauf wegen e<=16n überflüssig) +// e:=e+1. (Test auf Überlauf wegen e<=16n überflüssig) // e>=16n -> Ergebnis x. #if 0 var cl_signean sign; @@ -56,9 +56,9 @@ const cl_LF futruncate (const cl_LF& x) copy_loop_msp(mantMSDptr,MSDptr,count); // count ganze Digits kopieren if ((mspref(ptr,0) = ((mspref(mantptr,0) & mask) - mask)) == 0) // dann bitcount Bits kopieren und incrementieren { if (!( inc_loop_lsp(ptr,count) ==0)) // evtl. weiterincrementieren - { mspref(MSDptr,0) = bit(intDsize-1); exp = exp+1; } // evtl. Exponenten erhöhen + { mspref(MSDptr,0) = bit(intDsize-1); exp = exp+1; } // evtl. Exponenten erhöhen } - clear_loop_msp(ptr mspop 1,mantlen-count-1); // Rest mit Nullen füllen + clear_loop_msp(ptr mspop 1,mantlen-count-1); // Rest mit Nullen füllen } return encode_LF(sign,exp,MSDptr,mantlen); } @@ -92,9 +92,9 @@ const cl_LF futruncate (const cl_LF& x) copy_loop_msp(x_mantMSDptr,y_mantMSDptr,count); // count ganze Digits kopieren if ((mspref(ptr,0) = ((mspref(x_mantMSDptr,count) & mask) - mask)) == 0) // dann bitcount Bits kopieren und incrementieren { if (!( inc_loop_lsp(ptr,count) ==0)) // evtl. weiterincrementieren - { mspref(y_mantMSDptr,0) = bit(intDsize-1); (TheLfloat(y)->expo)++; } // evtl. Exponenten erhöhen + { mspref(y_mantMSDptr,0) = bit(intDsize-1); (TheLfloat(y)->expo)++; } // evtl. Exponenten erhöhen } - clear_loop_msp(ptr mspop 1,len-count-1); // Rest mit Nullen füllen + clear_loop_msp(ptr mspop 1,len-count-1); // Rest mit Nullen füllen } return y; #endif diff --git a/src/float/lfloat/elem/cl_LF_scale.cc b/src/float/lfloat/elem/cl_LF_scale.cc index 9aa98b1..4785273 100644 --- a/src/float/lfloat/elem/cl_LF_scale.cc +++ b/src/float/lfloat/elem/cl_LF_scale.cc @@ -20,16 +20,16 @@ const cl_LF scale_float (const cl_LF& x, sintC delta) // Methode: // delta=0 -> x als Ergebnis // x=0.0 -> x als Ergebnis - // delta muß ein Integer betragsmäßig <= LF_exp_high-LF_exp_low sein. - // Neues LF mit um delta vergrößertem Exponenten bilden. + // delta muß ein Integer betragsmäßig <= LF_exp_high-LF_exp_low sein. + // Neues LF mit um delta vergrößertem Exponenten bilden. if (delta == 0) { return x; } // delta=0 -> x als Ergebnis var uintE uexp = TheLfloat(x)->expo; if (uexp==0) { return x; } var uintE udelta = delta; if (delta >= 0) { // udelta = delta >=0 - if ( ((uexp = uexp+udelta) < udelta) // Exponent-Überlauf? - || (uexp > LF_exp_high) // oder Exponent zu groß? + if ( ((uexp = uexp+udelta) < udelta) // Exponent-Überlauf? + || (uexp > LF_exp_high) // oder Exponent zu groß? ) { throw floating_point_overflow_exception(); } } else { diff --git a/src/float/lfloat/elem/cl_LF_scale_I.cc b/src/float/lfloat/elem/cl_LF_scale_I.cc index ef119bd..12c68d9 100644 --- a/src/float/lfloat/elem/cl_LF_scale_I.cc +++ b/src/float/lfloat/elem/cl_LF_scale_I.cc @@ -21,13 +21,13 @@ const cl_LF scale_float (const cl_LF& x, const cl_I& delta) // Methode: // delta=0 -> x als Ergebnis // x=0.0 -> x als Ergebnis - // delta muß ein Integer betragsmäßig <= LF_exp_high-LF_exp_low sein. - // Neues LF mit um delta vergrößertem Exponenten bilden. + // delta muß ein Integer betragsmäßig <= LF_exp_high-LF_exp_low sein. + // Neues LF mit um delta vergrößertem Exponenten bilden. if (eq(delta,0)) { return x; } // delta=0 -> x als Ergebnis var uintE uexp = TheLfloat(x)->expo; if (uexp==0) { return x; } var uintE udelta; - // |delta| muß <= LF_exp_high-LF_exp_low < 2^32 sein. Wie bei I_to_UL: + // |delta| muß <= LF_exp_high-LF_exp_low < 2^32 sein. Wie bei I_to_UL: if (fixnump(delta)) { // Fixnum var sintV sdelta = FN_to_V(delta); @@ -40,7 +40,7 @@ const cl_LF scale_float (const cl_LF& x, const cl_I& delta) var cl_heap_bignum* bn = TheBignum(delta); if ((sintD)mspref(arrayMSDptr(bn->data,bn->length),0) >= 0) { #define IF_LENGTH(i) \ - if (bn_minlength <= i) /* genau i Digits überhaupt möglich? */\ + if (bn_minlength <= i) /* genau i Digits überhaupt möglich? */\ if (bn->length == i) /* genau i Digits? */ \ /* 2^((i-1)*intDsize-1) <= delta < 2^(i*intDsize-1) */ \ if ( (i*intDsize-1 > 32) \ @@ -60,10 +60,10 @@ const cl_LF scale_float (const cl_LF& x, const cl_I& delta) IF_LENGTH(5) { udelta = get_uint4D_Dptr(arrayLSDptr(bn->data,5)); goto pos; } #undef IF_LENGTH - goto overflow; // delta zu groß + goto overflow; // delta zu groß } else { #define IF_LENGTH(i) \ - if (bn_minlength <= i) /* genau i Digits überhaupt möglich? */\ + if (bn_minlength <= i) /* genau i Digits überhaupt möglich? */\ if (bn->length == i) /* genau i Digits? */ \ /* - 2^((i-1)*intDsize-1) > delta >= - 2^(i*intDsize-1) */\ if ( (i*intDsize-1 > 32) \ @@ -88,8 +88,8 @@ const cl_LF scale_float (const cl_LF& x, const cl_I& delta) } pos: // udelta = delta >=0 - if ( ((uexp = uexp+udelta) < udelta) // Exponent-Überlauf? - || (uexp > LF_exp_high) // oder Exponent zu groß? + if ( ((uexp = uexp+udelta) < udelta) // Exponent-Überlauf? + || (uexp > LF_exp_high) // oder Exponent zu groß? ) overflow: { throw floating_point_overflow_exception(); } diff --git a/src/float/lfloat/elem/cl_LF_square.cc b/src/float/lfloat/elem/cl_LF_square.cc index 956dcc9..c22a1f3 100644 --- a/src/float/lfloat/elem/cl_LF_square.cc +++ b/src/float/lfloat/elem/cl_LF_square.cc @@ -51,7 +51,7 @@ const cl_LF square (const cl_LF& x) num_stack_alloc(2*len,MSDptr=,LSDptr=); cl_UDS_mul_square(x_LSDptr,len,LSDptr); {var uintD* midptr = MSDptr mspop len; // Pointer in die Mitte der 2*len Digits - if ((sintD)mspref(MSDptr,0) >= 0) // führendes Bit abtesten + if ((sintD)mspref(MSDptr,0) >= 0) // führendes Bit abtesten { // erste n+1 Digits um 1 Bit nach links schieben: shift1left_loop_lsp(midptr mspop 1,len+1); // Exponenten decrementieren: @@ -62,11 +62,11 @@ const cl_LF square (const cl_LF& x) { return encode_LF0(len); } // Ergebnis 0.0 } } - // erste Hälfte des Mantissenprodukts übertragen: + // erste Hälfte des Mantissenprodukts übertragen: {var uintD* y_mantMSDptr = arrayMSDptr(TheLfloat(y)->data,len); var uintD* y_mantLSDptr = copy_loop_msp(MSDptr,y_mantMSDptr,len); // Runden: - if ( ((sintD)mspref(midptr,0) >= 0) // nächstes Bit =0 -> abrunden + if ( ((sintD)mspref(midptr,0) >= 0) // nächstes Bit =0 -> abrunden || ( ((mspref(midptr,0) & ((uintD)bit(intDsize-1)-1)) ==0) // Bit =1, weitere Bits >0 -> aufrunden && !test_loop_msp(midptr mspop 1,len-1) // round-to-even @@ -77,10 +77,10 @@ const cl_LF square (const cl_LF& x) else // aufrunden { if ( inc_loop_lsp(y_mantLSDptr,len) ) - { // Übertrag durchs Aufrunden (kann nur auftreten, + { // Übertrag durchs Aufrunden (kann nur auftreten, // wenn vorhin um 1 Bit nach links geschoben wurde) mspref(y_mantMSDptr,0) = bit(intDsize-1); // Mantisse := 10...0 - (TheLfloat(y)->expo)++; // Exponent wieder zurück-erhöhen + (TheLfloat(y)->expo)++; // Exponent wieder zurück-erhöhen } } // LF_exp_low <= exp <= LF_exp_high sicherstellen: if (TheLfloat(y)->expo == LF_exp_high+1) { throw floating_point_overflow_exception(); } diff --git a/src/float/lfloat/elem/cl_LF_to_I.cc b/src/float/lfloat/elem/cl_LF_to_I.cc index fb5655c..35eccc1 100644 --- a/src/float/lfloat/elem/cl_LF_to_I.cc +++ b/src/float/lfloat/elem/cl_LF_to_I.cc @@ -34,13 +34,13 @@ const cl_I cl_LF_to_I (const cl_LF& x) var uintC len1 = len+1; // brauche 1 Digit mehr num_stack_alloc(len1, MSDptr=,LSDptr=); copy_loop_msp(arrayMSDptr(TheLfloat(x)->data,len),MSDptr mspop 1,len); // Mantisse kopieren - mspref(MSDptr,0) = 0; // und zusätzliches Nulldigit + mspref(MSDptr,0) = 0; // und zusätzliches Nulldigit // Mantisse ist die UDS MSDptr/len1/LSDptr. if (minusp(x)) // x<0 -> Mantisse negieren: { neg_loop_lsp(LSDptr,len1); } // Vorzeichen*Mantisse ist die DS MSDptr/len1/LSDptr. - // (ASH Vorzeichen*Mantisse (- e 16n)) durchführen: + // (ASH Vorzeichen*Mantisse (- e 16n)) durchführen: return ash(DS_to_I(MSDptr,len1), minus(uexp, LF_exp_mid + intDsize*len) ); diff --git a/src/float/lfloat/misc/cl_LF_extend.cc b/src/float/lfloat/misc/cl_LF_extend.cc index 4ca4ce2..ba43053 100644 --- a/src/float/lfloat/misc/cl_LF_extend.cc +++ b/src/float/lfloat/misc/cl_LF_extend.cc @@ -17,10 +17,10 @@ namespace cln { const cl_LF extend (const cl_LF& x, uintC len) { var Lfloat y = allocate_lfloat(len,TheLfloat(x)->expo,TheLfloat(x)->sign); // neues LF - { var uintC oldlen = TheLfloat(x)->len; // alte Länge, < len + { var uintC oldlen = TheLfloat(x)->len; // alte Länge, < len // Mantisse von x nach y kopieren: var uintD* ptr = copy_loop_msp(arrayMSDptr(TheLfloat(x)->data,oldlen),arrayMSDptr(TheLfloat(y)->data,len),oldlen); - // und mit Null-Digits ergänzen: + // und mit Null-Digits ergänzen: clear_loop_msp(ptr,len-oldlen); } return y; diff --git a/src/float/lfloat/misc/cl_LF_idecode.cc b/src/float/lfloat/misc/cl_LF_idecode.cc index 033e4bd..8d547d3 100644 --- a/src/float/lfloat/misc/cl_LF_idecode.cc +++ b/src/float/lfloat/misc/cl_LF_idecode.cc @@ -25,7 +25,7 @@ const cl_idecoded_float integer_decode_float (const cl_LF& x) var cl_signean sign = TheLfloat(x)->sign; var uintC len = TheLfloat(x)->len; // intDsize*len >= 53 >= 33 >= cl_value_len, also len >= bn_minlength. - // Baue Integer für die Mantisse. + // Baue Integer für die Mantisse. // Vorne 1 Nulldigit, damit es eine NDS wird. var Bignum mant = allocate_bignum(1+len); mspref(arrayMSDptr(TheBignum(mant)->data,1+len),0) = 0; diff --git a/src/float/lfloat/misc/cl_LF_leninc.cc b/src/float/lfloat/misc/cl_LF_leninc.cc index 4266867..b1de23b 100644 --- a/src/float/lfloat/misc/cl_LF_leninc.cc +++ b/src/float/lfloat/misc/cl_LF_leninc.cc @@ -14,13 +14,13 @@ namespace cln { uintC cl_LF_len_incsqrt (uintC n) { // Methode bei intDsize=16: -// n -> n+1 für n<=12 wegen 16n+sqrt(16n)+2 < 16(n+1) -// n -> n+2 für n<=56 wegen 16n+sqrt(16n)+2 < 16(n+2) -// n -> n+4 für n<=240 -// n -> n+8 für n<=992 -// n -> n+16 für n<=4032 -// n -> n+32 für n<=16256 -// n -> n+65 für n<=65535 +// n -> n+1 für n<=12 wegen 16n+sqrt(16n)+2 < 16(n+1) +// n -> n+2 für n<=56 wegen 16n+sqrt(16n)+2 < 16(n+2) +// n -> n+4 für n<=240 +// n -> n+8 für n<=992 +// n -> n+16 für n<=4032 +// n -> n+32 für n<=16256 +// n -> n+65 für n<=65535 // Allgemein: intDsize*n + sqrt(intDsize*n) + 2 < intDsize*(n+inc) // <==> sqrt(intDsize*n) + 2 < intDsize*inc // <==> sqrt(intDsize*n) < intDsize*inc - 2 diff --git a/src/float/lfloat/misc/cl_LF_shorten.cc b/src/float/lfloat/misc/cl_LF_shorten.cc index f7e9b42..35635bd 100644 --- a/src/float/lfloat/misc/cl_LF_shorten.cc +++ b/src/float/lfloat/misc/cl_LF_shorten.cc @@ -20,12 +20,12 @@ const cl_LF shorten (const cl_LF& x, uintC len) // x = 0.0 braucht nicht abgefangen zu werden, da bei Mantisse 0 dann // sowieso abgerundet wird, die Mantisse also 0 bleibt. var Lfloat y = allocate_lfloat(len,TheLfloat(x)->expo,TheLfloat(x)->sign); // neues LF - { var uintC oldlen = TheLfloat(x)->len; // alte Länge, > len + { var uintC oldlen = TheLfloat(x)->len; // alte Länge, > len // Mantisse von x nach y kopieren: copy_loop_msp(arrayMSDptr(TheLfloat(x)->data,oldlen),arrayMSDptr(TheLfloat(y)->data,len),len); // Entscheiden, ob auf- oder abrunden: var uintD* ptr = arrayMSDptr(TheLfloat(x)->data,oldlen) mspop len; - if ( ((sintD)mspref(ptr,0) >= 0) // nächstes Bit eine 0 -> abrunden + if ( ((sintD)mspref(ptr,0) >= 0) // nächstes Bit eine 0 -> abrunden || ( ((mspref(ptr,0) & ((uintD)bit(intDsize-1)-1)) ==0) // eine 1 und alles weitere Nullen? && !test_loop_msp(ptr mspop 1,oldlen-len-1) // round-to-even @@ -36,9 +36,9 @@ const cl_LF shorten (const cl_LF& x, uintC len) else // aufrunden { if ( inc_loop_lsp(arrayLSDptr(TheLfloat(y)->data,len),len) ) - // Übertrag durch Aufrunden + // Übertrag durch Aufrunden { mspref(arrayMSDptr(TheLfloat(y)->data,len),0) = bit(intDsize-1); // Mantisse := 10...0 - // Exponent erhöhen: + // Exponent erhöhen: if (++(TheLfloat(y)->expo) == LF_exp_high+1) { throw floating_point_overflow_exception(); } } } } diff --git a/src/float/lfloat/misc/cl_LF_shortenrel.cc b/src/float/lfloat/misc/cl_LF_shortenrel.cc index 5217967..dedf5ac 100644 --- a/src/float/lfloat/misc/cl_LF_shortenrel.cc +++ b/src/float/lfloat/misc/cl_LF_shortenrel.cc @@ -27,7 +27,7 @@ const cl_LF cl_LF_shortenrelative (const cl_LF& x, const cl_LF& y) // ex := float_exponent(x), ey := float_exponent(y). // dx := float_digits(x), dy := float_digits(y). // 1 ulp(x) = 2^(ex-dx), 1 ulp(y) = 2^(ey-dy). - // Falls ex-dx < ey-dy, x von Precision dx auf dy-ey+ex verkürzen. + // Falls ex-dx < ey-dy, x von Precision dx auf dy-ey+ex verkürzen. var sintE ey = float_exponent(y); var sintC dy = float_precision(y); if (dy==0) // zerop(y) ? diff --git a/src/float/lfloat/misc/cl_LF_shortenwith.cc b/src/float/lfloat/misc/cl_LF_shortenwith.cc index f88a614..adc9ba7 100644 --- a/src/float/lfloat/misc/cl_LF_shortenwith.cc +++ b/src/float/lfloat/misc/cl_LF_shortenwith.cc @@ -24,7 +24,7 @@ const cl_LF cl_LF_shortenwith (const cl_LF& x, const cl_LF& y) // x = 0.0 -> Precision egal, return x. // ex := float_exponent(x), dx := float_digits(x), 1 ulp(x) = 2^(ex-dx). // ey := float_exponent(y). - // Falls ex-dx < ey, x von Precision dx auf ex-ey verkürzen. + // Falls ex-dx < ey, x von Precision dx auf ex-ey verkürzen. var sintE ey = float_exponent(y); var sintE ex = float_exponent(x); var uintC dx = float_precision(x); diff --git a/src/float/misc/cl_F_extendsqrt.cc b/src/float/misc/cl_F_extendsqrt.cc index 99f82e0..89aa209 100644 --- a/src/float/misc/cl_F_extendsqrt.cc +++ b/src/float/misc/cl_F_extendsqrt.cc @@ -20,13 +20,13 @@ const cl_F cl_F_extendsqrt (const cl_F& x) // SF -> FF wegen 17+sqrt(17)+2 = 23.2 < 24 // FF -> DF wegen 24+sqrt(24)+2 = 30.9 < 53 // DF -> LF(4) wegen 53+sqrt(53)+2 = 62.3 < 64 -// LF(n) -> LF(n+1) für n<=12 wegen 16n+sqrt(16n)+2 < 16(n+1) -// LF(n) -> LF(n+2) für n<=56 wegen 16n+sqrt(16n)+2 < 16(n+2) -// LF(n) -> LF(n+4) für n<=240 -// LF(n) -> LF(n+8) für n<=992 -// LF(n) -> LF(n+16) für n<=4032 -// LF(n) -> LF(n+32) für n<=16256 -// LF(n) -> LF(n+65) für n<=65535 +// LF(n) -> LF(n+1) für n<=12 wegen 16n+sqrt(16n)+2 < 16(n+1) +// LF(n) -> LF(n+2) für n<=56 wegen 16n+sqrt(16n)+2 < 16(n+2) +// LF(n) -> LF(n+4) für n<=240 +// LF(n) -> LF(n+8) für n<=992 +// LF(n) -> LF(n+16) für n<=4032 +// LF(n) -> LF(n+32) für n<=16256 +// LF(n) -> LF(n+65) für n<=65535 floatcase(x , if (SF_mant_len+1<=17) return cl_SF_to_FF(x); // 17+sqrt(17)+2 = 23.2 < 24 diff --git a/src/float/misc/cl_F_leastneg.cc b/src/float/misc/cl_F_leastneg.cc index 63a01ce..918db47 100644 --- a/src/float/misc/cl_F_leastneg.cc +++ b/src/float/misc/cl_F_leastneg.cc @@ -19,7 +19,7 @@ CL_PROVIDE(cl_F_leastneg) namespace cln { -// Exponent so klein wie möglich, Mantisse 10...0, Vorzeichen -. +// Exponent so klein wie möglich, Mantisse 10...0, Vorzeichen -. static const cl_SF least_negative_SF = make_SF(-1,SF_exp_low,bit(SF_mant_len)); diff --git a/src/float/misc/cl_F_leastpos.cc b/src/float/misc/cl_F_leastpos.cc index 16fdecc..f913721 100644 --- a/src/float/misc/cl_F_leastpos.cc +++ b/src/float/misc/cl_F_leastpos.cc @@ -19,7 +19,7 @@ CL_PROVIDE(cl_F_leastpos) namespace cln { -// Exponent so klein wie möglich, Mantisse 10...0, Vorzeichen +. +// Exponent so klein wie möglich, Mantisse 10...0, Vorzeichen +. static const cl_SF least_positive_SF = make_SF(0,SF_exp_low,bit(SF_mant_len)); diff --git a/src/float/misc/cl_F_mostneg.cc b/src/float/misc/cl_F_mostneg.cc index ca1d467..1008f83 100644 --- a/src/float/misc/cl_F_mostneg.cc +++ b/src/float/misc/cl_F_mostneg.cc @@ -19,7 +19,7 @@ CL_PROVIDE(cl_F_mostneg) namespace cln { -// Exponent so groß wie möglich, Mantisse 1...1, Vorzeichen -. +// Exponent so groß wie möglich, Mantisse 1...1, Vorzeichen -. static const cl_SF most_negative_SF = make_SF(-1,SF_exp_high,bit(SF_mant_len+1)-1); diff --git a/src/float/misc/cl_F_mostpos.cc b/src/float/misc/cl_F_mostpos.cc index daed686..c8e413d 100644 --- a/src/float/misc/cl_F_mostpos.cc +++ b/src/float/misc/cl_F_mostpos.cc @@ -19,7 +19,7 @@ CL_PROVIDE(cl_F_mostpos) namespace cln { -// Exponent so groß wie möglich, Mantisse 1...1, Vorzeichen +. +// Exponent so groß wie möglich, Mantisse 1...1, Vorzeichen +. static const cl_SF most_positive_SF = make_SF(0,SF_exp_high,bit(SF_mant_len+1)-1); diff --git a/src/float/misc/cl_F_rational.cc b/src/float/misc/cl_F_rational.cc index e14590a..402bc42 100644 --- a/src/float/misc/cl_F_rational.cc +++ b/src/float/misc/cl_F_rational.cc @@ -34,16 +34,16 @@ const cl_RA rational (const cl_F& x) #if 0 return I_posI_div_RA(n, ash(1,-e)); #else // spart ggT - // n /= 0, -e > 0. Kürze mit ggT(n,2^(-e)) = 2^min(ord2(n),-e). + // n /= 0, -e > 0. Kürze mit ggT(n,2^(-e)) = 2^min(ord2(n),-e). // 0 < -e <= LF_exp_mid-LF_exp_low + intDsize*len < 2^32, var cl_I minus_e = -e; - var uintL _e = cl_I_to_UL(minus_e); // daher kein Überlauf + var uintL _e = cl_I_to_UL(minus_e); // daher kein Überlauf var uintC k = ord2(n); if (k >= _e) - // Kürze mit 2^(-e). + // Kürze mit 2^(-e). return ash(n,e); else - // Kürze mit 2^k, 0 <= k < -e. + // Kürze mit 2^k, 0 <= k < -e. return I_I_to_RT(ash(n,-(sintC)k), ash(1,minus_e-(cl_I)(unsigned long)k)); #endif diff --git a/src/float/misc/cl_F_shortenrel.cc b/src/float/misc/cl_F_shortenrel.cc index 1f219a0..fec6cae 100644 --- a/src/float/misc/cl_F_shortenrel.cc +++ b/src/float/misc/cl_F_shortenrel.cc @@ -21,7 +21,7 @@ const cl_F cl_F_shortenrelative (const cl_F& x, const cl_F& y) // ex := float_exponent(x), ey := float_exponent(y). // dx := float_digits(x), dy := float_digits(y). // 1 ulp(x) = 2^(ex-dx), 1 ulp(y) = 2^(ey-dy). - // Falls ex-dx < ey-dy, x von Precision dx auf dy-ey+ex verkürzen. + // Falls ex-dx < ey-dy, x von Precision dx auf dy-ey+ex verkürzen. var sintE ey = float_exponent(y); var sintC dy = float_precision(y); if (dy==0) // zerop(y) ? diff --git a/src/float/misc/cl_float_format.cc b/src/float/misc/cl_float_format.cc index 8c6e4df..217582c 100644 --- a/src/float/misc/cl_float_format.cc +++ b/src/float/misc/cl_float_format.cc @@ -15,11 +15,11 @@ float_format_t float_format (uintE n) { // Methode: // Mindestens 1+n Dezimalstellen (inklusive Vorkommastelle) -// bedeutet mindestens ceiling((1+n)*ln(10)/ln(2)) Binärstellen. -// ln(10)/ln(2) = 3.321928095 = (binär) 11.0101001001101001111000010010111100110100... -// = (binär) 100 - 0.1010110110010110000111101101000111001011... +// bedeutet mindestens ceiling((1+n)*ln(10)/ln(2)) Binärstellen. +// ln(10)/ln(2) = 3.321928095 = (binär) 11.0101001001101001111000010010111100110100... +// = (binär) 100 - 0.1010110110010110000111101101000111001011... // Durch diese Berechnungsmethode wird das Ergebnis sicher >= (1+n)*ln(10)/ln(2) -// sein, evtl. um ein paar Bit zu groß aber nicht zu klein. +// sein, evtl. um ein paar Bit zu groß aber nicht zu klein. n = 1+n; return (float_format_t) ((n << 2) diff --git a/src/float/output/cl_F_dprint.cc b/src/float/output/cl_F_dprint.cc index 602872c..c34ff57 100644 --- a/src/float/output/cl_F_dprint.cc +++ b/src/float/output/cl_F_dprint.cc @@ -13,20 +13,20 @@ // Bruno Haible 8.9.1990 - 10.9.1990 // Grundgedanken: -// Jede Real-Zahl /= 0 repräsentiert ein (offenes) Intervall. Es wird die- -// jenige Dezimalzahl mit möglichst wenig Stellen ausgegeben, die in diesem +// Jede Real-Zahl /= 0 repräsentiert ein (offenes) Intervall. Es wird die- +// jenige Dezimalzahl mit möglichst wenig Stellen ausgegeben, die in diesem // Intervall liegt. -// Um auch große Exponenten zu behandeln, werden Zweier- in Zehnerpotenzen -// erst einmal näherungsweise umgerechnet. Nötigenfalls wird die Rechen- -// genauigkeit erhöht. Hierbei wird von den Long-Floats beliebiger +// Um auch große Exponenten zu behandeln, werden Zweier- in Zehnerpotenzen +// erst einmal näherungsweise umgerechnet. Nötigenfalls wird die Rechen- +// genauigkeit erhöht. Hierbei wird von den Long-Floats beliebiger // Genauigkeit Gebrauch gemacht. -// Stützt sich auf: +// Stützt sich auf: // cl_ln2(digits) liefert ln(2) mit mindestens digits Mantissenbits. // cl_ln10(digits) liefert ln(10) mit mindestens digits Mantissenbits. // cl_decimal_string(integer) liefert zu einem Integer >0 // einen String mit seiner Dezimaldarstellung. -// (substring string start [end]) wie subseq, jedoch für Strings schneller. +// (substring string start [end]) wie subseq, jedoch für Strings schneller. CL_REQUIRE(cl_F_ln2_var) CL_REQUIRE(cl_F_ln10_var) @@ -49,14 +49,14 @@ namespace cln { // berechnet mit folgenden Eigenschaften: // s = sign(x). // Falls x/=0, betrachte |x| statt x. Also oBdA x>0. -// Seien x1 und x2 die nächstkleinere bzw. die nächstgrößere Zahl zu x -// vom selben Floating-Point-Format. Die Zahl x repräsentiert somit das +// Seien x1 und x2 die nächstkleinere bzw. die nächstgrößere Zahl zu x +// vom selben Floating-Point-Format. Die Zahl x repräsentiert somit das // offene Intervall von (x+x1)/2 bis (x+x2)/2. // a ist ein Integer >0, mit genau k Dezimalstellen (k>=1), und es gilt // (x+x1)/2 < a*10^(-k+e) < (x+x2)/2 . // Dabei ist k minimal, also a nicht durch 10 teilbar. // Falls x=0: a=0, k=1, e=0. -// as ist die Ziffernfolge von a, der Länge k. +// as ist die Ziffernfolge von a, der Länge k. // typedef struct cl_decimal_decoded_float { @@ -96,26 +96,26 @@ static const cl_decimal_decoded_float decode_float_decimal (const cl_F& x) unten = minus1(ash(binmant2,1)); untenshift = 1; } - // Bestimme d (ganz) und a1,a2 (ganz, >0) so, daß + // Bestimme d (ganz) und a1,a2 (ganz, >0) so, daß // die ganzen a mit (x+x1)/2 < 10^d * a < (x+x2)/2 genau // die ganzen a mit a1 <= a <= a2 sind und 0 <= a2-a1 < 20 gilt. // Wandle dazu 2^e := 2^(binexpo-1) ins Dezimalsystem um. var cl_I e = binexpo - 1; - var bool e_gross = (abs(e) > ash(l,1)); // Ist |e| recht groß, >2*l ? - var uintC g; // Hilfsvariablen für den Fall, daß |e| groß ist + var bool e_gross = (abs(e) > ash(l,1)); // Ist |e| recht groß, >2*l ? + var uintC g; // Hilfsvariablen für den Fall, daß |e| groß ist var cl_I f; // - var cl_I zehn_d; // Hilfsvariable 10^|d| für den Fall, daß |e| klein ist + var cl_I zehn_d; // Hilfsvariable 10^|d| für den Fall, daß |e| klein ist var cl_I d; // Ergebnisvariablen var cl_I a1; // var cl_I a2; // - if (e_gross) { // Ist |e| recht groß ? - // Da 2^e nur näherungsweise gehen kann, braucht man Schutzbits. - var uintL h = 16; // Anzahl der Schutzbits, muß >= 3 sein + if (e_gross) { // Ist |e| recht groß ? + // Da 2^e nur näherungsweise gehen kann, braucht man Schutzbits. + var uintL h = 16; // Anzahl der Schutzbits, muß >= 3 sein neue_schutzbits: // Ziel: 2^e ~= 10^d * f/2^g, wobei 1 <= f/2^g < 10. - g = l + h; // Anzahl der gültigen Bits von f - // Schätze d = floor(e*lg(2)) - // mit Hilfe der Näherungsbrüche von lg(2): + g = l + h; // Anzahl der gültigen Bits von f + // Schätze d = floor(e*lg(2)) + // mit Hilfe der Näherungsbrüche von lg(2): // (0 1/3 3/10 28/93 59/196 146/485 643/2136 4004/13301 // 8651/28738 12655/42039 21306/70777 76573/254370 97879/325147 // 1838395/6107016 1936274/6432163 13456039/44699994 @@ -125,48 +125,48 @@ static const cl_decimal_decoded_float decode_float_decimal (const cl_F& x) // 174131244785/578451474249 845863046269/2809896217828 // 1865857337323/6198243909905 6443435058238/21404627947543 // ) - // e>=0 : wähle lg(2) < a/b < lg(2) + 1/e, + // e>=0 : wähle lg(2) < a/b < lg(2) + 1/e, // dann ist d <= floor(e*a/b) <= d+1 . - // e<0 : wähle lg(2) - 1/abs(e) < a/b < lg(2), + // e<0 : wähle lg(2) - 1/abs(e) < a/b < lg(2), // dann ist d <= floor(e*a/b) <= d+1 . // Es ist bekannt, dass abs(e) <= 2^31 + 2^32*64, falls intEsize == 32, // bzw. dass abs(e) <= 2^63 + 2^64*64, falls intEsize == 64. - // (Hierbei steht 64 für die maximale intDsize und es wurde benutzt, + // (Hierbei steht 64 für die maximale intDsize und es wurde benutzt, // dass intEsize >= intCsize.) // Unser d sei := floor(e*a/b)-1. (d /= 0, da abs(e) >= 7.) d = minus1(minusp(e) ? (e >= -970 - ? floor1(e*3,10) // Näherungsbruch 3/10 + ? floor1(e*3,10) // Näherungsbruch 3/10 #if (intEsize==32) - : floor1(e*97879,325147) // Näherungsbruch 97879/325147 + : floor1(e*97879,325147) // Näherungsbruch 97879/325147 #else : (e >= -1800000000LL - ? floor1(e*8651,28738) // Näherungsbruch 8651/28738 - : floor1(e*24793177656LL,82361153417LL) // Näherungsbruch 24793177656/82361153417 + ? floor1(e*8651,28738) // Näherungsbruch 8651/28738 + : floor1(e*24793177656LL,82361153417LL) // Näherungsbruch 24793177656/82361153417 ) #endif ) : (e <= 22000 - ? floor1(e*28,93) // Näherungsbruch 28/93 + ? floor1(e*28,93) // Näherungsbruch 28/93 #if (intEsize==32) - : floor1(e*1838395,6107016) // Näherungsbruch 1838395/6107016 + : floor1(e*1838395,6107016) // Näherungsbruch 1838395/6107016 #else : (e <= 3300000000LL - ? floor1(e*12655,42039) // Näherungsbruch 12655/42039 - : floor1(e*149338067129LL,496090320832LL) // Näherungsbruch 149338067129/496090320832 + ? floor1(e*12655,42039) // Näherungsbruch 12655/42039 + : floor1(e*149338067129LL,496090320832LL) // Näherungsbruch 149338067129/496090320832 ) #endif ) ); - // Das wahre d wird durch diese Schätzung entweder getroffen - // oder um 1 unterschätzt. - // Anders ausgedrückt: 0 < e*log(2)-d*log(10) < 2*log(10). + // Das wahre d wird durch diese Schätzung entweder getroffen + // oder um 1 unterschätzt. + // Anders ausgedrückt: 0 < e*log(2)-d*log(10) < 2*log(10). // Nun f/2^g als exp(e*log(2)-d*log(10)) berechnen. // Da f < 100*2^g < 2^(g+7), sind g+7 Bits relative Genauigkeit // des Ergebnisses, also g+7 Bits absolute Genauigkeit von - // e*log(2)-d*log(10) nötig. Dazu mit l'=integerlength(e) - // für log(2): g+7+l' Bits abs. Gen., g+7+l' Bits rel. Gen., - // für log(10): g+7+l' Bits abs. Gen., g+7+l'+2 Bist rel. Gen. + // e*log(2)-d*log(10) nötig. Dazu mit l'=integerlength(e) + // für log(2): g+7+l' Bits abs. Gen., g+7+l' Bits rel. Gen., + // für log(10): g+7+l' Bits abs. Gen., g+7+l'+2 Bist rel. Gen. var float_format_t gen = (float_format_t)(g + integer_length(e) + 9); // Genauigkeit var cl_F f2g = exp(The(cl_F)(e * cl_ln2(gen)) - The(cl_F)(d * cl_ln10(gen))); // f/2^g // Das so berechnete f/2^g ist >1, <100. @@ -176,7 +176,7 @@ static const cl_decimal_decoded_float decode_float_decimal (const cl_F& x) if (f >= ash(10,g)) // f >= 10*2^g ? { f = floor1(f,10); d = d+1; } // Nun ist 2^e ~= 10^d * f/2^g, wobei 1 <= f/2^g < 10 und - // f ein Integer ist, der um höchstens 1 vom wahren Wert abweicht: + // f ein Integer ist, der um höchstens 1 vom wahren Wert abweicht: // 10^d * (f-1)/2^g < 2^e < 10^d * (f+1)/2^g // Wir verkleinern nun das offene Intervall // von (x+x1)/2 = 2^(binexpo-1-untenshift) * unten @@ -187,7 +187,7 @@ static const cl_decimal_decoded_float decode_float_decimal (const cl_F& x) // und suchen darin Zahlen der Form 10^d * a mit ganzem a. // Wegen oben - unten/2^untenshift >= 3/2 // und oben + unten/2^untenshift <= 4*binmant+1 < 2^(l+2) <= 2^(g-1) - // ist die Intervall-Länge + // ist die Intervall-Länge // = 10^d * ((f-1)*oben - (f+1)*unten/2^untenshift) / 2^g // = 10^d * ( f * (oben - unten/2^untenshift) // - (oben + unten/2^untenshift) ) / 2^g @@ -199,10 +199,10 @@ static const cl_decimal_decoded_float decode_float_decimal (const cl_F& x) // mit a1 <= a <= a2, wobei a2 = floor((f-1)*oben/2^g) und // a1 = ceiling((f+1)*unten/2^(g+untenshift)) // = floor(((f+1)*unten-1)/2^(g+untenshift))+1 . - // Wir haben eben gesehen, daß a1 <= a2 sein muß. + // Wir haben eben gesehen, daß a1 <= a2 sein muß. a1 = plus1(ash(minus1((f+1)*unten),-(g+untenshift))); a2 = ash((f-1)*oben,-g); - // Wir können auch das offene Intervall + // Wir können auch das offene Intervall // von (x+x1)/2 = 2^(binexpo-1-untenshift) * unten // bis (x+x2)/2 = 2^(binexpo-1) * oben // in das (abgeschlossene) Intervall @@ -213,26 +213,26 @@ static const cl_decimal_decoded_float decode_float_decimal (const cl_F& x) // und sich a1' und a2' analog zu a1 und a2 berechnen. // Da (f-1)*oben/2^g und (f+1)*oben/2^g sich um 2*oben/2^g // < 2^(l+2-g) < 1 unterscheiden, unterscheiden sich a2 und - // a2' um höchstens 1. + // a2' um höchstens 1. // Ebenso, wenn 'oben' durch 'unten/2^untenshift' ersetzt - // wird: a1' und a1 unterscheiden sich um höchstens 1. + // wird: a1' und a1 unterscheiden sich um höchstens 1. // Ist nun a1' < a1 oder a2 < a2' , so ist die Zweierpotenz- - // Näherung 10^d * f/2^g für 2^e nicht genau genug gewesen, - // und man hat das Ganze mit erhöhtem h zu wiederholen. - // Ausnahme (da hilft auch keine höhere Genauigkeit): + // Näherung 10^d * f/2^g für 2^e nicht genau genug gewesen, + // und man hat das Ganze mit erhöhtem h zu wiederholen. + // Ausnahme (da hilft auch keine höhere Genauigkeit): // Wenn die obere oder untere Intervallgrenze (x+x2)/2 bzw. // (x+x1)/2 selbst die Gestalt 10^d * a mit ganzem a hat. // Dies testet man so: // (x+x2)/2 = 2^e * oben == 10^d * a mit ganzem a, wenn - // - für e>=0, (dann 0 <= d <= e): 5^d | oben, - // - für e<0, (dann e <= d < 0): 2^(d-e) | oben, was - // nur für d-e=0 der Fall ist. + // - für e>=0, (dann 0 <= d <= e): 5^d | oben, + // - für e<0, (dann e <= d < 0): 2^(d-e) | oben, was + // nur für d-e=0 der Fall ist. // (x+x1)/2 = 2^(e-untenshift) * unten == 10^d * a // mit ganzem a, wenn - // - für e>0, (dann 0 <= d < e): 5^d | unten, - // - für e<=0, (dann e <= d <= 0): 2^(d-e+untenshift) | unten, - // was nur für d-e+untenshift=0 der Fall ist. - // Da wir es jedoch mit großem |e| zu tun haben, kann dieser + // - für e>0, (dann 0 <= d < e): 5^d | unten, + // - für e<=0, (dann e <= d <= 0): 2^(d-e+untenshift) | unten, + // was nur für d-e+untenshift=0 der Fall ist. + // Da wir es jedoch mit großem |e| zu tun haben, kann dieser // Ausnahmefall hier gar nicht eintreten! // Denn im Falle e>=0: Aus e>=2*l und l>=11 folgt // e >= (l+2)*ln(10)/ln(5) + ln(10)/ln(2), @@ -256,67 +256,67 @@ static const cl_decimal_decoded_float decode_float_decimal (const cl_F& x) if (a2 < a2prime) { h = 2*h; goto neue_schutzbits; } // h verdoppeln und alles wiederholen } - // Jetzt ist a1 der kleinste und a2 der größte Wert, der - // für a möglich ist. + // Jetzt ist a1 der kleinste und a2 der größte Wert, der + // für a möglich ist. // Wegen oben - unten/2^untenshift <= 2 - // ist die obige Intervall-Länge + // ist die obige Intervall-Länge // = 10^d * ((f-1)*oben - (f+1)*unten/2^untenshift) / 2^g // < 10^d * ((f-1)*oben - (f-1)*unten/2^untenshift) / 2^g // = 10^d * (f-1)/2^g * (oben - unten/2^untenshift) // < 10^d * 10 * 2, - // also gibt es höchstens 20 mögliche Werte für a. + // also gibt es höchstens 20 mögliche Werte für a. } else { // |e| ist recht klein -> man kann 2^e und 10^d exakt ausrechnen if (!minusp(e)) { - // e >= 0. Schätze d = floor(e*lg(2)) wie oben. + // e >= 0. Schätze d = floor(e*lg(2)) wie oben. // Es ist e<=2*l<2^39, falls intCsize == 32, // bzw. e<=2*l<2^71, falls intCsize == 64. d = (e <= 22000 - ? floor1(e*28,93) // Näherungsbruch 28/93 + ? floor1(e*28,93) // Näherungsbruch 28/93 #if (intCsize==32) - : floor1(e*1838395,6107016) // Näherungsbruch 1838395/6107016 + : floor1(e*1838395,6107016) // Näherungsbruch 1838395/6107016 #else : (e <= 3300000000LL - ? floor1(e*12655,42039) // Näherungsbruch 12655/42039 - : floor1(e*149338067129LL,496090320832LL) // Näherungsbruch 149338067129/496090320832 + ? floor1(e*12655,42039) // Näherungsbruch 12655/42039 + : floor1(e*149338067129LL,496090320832LL) // Näherungsbruch 149338067129/496090320832 ) #endif ); - // Das wahre d wird durch diese Schätzung entweder getroffen - // oder um 1 überschätzt, aber das können wir leicht feststellen. + // Das wahre d wird durch diese Schätzung entweder getroffen + // oder um 1 überschätzt, aber das können wir leicht feststellen. zehn_d = The(cl_I)(expt(10,d)); // zehn_d = 10^d if (ash(1,e) < zehn_d) // falls 2^e < 10^d, - { d = d-1; zehn_d = exquo(zehn_d,10); } // Schätzung korrigieren + { d = d-1; zehn_d = exquo(zehn_d,10); } // Schätzung korrigieren // Nun ist 10^d <= 2^e < 10^(d+1) und zehn_d = 10^d. // a1 sei das kleinste ganze a > 2^(e-untenshift) * unten / 10^d, - // a2 sei das größte ganze a < 2^e * oben / 10^d. + // a2 sei das größte ganze a < 2^e * oben / 10^d. // a1 = 1+floor(unten*2^e/(2^untenshift*10^d)), // a2 = floor((oben*2^e-1)/10^d). a1 = plus1(floor1(ash(unten,e),ash(zehn_d,untenshift))); a2 = floor1(minus1(ash(oben,e)),zehn_d); } else { - // e < 0. Schätze d = floor(e*lg(2)) wie oben. + // e < 0. Schätze d = floor(e*lg(2)) wie oben. // Es ist |e|<=2*l<2^39, falls intCsize == 32, // bzw. |e|<=2*l<2^71, falls intCsize == 64. d = (e >= -970 - ? floor1(e*3,10) // Näherungsbruch 3/10 + ? floor1(e*3,10) // Näherungsbruch 3/10 #if (intCsize==32) - : floor1(e*97879,325147) // Näherungsbruch 97879/325147 + : floor1(e*97879,325147) // Näherungsbruch 97879/325147 #else : (e >= -1800000000LL - ? floor1(e*8651,28738) // Näherungsbruch 8651/28738 - : floor1(e*24793177656LL,82361153417LL) // Näherungsbruch 24793177656/82361153417 + ? floor1(e*8651,28738) // Näherungsbruch 8651/28738 + : floor1(e*24793177656LL,82361153417LL) // Näherungsbruch 24793177656/82361153417 ) #endif ); - // Das wahre d wird durch diese Schätzung entweder getroffen - // oder um 1 überschätzt, aber das können wir leicht feststellen. + // Das wahre d wird durch diese Schätzung entweder getroffen + // oder um 1 überschätzt, aber das können wir leicht feststellen. zehn_d = The(cl_I)(expt(10,-d)); // zehn_d = 10^(-d) if (integer_length(zehn_d) <= -e) // falls 2^e < 10^d, - { d = d-1; zehn_d = zehn_d*10; } // Schätzung korrigieren + { d = d-1; zehn_d = zehn_d*10; } // Schätzung korrigieren // Nun ist 10^d <= 2^e < 10^(d+1) und zehn_d = 10^(-d). // a1 sei das kleinste ganze a > 2^(e-untenshift) * unten / 10^d, - // a2 sei das größte ganze a < 2^e * oben / 10^d. + // a2 sei das größte ganze a < 2^e * oben / 10^d. // a1 = 1+floor(unten*10^(-d)/2^(-e+untenshift)), // a2 = floor((oben*10^(-d)-1)/2^(-e)) a1 = plus1(ash(unten*zehn_d,e-untenshift)); @@ -324,19 +324,19 @@ static const cl_decimal_decoded_float decode_float_decimal (const cl_F& x) } } // Nun sind die ganzen a mit (x+x1)/2 < 10^d * a < (x+x2)/2 genau - // die ganzen a mit a1 <= a <= a2. Deren gibt es höchstens 20. + // die ganzen a mit a1 <= a <= a2. Deren gibt es höchstens 20. // Diese werden in drei Schritten auf einen einzigen reduziert: - // 1. Enthält der Bereich eine durch 10 teilbare Zahl a ? + // 1. Enthält der Bereich eine durch 10 teilbare Zahl a ? // ja -> setze a1:=ceiling(a1/10), a2:=floor(a2/10), d:=d+1. - // Danach enthält der Bereich a1 <= a <= a2 höchstens 10 - // mögliche Werte für a. - // 2. Falls jetzt einer der möglichen Werte durch 10 teilbar ist + // Danach enthält der Bereich a1 <= a <= a2 höchstens 10 + // mögliche Werte für a. + // 2. Falls jetzt einer der möglichen Werte durch 10 teilbar ist // (es kann nur noch einen solchen geben), - // wird er gewählt, die anderen vergessen. - // 3. Sonst wird unter allen noch möglichen Werten der zu x - // nächstgelegene gewählt. + // wird er gewählt, die anderen vergessen. + // 3. Sonst wird unter allen noch möglichen Werten der zu x + // nächstgelegene gewählt. var bool d_shift = false; // Flag, ob im 1. Schritt d incrementiert wurde - var cl_I a; // das ausgewählte a + var cl_I a; // das ausgewählte a // 1. { var cl_I b1 = ceiling1(a1,10); @@ -350,14 +350,14 @@ static const cl_decimal_decoded_float decode_float_decimal (const cl_F& x) a = floor1(a2,10); if (10*a >= a1) { // Noch eine durch 10 teilbare Zahl -> durch 10 teilen. - d = d+1; // noch d erhöhen, zehn-d wird nicht mehr gebraucht + d = d+1; // noch d erhöhen, zehn-d wird nicht mehr gebraucht // Nun a in einen Dezimalstring umwandeln - // und dann Nullen am Schluß streichen: + // und dann Nullen am Schluß streichen: var char* as = cl_decimal_string(a); // Ziffernfolge zu a>0 - var uintC las = ::strlen(as); // Länge der Ziffernfolge - var uintC k = las; // Länge ohne die gestrichenen Nullen am Schluß + var uintC las = ::strlen(as); // Länge der Ziffernfolge + var uintC k = las; // Länge ohne die gestrichenen Nullen am Schluß var cl_I ee = k+d; // a * 10^d = a * 10^(-k+ee) - while (as[k-1] == '0') // eine 0 am Schluß? + while (as[k-1] == '0') // eine 0 am Schluß? { // ja -> a := a / 10 (wird aber nicht mehr gebraucht), // d := d+1 (wird aber nicht mehr gebraucht), k = k-1; as[k] = '\0'; @@ -370,10 +370,10 @@ static const cl_decimal_decoded_float decode_float_decimal (const cl_F& x) // a1=a2 -> keine Frage der Auswahl mehr: a = a1; } else { - // a1 zu x nächstgelegenes 10^d * a wählen: + // a1 zu x nächstgelegenes 10^d * a wählen: if (e_gross) { // a = round(f*2*binmant/2^g/(1oder10)) (beliebige Rundung) - // = ceiling(floor(f*2*binmant/(1oder10)/2^(g-1))/2) wählen: + // = ceiling(floor(f*2*binmant/(1oder10)/2^(g-1))/2) wählen: var cl_I temp = f * binmant2; if (d_shift) { temp = floor1(temp,10); } a = ash(plus1(ash(temp,1-g)),-1); @@ -406,7 +406,7 @@ void print_float (std::ostream& stream, const cl_print_float_flags& flags, const var cl_I& expo = z_decoded.e; var cl_I& sign = z_decoded.s; // arg in Dezimaldarstellung: +/- 0.mant * 10^expo, wobei - // mant die Mantisse: als Simple-String mantstring mit Länge mantlen, + // mant die Mantisse: als Simple-String mantstring mit Länge mantlen, // expo der Dezimal-Exponent, // sign das Vorzeichen (-1 oder 0 oder 1). if (eq(sign,-1)) // z < 0 ? @@ -418,8 +418,8 @@ void print_float (std::ostream& stream, const cl_print_float_flags& flags, const // 0 < expo < mantlen -> // die ersten expo Ziffern, Punkt, die restlichen Ziffern // expo >= mantlen -> alle Ziffern, expo-mantlen Nullen, Punkt, Null - // Nach Möglichkeit kein Exponent// wenn nötig, Exponent 0. - // flag gelöscht -> "scientific notation": + // Nach Möglichkeit kein Exponent// wenn nötig, Exponent 0. + // flag gelöscht -> "scientific notation": // erste Ziffer, Punkt, die restlichen Ziffern, bei mantlen=1 eine Null // Exponent. if (flag && !plusp(expo)) { @@ -446,7 +446,7 @@ void print_float (std::ostream& stream, const cl_print_float_flags& flags, const fprintchar(stream,mantstring[i]); } } else { - // scale>=mantlen -> es bleibt nichts für die Nachkommastellen. + // scale>=mantlen -> es bleibt nichts für die Nachkommastellen. // alle Ziffern, dann scale-mantlen Nullen, dann Punkt und Null fprint(stream,mantstring); for (uintV i = mantlen; i < scale; i++) @@ -476,7 +476,7 @@ void print_float (std::ostream& stream, const cl_print_float_flags& flags, const fprintchar(stream,exp_marker); print_integer(stream,10,expo); } - // Fertig. Aufräumen. + // Fertig. Aufräumen. free_hook(mantstring); } diff --git a/src/float/output/cl_F_printb.cc b/src/float/output/cl_F_printb.cc index 9eafb0b..e55f6cc 100644 --- a/src/float/output/cl_F_printb.cc +++ b/src/float/output/cl_F_printb.cc @@ -18,14 +18,14 @@ namespace cln { void print_float_binary (std::ostream& stream, const cl_F& z) { -// Vorzeichen, Punkt, Mantisse (binär), (Zweiersystem-)Exponent (dezimal) +// Vorzeichen, Punkt, Mantisse (binär), (Zweiersystem-)Exponent (dezimal) cl_idecoded_float m_e_s = integer_decode_float(z); var cl_I& m = m_e_s.mantissa; var cl_I& s = m_e_s.sign; // Vorzeichen ausgeben, falls <0: if (eq(s,-1)) fprintchar(stream,'-'); - // Mantisse binär(!) ausgeben: + // Mantisse binär(!) ausgeben: fprintchar(stream,'.'); print_integer(stream,2,m); // Exponent-Marker ausgeben: diff --git a/src/float/sfloat/algebraic/cl_SF_sqrt.cc b/src/float/sfloat/algebraic/cl_SF_sqrt.cc index c1eba13..7fa6309 100644 --- a/src/float/sfloat/algebraic/cl_SF_sqrt.cc +++ b/src/float/sfloat/algebraic/cl_SF_sqrt.cc @@ -23,7 +23,7 @@ const cl_SF sqrt (const cl_SF& x) // Ergebnis-Mantisse: // Bilde aus [1,m15,...,m0,(19 Nullbits)] bei geradem e, // aus [0,1,m15,...,m0,(18 Nullbits)] bei ungeradem e -// die Ganzzahl-Wurzel, eine 18-Bit-Zahl mit einer führenden 1. +// die Ganzzahl-Wurzel, eine 18-Bit-Zahl mit einer führenden 1. // Runde das letzte Bit weg: // Bit 0 = 0 -> abrunden, // Bit 0 = 1 und Wurzel exakt -> round-to-even, @@ -35,7 +35,7 @@ const cl_SF sqrt (const cl_SF& x) var sintL exp; var uint32 mant; SF_decode(x, { return x; }, ,exp=,mant=); - // Um die 64-Bit-Ganzzahl-Wurzel ausnutzen zu können, fügen wir beim + // Um die 64-Bit-Ganzzahl-Wurzel ausnutzen zu können, fügen wir beim // Radikanden 46 bzw. 47 statt 18 bzw. 19 Nullbits an. if (exp & bit(0)) // e ungerade diff --git a/src/float/sfloat/cl_SF.h b/src/float/sfloat/cl_SF.h index a9c30fa..9329133 100644 --- a/src/float/sfloat/cl_SF.h +++ b/src/float/sfloat/cl_SF.h @@ -63,7 +63,7 @@ inline const cl_SF make_SF (cl_sint sign, unsigned int exp, cl_uint mant) // Entpacken eines Short-Float: // SF_decode(obj, zero_statement, sign=,exp=,mant=); // zerlegt ein Short-Float obj. -// Ist obj=0.0, wird zero_statement ausgeführt. +// Ist obj=0.0, wird zero_statement ausgeführt. // Sonst: cl_signean sign = Vorzeichen (0 = +, -1 = -), // sintL exp = Exponent (vorzeichenbehaftet), // uintL mant = Mantisse (>= 2^SF_mant_len, < 2^(SF_mant_len+1)) @@ -96,11 +96,11 @@ inline uintL SF_mant (const cl_SF& x) // Einpacken eines Short-Float: // encode_SF(sign,exp,mant) // liefert ein Short-Float. -// > cl_signean sign: Vorzeichen, 0 für +, -1 für negativ. +// > cl_signean sign: Vorzeichen, 0 für +, -1 für negativ. // > sintL exp: Exponent // > uintL mant: Mantisse, sollte >= 2^SF_mant_len und < 2^(SF_mant_len+1) sein. // < object ergebnis: ein Short-Float -// Der Exponent wird auf Überlauf/Unterlauf getestet. +// Der Exponent wird auf Überlauf/Unterlauf getestet. inline const cl_SF encode_SF (cl_signean sign, sintL exp, uintL mant) { if (exp < (sintL)(SF_exp_low-SF_exp_mid)) @@ -118,7 +118,7 @@ inline const cl_SF encode_SF (cl_signean sign, sintL exp, uintL mant) // Liefert zu einem Short-Float x : (futruncate x), ein SF. -// x wird von der 0 weg zur nächsten ganzen Zahl gerundet. +// x wird von der 0 weg zur nächsten ganzen Zahl gerundet. extern const cl_SF futruncate (const cl_SF& x); // SF_to_I(x) wandelt ein Short-Float x, das eine ganze Zahl darstellt, diff --git a/src/float/sfloat/elem/cl_SF_div.cc b/src/float/sfloat/elem/cl_SF_div.cc index 39b105e..2c8458b 100644 --- a/src/float/sfloat/elem/cl_SF_div.cc +++ b/src/float/sfloat/elem/cl_SF_div.cc @@ -28,11 +28,11 @@ const cl_SF operator/ (const cl_SF& x1, const cl_SF& x2) // nach Rundung mant1/mant2 >=1/2, <=2*mant1<2. // Bei mant1/mant2 >=1 brauche 16 Nachkommabits, // bei mant1/mant2 <1 brauche 17 Nachkommabits. -// Fürs Runden: brauche ein Rundungsbit (Rest gibt an, ob exakt). +// Fürs Runden: brauche ein Rundungsbit (Rest gibt an, ob exakt). // Brauche daher insgesamt 18 Nachkommabits von mant1/mant2. // Dividiere daher (als Unsigned Integers) 2^18*(2^17*mant1) durch (2^17*mant2). // Falls der Quotient >=2^18 ist, runde die letzten zwei Bits weg und -// erhöhe den Exponenten um 1. +// erhöhe den Exponenten um 1. // Falls der Quotient <2^18 ist, runde das letzte Bit weg. Bei rounding // overflow schiebe um ein weiteres Bit nach rechts, incr. Exponenten. // x1,x2 entpacken: @@ -46,11 +46,11 @@ const cl_SF operator/ (const cl_SF& x1, const cl_SF& x2) SF_decode(x1, { return x1; }, sign1=,exp1=,mant1=); exp1 = exp1 - exp2; // Differenz der Exponenten sign1 = sign1 ^ sign2; // Ergebnis-Vorzeichen - // Dividiere 2^18*mant1 durch mant2 oder (äquivalent) - // 2^i*2^18*mant1 durch 2^i*mant2 für irgendein i mit 0 <= i <= 32-17 : + // Dividiere 2^18*mant1 durch mant2 oder (äquivalent) + // 2^i*2^18*mant1 durch 2^i*mant2 für irgendein i mit 0 <= i <= 32-17 : var uintL mant; var uintL rest; - // wähle i = 32-(SF_mant_len+1), also i+(SF_mant_len+2) = 33. + // wähle i = 32-(SF_mant_len+1), also i+(SF_mant_len+2) = 33. divu_6432_3232(mant1<<1,0, mant2<<(32-(SF_mant_len+1)), mant=,rest=); if (mant >= bit(SF_mant_len+2)) // Quotient >=2^18 -> 2 Bits wegrunden diff --git a/src/float/sfloat/elem/cl_SF_from_I.cc b/src/float/sfloat/elem/cl_SF_from_I.cc index 21f337b..c6787ee 100644 --- a/src/float/sfloat/elem/cl_SF_from_I.cc +++ b/src/float/sfloat/elem/cl_SF_from_I.cc @@ -22,7 +22,7 @@ const cl_SF cl_I_to_SF (const cl_I& x) // Merke Vorzeichen von x. // x:=(abs x) // Exponent:=(integer-length x) -// Greife die 18 höchstwertigen Bits heraus (angeführt von einer 1). +// Greife die 18 höchstwertigen Bits heraus (angeführt von einer 1). // Runde das letzte Bit weg: // Bit 0 = 0 -> abrunden, // Bit 0 = 1 und Rest =0 -> round-to-even, @@ -39,7 +39,7 @@ const cl_SF cl_I_to_SF (const cl_I& x) var uintC len; 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 + // Führende Digits holen: Brauche SF_mant_len+1 Bits, dazu intDsize // Bits (die NDS kann mit bis zu intDsize Nullbits anfangen). // Dann werden diese Bits um (exp mod intDsize) nach rechts geschoben. var uintD msd = msprefnext(MSDptr); // erstes Digit @@ -59,15 +59,15 @@ const cl_SF cl_I_to_SF (const cl_I& x) --len; ok: #if (intDsize==64) // Die NDS besteht aus msd, msdd, und len weiteren Digits. - // Das höchste in 2^intDsize*msd+msdd gesetzte Bit ist Bit Nummer + // Das höchste in 2^intDsize*msd+msdd gesetzte Bit ist Bit Nummer // intDsize-1 + (exp mod intDsize). var uintL shiftcount = exp % intDsize; - var uint64 mant = // führende 64 Bits + var uint64 mant = // führende 64 Bits (shiftcount==0 ? msdd : ((msd << (64-shiftcount)) | (msdd >> shiftcount)) ); - // Das höchste in mant gesetzte Bit ist Bit Nummer 63. + // Das höchste in mant gesetzte Bit ist Bit Nummer 63. if ( ((mant & bit(62-SF_mant_len)) ==0) // Bit 46 =0 -> abrunden || ( ((mant & (bit(62-SF_mant_len)-1)) ==0) // Bit 46 =1 und Bits 45..0 =0 && ((msdd & (bit(shiftcount)-1)) ==0) // und weitere Bits aus msdd =0 @@ -86,15 +86,15 @@ const cl_SF cl_I_to_SF (const cl_I& x) } #else // Die NDS besteht aus msd, msdd, und len weiteren Digits. - // Das höchste in 2^32*msd+msdd gesetzte Bit ist Bit Nummer + // Das höchste in 2^32*msd+msdd gesetzte Bit ist Bit Nummer // 31 + (exp mod intDsize). var uintL shiftcount = exp % intDsize; - var uint32 mant = // führende 32 Bits + var uint32 mant = // führende 32 Bits (shiftcount==0 ? msdd : (((uint32)msd << (32-shiftcount)) | (msdd >> shiftcount)) ); - // Das höchste in mant gesetzte Bit ist Bit Nummer 31. + // Das höchste in mant gesetzte Bit ist Bit Nummer 31. if ( ((mant & bit(30-SF_mant_len)) ==0) // Bit 14 =0 -> abrunden || ( ((mant & (bit(30-SF_mant_len)-1)) ==0) // Bit 14 =1 und Bits 13..0 =0 && ((msdd & (bit(shiftcount)-1)) ==0) // und weitere Bits aus msdd =0 diff --git a/src/float/sfloat/elem/cl_SF_from_RA.cc b/src/float/sfloat/elem/cl_SF_from_RA.cc index e0019f5..71cb5b5 100644 --- a/src/float/sfloat/elem/cl_SF_from_RA.cc +++ b/src/float/sfloat/elem/cl_SF_from_RA.cc @@ -20,7 +20,7 @@ const cl_SF cl_RA_to_SF (const cl_RA& x) // Methode: // x ganz -> klar. // x = +/- a/b mit Integers a,b>0: -// Seien n,m so gewählt, daß +// Seien n,m so gewählt, daß // 2^(n-1) <= a < 2^n, 2^(m-1) <= b < 2^m. // Dann ist 2^(n-m-1) < a/b < 2^(n-m+1). // Berechne n=(integer-length a) und m=(integer-length b) und @@ -61,7 +61,7 @@ const cl_SF cl_RA_to_SF (const cl_RA& x) { zaehler = ash(a,(SF_mant_len+2) - lendiff); // (ash a -n+m+18) nenner = b; // b } - // Division zaehler/nenner durchführen: + // Division zaehler/nenner durchführen: var cl_I_div_t q_r = cl_divide(zaehler,nenner); var cl_I& q = q_r.quotient; var cl_I& r = q_r.remainder; diff --git a/src/float/sfloat/elem/cl_SF_fround.cc b/src/float/sfloat/elem/cl_SF_fround.cc index 1b70ad2..a52d0ab 100644 --- a/src/float/sfloat/elem/cl_SF_fround.cc +++ b/src/float/sfloat/elem/cl_SF_fround.cc @@ -28,9 +28,9 @@ const cl_SF fround (const cl_SF& x) { return x; } else if (uexp > SF_exp_mid+1) // e>1 ? - { var cl_uint bitmask = // Bitmaske: Bit 16-e gesetzt, alle anderen gelöscht + { var cl_uint bitmask = // Bitmaske: Bit 16-e gesetzt, alle anderen gelöscht bit(SF_mant_len+SF_mant_shift + SF_exp_mid-uexp); - var cl_uint mask = // Bitmaske: Bits 15-e..0 gesetzt, alle anderen gelöscht + var cl_uint mask = // Bitmaske: Bits 15-e..0 gesetzt, alle anderen gelöscht bitmask - bit(SF_mant_shift); if ( ((x.word & bitmask) ==0) // Bit 16-e =0 -> abrunden || ( ((x.word & mask) ==0) // Bit 16-e =1 und Bits 15-e..0 >0 -> aufrunden @@ -38,19 +38,19 @@ const cl_SF fround (const cl_SF& x) && ((x.word & (bitmask<<1)) ==0) ) ) // abrunden - { mask |= bitmask; // Bitmaske: Bits 16-e..0 gesetzt, alle anderen gelöscht + { mask |= bitmask; // Bitmaske: Bits 16-e..0 gesetzt, alle anderen gelöscht return cl_SF_from_word(x.word & ~mask); } else // aufrunden { return cl_SF_from_word( (x.word | mask) // alle diese Bits 15-e..0 setzen (Bit 16-e schon gesetzt) - + bit(SF_mant_shift) // letzte Stelle erhöhen, dabei evtl. Exponenten incrementieren + + bit(SF_mant_shift) // letzte Stelle erhöhen, dabei evtl. Exponenten incrementieren ); } } elif (uexp == SF_exp_mid+1) // e=1 ? - // Wie bei 1 < e <= 16, nur daß Bit 17-e stets gesetzt ist. + // Wie bei 1 < e <= 16, nur daß Bit 17-e stets gesetzt ist. { if ((x.word & bit(SF_mant_len+SF_mant_shift-1)) ==0) // Bit 16-e =0 -> abrunden // abrunden { return cl_SF_from_word(x.word & ~(bit(SF_mant_len+SF_mant_shift)-bit(SF_mant_shift))); } @@ -58,13 +58,13 @@ const cl_SF fround (const cl_SF& x) // aufrunden { return cl_SF_from_word( (x.word | (bit(SF_mant_len+SF_mant_shift)-bit(SF_mant_shift))) // alle diese Bits 16-e..0 setzen - + bit(SF_mant_shift) // letzte Stelle erhöhen, dabei evtl. Exponenten incrementieren + + bit(SF_mant_shift) // letzte Stelle erhöhen, dabei evtl. Exponenten incrementieren ); } } else // e=0 ? - // Wie bei 1 < e <= 16, nur daß Bit 16-e stets gesetzt - // und Bit 17-e stets gelöscht ist. + // Wie bei 1 < e <= 16, nur daß Bit 16-e stets gesetzt + // und Bit 17-e stets gelöscht ist. { if ((x.word & (bit(SF_mant_len+SF_mant_shift)-bit(SF_mant_shift))) ==0) // abrunden von +-0.5 zu 0.0 { return SF_0; } @@ -72,7 +72,7 @@ const cl_SF fround (const cl_SF& x) // aufrunden { return cl_SF_from_word( (x.word | (bit(SF_mant_len+SF_mant_shift)-bit(SF_mant_shift))) // alle Bits 15-e..0 setzen - + bit(SF_mant_shift) // letzte Stelle erhöhen, dabei Exponenten incrementieren + + bit(SF_mant_shift) // letzte Stelle erhöhen, dabei Exponenten incrementieren ); } } } diff --git a/src/float/sfloat/elem/cl_SF_ftrunc.cc b/src/float/sfloat/elem/cl_SF_ftrunc.cc index 8bbeb0a..edc9579 100644 --- a/src/float/sfloat/elem/cl_SF_ftrunc.cc +++ b/src/float/sfloat/elem/cl_SF_ftrunc.cc @@ -28,7 +28,7 @@ const cl_SF ftruncate (const cl_SF& x) { return x; } else { return cl_SF_from_word( - x.word & // Bitmaske: Bits 16-e..0 gelöscht, alle anderen gesetzt + x.word & // Bitmaske: Bits 16-e..0 gelöscht, alle anderen gesetzt ~(bit(SF_mant_len+SF_mant_shift + 1+SF_exp_mid-uexp) - bit(SF_mant_shift)) ); } diff --git a/src/float/sfloat/elem/cl_SF_futrunc.cc b/src/float/sfloat/elem/cl_SF_futrunc.cc index 458eb0d..7dc3522 100644 --- a/src/float/sfloat/elem/cl_SF_futrunc.cc +++ b/src/float/sfloat/elem/cl_SF_futrunc.cc @@ -18,10 +18,10 @@ const cl_SF futruncate (const cl_SF& x) // e<=0 -> Ergebnis 1.0 oder -1.0, je nach Vorzeichen von x. // 1<=e<=16 -> Greife die letzten (17-e) Bits von x heraus. // Sind sie alle =0 -> Ergebnis x. -// Sonst setze sie alle und erhöhe dann die letzte Stelle um 1. -// Kein Überlauf der 16 Bit -> fertig. +// Sonst setze sie alle und erhöhe dann die letzte Stelle um 1. +// Kein Überlauf der 16 Bit -> fertig. // Sonst (Ergebnis eine Zweierpotenz): Mantisse := .1000...000, -// e:=e+1. (Test auf Überlauf wegen e<=17 überflüssig) +// e:=e+1. (Test auf Überlauf wegen e<=17 überflüssig) // e>=17 -> Ergebnis x. var uintL uexp = SF_uexp(x); // e + SF_exp_mid if (uexp==0) // 0.0 ? @@ -39,13 +39,13 @@ const cl_SF futruncate (const cl_SF& x) { if (uexp > SF_exp_mid+SF_mant_len) // e > 16 ? { return x; } else - { var cl_uint mask = // Bitmaske: Bits 16-e..0 gesetzt, alle anderen gelöscht + { var cl_uint mask = // Bitmaske: Bits 16-e..0 gesetzt, alle anderen gelöscht bit(SF_mant_len+SF_mant_shift + 1+SF_exp_mid-uexp) - bit(SF_mant_shift); if ((x.word & mask)==0) // alle diese Bits =0 ? { return x; } return cl_SF_from_word( (x.word | mask) // alle diese Bits setzen - + bit(SF_mant_shift) // letzte Stelle erhöhen, dabei evtl. Exponenten incrementieren + + bit(SF_mant_shift) // letzte Stelle erhöhen, dabei evtl. Exponenten incrementieren ); } } } diff --git a/src/float/sfloat/elem/cl_SF_plus.cc b/src/float/sfloat/elem/cl_SF_plus.cc index 2f4fc48..80a319b 100644 --- a/src/float/sfloat/elem/cl_SF_plus.cc +++ b/src/float/sfloat/elem/cl_SF_plus.cc @@ -23,11 +23,11 @@ const cl_SF operator+ (const cl_SF& x1, const cl_SF& x2) // Also e1 >= e2. // Falls e1 - e2 >= 16 + 3, Ergebnis x1. // Schiebe beide Mantissen um 3 Bits nach links (Vorbereitung der Rundung: -// Bei e1-e2=0,1 ist keine Rundung nötig, bei e1-e2>1 ist der Exponent des +// Bei e1-e2=0,1 ist keine Rundung nötig, bei e1-e2>1 ist der Exponent des // Ergebnisses =e1-1, =e1 oder =e1+1. Brauche daher 1 Schutzbit und zwei -// Rundungsbits: 00 exakt, 01 1.Hälfte, 10 exakte Mitte, 11 2.Hälfte.) +// Rundungsbits: 00 exakt, 01 1.Hälfte, 10 exakte Mitte, 11 2.Hälfte.) // Schiebe die Mantisse von x2 um e0-e1 Bits nach rechts. (Dabei die Rundung -// ausführen: Bit 0 ist das logische Oder der Bits 0,-1,-2,...) +// ausführen: Bit 0 ist das logische Oder der Bits 0,-1,-2,...) // Falls x1,x2 selbes Vorzeichen haben: Addiere dieses zur Mantisse von x1. // Falls x1,x2 verschiedenes Vorzeichen haben: Subtrahiere dieses von der // Mantisse von x1. <0 -> (Es war e1=e2) Vertausche die Vorzeichen, negiere. @@ -74,10 +74,10 @@ const cl_SF operator+ (const cl_SF& x1, const cl_SF& x2) { mant1 = mant1 + mant2; } // mant1 = Ergebnis-Mantisse >0, sign1 = Ergebnis-Vorzeichen, // exp1 = Ergebnis-Exponent. - // Außerdem: Bei expdiff=0,1 sind die zwei letzten Bits von mant1 Null, + // Außerdem: Bei expdiff=0,1 sind die zwei letzten Bits von mant1 Null, // bei expdiff>=2 ist mant1 >= 2^(SF_mant_len+2). // Stets ist mant1 < 2^(SF_mant_len+5). (Daher werden die 2 Rundungsbits - // nachher um höchstens eine Position nach links geschoben werden.) + // nachher um höchstens eine Position nach links geschoben werden.) // [Knuth, S.201, leicht modifiziert: // N1. m>=1 -> goto N4. // N2. [Hier m<1] m>=1/2 -> goto N5. @@ -116,8 +116,8 @@ const cl_SF operator+ (const cl_SF& x1, const cl_SF& x2) // aufrunden { mant1 = mant1+1; if (mant1 >= bit(SF_mant_len+1)) - // Bei Überlauf während der Rundung nochmals rechts schieben - // (Runden ist hier überflüssig): + // Bei Überlauf während der Rundung nochmals rechts schieben + // (Runden ist hier überflüssig): { mant1 = mant1>>1; exp1 = exp1+1; } // Mantisse rechts schieben } }// Runden fertig diff --git a/src/float/sfloat/elem/cl_SF_scale.cc b/src/float/sfloat/elem/cl_SF_scale.cc index 842b5fa..a42891b 100644 --- a/src/float/sfloat/elem/cl_SF_scale.cc +++ b/src/float/sfloat/elem/cl_SF_scale.cc @@ -18,8 +18,8 @@ const cl_SF scale_float (const cl_SF& x, sintC delta) { // Methode: // x=0.0 -> x als Ergebnis - // delta muß betragsmäßig <= SF_exp_high-SF_exp_low sein. - // Neues SF mit um delta vergrößertem Exponenten bilden. + // delta muß betragsmäßig <= SF_exp_high-SF_exp_low sein. + // Neues SF mit um delta vergrößertem Exponenten bilden. // x entpacken: var cl_signean sign; var sintL exp; diff --git a/src/float/sfloat/elem/cl_SF_scale_I.cc b/src/float/sfloat/elem/cl_SF_scale_I.cc index c11ba5d..d8011b8 100644 --- a/src/float/sfloat/elem/cl_SF_scale_I.cc +++ b/src/float/sfloat/elem/cl_SF_scale_I.cc @@ -19,8 +19,8 @@ const cl_SF scale_float (const cl_SF& x, const cl_I& delta) { // Methode: // x=0.0 -> x als Ergebnis - // delta muß ein Fixnum betragsmäßig <= SF_exp_high-SF_exp_low sein. - // Neues SF mit um delta vergrößertem Exponenten bilden. + // delta muß ein Fixnum betragsmäßig <= SF_exp_high-SF_exp_low sein. + // Neues SF mit um delta vergrößertem Exponenten bilden. // x entpacken: var cl_signean sign; var sintL exp; diff --git a/src/float/transcendental/cl_F_atanhx.cc b/src/float/transcendental/cl_F_atanhx.cc index 3faf4b9..b3abe09 100644 --- a/src/float/transcendental/cl_F_atanhx.cc +++ b/src/float/transcendental/cl_F_atanhx.cc @@ -32,8 +32,8 @@ namespace cln { // (denn bei e<=-d/2 ist x^2 < 2^(-d), also // 1 <= atanh(x)/x = 1+x^2/3+x^4/5+... < 1+x^2/2 < 1+2^(-d-1) < 1+2^(-d), // also ist atanh(x)/x, auf d Bits gerundet, gleich 1.0). -// Bei großem d verwende die Formel ln((1+x)/(1-x))/2 (asymptotisch schneller), -// aber erhöhe die Genauigkeit, so daß beim Bilden von 1+x keine Bits verloren +// Bei großem d verwende die Formel ln((1+x)/(1-x))/2 (asymptotisch schneller), +// aber erhöhe die Genauigkeit, so daß beim Bilden von 1+x keine Bits verloren // gehen. // Bei e<=-sqrt(d) verwende die Potenzreihe // atanh(x)/x = sum(j=0..inf,(x^2)^j/(2j+1)): @@ -61,20 +61,20 @@ const cl_LF atanhx (const cl_LF& x) var cl_LF xx = extend(x,TheLfloat(x)->len+ceiling((uintE)(-e),intDsize)); return cl_float(scale_float(ln((1+xx)/(1-xx)),-1),x); } - var uintL k = 0; // Rekursionszähler k:=0 + var uintL k = 0; // Rekursionszähler k:=0 // Bei e <= -1-limit_slope*floor(sqrt(d)) kann die Potenzreihe // angewandt werden. limit_slope = 1.0 ist schlecht (ca. 15% zu // schlecht). Ein guter Wert ist: - // für naive1: limit_scope = 0.625 = 5/8, - // für naive2: limit_scope = 0.4 = 13/32. + // für naive1: limit_scope = 0.625 = 5/8, + // für naive2: limit_scope = 0.4 = 13/32. var uintL sqrt_d = floor(isqrtC(d)*13,32); // limit_slope*floor(sqrt(d)) var cl_LF xx = x; if (e >= (sintL)(-sqrt_d)) { - // e > -1-limit_slope*floor(sqrt(d)) -> muß |x| verkleinern. + // e > -1-limit_slope*floor(sqrt(d)) -> muß |x| verkleinern. var sintL e_limit = 1+sqrt_d; // 1+limit_slope*floor(sqrt(d)) xx = recip(abs(xx)); // 1/|x| do { - // nächstes x nach der Formel x := x+sqrt(x^2 - 1) berechnen: + // nächstes x nach der Formel x := x+sqrt(x^2 - 1) berechnen: xx = sqrt(square(xx) + cl_float(-1,xx)) + xx; k = k+1; } until (float_exponent(xx) > e_limit); @@ -133,18 +133,18 @@ const cl_F atanhx (const cl_F& x) var sintE e = float_exponent(x); if (e <= (sintC)(-d)>>1) // e <= -d/2 <==> e <= -ceiling(d/2) return x; // ja -> x als Ergebnis - var uintL k = 0; // Rekursionszähler k:=0 + var uintL k = 0; // Rekursionszähler k:=0 // Bei e <= -1-limit_slope*floor(sqrt(d)) kann die Potenzreihe // angewandt werden. limit_slope = 1.0 ist schlecht (ca. 15% zu // schlecht). Ein guter Wert ist limit_scope = 0.625 = 5/8. var uintL sqrt_d = floor(isqrtC(d)*5,8); // limit_slope*floor(sqrt(d)) var cl_F xx = x; if (e >= (sintL)(-sqrt_d)) { - // e > -1-limit_slope*floor(sqrt(d)) -> muß |x| verkleinern. + // e > -1-limit_slope*floor(sqrt(d)) -> muß |x| verkleinern. var sintL e_limit = 1+sqrt_d; // 1+limit_slope*floor(sqrt(d)) xx = recip(abs(xx)); // 1/|x| do { - // nächstes x nach der Formel x := x+sqrt(x^2 - 1) berechnen: + // nächstes x nach der Formel x := x+sqrt(x^2 - 1) berechnen: xx = sqrt(square(xx) + cl_float(-1,xx)) + xx; k = k+1; } until (float_exponent(xx) > e_limit); diff --git a/src/float/transcendental/cl_F_atanx.cc b/src/float/transcendental/cl_F_atanx.cc index ee51130..f17fd49 100644 --- a/src/float/transcendental/cl_F_atanx.cc +++ b/src/float/transcendental/cl_F_atanx.cc @@ -54,21 +54,21 @@ static const cl_LF atanx_naive (const cl_LF& x) var sintE e = float_exponent(x); if (e <= (sintC)(-d)>>1) // e <= -d/2 <==> e <= -ceiling(d/2) return x; // ja -> x als Ergebnis - var uintL k = 0; // Rekursionszähler k:=0 + var uintL k = 0; // Rekursionszähler k:=0 // Bei e <= -1-limit_slope*floor(sqrt(d)) kann die Potenzreihe // angewandt werden. limit_slope = 1.0 ist schlecht (ca. 20% zu // schlecht). Ein guter Wert ist: - // Für naive1: limit_scope = 0.5. - // Für naive2: limit_scope = 0.375 (ca. 0.5 für kleine len, 0.35 für - // große len). + // Für naive1: limit_scope = 0.5. + // Für naive2: limit_scope = 0.375 (ca. 0.5 für kleine len, 0.35 für + // große len). var uintL sqrt_d = floor(isqrtC(d)*3,8); // limit_slope*floor(sqrt(d)) var cl_LF xx = x; if (e >= (sintL)(-sqrt_d)) { - // e > -1-limit_slope*floor(sqrt(d)) -> muß |x| verkleinern. + // e > -1-limit_slope*floor(sqrt(d)) -> muß |x| verkleinern. var sintL e_limit = 1+sqrt_d; // 1+limit_slope*floor(sqrt(d)) xx = recip(abs(xx)); // 1/|x| do { - // nächstes x nach der Formel x := x+sqrt(x^2 + 1) berechnen: + // nächstes x nach der Formel x := x+sqrt(x^2 + 1) berechnen: xx = sqrt(square(xx) + cl_float(1,xx)) + xx; k = k+1; } until (float_exponent(xx) > e_limit); @@ -123,18 +123,18 @@ static const cl_F atanx_naive (const cl_F& x) var sintE e = float_exponent(x); if (e <= (sintC)(-d)>>1) // e <= -d/2 <==> e <= -ceiling(d/2) return x; // ja -> x als Ergebnis - var uintL k = 0; // Rekursionszähler k:=0 + var uintL k = 0; // Rekursionszähler k:=0 var uintL sqrt_d = floor(isqrtC(d),2); // limit_slope*floor(sqrt(d)) // Bei e <= -1-limit_slope*floor(sqrt(d)) kann die Potenzreihe // angewandt werden. limit_slope = 1.0 ist schlecht (ca. 20% zu // schlecht). Ein guter Wert ist limit_scope = 0.5. var cl_F xx = x; if (e >= (sintL)(-sqrt_d)) { - // e > -1-limit_slope*floor(sqrt(d)) -> muß |x| verkleinern. + // e > -1-limit_slope*floor(sqrt(d)) -> muß |x| verkleinern. var sintL e_limit = 1+sqrt_d; // 1+limit_slope*floor(sqrt(d)) xx = recip(abs(xx)); // 1/|x| do { - // nächstes x nach der Formel x := x+sqrt(x^2 + 1) berechnen: + // nächstes x nach der Formel x := x+sqrt(x^2 + 1) berechnen: xx = sqrt(square(xx) + cl_float(1,xx)) + xx; k = k+1; } until (float_exponent(xx) > e_limit); diff --git a/src/float/transcendental/cl_F_cos.cc b/src/float/transcendental/cl_F_cos.cc index 1cb5a5e..7c04470 100644 --- a/src/float/transcendental/cl_F_cos.cc +++ b/src/float/transcendental/cl_F_cos.cc @@ -20,8 +20,8 @@ namespace cln { const cl_F cos (const cl_F& x) { // Methode: -// Genauigkeit erhöhen, -// (q,r) := (round x (float pi x)), so daß |r|<=pi/2. +// Genauigkeit erhöhen, +// (q,r) := (round x (float pi x)), so daß |r|<=pi/2. // e := Exponent aus (decode-float r), d := (float-digits r) // Bei r=0.0 oder e<=-d/2 liefere 1.0 // (denn bei e<=-d/2 ist r^2/2 < 2^(-d)/2 = 2^(-d-1), also @@ -31,7 +31,7 @@ const cl_F cos (const cl_F& x) // (sin(s)/s)^2 errechnen, cos(r) = 1-r*s*(sin(s)/s)^2 errechnen. // Falls q ungerade: Vorzeichenwechsel. - // Rechengenauigkeit erhöhen und durch pi dividieren: + // Rechengenauigkeit erhöhen und durch pi dividieren: var cl_F cos_r; if (longfloatp(x)) { DeclareType(cl_LF,x); diff --git a/src/float/transcendental/cl_F_cosh.cc b/src/float/transcendental/cl_F_cosh.cc index a64b733..b6af726 100644 --- a/src/float/transcendental/cl_F_cosh.cc +++ b/src/float/transcendental/cl_F_cosh.cc @@ -19,7 +19,7 @@ namespace cln { const cl_F cosh (const cl_F& x) { // Methode: -// Genauigkeit erhöhen, +// Genauigkeit erhöhen, // e := Exponent aus (decode-float x), d := (float-digits x) // falls x=0.0 oder e<=(1-d)/2 liefere 1.0 // (denn bei e<=(1-d)/2 ist 1 <= cosh(x) = 1+x^2/2+... < 1+2^(-d), @@ -37,7 +37,7 @@ const cl_F cosh (const cl_F& x) var uintC d = float_digits(x); if (e <= (1-(sintC)d)>>1) // e <= (1-d)/2 <==> e <= -ceiling((d-1)/2) ? return cl_float(1,x); // ja -> 1.0 als Ergebnis - // Rechengenauigkeit erhöhen + // Rechengenauigkeit erhöhen if (longfloatp(x)) { DeclareType(cl_LF,x); #if 0 diff --git a/src/float/transcendental/cl_F_coshsinh.cc b/src/float/transcendental/cl_F_coshsinh.cc index 55b9087..f0df7b7 100644 --- a/src/float/transcendental/cl_F_coshsinh.cc +++ b/src/float/transcendental/cl_F_coshsinh.cc @@ -19,7 +19,7 @@ namespace cln { const cosh_sinh_t cosh_sinh (const cl_F& x) { // Methode: -// Genauigkeit erhöhen, +// Genauigkeit erhöhen, // e := Exponent aus (decode-float x), d := (float-digits x) // falls x=0.0 oder e<=(1-d)/2 liefere (1.0,x) // (denn bei e<=(1-d)/2 ist @@ -39,7 +39,7 @@ const cosh_sinh_t cosh_sinh (const cl_F& x) if (zerop(x) || (e <= (1-(sintC)float_digits(x))>>1)) // e <= (1-d)/2 <==> e <= -ceiling((d-1)/2) return cosh_sinh_t(cl_float(1,x),x); - // Rechengenauigkeit erhöhen + // Rechengenauigkeit erhöhen if (longfloatp(x)) { DeclareType(cl_LF,x); #if 0 diff --git a/src/float/transcendental/cl_F_cossin.cc b/src/float/transcendental/cl_F_cossin.cc index 486bacd..2734ae1 100644 --- a/src/float/transcendental/cl_F_cossin.cc +++ b/src/float/transcendental/cl_F_cossin.cc @@ -20,8 +20,8 @@ namespace cln { const cos_sin_t cos_sin (const cl_F& x) { // Methode: -// Genauigkeit erhöhen, -// (q,r) := (round x (float pi/2 x)), so daß |r|<=pi/4. +// Genauigkeit erhöhen, +// (q,r) := (round x (float pi/2 x)), so daß |r|<=pi/4. // y:=(sin(r)/r)^2 errechnen. // cos(r) berechnen: // e := Exponent aus (decode-float r), d := (float-digits r) @@ -37,7 +37,7 @@ const cos_sin_t cos_sin (const cl_F& x) // Falls q = 2 mod 4: (-cos(r), -sin(r)) // Falls q = 3 mod 4: (sin(r), -cos(r)) - // Rechengenauigkeit erhöhen und durch pi/2 dividieren: + // Rechengenauigkeit erhöhen und durch pi/2 dividieren: var cl_F cos_r; var cl_F sin_r; var cl_I q; diff --git a/src/float/transcendental/cl_F_exp.cc b/src/float/transcendental/cl_F_exp.cc index 0898a19..b2c084b 100644 --- a/src/float/transcendental/cl_F_exp.cc +++ b/src/float/transcendental/cl_F_exp.cc @@ -44,11 +44,11 @@ const cl_F exp (const cl_F& x) { // Methode: // d := (float-digits x), -// Genauigkeit um sqrt(d)+max(integer-length(e)) Bits erhöhen, +// Genauigkeit um sqrt(d)+max(integer-length(e)) Bits erhöhen, // (q,r) := (floor x ln(2)) // Ergebnis ist exp(q*ln(2)+r) = (scale-float exp(r) q). - // Rechengenauigkeit erhöhen und durch ln(2) dividieren: + // Rechengenauigkeit erhöhen und durch ln(2) dividieren: if (longfloatp(x) && (TheLfloat(x)->len >= 84)) { DeclareType(cl_LF,x); var cl_LF_div_t q_r = cl_floor_ln2(extend(x,TheLfloat(x)->len+1)); diff --git a/src/float/transcendental/cl_F_expx.cc b/src/float/transcendental/cl_F_expx.cc index a42effd..ff28ef7 100644 --- a/src/float/transcendental/cl_F_expx.cc +++ b/src/float/transcendental/cl_F_expx.cc @@ -43,7 +43,7 @@ namespace cln { const cl_LF expx_naive (const cl_LF& x) { // Methode: -// wie oben, mit adaptiver Genauigkeit während der Potenzreihen-Summation. +// wie oben, mit adaptiver Genauigkeit während der Potenzreihen-Summation. if (zerop(x)) return cl_float(1,x); var uintL actuallen = TheLfloat(x)->len; @@ -52,13 +52,13 @@ const cl_LF expx_naive (const cl_LF& x) if (e < -(sintC)d) // e < -d ? return cl_float(1,x); // ja -> 1.0 als Ergebnis { Mutable(cl_LF,x); - var uintE k = 0; // Rekursionszähler k:=0 + var uintE k = 0; // Rekursionszähler k:=0 // Bei e <= -1-limit_slope*floor(sqrt(d)) kann die Potenzreihe // angewandt werden. limit_slope = 1.0 ist nicht schlecht, // auch im Bereich d = ca. 800. var sintL e_limit = -1-isqrtC(d); // -1-floor(sqrt(d)) if (e > e_limit) { - // e > -1-floor(sqrt(d)) -> muß |x| verkleinern. + // e > -1-floor(sqrt(d)) -> muß |x| verkleinern. k = e - e_limit; x = scale_float(x,-(sintE)k); // x := x/2^k // Neuer Exponent = e-k = e_limit. @@ -98,16 +98,16 @@ const cl_F expx_naive (const cl_F& x) if (e < -(sintC)d) // e < -d ? return cl_float(1,x); // ja -> 1.0 als Ergebnis { Mutable(cl_F,x); - var uintE k = 0; // Rekursionszähler k:=0 + var uintE k = 0; // Rekursionszähler k:=0 // Bei e <= -1-limit_slope*floor(sqrt(d)) kann die Potenzreihe - // angewandt werden. limit_slope = 1.0 ist nicht schlecht. Für + // angewandt werden. limit_slope = 1.0 ist nicht schlecht. Für // d > 1600 scheint der Bereich 2.0 <= limit_slope <= 2.6 am besten - // zu sein (mit bis zu 15% Beschleunigung gegenüber limit_slope = 1.0), + // zu sein (mit bis zu 15% Beschleunigung gegenüber limit_slope = 1.0), // aber in diesem Bereich rechnen wir gar nicht. - // Wir wählen limit_slope = 1.5. + // Wir wählen limit_slope = 1.5. var sintL e_limit = -1-floor(isqrtC(d)*3,2); // -1-floor(sqrt(d)) if (e > e_limit) { - // e > -1-floor(sqrt(d)) -> muß |x| verkleinern. + // e > -1-floor(sqrt(d)) -> muß |x| verkleinern. k = e - e_limit; x = scale_float(x,-(sintE)k); // x := x/2^k // Neuer Exponent = e-k = e_limit. diff --git a/src/float/transcendental/cl_F_ln.cc b/src/float/transcendental/cl_F_ln.cc index adc8a74..56e9beb 100644 --- a/src/float/transcendental/cl_F_ln.cc +++ b/src/float/transcendental/cl_F_ln.cc @@ -22,12 +22,12 @@ const cl_F ln (const cl_F& x) { // Methode: // d := (float-digits x), -// Genauigkeit um sqrt(d)+max(integer-length(e)) Bits erhöhen, -// (m,e) := (decode-float x), so daß 1/2 <= m < 1. -// m<2/3 -> m:=2m, e:=e-1, so daß 2/3 <= m <= 4/3. +// Genauigkeit um sqrt(d)+max(integer-length(e)) Bits erhöhen, +// (m,e) := (decode-float x), so daß 1/2 <= m < 1. +// m<2/3 -> m:=2m, e:=e-1, so daß 2/3 <= m <= 4/3. // ln(m) errechnen, ln(x)=ln(m)+e*ln(2) als Ergebnis. - // Rechengenauigkeit erhöhen und m,e,s bestimmen: + // Rechengenauigkeit erhöhen und m,e,s bestimmen: if (longfloatp(x) && (TheLfloat(x)->len >= 110)) { DeclareType(cl_LF,x); var decoded_lfloat m_e_s = decode_float(extend(x,TheLfloat(x)->len+1)); diff --git a/src/float/transcendental/cl_F_lnx.cc b/src/float/transcendental/cl_F_lnx.cc index d09b8da..e8b1c4b 100644 --- a/src/float/transcendental/cl_F_lnx.cc +++ b/src/float/transcendental/cl_F_lnx.cc @@ -53,16 +53,16 @@ const cl_LF lnx_naive (const cl_LF& x) if (e <= -(sintC)d) // e <= -d ? return y; // ja -> y als Ergebnis { Mutable(cl_LF,x); - var uintL k = 0; // Rekursionszähler k:=0 + var uintL k = 0; // Rekursionszähler k:=0 // Bei e <= -1-limit_slope*floor(sqrt(d)) kann die Potenzreihe // angewandt werden. - // Wähle für ln(1+y), naive1: limit_slope = 1.0, - // für ln(1+y), naive2: limit_slope = 11/16 = 0.7, - // für atanh(z), naive1: limit_slope = 0.6, - // für atanh(z), naive1: limit_slope = 0.5. + // Wähle für ln(1+y), naive1: limit_slope = 1.0, + // für ln(1+y), naive2: limit_slope = 11/16 = 0.7, + // für atanh(z), naive1: limit_slope = 0.6, + // für atanh(z), naive1: limit_slope = 0.5. var sintL e_limit = -1-floor(isqrtC(d),2); // -1-floor(sqrt(d)) while (e > e_limit) { - // e > -1-floor(sqrt(d)) -> muß |y| verkleinern. + // e > -1-floor(sqrt(d)) -> muß |y| verkleinern. x = sqrt(x); // x := (sqrt x) y = x-cl_float(1,x); // y := (- x 1) und e = float_exponent(y); // e neu berechnen @@ -151,11 +151,11 @@ const cl_F lnx_naive (const cl_F& x) if (e <= -(sintC)d) // e <= -d ? return y; // ja -> y als Ergebnis { Mutable(cl_F,x); - var uintL k = 0; // Rekursionszähler k:=0 + var uintL k = 0; // Rekursionszähler k:=0 // Bei e <= -1-floor(sqrt(d)) kann die Potenzreihe angewandt werden. var sintL e_limit = -1-isqrtC(d); // -1-floor(sqrt(d)) while (e > e_limit) { - // e > -1-floor(sqrt(d)) -> muß |y| verkleinern. + // e > -1-floor(sqrt(d)) -> muß |y| verkleinern. x = sqrt(x); // x := (sqrt x) y = x-cl_float(1,x); // y := (- x 1) und e = float_exponent(y); // e neu berechnen diff --git a/src/float/transcendental/cl_F_roundpi.cc b/src/float/transcendental/cl_F_roundpi.cc index df8959b..71e535a 100644 --- a/src/float/transcendental/cl_F_roundpi.cc +++ b/src/float/transcendental/cl_F_roundpi.cc @@ -14,7 +14,7 @@ namespace cln { const cl_F_div_t cl_round_pi (const cl_F& x) { if (float_exponent(x) <= 0) - // Exponent <=0 -> |x|<1 -> |x/pi| < 1/2, also Division unnötig + // Exponent <=0 -> |x|<1 -> |x/pi| < 1/2, also Division unnötig return cl_F_div_t(0,x); // Quotient 0, Rest x else // x durch pi (mit hinreichender Genauigkeit) dividieren diff --git a/src/float/transcendental/cl_F_roundpi2.cc b/src/float/transcendental/cl_F_roundpi2.cc index 671cdcf..0e20c19 100644 --- a/src/float/transcendental/cl_F_roundpi2.cc +++ b/src/float/transcendental/cl_F_roundpi2.cc @@ -14,7 +14,7 @@ namespace cln { const cl_F_div_t cl_round_pi2 (const cl_F& x) { if (float_exponent(x) < 0) - // Exponent <0 -> |x|<1/2 -> |x/(pi/2)| < 1/2, also Division unnötig + // Exponent <0 -> |x|<1/2 -> |x/(pi/2)| < 1/2, also Division unnötig return cl_F_div_t(0,x); // Quotient 0, Rest x else // x durch pi/2 (mit hinreichender Genauigkeit) dividieren diff --git a/src/float/transcendental/cl_F_sin.cc b/src/float/transcendental/cl_F_sin.cc index 0c31bc4..3b0d33e 100644 --- a/src/float/transcendental/cl_F_sin.cc +++ b/src/float/transcendental/cl_F_sin.cc @@ -20,8 +20,8 @@ namespace cln { const cl_F sin (const cl_F& x) { // Methode: -// Genauigkeit erhöhen, -// (q,r) := (round x (float pi/2 x)), so daß |r|<=pi/4. +// Genauigkeit erhöhen, +// (q,r) := (round x (float pi/2 x)), so daß |r|<=pi/4. // y:=(sin(r)/r)^2 errechnen. // Falls q gerade: // sin(r) berechnen: r*sqrt(y). @@ -35,7 +35,7 @@ const cl_F sin (const cl_F& x) // Sonst sqrt(1-r^2*y). // Falls q == 2,3 mod 4, Vorzeichenwechsel. - // Rechengenauigkeit erhöhen und durch pi/2 dividieren: + // Rechengenauigkeit erhöhen und durch pi/2 dividieren: var cl_F z; var cl_I q; if (longfloatp(x)) { diff --git a/src/float/transcendental/cl_F_sinh.cc b/src/float/transcendental/cl_F_sinh.cc index 21d37db..21c9d4c 100644 --- a/src/float/transcendental/cl_F_sinh.cc +++ b/src/float/transcendental/cl_F_sinh.cc @@ -19,14 +19,14 @@ namespace cln { const cl_F sinh (const cl_F& x) { // Methode: -// Genauigkeit erhöhen, +// Genauigkeit erhöhen, // e := Exponent aus (decode-float x) // falls e<0: (sinh(x)/x)^2 errechnen, Wurzel ziehen, mit x multiplizieren. // falls e>=0: y:=exp(x) errechnen, (scale-float (- y (/ y)) -1) bilden. if (float_exponent(x) < 0) { // Exponent e abtesten // e<0 - // Rechengenauigkeit erhöhen + // Rechengenauigkeit erhöhen if (longfloatp(x)) { DeclareType(cl_LF,x); #if 0 @@ -39,8 +39,8 @@ const cl_F sinh (const cl_F& x) if ((TheLfloat(x)->len >= 500) && (float_exponent(x) > (-(sintC)float_digits(x))>>1)) { // verwende exp(x), schneller als cl_coshsinh_ratseries - // (aber nur bei 0 > e > -d/2, denn wir müssen, um - // Auslöschung zu verhindern, |e| Bits dazunehmen) + // (aber nur bei 0 > e > -d/2, denn wir müssen, um + // Auslöschung zu verhindern, |e| Bits dazunehmen) var cl_LF xx = extend(x,TheLfloat(x)->len+ceiling((uintE)(-float_exponent(x)),intDsize)); var cl_F y = exp(xx); var cl_F z = scale_float(y - recip(y), -1); // (/ (- y (/ y)) 2) diff --git a/src/float/transcendental/cl_F_sinhx.cc b/src/float/transcendental/cl_F_sinhx.cc index d2b61e6..04ba0d2 100644 --- a/src/float/transcendental/cl_F_sinhx.cc +++ b/src/float/transcendental/cl_F_sinhx.cc @@ -42,7 +42,7 @@ const cl_F sinhxbyx_naive (const cl_F& x) // berechne rekursiv z:=(sinh(y)/y)^2 und liefere z*(1+y^2*z). // [Die Grenze sqrt(d) ergibt sich so: // Man braucht bei der Potenzreihe mit x=2^-k etwa j Glieder, mit -// k*j*ln 2 + j*(ln j - 1) = d, und der Aufwand beträgt etwa 2.8*(j/2) +// k*j*ln 2 + j*(ln j - 1) = d, und der Aufwand beträgt etwa 2.8*(j/2) // Multiplikationen von d-Bit-Zahlen. Bei Halbierungen bis x=2^-k ist der // Gesamtaufwand etwa 2*(k+e)+1.4*j(k). Dieses minimieren nach k: Soll sein // -1.4 = d/dk j(k) = (d/dj k(j))^-1 = - j^2/(d+j)*ln 2, also j^2=2(d+j), @@ -57,10 +57,10 @@ const cl_F sinhxbyx_naive (const cl_F& x) return cl_float(1,x); // ja -> 1.0 als Ergebnis { Mutable(cl_F,x); // Bei e <= -1-limit_slope*floor(sqrt(d)) kann die Potenzreihe - // angewandt werden. Wähle limit_slope = 13/32 = 0.4. + // angewandt werden. Wähle limit_slope = 13/32 = 0.4. var sintL e_limit = -1-floor(isqrtC(d)*13,32); // -1-floor(sqrt(d)) if (e > e_limit) { - // e > -1-limit_slope*floor(sqrt(d)) -> muß |x| verkleinern. + // e > -1-limit_slope*floor(sqrt(d)) -> muß |x| verkleinern. x = scale_float(x,e_limit-e); // Neuer Exponent = e_limit. } @@ -105,7 +105,7 @@ const cl_LF sinhx_naive (const cl_LF& x) // berechne rekursiv z:=sinh(y)^2 und liefere 4*z*(1+z) = (1+2*z)^2-1. // [Die Grenze sqrt(d) ergibt sich so: // Man braucht bei der Potenzreihe mit x=2^-k etwa j Glieder, mit -// k*j*ln 2 + j*(ln j - 1) = d, und der Aufwand beträgt etwa 2.8*(j/2) +// k*j*ln 2 + j*(ln j - 1) = d, und der Aufwand beträgt etwa 2.8*(j/2) // Multiplikationen von d-Bit-Zahlen. Bei Halbierungen bis x=2^-k ist der // Gesamtaufwand etwa 2*(k+e)+1.4*j(k). Dieses minimieren nach k: Soll sein // -1.4 = d/dk j(k) = (d/dj k(j))^-1 = - j^2/(d+j)*ln 2, also j^2=2(d+j), @@ -122,11 +122,11 @@ const cl_LF sinhx_naive (const cl_LF& x) { Mutable(cl_LF,x); var sintE ee = e; // Bei e <= -1-limit_slope*floor(sqrt(d)) kann die Potenzreihe - // angewandt werden. Ein guter Wert für naive1 ist limit_slope = 0.6, - // für naive3 aber limit_slope = 0.5. + // angewandt werden. Ein guter Wert für naive1 ist limit_slope = 0.6, + // für naive3 aber limit_slope = 0.5. var sintL e_limit = -1-floor(isqrtC(d),2); // -1-floor(sqrt(d)) if (e > e_limit) { - // e > -1-limit_slope*floor(sqrt(d)) -> muß |x| verkleinern. + // e > -1-limit_slope*floor(sqrt(d)) -> muß |x| verkleinern. x = scale_float(x,e_limit-e); ee = e_limit; // Neuer Exponent = e_limit. } diff --git a/src/float/transcendental/cl_F_sinx.cc b/src/float/transcendental/cl_F_sinx.cc index 430cfed..102e4c4 100644 --- a/src/float/transcendental/cl_F_sinx.cc +++ b/src/float/transcendental/cl_F_sinx.cc @@ -42,7 +42,7 @@ const cl_F sinxbyx_naive (const cl_F& x) // berechne rekursiv z:=(sin(y)/y)^2 und liefere z*(1-y^2*z). // [Die Grenze sqrt(d) ergibt sich so: // Man braucht bei der Potenzreihe mit x=2^-k etwa j Glieder, mit -// k*j*ln 2 + j*(ln j - 1) = d, und der Aufwand beträgt etwa 2.8*(j/2) +// k*j*ln 2 + j*(ln j - 1) = d, und der Aufwand beträgt etwa 2.8*(j/2) // Multiplikationen von d-Bit-Zahlen. Bei Halbierungen bis x=2^-k ist der // Gesamtaufwand etwa 2*(k+e)+1.4*j(k). Dieses minimieren nach k: Soll sein // -1.4 = d/dk j(k) = (d/dj k(j))^-1 = - j^2/(d+j)*ln 2, also j^2=2(d+j), @@ -66,10 +66,10 @@ const cl_F sinxbyx_naive (const cl_F& x) // 50 0.35-0.40 // 100 0.40-0.45 // 200 0.40-0.45 - // Wähle limit_slope = 13/32 = 0.4. + // Wähle limit_slope = 13/32 = 0.4. var sintL e_limit = -1-floor(isqrtC(d)*13,32); // -1-floor(sqrt(d)) if (e > e_limit) { - // e > -1-limit_slope*floor(sqrt(d)) -> muß |x| verkleinern. + // e > -1-limit_slope*floor(sqrt(d)) -> muß |x| verkleinern. x = scale_float(x,e_limit-e); // Neuer Exponent = e_limit. } @@ -114,7 +114,7 @@ const cl_LF sinx_naive (const cl_LF& x) // berechne rekursiv z:=sin(y)^2 und liefere 4*z*(1-z) = 1-(1-2*z)^2. // [Die Grenze sqrt(d) ergibt sich so: // Man braucht bei der Potenzreihe mit x=2^-k etwa j Glieder, mit -// k*j*ln 2 + j*(ln j - 1) = d, und der Aufwand beträgt etwa 2.8*(j/2) +// k*j*ln 2 + j*(ln j - 1) = d, und der Aufwand beträgt etwa 2.8*(j/2) // Multiplikationen von d-Bit-Zahlen. Bei Halbierungen bis x=2^-k ist der // Gesamtaufwand etwa 2*(k+e)+1.4*j(k). Dieses minimieren nach k: Soll sein // -1.4 = d/dk j(k) = (d/dj k(j))^-1 = - j^2/(d+j)*ln 2, also j^2=2(d+j), @@ -132,11 +132,11 @@ const cl_LF sinx_naive (const cl_LF& x) var sintE ee = e; // Bei e <= -1-limit_slope*floor(sqrt(d)) kann die Potenzreihe // angewandt werden. limit_slope = 1.0 ist schlecht (ca. 10% zu - // schlecht). Ein guter Wert für naive1 ist limit_slope = 0.6, - // für naive3 aber limit_slope = 0.5. + // schlecht). Ein guter Wert für naive1 ist limit_slope = 0.6, + // für naive3 aber limit_slope = 0.5. var sintL e_limit = -1-floor(isqrtC(d),2); // -1-floor(sqrt(d)) if (e > e_limit) { - // e > -1-limit_slope*floor(sqrt(d)) -> muß |x| verkleinern. + // e > -1-limit_slope*floor(sqrt(d)) -> muß |x| verkleinern. x = scale_float(x,e_limit-e); ee = e_limit; // Neuer Exponent = e_limit. } diff --git a/src/float/transcendental/cl_F_tran.h b/src/float/transcendental/cl_F_tran.h index 29a7a87..daa5a95 100644 --- a/src/float/transcendental/cl_F_tran.h +++ b/src/float/transcendental/cl_F_tran.h @@ -45,24 +45,24 @@ struct cl_LF_cosh_sinh_t { }; extern const cl_LF_cosh_sinh_t cl_coshsinh_aux (const cl_I& p, uintE lq, uintC len); -// atanhx(x) liefert zu einem Float x (betragsmäßig <1/2) atanh(x) als Float. +// atanhx(x) liefert zu einem Float x (betragsmäßig <1/2) atanh(x) als Float. extern const cl_F atanhx (const cl_F& x); -// atanx(x) liefert zu einem Float x (betragsmäßig <=1) atan(x) als Float. +// atanx(x) liefert zu einem Float x (betragsmäßig <=1) atan(x) als Float. extern const cl_F atanx (const cl_F& x); -// sinx(x) liefert zu einem Float x (betragsmäßig <1) sin(x)^2 als Float. -// sinxbyx(x) liefert zu einem Float x (betragsmäßig <1) (sin(x)/x)^2 als Float. +// sinx(x) liefert zu einem Float x (betragsmäßig <1) sin(x)^2 als Float. +// sinxbyx(x) liefert zu einem Float x (betragsmäßig <1) (sin(x)/x)^2 als Float. extern const cl_LF sinx_naive (const cl_LF& x); // requires cl_F_extendsqrt extern const cl_F sinxbyx_naive (const cl_F& x); // requires cl_F_extendsqrt -// (cos(x),sin(x)) für ein Long-Float x (betragsmäßig <1). +// (cos(x),sin(x)) für ein Long-Float x (betragsmäßig <1). extern const cl_LF_cos_sin_t cl_cossin_ratseries (const cl_LF& x); // requires extend by 1 -// sinhx(x) liefert zu einem Float x (betragsmäßig <1) sinh(x)^2 als Float. -// sinhxbyx(x) liefert zu einem Float x (betragsmäßig <1) (sinh(x)/x)^2 als Float. +// sinhx(x) liefert zu einem Float x (betragsmäßig <1) sinh(x)^2 als Float. +// sinhxbyx(x) liefert zu einem Float x (betragsmäßig <1) (sinh(x)/x)^2 als Float. extern const cl_LF sinhx_naive (const cl_LF& x); // requires cl_F_extendsqrt extern const cl_F sinhxbyx_naive (const cl_F& x); // requires cl_F_extendsqrt -// (cosh(x),sinh(x)) für ein Long-Float x (betragsmäßig <1). +// (cosh(x),sinh(x)) für ein Long-Float x (betragsmäßig <1). extern const cl_LF_cosh_sinh_t cl_coshsinh_ratseries (const cl_LF& x); // requires extend by 1 // cl_round_pi(x) dividiert ein Float x mit Rest durch pi. @@ -123,7 +123,7 @@ extern const cl_DF cl_DF_exp1; extern cl_LF cl_LF_exp1; // as long as it has ever been computed extern const cl_LF exp1 (uintC len); // computes it even further -// expx(x) liefert zu einem Float x (betragsmäßig <1) exp(x) als Float. +// expx(x) liefert zu einem Float x (betragsmäßig <1) exp(x) als Float. extern const cl_F expx_naive (const cl_F& x); // requires cl_F_extendsqrtx extern const cl_LF expx_naive (const cl_LF& x); // requires cl_F_extendsqrtx extern const cl_LF expx_ratseries (const cl_LF& x); // requires extend by 1 @@ -142,9 +142,9 @@ extern const cl_DF cl_DF_catalanconst; extern cl_LF cl_LF_catalanconst; // as long as it has ever been computed extern const cl_LF catalanconst (uintC len); // computes it even further -// Zeta-Funktion für s>1 ganzzahlig. +// Zeta-Funktion für s>1 ganzzahlig. extern const cl_LF zeta (int s, uintC len); -// Zeta-Funktion für s=3. +// Zeta-Funktion für s=3. extern const cl_LF zeta3 (uintC len); } // namespace cln diff --git a/src/float/transcendental/cl_LF_catalanconst.cc b/src/float/transcendental/cl_LF_catalanconst.cc index e2acd23..5f3f2ee 100644 --- a/src/float/transcendental/cl_LF_catalanconst.cc +++ b/src/float/transcendental/cl_LF_catalanconst.cc @@ -42,7 +42,7 @@ const cl_LF compute_catalanconst_ramanujan (uintC len) + The(cl_LF)(pi(actuallen)) * ln(cl_I_to_LF(2,actuallen)+sqrt(cl_I_to_LF(3,actuallen))), -3); - return shorten(g,len); // verkürzen und fertig + return shorten(g,len); // verkürzen und fertig } // Bit complexity (N := len): O(N^2). @@ -86,7 +86,7 @@ const cl_LF compute_catalanconst_ramanujan_fast (uintC len) + The(cl_LF)(pi(actuallen)) * ln(cl_I_to_LF(2,actuallen)+sqrt(cl_I_to_LF(3,actuallen))), -3); - return shorten(g,len); // verkürzen und fertig + return shorten(g,len); // verkürzen und fertig } // Bit complexity (N := len): O(log(N)^2*M(N)). @@ -115,7 +115,7 @@ const cl_LF compute_catalanconst_expintegral1 (uintC len) gsum = gsum + gterm; } var cl_LF result = gsum/fsum; - return shorten(result,len); // verkürzen und fertig + return shorten(result,len); // verkürzen und fertig } // Bit complexity (N = len): O(N^2). @@ -147,7 +147,7 @@ const cl_LF compute_catalanconst_expintegral2 (uintC len) args[n].q.~cl_I(); args[n].d.~cl_I(); } - return shorten(result,len); // verkürzen und fertig + return shorten(result,len); // verkürzen und fertig } // Bit complexity (N = len): O(log(N)^2*M(N)). @@ -198,7 +198,7 @@ const cl_LF compute_catalanconst_cvz1 (uintC len) } var cl_LF result = gsum/cl_I_to_LF(1+fsum,actuallen); #endif - return shorten(result,len); // verkürzen und fertig + return shorten(result,len); // verkürzen und fertig } // Bit complexity (N = len): O(N^2). @@ -227,7 +227,7 @@ const cl_LF compute_catalanconst_cvz2 (uintC len) args[n].q.~cl_I(); args[n].d.~cl_I(); } - return shorten(result,len); // verkürzen und fertig + return shorten(result,len); // verkürzen und fertig } // Bit complexity (N = len): O(log(N)^2*M(N)). @@ -300,20 +300,20 @@ const cl_LF compute_catalanconst (uintC len) const cl_LF catalanconst (uintC len) { - var uintC oldlen = TheLfloat(cl_LF_catalanconst)->len; // vorhandene Länge + var uintC oldlen = TheLfloat(cl_LF_catalanconst)->len; // vorhandene Länge if (len < oldlen) return shorten(cl_LF_catalanconst,len); if (len == oldlen) return cl_LF_catalanconst; // TheLfloat(cl_LF_catalanconst)->len um mindestens einen konstanten Faktor - // > 1 wachsen lassen, damit es nicht zu häufig nachberechnet wird: + // > 1 wachsen lassen, damit es nicht zu häufig nachberechnet wird: var uintC newlen = len; oldlen += floor(oldlen,2); // oldlen * 3/2 if (newlen < oldlen) newlen = oldlen; - // gewünschte > vorhandene Länge -> muß nachberechnen: + // gewünschte > vorhandene Länge -> muß nachberechnen: cl_LF_catalanconst = compute_catalanconst(newlen); return (len < newlen ? shorten(cl_LF_catalanconst,len) : cl_LF_catalanconst); } diff --git a/src/float/transcendental/cl_LF_coshsinh_aux.cc b/src/float/transcendental/cl_LF_coshsinh_aux.cc index f7c9f57..92f2e4c 100644 --- a/src/float/transcendental/cl_LF_coshsinh_aux.cc +++ b/src/float/transcendental/cl_LF_coshsinh_aux.cc @@ -112,7 +112,7 @@ const cl_LF_cosh_sinh_t cl_coshsinh_aux (const cl_I& p, uintE lq, uintC len) #else // TRIVIAL_SPEEDUP var cl_LF coshsum = sqrt(cl_I_to_LF(1,actuallen) + square(sinhsum)); #endif - return cl_LF_cosh_sinh_t(shorten(coshsum,len),shorten(sinhsum,len)); // verkürzen und fertig + return cl_LF_cosh_sinh_t(shorten(coshsum,len),shorten(sinhsum,len)); // verkürzen und fertig }} // Bit complexity (N = len, and if p has length O(log N) and ql = O(log N)): // O(log(N)*M(N)). diff --git a/src/float/transcendental/cl_LF_cossin_aux.cc b/src/float/transcendental/cl_LF_cossin_aux.cc index 83dafa3..86e630d 100644 --- a/src/float/transcendental/cl_LF_cossin_aux.cc +++ b/src/float/transcendental/cl_LF_cossin_aux.cc @@ -112,7 +112,7 @@ const cl_LF_cos_sin_t cl_cossin_aux (const cl_I& p, uintE lq, uintC len) #else // TRIVIAL_SPEEDUP var cl_LF cossum = sqrt(cl_I_to_LF(1,actuallen) - square(sinsum)); #endif - return cl_LF_cos_sin_t(shorten(cossum,len),shorten(sinsum,len)); // verkürzen und fertig + return cl_LF_cos_sin_t(shorten(cossum,len),shorten(sinsum,len)); // verkürzen und fertig }} // Bit complexity (N = len, and if p has length O(log N) and ql = O(log N)): // O(log(N)*M(N)). diff --git a/src/float/transcendental/cl_LF_eulerconst.cc b/src/float/transcendental/cl_LF_eulerconst.cc index 467dfb6..55269cf 100644 --- a/src/float/transcendental/cl_LF_eulerconst.cc +++ b/src/float/transcendental/cl_LF_eulerconst.cc @@ -94,7 +94,7 @@ const cl_LF compute_eulerconst_expintegral (uintC len) qv[n].~cl_I(); } fsum = fsum - ln(cl_I_to_LF(z,actuallen)); // log(z) subtrahieren - return shorten(fsum,len); // verkürzen und fertig + return shorten(fsum,len); // verkürzen und fertig } // Bit complexity (N = len): O(log(N)^2*M(N)). @@ -174,7 +174,7 @@ const cl_LF compute_eulerconst_expintegral1 (uintC len) } } var cl_LF result = gsum/fsum - ln(cl_I_to_LF(x,actuallen)); - return shorten(result,len); // verkürzen und fertig + return shorten(result,len); // verkürzen und fertig } // Bit complexity (N = len): O(N^2). @@ -211,7 +211,7 @@ const cl_LF compute_eulerconst_expintegral2 (uintC len) args[n].q.~cl_I(); args[n].d.~cl_I(); } - return shorten(result,len); // verkürzen und fertig + return shorten(result,len); // verkürzen und fertig } // Bit complexity (N = len): O(log(N)^2*M(N)). @@ -305,7 +305,7 @@ const cl_LF compute_eulerconst_besselintegral1 (uintC len) } } var cl_LF result = gsum/fsum - ln(cl_I_to_LF(sx,actuallen)); - return shorten(result,len); // verkürzen und fertig + return shorten(result,len); // verkürzen und fertig } // Bit complexity (N = len): O(N^2). @@ -373,7 +373,7 @@ const cl_LF compute_eulerconst_besselintegral2 (uintC len) qv[n].~cl_I(); } var cl_LF result = gsum/fsum - ln(cl_I_to_LF(sx,actuallen)); - return shorten(result,len); // verkürzen und fertig + return shorten(result,len); // verkürzen und fertig } // Bit complexity (N = len): O(N^2). // Memory consumption: O(N^2). @@ -434,7 +434,7 @@ const cl_LF compute_eulerconst_besselintegral3 (uintC len) var cl_rational_series_for_g gseries = cl_rational_series_for_g(x); var cl_LF gsum = eval_rational_series(N,gseries,actuallen); var cl_LF result = gsum/fsum - ln(cl_I_to_LF(sx,actuallen)); - return shorten(result,len); // verkürzen und fertig + return shorten(result,len); // verkürzen und fertig } // Bit complexity (N = len): O(N^2). @@ -475,7 +475,7 @@ const cl_LF compute_eulerconst_besselintegral4 (uintC len) cl_R_to_LF(sums.V,actuallen) / The(cl_LF)(sums.D * cl_R_to_LF(sums.Q+sums.T,actuallen)) - ln(cl_R_to_LF(sx,actuallen)); - return shorten(result,len); // verkürzen und fertig + return shorten(result,len); // verkürzen und fertig } // Bit complexity (N = len): O(log(N)^2*M(N)). @@ -507,20 +507,20 @@ const cl_LF compute_eulerconst (uintC len) const cl_LF eulerconst (uintC len) { - var uintC oldlen = TheLfloat(cl_LF_eulerconst)->len; // vorhandene Länge + var uintC oldlen = TheLfloat(cl_LF_eulerconst)->len; // vorhandene Länge if (len < oldlen) return shorten(cl_LF_eulerconst,len); if (len == oldlen) return cl_LF_eulerconst; // TheLfloat(cl_LF_eulerconst)->len um mindestens einen konstanten Faktor - // > 1 wachsen lassen, damit es nicht zu häufig nachberechnet wird: + // > 1 wachsen lassen, damit es nicht zu häufig nachberechnet wird: var uintC newlen = len; oldlen += floor(oldlen,2); // oldlen * 3/2 if (newlen < oldlen) newlen = oldlen; - // gewünschte > vorhandene Länge -> muß nachberechnen: + // gewünschte > vorhandene Länge -> muß nachberechnen: cl_LF_eulerconst = compute_eulerconst(newlen); return (len < newlen ? shorten(cl_LF_eulerconst,len) : cl_LF_eulerconst); } diff --git a/src/float/transcendental/cl_LF_exp1.cc b/src/float/transcendental/cl_LF_exp1.cc index f8827f8..0f55fe5 100644 --- a/src/float/transcendental/cl_LF_exp1.cc +++ b/src/float/transcendental/cl_LF_exp1.cc @@ -56,7 +56,7 @@ const cl_LF compute_exp1 (uintC len) for (n = 0; n < N; n++) { qv[n].~cl_I(); } - return shorten(fsum,len); // verkürzen und fertig + return shorten(fsum,len); // verkürzen und fertig } // Bit complexity (N = len): O(log(N)*M(N)). @@ -77,20 +77,20 @@ const cl_LF compute_exp1 (uintC len) const cl_LF exp1 (uintC len) { - var uintC oldlen = TheLfloat(cl_LF_exp1)->len; // vorhandene Länge + var uintC oldlen = TheLfloat(cl_LF_exp1)->len; // vorhandene Länge if (len < oldlen) return shorten(cl_LF_exp1,len); if (len == oldlen) return cl_LF_exp1; // TheLfloat(cl_LF_exp1)->len um mindestens einen konstanten Faktor - // > 1 wachsen lassen, damit es nicht zu häufig nachberechnet wird: + // > 1 wachsen lassen, damit es nicht zu häufig nachberechnet wird: var uintC newlen = len; oldlen += floor(oldlen,2); // oldlen * 3/2 if (newlen < oldlen) newlen = oldlen; - // gewünschte > vorhandene Länge -> muß nachberechnen: + // gewünschte > vorhandene Länge -> muß nachberechnen: cl_LF_exp1 = compute_exp1(newlen); // (exp 1) return (len < newlen ? shorten(cl_LF_exp1,len) : cl_LF_exp1); } diff --git a/src/float/transcendental/cl_LF_exp_aux.cc b/src/float/transcendental/cl_LF_exp_aux.cc index a732bb7..8ac3297 100644 --- a/src/float/transcendental/cl_LF_exp_aux.cc +++ b/src/float/transcendental/cl_LF_exp_aux.cc @@ -74,7 +74,7 @@ const cl_LF cl_exp_aux (const cl_I& p, uintE lq, uintC len) pv[n].~cl_I(); qv[n].~cl_I(); } - return shorten(fsum,len); // verkürzen und fertig + return shorten(fsum,len); // verkürzen und fertig }} // Bit complexity (N = len, and if p has length O(log N) and ql = O(log N)): // O(log(N)*M(N)). diff --git a/src/float/transcendental/cl_LF_ln10.cc b/src/float/transcendental/cl_LF_ln10.cc index 1473e1e..ae57e33 100644 --- a/src/float/transcendental/cl_LF_ln10.cc +++ b/src/float/transcendental/cl_LF_ln10.cc @@ -48,20 +48,20 @@ static inline const cl_LF compute_ln10_p2357 (uintC len) const cl_LF cl_ln10 (uintC len) { - var uintC oldlen = TheLfloat(cl_LF_ln10)->len; // vorhandene Länge + var uintC oldlen = TheLfloat(cl_LF_ln10)->len; // vorhandene Länge if (len < oldlen) return shorten(cl_LF_ln10,len); if (len == oldlen) return cl_LF_ln10; // TheLfloat(cl_LF_ln10)->len um mindestens einen konstanten Faktor - // > 1 wachsen lassen, damit es nicht zu häufig nachberechnet wird: + // > 1 wachsen lassen, damit es nicht zu häufig nachberechnet wird: var uintC newlen = len; oldlen += floor(oldlen,2); // oldlen * 3/2 if (newlen < oldlen) newlen = oldlen; - // gewünschte > vorhandene Länge -> muß nachberechnen: + // gewünschte > vorhandene Länge -> muß nachberechnen: cl_LF_ln10 = compute_ln10(newlen); return (len < newlen ? shorten(cl_LF_ln10,len) : cl_LF_ln10); } diff --git a/src/float/transcendental/cl_LF_ln2.cc b/src/float/transcendental/cl_LF_ln2.cc index cdec528..a07c0e1 100644 --- a/src/float/transcendental/cl_LF_ln2.cc +++ b/src/float/transcendental/cl_LF_ln2.cc @@ -76,20 +76,20 @@ static inline const cl_LF compute_ln2_p2357 (uintC len) const cl_LF cl_ln2 (uintC len) { - var uintC oldlen = TheLfloat(cl_LF_ln2)->len; // vorhandene Länge + var uintC oldlen = TheLfloat(cl_LF_ln2)->len; // vorhandene Länge if (len < oldlen) return shorten(cl_LF_ln2,len); if (len == oldlen) return cl_LF_ln2; // TheLfloat(cl_LF_ln2)->len um mindestens einen konstanten Faktor - // > 1 wachsen lassen, damit es nicht zu häufig nachberechnet wird: + // > 1 wachsen lassen, damit es nicht zu häufig nachberechnet wird: var uintC newlen = len; oldlen += floor(oldlen,2); // oldlen * 3/2 if (newlen < oldlen) newlen = oldlen; - // gewünschte > vorhandene Länge -> muß nachberechnen: + // gewünschte > vorhandene Länge -> muß nachberechnen: cl_LF_ln2 = compute_ln2(newlen); return (len < newlen ? shorten(cl_LF_ln2,len) : cl_LF_ln2); } diff --git a/src/float/transcendental/cl_LF_pi.cc b/src/float/transcendental/cl_LF_pi.cc index 6b0a263..e82abee 100644 --- a/src/float/transcendental/cl_LF_pi.cc +++ b/src/float/transcendental/cl_LF_pi.cc @@ -20,7 +20,7 @@ namespace cln { ALL_cl_LF_OPERATIONS_SAME_PRECISION() // For the next algorithms, I warmly recommend -// [Jörg Arndt: hfloat documentation, august 1996, +// [Jörg Arndt: hfloat documentation, august 1996, // http://www.tu-chemnitz.de/~arndt/ hfdoc.dvi // But beware of the typos in his formulas! ] @@ -31,7 +31,7 @@ const cl_LF compute_pi_brent_salamin (uintC len) // functions. J. ACM 23(1976), 242-251.] // [Jonathan M. Borwein, Peter B. Borwein: Pi and the AGM. // Wiley 1987. Algorithm 2.2, p. 48.] - // [Jörg Arndt, formula (4.51)-(4.52).] + // [Jörg Arndt, formula (4.51)-(4.52).] // pi = AGM(1,1/sqrt(2))^2 * 2/(1 - sum(k=0..infty, 2^k c_k^2)). // where the AGM iteration reads // a_0 := 1, b_0 := 1/sqrt(2). @@ -63,7 +63,7 @@ const cl_LF compute_pi_brent_salamin (uintC len) // ) var uintC actuallen = len + 1; // 1 Schutz-Digit var uintE uexp_limit = LF_exp_mid - intDsize*len; - // Ein Long-Float ist genau dann betragsmäßig <2^-n, wenn + // Ein Long-Float ist genau dann betragsmäßig <2^-n, wenn // sein Exponent < LF_exp_mid-n = uexp_limit ist. var cl_LF a = cl_I_to_LF(1,actuallen); var cl_LF b = sqrt(scale_float(a,-1)); @@ -79,14 +79,14 @@ const cl_LF compute_pi_brent_salamin (uintC len) k++; } var cl_LF pires = square(a)/t; // a^2/t - return shorten(pires,len); // verkürzen und fertig + return shorten(pires,len); // verkürzen und fertig } // Bit complexity (N := len): O(log(N)*M(N)). const cl_LF compute_pi_brent_salamin_quartic (uintC len) { // See [Borwein, Borwein, section 1.4, exercise 3, p. 17]. - // See also [Jörg Arndt], formulas (4.52) and (3.30)[wrong!]. + // See also [Jörg Arndt], formulas (4.52) and (3.30)[wrong!]. // As above, we are using the formula // pi = AGM(1,1/sqrt(2))^2 * 2/(1 - sum(k=0..infty, 2^k c_k^2)). // where the AGM iteration reads @@ -135,7 +135,7 @@ const cl_LF compute_pi_brent_salamin_quartic (uintC len) k += 2; } var cl_LF pires = square(a)/t; - return shorten(pires,len); // verkürzen und fertig + return shorten(pires,len); // verkürzen und fertig } // Bit complexity (N := len): O(log(N)*M(N)). @@ -146,7 +146,7 @@ const cl_LF compute_pi_ramanujan_163 (uintC len) // mit J = -53360^3 = - (2^4 5 23 29)^3 // A = 163096908 = 2^2 3 13 1045493 // B = 6541681608 = 2^3 3^3 7 11 19 127 163 - // See [Jörg Arndt], formulas (4.27)-(4.30). + // See [Jörg Arndt], formulas (4.27)-(4.30). // This is also the formula used in Pari. // The absolute value of the n-th summand is approximately // |J|^-n * n^(-1/2) * B/(2*pi^(3/2)), @@ -177,7 +177,7 @@ const cl_LF compute_pi_ramanujan_163 (uintC len) var cl_LF fsum = scale_float(cl_I_to_LF(sum,actuallen),-scale); static const cl_I J3 = "262537412640768000"; // -1728*J var cl_LF pires = sqrt(cl_I_to_LF(J3,actuallen)) / fsum; - return shorten(pires,len); // verkürzen und fertig + return shorten(pires,len); // verkürzen und fertig } // Bit complexity (N := len): O(N^2). @@ -233,7 +233,7 @@ const cl_LF compute_pi_ramanujan_163_fast (uintC len) var cl_LF fsum = eval_rational_series(N,series,actuallen,actuallen); static const cl_I J3 = "262537412640768000"; // -1728*J var cl_LF pires = sqrt(cl_I_to_LF(J3,actuallen)) / fsum; - return shorten(pires,len); // verkürzen und fertig + return shorten(pires,len); // verkürzen und fertig } // Bit complexity (N := len): O(log(N)^2*M(N)). @@ -260,20 +260,20 @@ const cl_LF compute_pi_ramanujan_163_fast (uintC len) const cl_LF pi (uintC len) { - var uintC oldlen = TheLfloat(cl_LF_pi)->len; // vorhandene Länge + var uintC oldlen = TheLfloat(cl_LF_pi)->len; // vorhandene Länge if (len < oldlen) return shorten(cl_LF_pi,len); if (len == oldlen) return cl_LF_pi; // TheLfloat(cl_LF_pi)->len um mindestens einen konstanten Faktor - // > 1 wachsen lassen, damit es nicht zu häufig nachberechnet wird: + // > 1 wachsen lassen, damit es nicht zu häufig nachberechnet wird: var uintC newlen = len; oldlen += floor(oldlen,2); // oldlen * 3/2 if (newlen < oldlen) newlen = oldlen; - // gewünschte > vorhandene Länge -> muß nachberechnen: + // gewünschte > vorhandene Länge -> muß nachberechnen: cl_LF_pi = compute_pi_ramanujan_163_fast(newlen); return (len < newlen ? shorten(cl_LF_pi,len) : cl_LF_pi); } diff --git a/src/float/transcendental/cl_LF_zeta_int.cc b/src/float/transcendental/cl_LF_zeta_int.cc index 503b835..9d51282 100644 --- a/src/float/transcendental/cl_LF_zeta_int.cc +++ b/src/float/transcendental/cl_LF_zeta_int.cc @@ -48,7 +48,7 @@ const cl_LF compute_zeta_exp (int s, uintC len) args[n].q.~cl_I(); args[n].d.~cl_I(); } - result = shorten(result,len); // verkürzen und fertig + result = shorten(result,len); // verkürzen und fertig // Zum Schluss mit 2^(s-1)/(2^(s-1)-1) multiplizieren: return scale_float(result,s-1) / (ash(1,s-1)-1); } @@ -80,7 +80,7 @@ const cl_LF compute_zeta_cvz1 (int s, uintC len) gsum = gsum + gterm; } var cl_LF result = gsum/cl_I_to_LF(1+fsum,actuallen); - result = shorten(result,len); // verkürzen und fertig + result = shorten(result,len); // verkürzen und fertig // Zum Schluss mit 2^(s-1)/(2^(s-1)-1) multiplizieren: return scale_float(result,s-1) / (ash(1,s-1)-1); } @@ -121,7 +121,7 @@ const cl_LF compute_zeta_cvz2 (int s, uintC len) // Here we need U/(1+S) = V/D(Q+T). var cl_LF result = cl_I_to_LF(sums.V,actuallen) / The(cl_LF)(sums.D * cl_I_to_LF(sums.Q+sums.T,actuallen)); - result = shorten(result,len); // verkürzen und fertig + result = shorten(result,len); // verkürzen und fertig // Zum Schluss mit 2^(s-1)/(2^(s-1)-1) multiplizieren: return scale_float(result,s-1) / (ash(1,s-1)-1); } diff --git a/src/integer/algebraic/cl_I_rootp.cc b/src/integer/algebraic/cl_I_rootp.cc index 0286c04..68c464b 100644 --- a/src/integer/algebraic/cl_I_rootp.cc +++ b/src/integer/algebraic/cl_I_rootp.cc @@ -16,7 +16,7 @@ namespace cln { // Methode: // Falls x=0 oder x=1: x = x^n -> JA, x als Ergebnis. // Hier also x>1. Suche ein Integer y > 1 mit x=y^n. -// Falls n >= integer_length(x): NEIN. (Da y>=2, müßte x>=2^n gelten.) +// Falls n >= integer_length(x): NEIN. (Da y>=2, müßte x>=2^n gelten.) // Hier also n>0 klein... bool rootp (const cl_I& x, uintL n, cl_I* w) diff --git a/src/integer/algebraic/cl_I_rootp_I.cc b/src/integer/algebraic/cl_I_rootp_I.cc index 88468de..dc79ea8 100644 --- a/src/integer/algebraic/cl_I_rootp_I.cc +++ b/src/integer/algebraic/cl_I_rootp_I.cc @@ -16,7 +16,7 @@ namespace cln { // Methode: // Falls x=0 oder x=1: x = x^n -> JA, x als Ergebnis. // Hier also x>1. Suche ein Integer y > 1 mit x=y^n. -// Falls n >= integer_length(x): NEIN. (Da y>=2, müßte x>=2^n gelten.) +// Falls n >= integer_length(x): NEIN. (Da y>=2, müßte x>=2^n gelten.) // Hier also n>0 klein... bool rootp (const cl_I& x, const cl_I& n, cl_I* w) @@ -25,7 +25,7 @@ bool rootp (const cl_I& x, const cl_I& n, cl_I* w) { *w = x; return true; } // ja -> x als Ergebnis if (n >= (cl_I)(unsigned long)integer_length(x)) { return false; } - // Nun ist n < (integer-length x). Also paßt n in ein uintC. + // 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 073c5c0..8b50c50 100644 --- a/src/integer/algebraic/cl_I_rootp_aux.cc +++ b/src/integer/algebraic/cl_I_rootp_aux.cc @@ -30,13 +30,13 @@ bool cl_rootp_aux (cl_I x, uintL n, cl_I* w) // Methode: // Falls x=0 oder x=1: x = x^n -> JA, x als Ergebnis. // Hier also x>1. Suche ein Integer y > 1 mit x=y^n. -// Falls n >= integer_length(x): NEIN. (Da y>=2, müßte x>=2^n gelten.) +// Falls n >= integer_length(x): NEIN. (Da y>=2, müßte x>=2^n gelten.) // Hier also n>0 klein. // Solange n gerade ist: x := (sqrt x), n := (/ n 2). x nicht ganz -> NEIN. // Hier also n>0 ungerade. // Falls n=1: x = x^n -> JA, x als Ergebnis. // Falls o := ord2(x) nicht durch n teilbar ist: NEIN. -// Sonst dividiere x durch 2^o, am Schluß y mit 2^(o/n) multiplizieren. +// Sonst dividiere x durch 2^o, am Schluß y mit 2^(o/n) multiplizieren. // Hier also n>0 ungerade, x ungerade. // beta := 2^intDsize, m := ceiling(integer_length(x)/(intDsize*n)). // Suche ein y mit y>=0, y fertig. // Setze y == y0 + beta^k*y1 mod beta^2k an, wobei 2k := min(2*k,m). -// Dabei wird y1 mod beta^(2k-k) so gewählt, daß mod beta^2k +// Dabei wird y1 mod beta^(2k-k) so gewählt, daß mod beta^2k // x == y^n == y0^n + n * y0^(n-1) * beta^k*y1. Dazu wird // (x - y0^n) mod beta^2k errechnet, durch beta^k dividiert (die Division -// muß nach Voraussetzung an y0 aufgehen) und +// muß nach Voraussetzung an y0 aufgehen) und // y1 := ((x-y0^n)/beta^k) / (n*y0^(n-1)) mod beta^(2k-k) gebildet. // Damit hat man (y0 + beta^k*y1)^n == x mod beta^2k . 2k=m -> fertig. // Den Anfang (k=1) bekommt man analog, mit beta:=2 und k=1,k=2,k=4,... @@ -64,7 +64,7 @@ bool cl_rootp_aux (cl_I x, uintL n, cl_I* w) } // Nun ist n ungerade. if (n==1) { *w = x; return true; } // n=1 -> x als Ergebnis - var uintC oq = 0; // Shift von y am Schluß + 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 @@ -97,7 +97,7 @@ bool cl_rootp_aux (cl_I x, uintL n, cl_I* w) 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 - // Für k=1,2,4,...: + // Für k=1,2,4,...: // y_lsd := y_lsd + 2^k * (x_lsd-y_lsd^n)/2^k / (n*y_lsd^(n-1)) // = y_lsd + (x_lsd-y_lsd^n) / (n*y_lsd^(n-1)) doconsttimes(log2_intDsize, // log2(intDsize) Iterationen reichen aus @@ -110,23 +110,23 @@ bool cl_rootp_aux (cl_I x, uintL n, cl_I* w) y_lsd_ok: ASSERT(expt_pos(y_lsd,n)==x_lsd); // Nun ist y_lsd^n == x_lsd mod beta=2^intDsize. - { var uintC m = ceiling(x_len,n); // für y nötige Länge, >0, <=x_len + { var uintC m = ceiling(x_len,n); // für y nötige Länge, >0, <=x_len var uintD* y_LSDptr; { var uintD* z1_LSDptr; var uintD* z2_LSDptr; var uintD* z3_LSDptr; - num_stack_alloc_1(m, ,y_LSDptr=); // Platz für y + num_stack_alloc_1(m, ,y_LSDptr=); // Platz für y {var uintC need = 2*m+(32/intDsize-1); // >= max(2*m,m+32/intDsize) - num_stack_alloc(need, ,z1_LSDptr=); // Platz für Rechenregister 1 - num_stack_alloc(need, ,z2_LSDptr=); // Platz für Rechenregister 2 - num_stack_alloc(need, ,z3_LSDptr=); // Platz für Rechenregister 3 + num_stack_alloc(need, ,z1_LSDptr=); // Platz für Rechenregister 1 + num_stack_alloc(need, ,z2_LSDptr=); // Platz für Rechenregister 2 + num_stack_alloc(need, ,z3_LSDptr=); // Platz für Rechenregister 3 } {var uintC k = 1; // y ist bisher mod beta^k bekannt lspref(y_LSDptr,0) = y_lsd; // Startwert von y until (k==m) { var uintC k2 = 2*k; if (k2>m) { k2=m; } // k2 = min(2*k,m) > k // bisheriges y mod beta^k2 mit n-1 potenzieren: - // Methode für z := y^(n-1) : + // Methode für z := y^(n-1) : // zz:=y, e:=n-1. // Solange e gerade, setze zz:=zz*zz, e:=e/2. // z:=zz. @@ -146,7 +146,7 @@ bool cl_rootp_aux (cl_I x, uintL n, cl_I* w) } while ((e & bit(0)) ==0); // solange e gerade z_LSDptr = zz_LSDptr; // z:=zz - // (zz nicht kopieren; ab der nächsten Veränderung von zz wird + // (zz nicht kopieren; ab der nächsten Veränderung von zz wird // {zz_LSDptr,z_LSDptr,free_LSDptr} = {z1_LSDptr,z2_LSDptr,z3_LSDptr} // gelten.) until ((e = e>>1) == 0) @@ -187,9 +187,9 @@ bool cl_rootp_aux (cl_I x, uintL n, cl_I* w) // Die ganze Rechnung war umsonst. { return false; } } - // y ist tatsächlich n-te Wurzel von x. + // y ist tatsächlich n-te Wurzel von x. // Noch mit 2^oq multiplizieren: - if (oq==0) // kein Shift nötig? + if (oq==0) // kein Shift nötig? { *w = y; } else { *w = ash(y,oq); } diff --git a/src/integer/bitwise/cl_I_ash.cc b/src/integer/bitwise/cl_I_ash.cc index 345de1c..21e6850 100644 --- a/src/integer/bitwise/cl_I_ash.cc +++ b/src/integer/bitwise/cl_I_ash.cc @@ -20,11 +20,11 @@ const cl_I ash (const cl_I& x, sintC y) // x = 0 -> 0 als Ergebnis // y = 0 -> x als Ergebnis // y > 0 -> y = intDsize*k + i, j=k+(1 falls i>0, 0 falls i=0). - // j Wörter mehr reservieren, k Nullwörter, dann übertragen, + // j Wörter mehr reservieren, k Nullwörter, dann übertragen, // bei i>0: um i Bits links schieben (i=1 geht einfacher). - // y < 0 -> y <= - intDsize * (Länge(A0) in Digits) -> Ergebnis = 0 oder -1. - // Sonst: -y = intDsize*k + i mit k y <= - intDsize * (Länge(A0) in Digits) -> Ergebnis = 0 oder -1. + // Sonst: -y = intDsize*k + i mit k0: schiebe sie um i Bits nach rechts (i=1 geht einfacher). if (zerop(x)) return 0; // x=0 -> 0 als Ergebnis @@ -40,7 +40,7 @@ const cl_I ash (const cl_I& x, sintC y) var uintC len; var const uintD* x_LSDptr; I_to_NDS_nocopy(x, ,len=,x_LSDptr=,false,); // DS zu x bilden. - if (k >= (uintC)(~len)) // kann len+k+1 Überlauf geben? + if (k >= (uintC)(~len)) // kann len+k+1 Überlauf geben? { throw ash_exception(y); } // ja -> Fehler num_stack_alloc_1(len+k,,LSDptr=); LSDptr = clear_loop_lsp(LSDptr,k); // k Nulldigits @@ -72,7 +72,7 @@ const cl_I ash (const cl_I& x, sintC y) var uintD* MSDptr; var uintC len; I_to_NDS(x, MSDptr=,len=,); // DS zu x bilden. - if (k>=len) goto sign; // -y >= intDsize*len -> Vorzeichen von x zurück + if (k>=len) goto sign; // -y >= intDsize*len -> Vorzeichen von x zurück len -= k; // rechte k Digits einfach streichen // Noch ist len>0. Um i Bits nach rechts schieben: if (!(i==0)) // Bei i>0: diff --git a/src/integer/bitwise/cl_I_ash_I.cc b/src/integer/bitwise/cl_I_ash_I.cc index 15ea728..cef7d0d 100644 --- a/src/integer/bitwise/cl_I_ash_I.cc +++ b/src/integer/bitwise/cl_I_ash_I.cc @@ -20,11 +20,11 @@ const cl_I ash (const cl_I& x, const cl_I& y) // x = 0 -> 0 als Ergebnis // y = 0 -> x als Ergebnis // y > 0 -> y = intDsize*k + i, j=k+(1 falls i>0, 0 falls i=0). - // j Wörter mehr reservieren, k Nullwörter, dann übertragen, + // j Wörter mehr reservieren, k Nullwörter, dann übertragen, // bei i>0: um i Bits links schieben (i=1 geht einfacher). - // y < 0 -> y <= - intDsize * (Länge(A0) in Digits) -> Ergebnis = 0 oder -1. - // Sonst: -y = intDsize*k + i mit k y <= - intDsize * (Länge(A0) in Digits) -> Ergebnis = 0 oder -1. + // Sonst: -y = intDsize*k + i mit k0: schiebe sie um i Bits nach rechts (i=1 geht einfacher). if (zerop(x)) return 0; // x=0 -> 0 als Ergebnis @@ -85,7 +85,7 @@ const cl_I ash (const cl_I& x, const cl_I& y) var uintC len; var const uintD* x_LSDptr; I_to_NDS_nocopy(x, ,len=,x_LSDptr=,false,); // DS zu x bilden. - if (k >= (uintC)(~len)) // kann len+k+1 Überlauf geben? + if (k >= (uintC)(~len)) // kann len+k+1 Überlauf geben? { throw ash_exception(y); } // ja -> Fehler num_stack_alloc_1(len+k,,LSDptr=); LSDptr = clear_loop_lsp(LSDptr,k); // k Nulldigits @@ -165,7 +165,7 @@ const cl_I ash (const cl_I& x, const cl_I& y) var uintD* MSDptr; var uintC len; I_to_NDS(x, MSDptr=,len=,); // DS zu x bilden. - if (k>=len) goto sign; // -y >= intDsize*len -> Vorzeichen von x zurück + if (k>=len) goto sign; // -y >= intDsize*len -> Vorzeichen von x zurück len -= k; // rechte k Digits einfach streichen // Noch ist len>0. Um i Bits nach rechts schieben: if (!(i==0)) // Bei i>0: diff --git a/src/integer/bitwise/cl_I_ilength.cc b/src/integer/bitwise/cl_I_ilength.cc index 5620e85..19e2d80 100644 --- a/src/integer/bitwise/cl_I_ilength.cc +++ b/src/integer/bitwise/cl_I_ilength.cc @@ -34,12 +34,12 @@ uintC integer_length (const cl_I& x) var uintC len; BN_to_NDS_nocopy(x, MSDptr=,len=,); // normalisierte DS zu x bilden. var uintC bitcount = intDsize*(len-1); // Anzahl Digits mal intDsize - // MSDigit nehmen, testen, welches das höchste Bit ist, das vom + // MSDigit nehmen, testen, welches das höchste Bit ist, das vom // Vorzeichenbit abweicht: var uintD msd = mspref(MSDptr,0); // MSDigit if ((sintD)msd < 0) { msd = ~msd; } // falls negativ, invertieren - // Position des höchsten Bits in msd suchen und entsprechend bit_count - // erhöhen (um höchstens intDsize-1): + // Position des höchsten Bits in msd suchen und entsprechend bit_count + // erhöhen (um höchstens intDsize-1): if (!(msd == 0)) { integerlengthD(msd, bitcount += ); } return bitcount; // 0 <= bitcount < intDsize*2^intCsize. } diff --git a/src/integer/bitwise/cl_I_ldb.cc b/src/integer/bitwise/cl_I_ldb.cc index 81fecaf..43153c8 100644 --- a/src/integer/bitwise/cl_I_ldb.cc +++ b/src/integer/bitwise/cl_I_ldb.cc @@ -25,7 +25,7 @@ const cl_I ldb (const cl_I& n, const cl_byte& b) // Falls p <= l : // q:=min(p+s,l). // Extrahiere die Bits p,...,q-1 von n. - // Falls p+s>l und n<0, füge p+s-l Einsenbits an (addiere 2^s-2^(l-p)). + // Falls p+s>l und n<0, füge p+s-l Einsenbits an (addiere 2^s-2^(l-p)). var uintC s = b.size; var uintC p = b.position; var uintC l = integer_length(n); // l = (integer-length n) diff --git a/src/integer/bitwise/cl_I_ldbx.cc b/src/integer/bitwise/cl_I_ldbx.cc index 603f7f6..73bb142 100644 --- a/src/integer/bitwise/cl_I_ldbx.cc +++ b/src/integer/bitwise/cl_I_ldbx.cc @@ -21,11 +21,11 @@ const cl_I ldb_extract (const cl_I& x, uintC p, uintC q) var uintC len; var const uintD* LSDptr; 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: + // 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 - // paßt qD ebenso wie len in ein uintC. - MSDptr = MSDptr mspop (len - qD); // MSDptr um len-qD Digits erhöhen + // paßt qD ebenso wie len in ein uintC. + MSDptr = MSDptr mspop (len - qD); // MSDptr um len-qD Digits erhöhen len = qD; // len um len-qD erniedrigen } // LSDptr und len um floor(p/intDsize) erniedrigen: @@ -33,7 +33,7 @@ const cl_I ldb_extract (const cl_I& x, uintC p, uintC q) LSDptr = LSDptr lspop pD; len -= pD; } - // Jetzt enthält MSDptr/len/LSDptr genau die maßgeblichen Digits. + // Jetzt enthält MSDptr/len/LSDptr genau die maßgeblichen Digits. var uintD* newMSDptr; { var uintL i = p%intDsize; // p mod intDsize // Kopiere sie und schiebe sie dabei um i Bits nach rechts: @@ -43,7 +43,7 @@ const cl_I ldb_extract (const cl_I& x, uintC p, uintC q) else { shiftrightcopy_loop_msp(MSDptr,newMSDptr,len,i,0); } } - // newMSDptr/len/.. = geschobene Kopie der maßgeblichen Digits + // newMSDptr/len/.. = geschobene Kopie der maßgeblichen Digits // Ausblenden der Bits mit Nummern >= q-p: { var uintC bitcount = intDsize*len - (q-p); // Anzahl vorne auszublendender Bits ( >=0, <= intDsize-1 + intDsize-1 ) @@ -53,7 +53,7 @@ const cl_I ldb_extract (const cl_I& x, uintC p, uintC q) if (bitcount > 0) { mspref(newMSDptr,0) &= (uintD)(bit(intDsize-bitcount)-1); } } - // Jetzt enthält die UDS newMSDptr/len/.. die extrahierten Bits. + // Jetzt enthält die UDS newMSDptr/len/.. die extrahierten Bits. return UDS_to_I(newMSDptr,len); // UDS in Integer umwandeln } diff --git a/src/integer/bitwise/cl_I_ldbxtest.cc b/src/integer/bitwise/cl_I_ldbxtest.cc index 007a968..1bbc571 100644 --- a/src/integer/bitwise/cl_I_ldbxtest.cc +++ b/src/integer/bitwise/cl_I_ldbxtest.cc @@ -20,11 +20,11 @@ bool ldb_extract_test (const cl_I& x, uintC p, uintC q) var uintC len; var const uintD* LSDptr; 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: + // 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 - // paßt qD ebenso wie len in ein uintC. - MSDptr = MSDptr mspop (len - qD); // MSDptr um len-qD Digits erhöhen + // paßt qD ebenso wie len in ein uintC. + MSDptr = MSDptr mspop (len - qD); // MSDptr um len-qD Digits erhöhen len = qD; // len um len-qD erniedrigen } // LSDptr und len um floor(p/intDsize) erniedrigen: @@ -32,17 +32,17 @@ bool ldb_extract_test (const cl_I& x, uintC p, uintC q) LSDptr = LSDptr lspop pD; len -= pD; } - // Jetzt enthält MSDptr/len/LSDptr genau die maßgeblichen Digits. + // Jetzt enthält MSDptr/len/LSDptr genau die maßgeblichen Digits. 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. - // Vom ersten Digit müssen die vorderen intDsize-1-q Bits unberücksichtigt bleiben. + // Vom ersten Digit müssen die vorderen intDsize-1-q Bits unberücksichtigt bleiben. // Ein AND 2^(q+1)-1 erreicht dies. - // Vom letzten Digit müssen die hinteren p Bits unberücksichtigt bleiben. + // Vom letzten Digit müssen die hinteren p Bits unberücksichtigt bleiben. // Ein AND -2^p erreicht dies. if (--len==0) - // 1 Digit maßgeblich, wird von beiden Seiten angeschnitten: + // 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 true; diff --git a/src/integer/bitwise/cl_I_log.h b/src/integer/bitwise/cl_I_log.h index c774eb1..f64ff1a 100644 --- a/src/integer/bitwise/cl_I_log.h +++ b/src/integer/bitwise/cl_I_log.h @@ -9,7 +9,7 @@ namespace cln { -// Liefert die Anzahl Digits, die ein Integer als DS bräuchte. +// Liefert die Anzahl Digits, die ein Integer als DS bräuchte. // (Leicht aufgerundet.) inline uintC I_to_DS_need (const cl_I& x) { diff --git a/src/integer/bitwise/cl_I_log_aux.cc b/src/integer/bitwise/cl_I_log_aux.cc index 0d4c4d2..c70128b 100644 --- a/src/integer/bitwise/cl_I_log_aux.cc +++ b/src/integer/bitwise/cl_I_log_aux.cc @@ -16,7 +16,7 @@ namespace cln { uintD* I_to_DS_n_aux (const cl_I& obj, uintC n, uintD* destptr) { // Nun sind unterhalb von destptr n Digits Platz. - // oberen Teil der DS aus obj füllen, dabei destptr erniedrigen: + // oberen Teil der DS aus obj füllen, dabei destptr erniedrigen: if (fixnump(obj)) // Fixnum: { @@ -47,7 +47,7 @@ uintD* I_to_DS_n_aux (const cl_I& obj, uintC n, uintD* destptr) n -= len; destptr = copy_loop_lsp(BN_LSDptr(obj),destptr,len); // DS kopieren } - // unteren Teil mit Fülldigits, gebildet aus dem Vorzeichen, füllen: + // unteren Teil mit Fülldigits, gebildet aus dem Vorzeichen, füllen: if (!(n==0)) { destptr = fill_loop_lsp(destptr,n,sign_of_sintD(mspref(destptr,0))); } // destptr zeigt nun aufs untere Ende der DS. diff --git a/src/integer/bitwise/cl_I_logand.cc b/src/integer/bitwise/cl_I_logand.cc index 7ca2b17..99cf698 100644 --- a/src/integer/bitwise/cl_I_logand.cc +++ b/src/integer/bitwise/cl_I_logand.cc @@ -16,15 +16,15 @@ namespace cln { // Logische Operationen auf Integers: -// Methode: aus den Längen der beiden Argumente eine obere Schranke für -// die Länge des Ergebnisses berechnen (das Maximum der beiden Längen und -// FN_maxlength), so daß das MSD für unendlich viele Bits steht. -// Dann beide Argumente in gleichgroße Digit sequences umwandeln, Operation -// mit einer einfachen Schleife durchführen. +// Methode: aus den Längen der beiden Argumente eine obere Schranke für +// die Länge des Ergebnisses berechnen (das Maximum der beiden Längen und +// FN_maxlength), so daß das MSD für unendlich viele Bits steht. +// Dann beide Argumente in gleichgroße Digit sequences umwandeln, Operation +// mit einer einfachen Schleife durchführen. const cl_I logand (const cl_I& x, const cl_I& y) { if (fixnump(x) && fixnump(y)) // Beides Fixnums -> ganz einfach: - { // bitweise als Fixnum zurück + { // bitweise als Fixnum zurück return cl_I_from_word(x.word & y.word); } if (fixnump(x)) @@ -48,7 +48,7 @@ const cl_I logand (const cl_I& x, const cl_I& y) {var uintD* xptr; I_to_DS_n(x,n,xptr=); // Pointer in DS zu x var uintD* yptr; I_to_DS_n(y,n,yptr=); // Pointer in DS zu y var uintD* zptr = xptr; // Pointer aufs Ergebnis - and_loop_msp(xptr,yptr,n); // mit AND verknüpfen + and_loop_msp(xptr,yptr,n); // mit AND verknüpfen return DS_to_I(zptr,n); // Ergebnis als Integer } }} diff --git a/src/integer/bitwise/cl_I_logandc2.cc b/src/integer/bitwise/cl_I_logandc2.cc index 1fb71fe..a07913f 100644 --- a/src/integer/bitwise/cl_I_logandc2.cc +++ b/src/integer/bitwise/cl_I_logandc2.cc @@ -16,15 +16,15 @@ namespace cln { // Logische Operationen auf Integers: -// Methode: aus den Längen der beiden Argumente eine obere Schranke für -// die Länge des Ergebnisses berechnen (das Maximum der beiden Längen und -// FN_maxlength), so daß das MSD für unendlich viele Bits steht. -// Dann beide Argumente in gleichgroße Digit sequences umwandeln, Operation -// mit einer einfachen Schleife durchführen. +// Methode: aus den Längen der beiden Argumente eine obere Schranke für +// die Länge des Ergebnisses berechnen (das Maximum der beiden Längen und +// FN_maxlength), so daß das MSD für unendlich viele Bits steht. +// Dann beide Argumente in gleichgroße Digit sequences umwandeln, Operation +// mit einer einfachen Schleife durchführen. const cl_I logandc2 (const cl_I& x, const cl_I& y) { if (fixnump(x) && fixnump(y)) // Beides Fixnums -> ganz einfach: - { // bitweise als Fixnum zurück + { // bitweise als Fixnum zurück return cl_I_from_word((x.word & ~ y.word) | cl_combine(cl_FN_tag,0)); } if (fixnump(x)) @@ -42,7 +42,7 @@ const cl_I logandc2 (const cl_I& x, const cl_I& y) {var uintD* xptr; I_to_DS_n(x,n,xptr=); // Pointer in DS zu x var uintD* yptr; I_to_DS_n(y,n,yptr=); // Pointer in DS zu y var uintD* zptr = xptr; // Pointer aufs Ergebnis - andc2_loop_msp(xptr,yptr,n); // mit AND NOT verknüpfen + andc2_loop_msp(xptr,yptr,n); // mit AND NOT verknüpfen return DS_to_I(zptr,n); // Ergebnis als Integer } }} diff --git a/src/integer/bitwise/cl_I_logbitp.cc b/src/integer/bitwise/cl_I_logbitp.cc index 5a0c3b1..6bfd4f7 100644 --- a/src/integer/bitwise/cl_I_logbitp.cc +++ b/src/integer/bitwise/cl_I_logbitp.cc @@ -17,7 +17,7 @@ namespace cln { bool logbitp (uintC x, const cl_I& y) { // Methode: - // Falls x>=intDsize*Länge(y), teste Vorzeichen von y. + // Falls x>=intDsize*Länge(y), teste Vorzeichen von y. // Sonst x=intDsize*k+i, Teste Bit i vom Worte Nr. k+1 (von oben herab). var const uintD* yMSDptr; diff --git a/src/integer/bitwise/cl_I_logbitp_I.cc b/src/integer/bitwise/cl_I_logbitp_I.cc index 03e8856..aab5c70 100644 --- a/src/integer/bitwise/cl_I_logbitp_I.cc +++ b/src/integer/bitwise/cl_I_logbitp_I.cc @@ -22,7 +22,7 @@ bool logbitp (const cl_I& x, const cl_I& y) { // Methode: // Falls x<0, Error. - // Falls x>=0: Falls x>=intDsize*Länge(y), teste Vorzeichen von y. + // Falls x>=0: Falls x>=intDsize*Länge(y), teste Vorzeichen von y. // Sonst x=intDsize*k+i, Teste Bit i vom Worte Nr. k+1 (von oben herab). if (!minusp(x)) // x>=0 ? { if (fixnump(x)) diff --git a/src/integer/bitwise/cl_I_logcount.cc b/src/integer/bitwise/cl_I_logcount.cc index 62a1814..6480c1a 100644 --- a/src/integer/bitwise/cl_I_logcount.cc +++ b/src/integer/bitwise/cl_I_logcount.cc @@ -23,10 +23,10 @@ uintC logcount (const cl_I& x) if (FN_V_minusp(x,(sintV)x32)) { x32 = ~ x32; } // falls <0, komplementieren #if (intVsize>32) #define x64 x32 - logcount_64(); // Bits von x32 zählen + logcount_64(); // Bits von x32 zählen #undef x64 #else - logcount_32(); // Bits von x32 zählen + logcount_32(); // Bits von x32 zählen #endif return x32; } @@ -34,8 +34,8 @@ uintC logcount (const cl_I& x) { var const uintD* MSDptr; var uintC len; BN_to_NDS_nocopy(x, MSDptr=,len=,); // DS zu x bilden, len>0. - var uintC bitcount = 0; // Bitzähler - var const uintD* ptr = MSDptr; // läuft durch die Digits durch + var uintC bitcount = 0; // Bitzähler + var const uintD* ptr = MSDptr; // läuft durch die Digits durch var uintD sign = sign_of_sintD(mspref(ptr,0)); // Vorzeichen dotimespC(len,len, { bitcount += (uintC)logcountD(msprefnext(ptr) ^ sign); }); diff --git a/src/integer/bitwise/cl_I_logeqv.cc b/src/integer/bitwise/cl_I_logeqv.cc index 0ac56b8..da50ef4 100644 --- a/src/integer/bitwise/cl_I_logeqv.cc +++ b/src/integer/bitwise/cl_I_logeqv.cc @@ -16,15 +16,15 @@ namespace cln { // Logische Operationen auf Integers: -// Methode: aus den Längen der beiden Argumente eine obere Schranke für -// die Länge des Ergebnisses berechnen (das Maximum der beiden Längen und -// FN_maxlength), so daß das MSD für unendlich viele Bits steht. -// Dann beide Argumente in gleichgroße Digit sequences umwandeln, Operation -// mit einer einfachen Schleife durchführen. +// Methode: aus den Längen der beiden Argumente eine obere Schranke für +// die Länge des Ergebnisses berechnen (das Maximum der beiden Längen und +// FN_maxlength), so daß das MSD für unendlich viele Bits steht. +// Dann beide Argumente in gleichgroße Digit sequences umwandeln, Operation +// mit einer einfachen Schleife durchführen. const cl_I logeqv (const cl_I& x, const cl_I& y) { if (fixnump(x) && fixnump(y)) // Beides Fixnums -> ganz einfach: - { // bitweise als Fixnum zurück + { // bitweise als Fixnum zurück return cl_I_from_word(~(x.word ^ y.word) & cl_combine(cl_FN_tag,~(cl_uint)0)); } else @@ -37,7 +37,7 @@ const cl_I logeqv (const cl_I& x, const cl_I& y) {var uintD* xptr; I_to_DS_n(x,n,xptr=); // Pointer in DS zu x var uintD* yptr; I_to_DS_n(y,n,yptr=); // Pointer in DS zu y var uintD* zptr = xptr; // Pointer aufs Ergebnis - eqv_loop_msp(xptr,yptr,n); // mit NOT XOR verknüpfen + eqv_loop_msp(xptr,yptr,n); // mit NOT XOR verknüpfen return DS_to_I(zptr,n); // Ergebnis als Integer } }} diff --git a/src/integer/bitwise/cl_I_logior.cc b/src/integer/bitwise/cl_I_logior.cc index 07803fa..bccff4a 100644 --- a/src/integer/bitwise/cl_I_logior.cc +++ b/src/integer/bitwise/cl_I_logior.cc @@ -16,15 +16,15 @@ namespace cln { // Logische Operationen auf Integers: -// Methode: aus den Längen der beiden Argumente eine obere Schranke für -// die Länge des Ergebnisses berechnen (das Maximum der beiden Längen und -// FN_maxlength), so daß das MSD für unendlich viele Bits steht. -// Dann beide Argumente in gleichgroße Digit sequences umwandeln, Operation -// mit einer einfachen Schleife durchführen. +// Methode: aus den Längen der beiden Argumente eine obere Schranke für +// die Länge des Ergebnisses berechnen (das Maximum der beiden Längen und +// FN_maxlength), so daß das MSD für unendlich viele Bits steht. +// Dann beide Argumente in gleichgroße Digit sequences umwandeln, Operation +// mit einer einfachen Schleife durchführen. const cl_I logior (const cl_I& x, const cl_I& y) { if (fixnump(x) && fixnump(y)) // Beides Fixnums -> ganz einfach: - { // bitweise als Fixnum zurück + { // bitweise als Fixnum zurück return cl_I_from_word(x.word | y.word); } else @@ -37,7 +37,7 @@ const cl_I logior (const cl_I& x, const cl_I& y) {var uintD* xptr; I_to_DS_n(x,n,xptr=); // Pointer in DS zu x var uintD* yptr; I_to_DS_n(y,n,yptr=); // Pointer in DS zu y var uintD* zptr = xptr; // Pointer aufs Ergebnis - or_loop_msp(xptr,yptr,n); // mit OR verknüpfen + or_loop_msp(xptr,yptr,n); // mit OR verknüpfen return DS_to_I(zptr,n); // Ergebnis als Integer } }} diff --git a/src/integer/bitwise/cl_I_lognand.cc b/src/integer/bitwise/cl_I_lognand.cc index 9c0614b..6fecc9f 100644 --- a/src/integer/bitwise/cl_I_lognand.cc +++ b/src/integer/bitwise/cl_I_lognand.cc @@ -16,15 +16,15 @@ namespace cln { // Logische Operationen auf Integers: -// Methode: aus den Längen der beiden Argumente eine obere Schranke für -// die Länge des Ergebnisses berechnen (das Maximum der beiden Längen und -// FN_maxlength), so daß das MSD für unendlich viele Bits steht. -// Dann beide Argumente in gleichgroße Digit sequences umwandeln, Operation -// mit einer einfachen Schleife durchführen. +// Methode: aus den Längen der beiden Argumente eine obere Schranke für +// die Länge des Ergebnisses berechnen (das Maximum der beiden Längen und +// FN_maxlength), so daß das MSD für unendlich viele Bits steht. +// Dann beide Argumente in gleichgroße Digit sequences umwandeln, Operation +// mit einer einfachen Schleife durchführen. const cl_I lognand (const cl_I& x, const cl_I& y) { if (fixnump(x) && fixnump(y)) // Beides Fixnums -> ganz einfach: - { // bitweise als Fixnum zurück + { // bitweise als Fixnum zurück return cl_I_from_word((x.word & y.word) ^ cl_combine(0,~(cl_uint)0)); } if (fixnump(x)) @@ -48,7 +48,7 @@ const cl_I lognand (const cl_I& x, const cl_I& y) {var uintD* xptr; I_to_DS_n(x,n,xptr=); // Pointer in DS zu x var uintD* yptr; I_to_DS_n(y,n,yptr=); // Pointer in DS zu y var uintD* zptr = xptr; // Pointer aufs Ergebnis - nand_loop_msp(xptr,yptr,n); // mit NOT AND verknüpfen + nand_loop_msp(xptr,yptr,n); // mit NOT AND verknüpfen return DS_to_I(zptr,n); // Ergebnis als Integer } }} diff --git a/src/integer/bitwise/cl_I_lognor.cc b/src/integer/bitwise/cl_I_lognor.cc index 3f09228..103dcf1 100644 --- a/src/integer/bitwise/cl_I_lognor.cc +++ b/src/integer/bitwise/cl_I_lognor.cc @@ -16,15 +16,15 @@ namespace cln { // Logische Operationen auf Integers: -// Methode: aus den Längen der beiden Argumente eine obere Schranke für -// die Länge des Ergebnisses berechnen (das Maximum der beiden Längen und -// FN_maxlength), so daß das MSD für unendlich viele Bits steht. -// Dann beide Argumente in gleichgroße Digit sequences umwandeln, Operation -// mit einer einfachen Schleife durchführen. +// Methode: aus den Längen der beiden Argumente eine obere Schranke für +// die Länge des Ergebnisses berechnen (das Maximum der beiden Längen und +// FN_maxlength), so daß das MSD für unendlich viele Bits steht. +// Dann beide Argumente in gleichgroße Digit sequences umwandeln, Operation +// mit einer einfachen Schleife durchführen. const cl_I lognor (const cl_I& x, const cl_I& y) { if (fixnump(x) && fixnump(y)) // Beides Fixnums -> ganz einfach: - { // bitweise als Fixnum zurück + { // bitweise als Fixnum zurück return cl_I_from_word((x.word | y.word) ^ cl_combine(0,~(cl_uint)0)); } else @@ -37,7 +37,7 @@ const cl_I lognor (const cl_I& x, const cl_I& y) {var uintD* xptr; I_to_DS_n(x,n,xptr=); // Pointer in DS zu x var uintD* yptr; I_to_DS_n(y,n,yptr=); // Pointer in DS zu y var uintD* zptr = xptr; // Pointer aufs Ergebnis - nor_loop_msp(xptr,yptr,n); // mit NOT OR verknüpfen + nor_loop_msp(xptr,yptr,n); // mit NOT OR verknüpfen return DS_to_I(zptr,n); // Ergebnis als Integer } }} diff --git a/src/integer/bitwise/cl_I_lognot.cc b/src/integer/bitwise/cl_I_lognot.cc index 4122128..7725133 100644 --- a/src/integer/bitwise/cl_I_lognot.cc +++ b/src/integer/bitwise/cl_I_lognot.cc @@ -17,7 +17,7 @@ namespace cln { const cl_I lognot (const cl_I& x) { if (fixnump(x)) // Fixnum -> ganz einfach: - { // bitweise als Fixnum zurück + { // bitweise als Fixnum zurück return cl_I_from_word(x.word ^ cl_combine(0,~(cl_uint)0)); } else diff --git a/src/integer/bitwise/cl_I_logorc2.cc b/src/integer/bitwise/cl_I_logorc2.cc index 066506b..ca7188f 100644 --- a/src/integer/bitwise/cl_I_logorc2.cc +++ b/src/integer/bitwise/cl_I_logorc2.cc @@ -16,15 +16,15 @@ namespace cln { // Logische Operationen auf Integers: -// Methode: aus den Längen der beiden Argumente eine obere Schranke für -// die Länge des Ergebnisses berechnen (das Maximum der beiden Längen und -// FN_maxlength), so daß das MSD für unendlich viele Bits steht. -// Dann beide Argumente in gleichgroße Digit sequences umwandeln, Operation -// mit einer einfachen Schleife durchführen. +// Methode: aus den Längen der beiden Argumente eine obere Schranke für +// die Länge des Ergebnisses berechnen (das Maximum der beiden Längen und +// FN_maxlength), so daß das MSD für unendlich viele Bits steht. +// Dann beide Argumente in gleichgroße Digit sequences umwandeln, Operation +// mit einer einfachen Schleife durchführen. const cl_I logorc2 (const cl_I& x, const cl_I& y) { if (fixnump(x) && fixnump(y)) // Beides Fixnums -> ganz einfach: - { // bitweise als Fixnum zurück + { // bitweise als Fixnum zurück return cl_I_from_word((x.word | ~ y.word) & cl_combine(cl_FN_tag,~(cl_uint)0)); } else @@ -37,7 +37,7 @@ const cl_I logorc2 (const cl_I& x, const cl_I& y) {var uintD* xptr; I_to_DS_n(x,n,xptr=); // Pointer in DS zu x var uintD* yptr; I_to_DS_n(y,n,yptr=); // Pointer in DS zu y var uintD* zptr = xptr; // Pointer aufs Ergebnis - orc2_loop_msp(xptr,yptr,n); // mit OR NOT verknüpfen + orc2_loop_msp(xptr,yptr,n); // mit OR NOT verknüpfen return DS_to_I(zptr,n); // Ergebnis als Integer } }} diff --git a/src/integer/bitwise/cl_I_logtest.cc b/src/integer/bitwise/cl_I_logtest.cc index 5a2d0c1..14e6b8f 100644 --- a/src/integer/bitwise/cl_I_logtest.cc +++ b/src/integer/bitwise/cl_I_logtest.cc @@ -18,8 +18,8 @@ bool logtest (const cl_I& x, const cl_I& y) { // Methode: // Fixnums separat behandeln. - // Sei oBdA x die kürzere der beiden Zahlen (in Digits). - // x echt kürzer und x<0 -> [eines der most signif. intDsize+1 Bits von y ist 1] Ja. + // Sei oBdA x die kürzere der beiden Zahlen (in Digits). + // x echt kürzer und x<0 -> [eines der most signif. intDsize+1 Bits von y ist 1] Ja. // Beide gleich lang oder x>=0 -> // Kann mich auf die untersten length(x) Digits beschraenken. // Mit AND durchlaufen, abbrechen (mit "Ja") falls /=0. Am Ende: Nein. @@ -32,7 +32,7 @@ bool logtest (const cl_I& x, const cl_I& y) return true; } else - // x Fixnum, y Bignum, also ist x echt kürzer + // x Fixnum, y Bignum, also ist x echt kürzer { 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; @@ -76,17 +76,17 @@ bool logtest (const cl_I& x, const cl_I& y) if (!(xlen==ylen)) // beide verschieden lang { if (xlen ganz einfach: - { // bitweise als Fixnum zurück + { // bitweise als Fixnum zurück return cl_I_from_word((x.word ^ y.word) | cl_combine(cl_FN_tag,0)); } else @@ -37,7 +37,7 @@ const cl_I logxor (const cl_I& x, const cl_I& y) {var uintD* xptr; I_to_DS_n(x,n,xptr=); // Pointer in DS zu x var uintD* yptr; I_to_DS_n(y,n,yptr=); // Pointer in DS zu y var uintD* zptr = xptr; // Pointer aufs Ergebnis - xor_loop_msp(xptr,yptr,n); // mit XOR verknüpfen + xor_loop_msp(xptr,yptr,n); // mit XOR verknüpfen return DS_to_I(zptr,n); // Ergebnis als Integer } }} diff --git a/src/integer/bitwise/cl_I_mkf.cc b/src/integer/bitwise/cl_I_mkf.cc index 86c49ea..d62585d 100644 --- a/src/integer/bitwise/cl_I_mkf.cc +++ b/src/integer/bitwise/cl_I_mkf.cc @@ -25,7 +25,7 @@ const cl_I mask_field (const cl_I& n, const cl_byte& b) // Falls p <= l : // q:=min(p+s,l). // Extrahiere die Bits p,...,q-1 von n. - // Falls p+s>l und n<0, füge p+s-l Einsenbits an (addiere 2^(p+s)-2^l). + // Falls p+s>l und n<0, füge p+s-l Einsenbits an (addiere 2^(p+s)-2^l). var uintC s = b.size; var uintC p = b.position; {var uintC ps = p+s; diff --git a/src/integer/bitwise/cl_I_mkfx.cc b/src/integer/bitwise/cl_I_mkfx.cc index fdbe4c1..df069b2 100644 --- a/src/integer/bitwise/cl_I_mkfx.cc +++ b/src/integer/bitwise/cl_I_mkfx.cc @@ -22,27 +22,27 @@ const cl_I mkf_extract (const cl_I& x, uintC p, uintC q) var uintC len; var const uintD* LSDptr; 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: + // 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 - // paßt qD ebenso wie len in ein uintC. - MSDptr = MSDptr mspop (len - qD); // MSDptr um len-qD Digits erhöhen + // paßt qD ebenso wie len in ein uintC. + MSDptr = MSDptr mspop (len - qD); // MSDptr um len-qD Digits erhöhen len = qD; // len um len-qD erniedrigen } - // Platz (len Digits) für die neue UDS bereitstellen: + // Platz (len Digits) für die neue UDS bereitstellen: var uintD* newMSDptr; num_stack_alloc_1(len, newMSDptr = ,); // Platz belegen - {var uintC pD = p/intDsize; // floor(p/intDsize), paßt in ein uintC + {var uintC pD = p/intDsize; // floor(p/intDsize), paßt in ein uintC // Kopiere len-pD Digits aus der DS zu x heraus: var uintD* midptr = copy_loop_msp(MSDptr,newMSDptr,len-pD); - // Lösche p-intDsize*floor(p/intDsize) Bits im Digit unterhalb von midptr: + // Lösche p-intDsize*floor(p/intDsize) Bits im Digit unterhalb von midptr: {var uintC p_D = p%intDsize; if (!(p_D==0)) { lspref(midptr,0) &= minus_bit(p_D); } } - // Lösche pD Digits darüber: + // Lösche pD Digits darüber: clear_loop_msp(midptr,pD); } - // Lösche intDsize*ceiling(q/intDsize)-q Bits im ersten Digit: + // Lösche intDsize*ceiling(q/intDsize)-q Bits im ersten Digit: {var uintL q_D = q%intDsize; #ifdef HAVE_FAST_LONGLONG if (!(q_D==0)) @@ -52,7 +52,7 @@ const cl_I mkf_extract (const cl_I& x, uintC p, uintC q) mspref(newMSDptr,0) &= (uintD)((1L<=0 umwandeln. -// Unterhalb von MSDptr muß 1 Digit Platz sein. +// Unterhalb von MSDptr muß 1 Digit Platz sein. extern const cl_I NUDS_to_I (uintD* MSDptr, uintC len); // Unsigned Digit Sequence to Integer // UDS_to_I(MSDptr,len) // UDS MSDptr/len/.. in Integer >=0 umwandeln. -// Unterhalb von MSDptr muß 1 Digit Platz sein. +// Unterhalb von MSDptr muß 1 Digit Platz sein. extern const cl_I UDS_to_I (uintD* MSDptr, uintC len); // Digit Sequence to Integer @@ -551,7 +551,7 @@ inline sintD FN_MSD (cl_uint word) unused (LSDptr_zuweisung (destLSDptr)); \ } -// Bignum to Normalized Digit sequence, Kopieren unnötig +// Bignum to Normalized Digit sequence, Kopieren unnötig // BN_to_NDS_nocopy(obj, MSDptr=,len=,LSDptr=); // > obj: ein Bignum // < MSDptr/len/LSDptr: Normalized Digit sequence @@ -602,11 +602,11 @@ inline sintD FN_MSD (cl_uint word) copy_loop_msp(BN_MSDptr(obj_from_BN_to_NDS),MSDptr_from_BN_to_NDS,len_from_BN_to_NDS); \ } -// Integer to Normalized Digit sequence, Kopieren unnötig. +// Integer to Normalized Digit sequence, Kopieren unnötig. // I_to_NDS_nocopy(obj, MSDptr=,len=,LSDptr=,check_for_0,zero_statement); // > obj: ein Integer -// > check_for_0: ob obj möglicherweise =0 sein kann -// > zero_statement: wird bei obj=0 ausgeführt +// > check_for_0: ob obj möglicherweise =0 sein kann +// > zero_statement: wird bei obj=0 ausgeführt // < MSDptr/len/LSDptr: Normalized Digit sequence #define I_to_NDS_nocopy(obj, MSDptr_zuweisung,len_zuweisung,LSDptr_zuweisung, check_for_0,zero_statement) \ var uintD CONCAT(FN_store_,__LINE__) [FN_maxlength]; \ @@ -659,8 +659,8 @@ inline sintD FN_MSD (cl_uint word) // ggT und kgV von Integers - // Teilfunktion für die Durchführung des Euklid-Algorithmus auf - // den führenden Ziffern a' und b': + // Teilfunktion für die Durchführung des Euklid-Algorithmus auf + // den führenden Ziffern a' und b': // partial_gcd(a',b',&erg); mit a'>b' // liefert in erg: x1,y1,x2,y2 mit den in cl_I_gcd.cc angegebenen Invarianten. typedef struct { uintD x1,y1,x2,y2; } partial_gcd_result; @@ -689,7 +689,7 @@ inline sintD FN_MSD (cl_uint word) // Wandelt eine Ziffernfolge in ein Integer >=0 um. // digits_to_I(MSBptr,len,base) // > base: Stellenwertsystem-Basis, >=2, <=36 -// > MSBptr/len/..: Ziffernfolge, bestehend aus Punkten (werden überlesen) +// > MSBptr/len/..: Ziffernfolge, bestehend aus Punkten (werden überlesen) // und Ziffern/Buchstaben mit Wert < base. // < ergebnis: der dargestellte Integer >=0 extern const cl_I digits_to_I (const char * MSBptr, uintC len, uintD base); @@ -697,7 +697,7 @@ inline sintD FN_MSD (cl_uint word) // Hilfsfunktion zur Ausgabe von Integers -// cl_digits_need(len,base) liefert eine obere Abschätzung für die Anzahl der +// cl_digits_need(len,base) liefert eine obere Abschätzung für die Anzahl der // Ziffern im Stellenwertsystem der Basis base, die x >= 0 braucht. extern uintC cl_digits_need (const cl_I& x, uintL base); diff --git a/src/integer/conv/cl_I_from_DS.cc b/src/integer/conv/cl_I_from_DS.cc index 883f98f..df2204e 100644 --- a/src/integer/conv/cl_I_from_DS.cc +++ b/src/integer/conv/cl_I_from_DS.cc @@ -22,18 +22,18 @@ MAYBE_INLINE2 const cl_I DS_to_I (const uintD* MSDptr, uintC len) { // erst normalisieren. - // Dabei evtl. MSDptr erhöhen und len erniedrigen: + // Dabei evtl. MSDptr erhöhen und len erniedrigen: if (!(len==0)) // leere DS ist normalisiert { var uintC count = len-1; if ((sintD)mspref(MSDptr,0) >= 0) // Zahl >= 0 - { // versuche maximal len-1 führende Nullen-Digits zu streichen: + { // versuche maximal len-1 führende Nullen-Digits zu streichen: while (!(count==0) && (mspref(MSDptr,0)==0) && ((sintD)mspref(MSDptr,1)>=0)) { msshrink(MSDptr); len--; count--; } // Nulldigit streichen } else // Zahl < 0 - // versuche maximal len-1 führende Einsen-Digits zu streichen: + // versuche maximal len-1 führende Einsen-Digits zu streichen: { while (!(count==0) && ((sintD)mspref(MSDptr,0)==-1) && ((sintD)mspref(MSDptr,1)<0)) { msshrink(MSDptr); len--; count--; } // Einsen-digit streichen } } diff --git a/src/integer/conv/cl_I_from_L.cc b/src/integer/conv/cl_I_from_L.cc index 9a57c27..aae3808 100644 --- a/src/integer/conv/cl_I_from_L.cc +++ b/src/integer/conv/cl_I_from_L.cc @@ -20,7 +20,7 @@ namespace cln { cl_private_thing cl_I_constructor_from_L (sint32 wert) { var uint32 test = wert & minus_bit(cl_value_len-1); - // test enthält die Bits, die nicht in den Fixnum-Wert >= 0 reinpassen. + // test enthält die Bits, die nicht in den Fixnum-Wert >= 0 reinpassen. if ((test == 0) || (test == (uint32)minus_bit(cl_value_len-1))) { return (cl_private_thing)(cl_combine(cl_FN_tag,wert)); } #if (intDsize==64) @@ -30,7 +30,7 @@ cl_private_thing cl_I_constructor_from_L (sint32 wert) return (cl_private_thing)(ptr); #else // Bignum erzeugen: - // (dessen Länge bn_minlength <= n <= ceiling(32/intDsize) erfüllt) + // (dessen Länge bn_minlength <= n <= ceiling(32/intDsize) erfüllt) if (bn_minlength == ceiling(32,intDsize)) { #if (intDsize==8) goto bignum4; diff --git a/src/integer/conv/cl_I_from_L2.cc b/src/integer/conv/cl_I_from_L2.cc index c2dccf5..26a7dee 100644 --- a/src/integer/conv/cl_I_from_L2.cc +++ b/src/integer/conv/cl_I_from_L2.cc @@ -28,7 +28,7 @@ cl_private_thing cl_I_constructor_from_L2 (sint32 wert_hi, uint32 wert_lo) return (cl_private_thing)(cl_combine(cl_FN_tag,(sint32)wert_lo)); } // Bignum erzeugen: - // (dessen Länge bn_minlength <= n <= ceiling(64/intDsize) erfüllt) + // (dessen Länge bn_minlength <= n <= ceiling(64/intDsize) erfüllt) #define FILL_1_DIGIT(l,i,from) \ arrayLSref(ptr->data,l,i) = (uintD)from; #define FILL_2_DIGIT(l,i,from) \ diff --git a/src/integer/conv/cl_I_from_NDS.cc b/src/integer/conv/cl_I_from_NDS.cc index 8de75ee..05eca40 100644 --- a/src/integer/conv/cl_I_from_NDS.cc +++ b/src/integer/conv/cl_I_from_NDS.cc @@ -21,7 +21,7 @@ const cl_I NDS_to_I (const uintD* MSDptr, uintC len) // Weniger als bn_minlength Digits -> Fixnum. // Genau bn_minlength Digits -> Bignum oder Fixnum. if (len < bn_minlength) - { // 0..bn_minlength-1 Digits, paßt in ein Fixnum: + { // 0..bn_minlength-1 Digits, paßt in ein Fixnum: if (bn_minlength>1 ? (len==0) : TRUE) // 0 Digits { return 0; } @@ -73,7 +73,7 @@ const cl_I NDS_to_I (const uintD* MSDptr, uintC len) if (len == bn_minlength) // bn_minlength Digits, also (incl. Vorzeichen) zwischen // (bn_minlength-1)*intDsize+1 und bn_minlength*intDsize Bits. - // Höchstens cl_value_len Bits -> paßt in ein Fixnum: + // Höchstens cl_value_len Bits -> paßt in ein Fixnum: { if ( (mspref(MSDptr,0) <= (uintD)(bit(cl_value_len-1-(bn_minlength-1)*intDsize)-1)) // Fixnum >=0 ? ||(mspref(MSDptr,0) >= (uintD)(-bit(cl_value_len-1-(bn_minlength-1)*intDsize))) // Fixnum <0 ? ) @@ -96,7 +96,7 @@ const cl_I NDS_to_I (const uintD* MSDptr, uintC len) #endif // mindestens bn_minlength Digits, mache ein Bignum { var Bignum result = allocate_bignum(len); - // neues Bignum mit dem Inhalt der NDS füllen: + // neues Bignum mit dem Inhalt der NDS füllen: copy_loop_msp(MSDptr,arrayMSDptr(result->data,len),len); return result; } diff --git a/src/integer/conv/cl_I_from_NUDS.cc b/src/integer/conv/cl_I_from_NUDS.cc index 0ec397f..349cb93 100644 --- a/src/integer/conv/cl_I_from_NUDS.cc +++ b/src/integer/conv/cl_I_from_NUDS.cc @@ -22,7 +22,7 @@ MAYBE_INLINE2 const cl_I NUDS_to_I (uintD* MSDptr, uintC len) { if ((!(len==0)) && ((sintD)mspref(MSDptr,0) < 0)) - // Falls die Länge >0 und das Most significant Bit = 1 sind, + // Falls die Länge >0 und das Most significant Bit = 1 sind, // die Digit Sequence um ein Nulldigit erweitern: { lsprefnext(MSDptr) = 0; len++; } return NDS_to_I(MSDptr,len); diff --git a/src/integer/conv/cl_I_from_Q.cc b/src/integer/conv/cl_I_from_Q.cc index 732e581..4f7f1dd 100644 --- a/src/integer/conv/cl_I_from_Q.cc +++ b/src/integer/conv/cl_I_from_Q.cc @@ -20,11 +20,11 @@ namespace cln { cl_private_thing cl_I_constructor_from_Q (sint64 wert) { var uint64 test = wert & (sint64)minus_bit(cl_value_len-1); - // test enthält die Bits, die nicht in den Fixnum-Wert >= 0 reinpassen. + // test enthält die Bits, die nicht in den Fixnum-Wert >= 0 reinpassen. if ((test == 0) || (test == (uint64)(sint64)minus_bit(cl_value_len-1))) return (cl_private_thing)(cl_combine(cl_FN_tag,wert)); // Bignum erzeugen: - // (dessen Länge bn_minlength <= n <= ceiling(32/intDsize) erfüllt) + // (dessen Länge bn_minlength <= n <= ceiling(32/intDsize) erfüllt) if (wert >= 0) { #define IF_LENGTH(i) \ if ((bn_minlength <= i) && (i*intDsize <= 64)) \ diff --git a/src/integer/conv/cl_I_from_UDS.cc b/src/integer/conv/cl_I_from_UDS.cc index d73dbdb..dcadfaf 100644 --- a/src/integer/conv/cl_I_from_UDS.cc +++ b/src/integer/conv/cl_I_from_UDS.cc @@ -25,7 +25,7 @@ const cl_I UDS_to_I (uintD* MSDptr, uintC len) { msshrink(MSDptr); len--; } // Nulldigit streichen // Dann wie bei NUDS_to_I : if ((!(len==0)) && ((sintD)mspref(MSDptr,0) < 0)) - // Falls die Länge >0 und das Most significant Bit = 1 sind, + // Falls die Länge >0 und das Most significant Bit = 1 sind, // die Digit Sequence um ein Nulldigit erweitern: { lsprefnext(MSDptr) = 0; len++; } return NDS_to_I(MSDptr,len); diff --git a/src/integer/conv/cl_I_from_UL.cc b/src/integer/conv/cl_I_from_UL.cc index adbd168..fe7e832 100644 --- a/src/integer/conv/cl_I_from_UL.cc +++ b/src/integer/conv/cl_I_from_UL.cc @@ -23,7 +23,7 @@ cl_private_thing cl_I_constructor_from_UL (uint32 wert) // Bits, die nicht in den Fixnum-Wert >= 0 reinpassen. return (cl_private_thing)(cl_combine(cl_FN_tag,wert)); // Bignum erzeugen: - // (dessen Länge bn_minlength <= n <= ceiling((32+1)/intDsize) erfüllt) + // (dessen Länge bn_minlength <= n <= ceiling((32+1)/intDsize) erfüllt) #define UL_maxlength ceiling(32+1,intDsize) #define IF_LENGTH(i) \ if ((bn_minlength <= i) && (i <= UL_maxlength)) \ diff --git a/src/integer/conv/cl_I_from_UL2.cc b/src/integer/conv/cl_I_from_UL2.cc index 3261c6b..be8b420 100644 --- a/src/integer/conv/cl_I_from_UL2.cc +++ b/src/integer/conv/cl_I_from_UL2.cc @@ -24,7 +24,7 @@ cl_private_thing cl_I_constructor_from_UL2 (uint32 wert_hi, uint32 wert_lo) ) return (cl_private_thing)(cl_combine(cl_FN_tag,wert_lo)); // Bignum erzeugen: - // (dessen Länge bn_minlength <= n <= ceiling((64+1)/intDsize) erfüllt) + // (dessen Länge bn_minlength <= n <= ceiling((64+1)/intDsize) erfüllt) #define UL2_maxlength ceiling(64+1,intDsize) #define FILL_1_DIGIT(l,i,from) \ arrayLSref(ptr->data,l,i) = (uintD)from; diff --git a/src/integer/conv/cl_I_from_UQ.cc b/src/integer/conv/cl_I_from_UQ.cc index d8490a5..fee98a3 100644 --- a/src/integer/conv/cl_I_from_UQ.cc +++ b/src/integer/conv/cl_I_from_UQ.cc @@ -23,7 +23,7 @@ cl_private_thing cl_I_constructor_from_UQ (uint64 wert) // Bits, die nicht in den Fixnum-Wert >= 0 reinpassen. return (cl_private_thing)(cl_combine(cl_FN_tag,wert)); // Bignum erzeugen: - // (dessen Länge bn_minlength <= n <= ceiling((32+1)/intDsize) erfüllt) + // (dessen Länge bn_minlength <= n <= ceiling((32+1)/intDsize) erfüllt) #define UQ_maxlength ceiling(64+1,intDsize) #define IF_LENGTH(i) \ if ((bn_minlength <= i) && (i <= UQ_maxlength)) \ diff --git a/src/integer/conv/cl_I_mul10plus.cc b/src/integer/conv/cl_I_mul10plus.cc index f80c134..5d282a7 100644 --- a/src/integer/conv/cl_I_mul10plus.cc +++ b/src/integer/conv/cl_I_mul10plus.cc @@ -24,7 +24,7 @@ const cl_I mul_10_plus_x (const cl_I& y, unsigned char x) var uintD carry = mulusmall_loop_lsp(10,LSDptr,len,x); // mal 10, plus x if (!(carry==0)) { lsprefnext(MSDptr) = carry; len++; } - return UDS_to_I(MSDptr,len); // UDS als Integer zurück + return UDS_to_I(MSDptr,len); // UDS als Integer zurück } } // namespace cln diff --git a/src/integer/conv/cl_I_to_L.cc b/src/integer/conv/cl_I_to_L.cc index 52d59c9..e03fd67 100644 --- a/src/integer/conv/cl_I_to_L.cc +++ b/src/integer/conv/cl_I_to_L.cc @@ -35,7 +35,7 @@ sint32 cl_I_to_L (const cl_I& obj) if ((sintD)mspref(arrayMSDptr(bn->data,len),0) >= 0) { // Bignum > 0 #define IF_LENGTH(i) \ - if (bn_minlength <= i) /* genau i Digits überhaupt möglich? */\ + if (bn_minlength <= i) /* genau i Digits überhaupt möglich? */\ if (len == i) /* genau i Digits? */ \ /* 2^((i-1)*intDsize-1) <= obj < 2^(i*intDsize-1) */ \ if ( (i*intDsize > 32) \ @@ -56,7 +56,7 @@ sint32 cl_I_to_L (const cl_I& obj) } else { // Bignum < 0 #define IF_LENGTH(i) \ - if (bn_minlength <= i) /* genau i Digits überhaupt möglich? */\ + if (bn_minlength <= i) /* genau i Digits überhaupt möglich? */\ if (len == i) /* genau i Digits? */ \ /* - 2^(i*intDsize-1) <= obj < - 2^((i-1)*intDsize-1) */ \ if ( (i*intDsize > 32) \ diff --git a/src/integer/conv/cl_I_to_Q.cc b/src/integer/conv/cl_I_to_Q.cc index 13197c3..5e53086 100644 --- a/src/integer/conv/cl_I_to_Q.cc +++ b/src/integer/conv/cl_I_to_Q.cc @@ -31,7 +31,7 @@ sint64 cl_I_to_Q (const cl_I& obj) if ((sintD)mspref(arrayMSDptr(bn->data,len),0) >= 0) { // Bignum > 0 #define IF_LENGTH(i) \ - if (bn_minlength <= i) /* genau i Digits überhaupt möglich? */\ + if (bn_minlength <= i) /* genau i Digits überhaupt möglich? */\ if (len == i) /* genau i Digits? */ \ /* 2^((i-1)*intDsize-1) <= obj < 2^(i*intDsize-1) */ \ if ( (i*intDsize > 64) \ @@ -82,7 +82,7 @@ sint64 cl_I_to_Q (const cl_I& obj) } else { // Bignum < 0 #define IF_LENGTH(i) \ - if (bn_minlength <= i) /* genau i Digits überhaupt möglich? */\ + if (bn_minlength <= i) /* genau i Digits überhaupt möglich? */\ if (len == i) /* genau i Digits? */ \ /* - 2^(i*intDsize-1) <= obj < - 2^((i-1)*intDsize-1) */ \ if ( (i*intDsize > 64) \ diff --git a/src/integer/conv/cl_I_to_UL.cc b/src/integer/conv/cl_I_to_UL.cc index 7ee081d..d64b2ea 100644 --- a/src/integer/conv/cl_I_to_UL.cc +++ b/src/integer/conv/cl_I_to_UL.cc @@ -36,7 +36,7 @@ uint32 cl_I_to_UL (const cl_I& obj) if ((sintD)mspref(arrayMSDptr(bn->data,len),0) < 0) goto bad; #define IF_LENGTH(i) \ - if (bn_minlength <= i) /* genau i Digits überhaupt möglich? */\ + if (bn_minlength <= i) /* genau i Digits überhaupt möglich? */\ if (len == i) /* genau i Digits? */ \ /* 2^((i-1)*intDsize-1) <= obj < 2^(i*intDsize-1) */ \ if ( (i*intDsize-1 > 32) \ diff --git a/src/integer/conv/cl_I_to_UQ.cc b/src/integer/conv/cl_I_to_UQ.cc index 5f30e50..60b8dd3 100644 --- a/src/integer/conv/cl_I_to_UQ.cc +++ b/src/integer/conv/cl_I_to_UQ.cc @@ -34,7 +34,7 @@ uint64 cl_I_to_UQ (const cl_I& obj) if ((sintD)mspref(arrayMSDptr(bn->data,len),0) < 0) goto bad; #define IF_LENGTH(i) \ - if (bn_minlength <= i) /* genau i Digits überhaupt möglich? */\ + if (bn_minlength <= i) /* genau i Digits überhaupt möglich? */\ if (len == i) /* genau i Digits? */ \ /* 2^((i-1)*intDsize-1) <= obj < 2^(i*intDsize-1) */ \ if ( (i*intDsize-1 > 64) \ diff --git a/src/integer/conv/cl_I_to_digits.cc b/src/integer/conv/cl_I_to_digits.cc index 46afb68..c383952 100644 --- a/src/integer/conv/cl_I_to_digits.cc +++ b/src/integer/conv/cl_I_to_digits.cc @@ -14,7 +14,7 @@ namespace cln { -// Timing für Dezimal-Umwandlung einer Zahl mit N Digits = (N*32) Bits, +// Timing für Dezimal-Umwandlung einer Zahl mit N Digits = (N*32) Bits, // auf einem i486 33 MHz unter Linux: // N standard dnq(div) dnq(mul) combined // 10 0.00031 0.00043 0.00059 0.00031 @@ -69,28 +69,28 @@ void I_to_digits (const cl_I& X, uintD base, cl_digits* erg) // Falls X>0: // Dividiere X durch das Wort b^k, // (Single-Precision-Division, vgl. UDS_DIVIDE mit n=1: -// r:=0, j:=m=Länge(X), +// r:=0, j:=m=Länge(X), // while j>0 do // j:=j-1, r:=r*beta+X[j], X[j]:=floor(r/b^k), r:=r-b^k*q[j]. // r=Rest.) // zerlege den Rest (mit k-1 Divisionen durch b) in k Ziffern, wandle diese // Ziffern einzeln in Ascii um und lege sie an die DIGITS an. -// Teste auf Speicherüberlauf. +// Teste auf Speicherüberlauf. // X := Quotient. // Mache aus X wieder eine NUDS (maximal 1 Nulldigit streichen). // Dies solange bis X=0. -// Streiche die führenden Nullen. +// Streiche die führenden Nullen. // Aufsuchen von k-1 und b^k aus der Tabelle: var const power_table_entry* tableptr = &power_table[base-2]; var uintC k = tableptr->k; var uintD b_hoch_k = tableptr->b_to_the_k; // b^k var uintB* erg_ptr = erg->LSBptr; #define next_digit(d) { *--erg_ptr = (d<10 ? '0'+d : 'A'-10+d); } - // Spezialfälle: + // Spezialfälle: if (zerop(X)) { next_digit(0); goto fertig; } // 0 -> eine Ziffer '0' else if ((base & (base-1)) == 0) - { // Schneller Algorithmus für Zweierpotenzen + { // Schneller Algorithmus für Zweierpotenzen var const uintD* MSDptr; var uintC len; var const uintD* LSDptr; @@ -138,7 +138,7 @@ void I_to_digits (const cl_I& X, uintD base, cl_digits* erg) if (fixnump(X) && count>cl_value_len-1) count = cl_value_len-1; if ((intDsize>=11) || (count>0)) - // (Bei intDsize>=11 ist wegen b<=36 zwangsläufig + // (Bei intDsize>=11 ist wegen b<=36 zwangsläufig // k = ceiling(intDsize*log(2)/log(b))-1 >= 2, also count = k-1 > 0.) do { var uintD d; #if HAVE_DD @@ -199,7 +199,7 @@ void I_to_digits (const cl_I& X, uintD base, cl_digits* erg) erg_ptr = erg->MSBptr; } #undef next_digit - // Streiche führende Nullen: + // Streiche führende Nullen: while (*erg_ptr == '0') { erg_ptr++; } fertig: erg->MSBptr = erg_ptr; diff --git a/src/integer/elem/cl_I_compare.cc b/src/integer/elem/cl_I_compare.cc index 2ce6059..9bf7a4f 100644 --- a/src/integer/elem/cl_I_compare.cc +++ b/src/integer/elem/cl_I_compare.cc @@ -32,8 +32,8 @@ cl_signean compare (const cl_I& x, const cl_I& y) // x > 0 -> x > y // y Bignum -> // falls beide gleich lang -> wortweise vergleichen - // x kürzer als y -> bei x,y > 0 : x < y, bei x,y < 0 : x > y - // y kürzer als x -> bei x,y > 0 : x > y, bei x,y > 0 : x < y + // x kürzer als y -> bei x,y > 0 : x < y, bei x,y < 0 : x > y + // y kürzer als x -> bei x,y > 0 : x > y, bei x,y > 0 : x < y var uintC xlen; var uintC ylen; if (fixnump(x)) @@ -76,7 +76,7 @@ cl_signean compare (const cl_I& x, const cl_I& y) ylen = TheBignum(y)->length; if (xlen==ylen) samelength: - // gleiche Länge -> digitweise vergleichen + // gleiche Länge -> digitweise vergleichen return compare_loop_msp(BN_MSDptr(x),BN_MSDptr(y),xlen); else return (xlen > ylen ? signean_plus : signean_minus); @@ -97,7 +97,7 @@ cl_signean compare (const cl_I& x, const cl_I& y) { xlen = TheBignum(x)->length; ylen = TheBignum(y)->length; if (xlen==ylen) - // gleiche Länge -> wortweise vergleichen + // gleiche Länge -> wortweise vergleichen goto samelength; // wie oben else return (xlen > ylen ? signean_minus : signean_plus); diff --git a/src/integer/elem/cl_I_equal.cc b/src/integer/elem/cl_I_equal.cc index 2aaa135..c34719f 100644 --- a/src/integer/elem/cl_I_equal.cc +++ b/src/integer/elem/cl_I_equal.cc @@ -48,7 +48,7 @@ bool equal (const cl_I& x, const cl_I& y) { var uintC xlen = TheBignum(x)->length; var uintC ylen = TheBignum(y)->length; if (xlen==ylen) - // gleiche Länge -> digitweise vergleichen + // gleiche Länge -> digitweise vergleichen return compare_loop_msp(BN_MSDptr(x),BN_MSDptr(y),xlen) == 0; else return false; diff --git a/src/integer/elem/cl_I_minus.cc b/src/integer/elem/cl_I_minus.cc index 8a0fbe1..d2b920b 100644 --- a/src/integer/elem/cl_I_minus.cc +++ b/src/integer/elem/cl_I_minus.cc @@ -47,7 +47,7 @@ const cl_I operator- (const cl_I& x, const cl_I& y) #endif } else - { // x ist Fixnum, y ist Bignum, also y länger + { // x ist Fixnum, y ist Bignum, also y länger #if (intDsize==64) var sint64 x_ = FN_to_V(x); // Wert von x #else @@ -77,15 +77,15 @@ const cl_I operator- (const cl_I& x, const cl_I& y) var uintD* midptr = LSDptr lspop pFN_maxlength; if (y_new < y_) { // Carry. - if (!FN_V_minusp(x,x_)) // kürzerer Summand war positiv - // Dann ist ein positiver Übertrag weiterzutragen + if (!FN_V_minusp(x,x_)) // kürzerer Summand war positiv + // Dann ist ein positiver Übertrag weiterzutragen // (Beispiel: 0002FFFC + 0007 = 00030003) { DS_1_plus(midptr,len-pFN_maxlength); } } else { // Kein Carry. - if (FN_V_minusp(x,x_)) // kürzerer Summand war negativ - // Dann ist ein negativer Übertrag weiterzutragen + if (FN_V_minusp(x,x_)) // kürzerer Summand war negativ + // Dann ist ein negativer Übertrag weiterzutragen // (Beispiel: 00020003 + FFF5 = 0001FFF8) { DS_minus1_plus(midptr,len-pFN_maxlength); } } } @@ -95,7 +95,7 @@ const cl_I operator- (const cl_I& x, const cl_I& y) else { // x ist Bignum if (fixnump(y)) - { // x ist Bignum, y ist Fixnum, also x länger + { // x ist Bignum, y ist Fixnum, also x länger #if (intDsize==64) var sint64 y_ = FN_to_V(y); // Wert von y #else @@ -123,15 +123,15 @@ const cl_I operator- (const cl_I& x, const cl_I& y) var uintD* midptr = LSDptr lspop pFN_maxlength; if (x_new > x_) { // Carry. - if (!FN_V_minusp(y,y_)) // kürzerer Summand war positiv - // Dann ist ein negativer Übertrag weiterzutragen + if (!FN_V_minusp(y,y_)) // kürzerer Summand war positiv + // Dann ist ein negativer Übertrag weiterzutragen // (Beispiel: 00030003 - 0007 = 0002FFFC) { DS_minus1_plus(midptr,len-pFN_maxlength); } } else { // Kein Carry. - if (FN_V_minusp(y,y_)) // kürzerer Summand war negativ - // Dann ist ein positiver Übertrag weiterzutragen + if (FN_V_minusp(y,y_)) // kürzerer Summand war negativ + // Dann ist ein positiver Übertrag weiterzutragen // (Beispiel: 0002FFF8 - FFF5 = 00030003) { DS_1_plus(midptr,len-pFN_maxlength); } } } @@ -140,36 +140,36 @@ const cl_I operator- (const cl_I& x, const cl_I& y) else { // x und y sind Bignums if (TheBignum(x)->length > TheBignum(y)->length) - { // x das längere von beiden. + { // x das längere von beiden. CL_ALLOCA_STACK; BN_to_NDS_1(x, MSDptr=,len=,LSDptr=); // NDS zu x bilden. var const uintD* yMSDptr; var uintC ylen; var const uintD* yLSDptr; BN_to_NDS_nocopy(y, yMSDptr=,ylen=,yLSDptr=); // NDS zu y bilden. - // yMSDptr/ylen/yLSDptr bilden die DS des kürzeren Arguments y. + // yMSDptr/ylen/yLSDptr bilden die DS des kürzeren Arguments y. // Es ist len>ylen. // subtrahieren: { var uintD* midptr = LSDptr lspop ylen; var uintD carry = subfrom_loop_lsp(yLSDptr,LSDptr,ylen); if (carry) { // Carry. - if ((sintD)mspref(yMSDptr,0) >=0) // kürzerer Summand war positiv - // Dann ist ein negativer Übertrag weiterzutragen + if ((sintD)mspref(yMSDptr,0) >=0) // kürzerer Summand war positiv + // Dann ist ein negativer Übertrag weiterzutragen // (Beispiel: 00030003 - 0007 = 0002FFFC) { DS_minus1_plus(midptr,len-ylen); } } else { // Kein Carry. - if ((sintD)mspref(yMSDptr,0) <0) // kürzerer Summand war negativ - // Dann ist ein positiver Übertrag weiterzutragen + if ((sintD)mspref(yMSDptr,0) <0) // kürzerer Summand war negativ + // Dann ist ein positiver Übertrag weiterzutragen // (Beispiel: 0002FFF8 - FFF5 = 00030003) { DS_1_plus(midptr,len-ylen); } } } return DS_to_I(MSDptr,len); // DS wieder zum Integer machen } else - { // y das längere von beiden. + { // y das längere von beiden. CL_ALLOCA_STACK; BN_to_NDS_1(y, MSDptr=,len=,LSDptr=); // NDS zu y bilden. // vorsorglich 1 Digit mehr belegen: @@ -183,22 +183,22 @@ const cl_I operator- (const cl_I& x, const cl_I& y) var uintC xlen; var const uintD* xLSDptr; BN_to_NDS_nocopy(x, xMSDptr=,xlen=,xLSDptr=); // NDS zu x bilden. - // xMSDptr/xlen/xLSDptr bilden die DS des kürzeren Arguments x. + // xMSDptr/xlen/xLSDptr bilden die DS des kürzeren Arguments x. // Es ist jetzt len>xlen. // addieren: { var uintD* midptr = LSDptr lspop xlen; var uintD carry = addto_loop_lsp(xLSDptr,LSDptr,xlen); if (carry) { // Carry. - if ((sintD)mspref(xMSDptr,0) >=0) // kürzerer Summand war positiv - // Dann ist ein positiver Übertrag weiterzutragen + if ((sintD)mspref(xMSDptr,0) >=0) // kürzerer Summand war positiv + // Dann ist ein positiver Übertrag weiterzutragen // (Beispiel: 0002FFFC + 0007 = 00030003) { DS_1_plus(midptr,len-xlen); } } else { // Kein Carry. - if ((sintD)mspref(xMSDptr,0) <0) // kürzerer Summand war negativ - // Dann ist ein negativer Übertrag weiterzutragen + if ((sintD)mspref(xMSDptr,0) <0) // kürzerer Summand war negativ + // Dann ist ein negativer Übertrag weiterzutragen // (Beispiel: 00020003 + FFF5 = 0001FFF8) { DS_minus1_plus(midptr,len-xlen); } } } diff --git a/src/integer/elem/cl_I_mul.cc b/src/integer/elem/cl_I_mul.cc index 8db6470..db75653 100644 --- a/src/integer/elem/cl_I_mul.cc +++ b/src/integer/elem/cl_I_mul.cc @@ -29,7 +29,7 @@ const cl_I operator* (const cl_I& x, const cl_I& y) { var sintV x_ = FN_to_V(x); var sintV y_ = FN_to_V(y); #if (cl_value_len > 32) - // nur falls x und y Integers mit höchstens 32 Bit sind: + // nur falls x und y Integers mit höchstens 32 Bit sind: if (((uintV)((sintV)sign_of(x_) ^ x_) < bit(31)) && ((uintV)((sintV)sign_of(y_) ^ y_) < bit(31))) #endif @@ -38,7 +38,7 @@ const cl_I operator* (const cl_I& x, const cl_I& y) var uint32 hi; var uint32 lo; mulu32((uint32)x_,(uint32)y_,hi=,lo=); // erst unsigned multiplizieren - if (x_ < 0) { hi -= (uint32)y_; } // dann Korrektur für Vorzeichen + if (x_ < 0) { hi -= (uint32)y_; } // dann Korrektur für Vorzeichen if (y_ < 0) { hi -= (uint32)x_; } // (vgl. DS_DS_mul_DS) return L2_to_I(hi,lo); } diff --git a/src/integer/elem/cl_I_plus.cc b/src/integer/elem/cl_I_plus.cc index a7abb63..eb27c51 100644 --- a/src/integer/elem/cl_I_plus.cc +++ b/src/integer/elem/cl_I_plus.cc @@ -47,7 +47,7 @@ const cl_I operator+ (const cl_I& x, const cl_I& y) #endif } else - { // x ist Fixnum, y ist Bignum, also y länger + { // x ist Fixnum, y ist Bignum, also y länger #if (intDsize==64) var sint64 x_ = FN_to_V(x); // Wert von x #else @@ -75,15 +75,15 @@ const cl_I operator+ (const cl_I& x, const cl_I& y) var uintD* midptr = LSDptr lspop pFN_maxlength; if (y_new < y_) { // Carry. - if (!FN_V_minusp(x,x_)) // kürzerer Summand war positiv - // Dann ist ein positiver Übertrag weiterzutragen + if (!FN_V_minusp(x,x_)) // kürzerer Summand war positiv + // Dann ist ein positiver Übertrag weiterzutragen // (Beispiel: 0002FFFC + 0007 = 00030003) { DS_1_plus(midptr,len-pFN_maxlength); } } else { // Kein Carry. - if (FN_V_minusp(x,x_)) // kürzerer Summand war negativ - // Dann ist ein negativer Übertrag weiterzutragen + if (FN_V_minusp(x,x_)) // kürzerer Summand war negativ + // Dann ist ein negativer Übertrag weiterzutragen // (Beispiel: 00020003 + FFF5 = 0001FFF8) { DS_minus1_plus(midptr,len-pFN_maxlength); } } } @@ -93,7 +93,7 @@ const cl_I operator+ (const cl_I& x, const cl_I& y) else { // x ist Bignum if (fixnump(y)) - { // x ist Bignum, y ist Fixnum, also x länger + { // x ist Bignum, y ist Fixnum, also x länger #if (intDsize==64) var sint64 y_ = FN_to_V(y); // Wert von y #else @@ -121,15 +121,15 @@ const cl_I operator+ (const cl_I& x, const cl_I& y) var uintD* midptr = LSDptr lspop pFN_maxlength; if (x_new < x_) { // Carry. - if (!FN_V_minusp(y,y_)) // kürzerer Summand war positiv - // Dann ist ein positiver Übertrag weiterzutragen + if (!FN_V_minusp(y,y_)) // kürzerer Summand war positiv + // Dann ist ein positiver Übertrag weiterzutragen // (Beispiel: 0002FFFC + 0007 = 00030003) { DS_1_plus(midptr,len-pFN_maxlength); } } else { // Kein Carry. - if (FN_V_minusp(y,y_)) // kürzerer Summand war negativ - // Dann ist ein negativer Übertrag weiterzutragen + if (FN_V_minusp(y,y_)) // kürzerer Summand war negativ + // Dann ist ein negativer Übertrag weiterzutragen // (Beispiel: 00020003 + FFF5 = 0001FFF8) { DS_minus1_plus(midptr,len-pFN_maxlength); } } } @@ -139,41 +139,41 @@ const cl_I operator+ (const cl_I& x, const cl_I& y) { // x und y sind Bignums CL_ALLOCA_STACK; if (TheBignum(x)->length > TheBignum(y)->length) - { // x das längere von beiden. + { // x das längere von beiden. BN_to_NDS_1(x, MSDptr=,len=,LSDptr=); // NDS zu x bilden. var const uintD* yMSDptr; var uintC ylen; var const uintD* yLSDptr; BN_to_NDS_nocopy(y, yMSDptr=,ylen=,yLSDptr=); // NDS zu y bilden. - // yMSDptr/ylen/yLSDptr bilden die DS des kürzeren Arguments y. + // yMSDptr/ylen/yLSDptr bilden die DS des kürzeren Arguments y. // Es ist len>ylen. // addieren: { var uintD* midptr = LSDptr lspop ylen; var uintD carry = addto_loop_lsp(yLSDptr,LSDptr,ylen); if (carry) { // Carry. - if ((sintD)mspref(yMSDptr,0) >=0) // kürzerer Summand war positiv - // Dann ist ein positiver Übertrag weiterzutragen + if ((sintD)mspref(yMSDptr,0) >=0) // kürzerer Summand war positiv + // Dann ist ein positiver Übertrag weiterzutragen // (Beispiel: 0002FFFC + 0007 = 00030003) { DS_1_plus(midptr,len-ylen); } } else { // Kein Carry. - if ((sintD)mspref(yMSDptr,0) <0) // kürzerer Summand war negativ - // Dann ist ein negativer Übertrag weiterzutragen + if ((sintD)mspref(yMSDptr,0) <0) // kürzerer Summand war negativ + // Dann ist ein negativer Übertrag weiterzutragen // (Beispiel: 00020003 + FFF5 = 0001FFF8) { DS_minus1_plus(midptr,len-ylen); } } } return DS_to_I(MSDptr,len); // DS wieder zum Integer machen } else - { // y das längere von beiden. + { // y das längere von beiden. BN_to_NDS_1(y, MSDptr=,len=,LSDptr=); // NDS zu y bilden. var const uintD* xMSDptr; var uintC xlen; var const uintD* xLSDptr; BN_to_NDS_nocopy(x, xMSDptr=,xlen=,xLSDptr=); // NDS zu x bilden. - // xMSDptr/xlen/xLSDptr bilden die DS des kürzeren Arguments x. + // xMSDptr/xlen/xLSDptr bilden die DS des kürzeren Arguments x. // len>xlen erzwingen: if (len==xlen) { var sintD sign = sign_of_sintD(mspref(MSDptr,0)); @@ -184,15 +184,15 @@ const cl_I operator+ (const cl_I& x, const cl_I& y) var uintD carry = addto_loop_lsp(xLSDptr,LSDptr,xlen); if (carry) { // Carry. - if ((sintD)mspref(xMSDptr,0) >=0) // kürzerer Summand war positiv - // Dann ist ein positiver Übertrag weiterzutragen + if ((sintD)mspref(xMSDptr,0) >=0) // kürzerer Summand war positiv + // Dann ist ein positiver Übertrag weiterzutragen // (Beispiel: 0002FFFC + 0007 = 00030003) { DS_1_plus(midptr,len-xlen); } } else { // Kein Carry. - if ((sintD)mspref(xMSDptr,0) <0) // kürzerer Summand war negativ - // Dann ist ein negativer Übertrag weiterzutragen + if ((sintD)mspref(xMSDptr,0) <0) // kürzerer Summand war negativ + // Dann ist ein negativer Übertrag weiterzutragen // (Beispiel: 00020003 + FFF5 = 0001FFF8) { DS_minus1_plus(midptr,len-xlen); } } } diff --git a/src/integer/elem/cl_I_square.cc b/src/integer/elem/cl_I_square.cc index cd48ac3..257e981 100644 --- a/src/integer/elem/cl_I_square.cc +++ b/src/integer/elem/cl_I_square.cc @@ -23,7 +23,7 @@ const cl_I square (const cl_I& x) if (fixnump(x)) { var sintV x_ = FN_to_V(x); #if (cl_value_len > 32) - // nur falls x ein Integer mit höchstens 32 Bit ist: + // nur falls x ein Integer mit höchstens 32 Bit ist: if ((uintV)((sintV)sign_of(x_) ^ x_) < bit(31)) #endif { @@ -31,7 +31,7 @@ const cl_I square (const cl_I& x) var uint32 hi; var uint32 lo; mulu32((uint32)x_,(uint32)x_,hi=,lo=); // erst unsigned multiplizieren - if (x_ < 0) { hi -= 2*(uint32)x_; } // dann Korrektur für Vorzeichen + if (x_ < 0) { hi -= 2*(uint32)x_; } // dann Korrektur für Vorzeichen return L2_to_I(hi,lo); } } diff --git a/src/integer/gcd/cl_I_gcd.cc b/src/integer/gcd/cl_I_gcd.cc index fb41860..4252d51 100644 --- a/src/integer/gcd/cl_I_gcd.cc +++ b/src/integer/gcd/cl_I_gcd.cc @@ -16,12 +16,12 @@ namespace cln { -#define GCD_ALGO 3 // 1: binär, 2: Schulmethode, 3: Lehmer +#define GCD_ALGO 3 // 1: binär, 2: Schulmethode, 3: Lehmer #if (GCD_ALGO == 1) -// binäre Methode: +// binäre Methode: // (gcd a b) :== // b=0 --> (abs a) // a=0 --> (abs b) @@ -147,7 +147,7 @@ namespace cln { if (eq(b,1)) { return 1; } // b=1 -> 1 if (eq(b,0)) { return abs(a); } // b=0 -> (abs a) if (eq(a,0)) { return abs(b); } // a=0 -> (abs b) - // Beträge nehmen: + // Beträge nehmen: {var cl_I abs_a = abs(a); var cl_I abs_b = abs(b); var cl_I& a = abs_a; @@ -188,16 +188,16 @@ namespace cln { // Falls (- (integer-length a) (integer-length b)) >= intDsize/2, // lohnt sich eine Division: (a,b) := (b , a mod b). Falls b=0: return a. // Falls dagegen 0 <= (- (integer-length a) (integer-length b)) < intDsize/2, -// seien a' die führenden intDsize Bits von a +// seien a' die führenden intDsize Bits von a // (2^(intDsize-1) <= a' < 2^intDsize) und b' die entsprechenden Bits von b // (2^(intDsize/2) <= b' <= a' < 2^intDsize). -// Rechne den Euklid-Algorithmus mit Beifaktoren für ALLE Zahlen (a,b) aus, -// die mit a' bzw. b' anfangen; das liefert x1,y1,x2,y2, so daß +// Rechne den Euklid-Algorithmus mit Beifaktoren für ALLE Zahlen (a,b) aus, +// die mit a' bzw. b' anfangen; das liefert x1,y1,x2,y2, so daß // ggT(a,b) = ggT(x1*a-y1*b,-x2*a+y2*b) und x1*a-y1*b>=0,-x2*a+y2*b>=0. // Genauer: Mit offensichtlicher Skalierung betrachten wir // a als beliebiges Element des Intervalls [a',a'+1) und // b als beliebiges Element des Intervalls [b',b'+1) und -// führen den Euklid-Algorithmus schrittweise durch: +// führen den Euklid-Algorithmus schrittweise durch: // (x1,y1,z1) := (1,0,a'), (x2,y2,z2) := (0,1,b'), // Schleife: // {Hier x1*a'-y1*b'=z1, x1*a-y1*b in [z1-y1,z1+x1), z1-y1>=0, z1>0, @@ -207,7 +207,7 @@ namespace cln { // (x1,y1,z1) := (x1+x2,y1+y2,z1-z2), goto Schleife. // Falls z2-x2>=z1+x1: // (x2,y2,z2) := (x2+x1,y2+y1,z2-z1), goto Schleife. -// Sonst muß man abbrechen. +// Sonst muß man abbrechen. // {Zu den Schleifeninvarianten: // 1. Die Gleichungen x1*a'-y1*b'=z1, -x2*a'+y2*b'=z2, // x1*y2-x2*y1=1, x1*z2+x2*z1=b', y1*z2+y2*z1=a' mit Induktion. @@ -221,22 +221,22 @@ namespace cln { // 7. Die Ungleichung max(z1,z2) <= a' mit Induktion. // 8. Die Ungleichung x1+x2 <= x1*z2+x2*z1 = b', // die Ungleichung y1+y2 <= y1*z2+y2*z1 = a'. -// Damit bleiben alle Größen im Intervall [0,beta), kein Überlauf. +// Damit bleiben alle Größen im Intervall [0,beta), kein Überlauf. // 9. Die Ungleichungen z1+x1<=beta, z2+y2<=beta mit Induktion. // 10. x1*a-y1*b in (z1-y1,z1+x1) (bzw. [z1,z1+x1) bei y1=0), // -x2*a+y2*b in (z2-x2,z2+y2) (bzw. [z2,z2+y2) bei x2=0), // da a in a'+[0,1) und b in b'+[0,1). // Jedenfalls 0 < x1*a-y1*b < z1+x1 <= x2*z1+x1*z2 = b' falls x2>0, // und 0 < -x2*a+y2*b < z2+y2 <= y1*z2+y2*z1 = a' falls y1>0.} -// Man kann natürlich auch mehrere Subtraktionsschritte auf einmal -// durchführen: +// Man kann natürlich auch mehrere Subtraktionsschritte auf einmal +// durchführen: // Falls q := floor((z1-y1)/(z2+y2)) > 0 : // (x1,y1,z1) := (x1+q*x2,y1+q*y2,z1-q*z2), goto Schleife. // Falls q := floor((z2-x2)/(z1+x1)) > 0 : // (x2,y2,z2) := (x2+q*x1,y2+q*y1,z2-q*z1), goto Schleife. -// {Am Schluß gilt -(x1+x2) < z1-z2 < y1+y2 und daher +// {Am Schluß gilt -(x1+x2) < z1-z2 < y1+y2 und daher // z2-x2 <= b'/(x1+x2) < z1+x1, z1-y1 <= a'/(y1+y2) < z2+y2, -// und - unter Berücksichtigung von x1*y2-x2*y1=1 - +// und - unter Berücksichtigung von x1*y2-x2*y1=1 - // z1-y1 <= b'/(x1+x2) < z2+y2, z2-x2 <= a'/(y1+y2) < z1+x1, // also max(z1-y1,z2-x2) <= min(b'/(x1+x2),a'/(y1+y2)) // <= max(b'/(x1+x2),a'/(y1+y2)) < min(z1+x1,z2+y2).} @@ -320,8 +320,8 @@ namespace cln { I_abs_to_NUDS(b); // (abs b) als NUDS erzeugen // Jetzt ist a = a_MSDptr/a_len/a_LSDptr, b = b_MSDptr/b_len/b_LSDptr, // beides NUDS, und a_len>0, b_len>0. - // Platz für zwei Rechenregister besorgen, mit je max(a_len,b_len)+1 Digits: - {var uintD* divroomptr; // Platz für Divisionsergebnis + // Platz für zwei Rechenregister besorgen, mit je max(a_len,b_len)+1 Digits: + {var uintD* divroomptr; // Platz für Divisionsergebnis var uintD* c_LSDptr; var uintD* d_LSDptr; {var uintC c_len = (a_len>=b_len ? a_len : b_len) + 1; @@ -344,7 +344,7 @@ namespace cln { swap(uintD*, a_LSDptr,b_LSDptr); a_greater_b: // Hier a>b>0, beides NUDS. - if (b_len==1) // Beschleunigung eines häufigen Falles + if (b_len==1) // Beschleunigung eines häufigen Falles { var uintD b0 = mspref(b_MSDptr,0); if (b0==1) // a>b=1 -> Ergebnis 1. @@ -361,21 +361,21 @@ namespace cln { return UD_to_I(gcdD(a0,b0)); } // Entscheidung, ob Division oder Linearkombination: - { var uintD a_msd; // führende intDsize Bits von a + { var uintD a_msd; // führende intDsize Bits von a var uintD b_msd; // entsprechende Bits von b #if DOUBLE_SPEED - var uintD a_nsd; // nächste intDsize Bits von a + var uintD a_nsd; // nächste intDsize Bits von a var uintD b_nsd; // entsprechende Bits von b #endif - { var uintC len_diff = a_len-b_len; // Längendifferenz - if (len_diff > 1) goto divide; // >=2 -> Bitlängendifferenz>intDsize -> dividieren + { var uintC len_diff = a_len-b_len; // Längendifferenz + if (len_diff > 1) goto divide; // >=2 -> Bitlängendifferenz>intDsize -> dividieren #define bitlendiff_limit (intDsize/2) // sollte >0,0,<=intDsize) berechnen + a_msd = mspref(a_MSDptr,0); // führendes Digit von a + integerlengthD(a_msd,a_msd_size=); // dessen Bit-Länge (>0,<=intDsize) berechnen b_msd = mspref(b_MSDptr,0); #if HAVE_DD - {var uintDD b_msdd = // 2 führende Digits von b + {var uintDD b_msdd = // 2 führende Digits von b (len_diff==0 ? highlowDD(b_msd, mspref(b_MSDptr,1)) : (uintDD)b_msd @@ -387,7 +387,7 @@ namespace cln { b_nsd = lowD(highlowDD(lowD(b_msdd), (b_len<=2-len_diff ? 0 : mspref(b_MSDptr,2-len_diff))) >> a_msd_size); #endif } - {var uintDD a_msdd = // 2 führende Digits von a + {var uintDD a_msdd = // 2 führende Digits von a highlowDD(a_msd, mspref(a_MSDptr,1)); a_msd = lowD(a_msdd >> a_msd_size); #if DOUBLE_SPEED @@ -402,9 +402,9 @@ namespace cln { && (b_msd < (uintD)bit(a_msd_size-bitlendiff_limit)) ) goto divide; - // Entscheidung für Linearkombination ist gefallen. - // a_msd und b_msd so erweitern, daß a_msd die führenden - // intDsize Bits von a enthält: + // Entscheidung für Linearkombination ist gefallen. + // a_msd und b_msd so erweitern, daß a_msd die führenden + // intDsize Bits von a enthält: {var uintC shiftcount = intDsize-a_msd_size; // Shiftcount nach links (>=0, 0) { a_msd = a_msd << shiftcount; @@ -432,9 +432,9 @@ namespace cln { || (b_msd < (uintD)bit(a_msd_size+intDsize-bitlendiff_limit)) ) goto divide; - // Entscheidung für Linearkombination ist gefallen. - // a_msd und b_msd so erweitern, daß a_msd die führenden - // intDsize Bits von a enthält: + // Entscheidung für Linearkombination ist gefallen. + // a_msd und b_msd so erweitern, daß a_msd die führenden + // intDsize Bits von a enthält: // 0 < a_msd_size < b_msd_size + bitlendiff_limit - intDsize <= bitlendiff_limit < intDsize. a_msd = (a_msd << (intDsize-a_msd_size)) | (mspref(a_MSDptr,1) >> a_msd_size); #if DOUBLE_SPEED @@ -449,7 +449,7 @@ namespace cln { #undef bitlendiff_limit }} // Nun ist a_msd = a' > b' = b_msd. - { // Euklid-Algorithmus auf den führenden Digits durchführen: + { // Euklid-Algorithmus auf den führenden Digits durchführen: var partial_gcd_result likobi; #if DOUBLE_SPEED if (a_len >= cl_gcd_double_threshold) @@ -467,14 +467,14 @@ namespace cln { if (likobi.x2==0) { // Ersetze (a,b) := (a-y1*b,b). if (likobi.y1==1) goto subtract; // einfacherer Fall - // Dazu evtl. a um 1 Digit erweitern, so daß a_len=b_len+1: + // Dazu evtl. a um 1 Digit erweitern, so daß a_len=b_len+1: if (a_len == b_len) { lsprefnext(a_MSDptr) = 0; a_len++; } // und y1*b von a subtrahieren: mspref(a_MSDptr,0) -= mulusub_loop_lsp(likobi.y1,b_LSDptr,a_LSDptr,b_len); } else { // Ersetze (a,b) := (x1*a-y1*b,-x2*a+y2*b). - // Dazu evtl. b um 1 Digit erweitern, so daß a_len=b_len: + // Dazu evtl. b um 1 Digit erweitern, so daß a_len=b_len: if (!(a_len==b_len)) { lsprefnext(b_MSDptr) = 0; b_len++; } // c := x1*a-y1*b bilden: mulu_loop_lsp(likobi.x1,a_LSDptr,c_LSDptr,a_len); @@ -484,7 +484,7 @@ namespace cln { mulu_loop_lsp(likobi.y2,b_LSDptr,d_LSDptr,a_len); /* lspref(d_LSDptr,a_len) -= */ mulusub_loop_lsp(likobi.x2,a_LSDptr,d_LSDptr,a_len); - // Wir wissen, daß 0 < c < b und 0 < d < a. Daher müßten + // Wir wissen, daß 0 < c < b und 0 < d < a. Daher müßten // lspref(c_LSDptr,a_len) und lspref(d_LSDptr,a_len) =0 sein. // a := c und b := d kopieren: copy_loop_lsp(c_LSDptr,a_LSDptr,a_len); @@ -495,7 +495,7 @@ namespace cln { 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. + // Übertrag nach b_len Stellen, muß also a_len=b_len+1 sein. { mspref(a_MSDptr,0) -= 1; } } // a normalisieren: @@ -509,7 +509,7 @@ namespace cln { cl_UDS_divide(a_MSDptr,a_len,a_LSDptr,b_MSDptr,b_len,b_LSDptr, divroomptr, &q,&r); a_MSDptr = b_MSDptr; a_len = b_len; a_LSDptr = b_LSDptr; // a := b b_len = r.len; if (b_len==0) break; // b=0 -> fertig - b_LSDptr = old_a_LSDptr; // b übernimmt den vorherigen Platz von a + b_LSDptr = old_a_LSDptr; // b übernimmt den vorherigen Platz von a b_MSDptr = copy_loop_lsp(r.LSDptr,b_LSDptr,b_len); // b := r kopieren goto a_greater_b; // Nun ist a>b>0 }} diff --git a/src/integer/gcd/cl_I_gcd_aux.cc b/src/integer/gcd/cl_I_gcd_aux.cc index e42ac9b..35a1e4a 100644 --- a/src/integer/gcd/cl_I_gcd_aux.cc +++ b/src/integer/gcd/cl_I_gcd_aux.cc @@ -56,7 +56,7 @@ void partial_gcd (uintD z1, uintD z2, partial_gcd_result* erg) } if (z1-y1 <= z2+y2-1) break; } - // Keine Subtraktion mehr möglich. + // Keine Subtraktion mehr möglich. erg->x1 = x1; erg->y1 = y1; erg->x2 = x2; erg->y2 = y2; // Ergebnis } diff --git a/src/integer/gcd/cl_I_gcd_aux2.cc b/src/integer/gcd/cl_I_gcd_aux2.cc index 2a4fc03..2ba09b6 100644 --- a/src/integer/gcd/cl_I_gcd_aux2.cc +++ b/src/integer/gcd/cl_I_gcd_aux2.cc @@ -14,8 +14,8 @@ namespace cln { -// Dasselbe wie partial_gcd(z1,z2,erg), nur daß z1 und z2 Doppelworte sind. -// Bevor im Ergebnis erg ein Überlauf eintritt, wird abgebrochen. +// Dasselbe wie partial_gcd(z1,z2,erg), nur daß z1 und z2 Doppelworte sind. +// Bevor im Ergebnis erg ein Überlauf eintritt, wird abgebrochen. #if HAVE_DD @@ -25,10 +25,10 @@ static inline uintDD muluDD_unchecked(uintD q, uintDD a) } // Division: liefert min(floor(x / y), 2^intDsize-1). -// Vorausgesetzt wird, daß x >= 2 * y > 0. +// Vorausgesetzt wird, daß x >= 2 * y > 0. static uintD floorDD (uintDD x, uintDD y) { - // vgl. Algorithmus für divu_3232_3232(). + // vgl. Algorithmus für divu_3232_3232(). var uintD q; if (y < ((uintDD)1 << intDsize)) { if (highD(x) >= y) @@ -178,17 +178,17 @@ void partial_gcd (uintDD z1, uintDD z2, partial_gcd_result* erg) if (z1 - (uintDD)y1 <= z2 + (uintDD)(y2-1)) goto done; } done: - // Keine Subtraktion (ohne Überlauf) mehr möglich. + // Keine Subtraktion (ohne Überlauf) mehr möglich. erg->x1 = x1; erg->y1 = y1; erg->x2 = x2; erg->y2 = y2; // Ergebnis } #else // Division: liefert min(floor(xhi|xlo / yhi|ylo), 2^intDsize-1). -// Vorausgesetzt wird, daß xhi|xlo >= 2 * yhi|ylo > 0. +// Vorausgesetzt wird, daß xhi|xlo >= 2 * yhi|ylo > 0. static uintD floorDD (uintD xhi, uintD xlo, uintD yhi, uintD ylo) { - // vgl. Algorithmus für divu_3232_3232(). + // vgl. Algorithmus für divu_3232_3232(). var uintD q; if (yhi == 0) { if (xhi >= ylo) @@ -448,7 +448,7 @@ void partial_gcd (uintD z1hi, uintD z1lo, uintD z2hi, uintD z2lo, partial_gcd_re } } done: - // Keine Subtraktion (ohne Überlauf) mehr möglich. + // Keine Subtraktion (ohne Überlauf) mehr möglich. erg->x1 = x1; erg->y1 = y1; erg->x2 = x2; erg->y2 = y2; // Ergebnis } diff --git a/src/integer/gcd/cl_I_lcm.cc b/src/integer/gcd/cl_I_lcm.cc index 36ccbc9..316989c 100644 --- a/src/integer/gcd/cl_I_lcm.cc +++ b/src/integer/gcd/cl_I_lcm.cc @@ -22,7 +22,7 @@ const cl_I lcm (const cl_I& a, const cl_I& b) // Falls g=1, Ergebnis a*b, sonst Ergebnis (a/g)*b. if (eq(a,0)) { return 0; } if (eq(b,0)) { return 0; } - // Beträge nehmen: + // Beträge nehmen: {var cl_I abs_a = abs(a); var cl_I abs_b = abs(b); var cl_I& a = abs_a; diff --git a/src/integer/gcd/cl_I_xgcd.cc b/src/integer/gcd/cl_I_xgcd.cc index 8afa2c2..76ec942 100644 --- a/src/integer/gcd/cl_I_xgcd.cc +++ b/src/integer/gcd/cl_I_xgcd.cc @@ -16,7 +16,7 @@ namespace cln { -#define GCD_ALGO 3 // 1: binär, 2: Schulmethode, 3: Lehmer +#define GCD_ALGO 3 // 1: binär, 2: Schulmethode, 3: Lehmer #if (GCD_ALGO == 2) @@ -51,7 +51,7 @@ namespace cln { var cl_I va = 0; var cl_I ub = 0; var cl_I vb = (minusp(b) ? cl_I(-1) : cl_I(1)); // vb := +/- 1 - // Beträge nehmen: + // Beträge nehmen: {var cl_I abs_a = abs(a); var cl_I abs_b = abs(b); var cl_I& a = abs_a; @@ -86,7 +86,7 @@ namespace cln { #if (GCD_ALGO == 3) // (xgcd A B) :== // wie oben bei (gcd A B). -// Zusätzlich werden Variablen sA,sB,sk,uAa,uBa,uAb,uBb geführt, +// Zusätzlich werden Variablen sA,sB,sk,uAa,uBa,uAb,uBb geführt, // wobei sA,sB,sk Vorzeichen (+/- 1) und uAa,uBa,uAb,uBb Integers >=0 sind mit // uAa * sA*A - uBa * sB*B = a, // - uAb * sA*A + uBb * sB*B = b, @@ -107,11 +107,11 @@ namespace cln { // Beim Ersetzen (a,b) := (b,a-q*b) // ersetzt man (uAa,uBa,uAb,uBb) := (uAb,uBb,uAa+q*uAb,uBa+q*uBb), // sk := -sk, (sA,sB) := (-sA,-sB). -// Zum Schluß ist a der ggT und a = uAa*sA * A + -uBa*sB * B -// die gewünschte Linearkombination. +// Zum Schluß ist a der ggT und a = uAa*sA * A + -uBa*sB * B +// die gewünschte Linearkombination. // Da stets gilt sk*sA*A = |A|, sk*sB*B = |B|, a>=1, b>=1, // folgt 0 <= uAa <= |B|, 0 <= uAb <= |B|, 0 <= uBa <= |A|, 0 <= uBb <= |A|. -// Ferner wird sk nie benutzt, braucht also nicht mitgeführt zu werden. +// Ferner wird sk nie benutzt, braucht also nicht mitgeführt zu werden. // Define this to 1 in order to use double-word sized a' and b'. // This gives better x1,y1,x2,y2, because normally the values x1,y1,x2,y2 @@ -119,7 +119,7 @@ namespace cln { // is lost. Actually, this flag multiplies the gcd speed by 1.5, not 2.0. #define DOUBLE_SPEED 1 - // Bildet u := u + v, wobei für u genügend Platz sei: + // Bildet u := u + v, wobei für u genügend Platz sei: // (Benutzt v.MSDptr nicht.) static void NUDS_likobi0_NUDS (DS* u, DS* v) { var uintC u_len = u->len; @@ -138,14 +138,14 @@ namespace cln { } } } - // Bildet u := u + q*v, wobei für u genügend Platz sei: + // Bildet u := u + q*v, wobei für u genügend Platz sei: // (Dabei sei nachher u>0.) static void NUDS_likobi1_NUDS (DS* u, DS* v, uintD q) { var uintC v_len = v->len; - if (v_len>0) // nur nötig, falls v /=0 + if (v_len>0) // nur nötig, falls v /=0 { var uintC u_len = u->len; var uintD carry; - if (u_len <= v_len) // evtl. u vergrößern + if (u_len <= v_len) // evtl. u vergrößern { u->MSDptr = clear_loop_lsp(u->MSDptr,v_len-u_len+1); u->len = u_len = v_len+1; } // Nun ist u_len > v_len. @@ -159,7 +159,7 @@ namespace cln { while (mspref(u->MSDptr,0)==0) { msshrink(u->MSDptr); u->len--; } // normalisieren } } - // Bildet (u,v) := (x1*u+y1*v,x2*u+y2*v), wobei für u,v genügend Platz sei: + // Bildet (u,v) := (x1*u+y1*v,x2*u+y2*v), wobei für u,v genügend Platz sei: // (Dabei sei u>0 oder v>0, nachher u>0 und v>0.) static void NUDS_likobi2_NUDS (DS* u, DS* v, partial_gcd_result* q, uintD* c_LSDptr, uintD* d_LSDptr) { var uintC u_len = u->len; @@ -257,10 +257,10 @@ namespace cln { var DS uAb; var DS uBb; // Rechenregister: - var uintD* divroomptr; // Platz für Divisionsergebnis + var uintD* divroomptr; // Platz für Divisionsergebnis var uintD* c_LSDptr; var uintD* d_LSDptr; - // Platz für uAa,uBa,uAb,uBb besorgen: + // Platz für uAa,uBa,uAb,uBb besorgen: {var uintC u_len = b_len+1; num_stack_alloc(u_len,,uAa.LSDptr=); uAa.MSDptr = uAa.LSDptr; num_stack_alloc(u_len,,uAb.LSDptr=); uAb.MSDptr = uAb.LSDptr; @@ -278,7 +278,7 @@ namespace cln { // uAb = uAb.MSDptr/uAb.len/uAb.LSDptr, // uBb = uBb.MSDptr/uBb.len/uBb.LSDptr, // alles NUDS. - // Platz für zwei Rechenregister besorgen, mit je max(a_len,b_len)+1 Digits: + // Platz für zwei Rechenregister besorgen, mit je max(a_len,b_len)+1 Digits: {var uintC c_len = (a_len>=b_len ? a_len : b_len) + 1; num_stack_alloc(c_len,,c_LSDptr=); num_stack_alloc(c_len,divroomptr=,d_LSDptr=); @@ -304,21 +304,21 @@ namespace cln { a_greater_b: // Hier a>b>0, beides NUDS. // Entscheidung, ob Division oder Linearkombination: - { var uintD a_msd; // führende intDsize Bits von a + { var uintD a_msd; // führende intDsize Bits von a var uintD b_msd; // entsprechende Bits von b #if DOUBLE_SPEED - var uintD a_nsd; // nächste intDsize Bits von a + var uintD a_nsd; // nächste intDsize Bits von a var uintD b_nsd; // entsprechende Bits von b #endif - { var uintC len_diff = a_len-b_len; // Längendifferenz - if (len_diff > 1) goto divide; // >=2 -> Bitlängendifferenz>intDsize -> dividieren + { var uintC len_diff = a_len-b_len; // Längendifferenz + if (len_diff > 1) goto divide; // >=2 -> Bitlängendifferenz>intDsize -> dividieren #define bitlendiff_limit (intDsize/2) // sollte >0,0,<=intDsize) berechnen + a_msd = mspref(a_MSDptr,0); // führendes Digit von a + integerlengthD(a_msd,a_msd_size=); // dessen Bit-Länge (>0,<=intDsize) berechnen b_msd = mspref(b_MSDptr,0); #if HAVE_DD - {var uintDD b_msdd = // 2 führende Digits von b + {var uintDD b_msdd = // 2 führende Digits von b (len_diff==0 ? highlowDD(b_msd, (b_len==1 ? 0 : mspref(b_MSDptr,1))) : (uintDD)b_msd @@ -330,7 +330,7 @@ namespace cln { b_nsd = lowD(highlowDD(lowD(b_msdd), (b_len<=2-len_diff ? 0 : mspref(b_MSDptr,2-len_diff))) >> a_msd_size); #endif } - {var uintDD a_msdd = // 2 führende Digits von a + {var uintDD a_msdd = // 2 führende Digits von a highlowDD(a_msd, (a_len==1 ? 0 : mspref(a_MSDptr,1))); a_msd = lowD(a_msdd >> a_msd_size); #if DOUBLE_SPEED @@ -345,9 +345,9 @@ namespace cln { && (b_msd < (uintD)bit(a_msd_size-bitlendiff_limit)) ) goto divide; - // Entscheidung für Linearkombination ist gefallen. - // a_msd und b_msd so erweitern, daß a_msd die führenden - // intDsize Bits von a enthält: + // Entscheidung für Linearkombination ist gefallen. + // a_msd und b_msd so erweitern, daß a_msd die führenden + // intDsize Bits von a enthält: {var uintC shiftcount = intDsize-a_msd_size; // Shiftcount nach links (>=0, 0) { a_msd = a_msd << shiftcount; @@ -379,9 +379,9 @@ namespace cln { || (b_msd < (uintD)bit(a_msd_size+intDsize-bitlendiff_limit)) ) goto divide; - // Entscheidung für Linearkombination ist gefallen. - // a_msd und b_msd so erweitern, daß a_msd die führenden - // intDsize Bits von a enthält: + // Entscheidung für Linearkombination ist gefallen. + // a_msd und b_msd so erweitern, daß a_msd die führenden + // intDsize Bits von a enthält: // 0 < a_msd_size < b_msd_size + bitlendiff_limit - intDsize <= bitlendiff_limit < intDsize. a_msd = (a_msd << (intDsize-a_msd_size)) | (mspref(a_MSDptr,1) >> a_msd_size); #if DOUBLE_SPEED @@ -398,7 +398,7 @@ namespace cln { #undef bitlendiff_limit }} // Nun ist a_msd = a' > b' = b_msd. - { // Euklid-Algorithmus auf den führenden Digits durchführen: + { // Euklid-Algorithmus auf den führenden Digits durchführen: var partial_gcd_result likobi; #if DOUBLE_SPEED #if HAVE_DD @@ -413,7 +413,7 @@ namespace cln { if (likobi.x2==0) { // Ersetze (a,b) := (a-y1*b,b). if (likobi.y1==1) goto subtract; // einfacherer Fall - // Dazu evtl. a um 1 Digit erweitern, so daß a_len=b_len+1: + // Dazu evtl. a um 1 Digit erweitern, so daß a_len=b_len+1: if (a_len == b_len) { lsprefnext(a_MSDptr) = 0; a_len++; } // und y1*b von a subtrahieren: mspref(a_MSDptr,0) -= mulusub_loop_lsp(likobi.y1,b_LSDptr,a_LSDptr,b_len); @@ -426,7 +426,7 @@ namespace cln { // Ersetze (uBa,uBb) := (x1*uBa+y1*uBb,x2*uBa+y2*uBb) : NUDS_likobi2_NUDS(&uBa,&uBb,&likobi,c_LSDptr,d_LSDptr); // Ersetze (a,b) := (x1*a-y1*b,-x2*a+y2*b). - // Dazu evtl. b um 1 Digit erweitern, so daß a_len=b_len: + // Dazu evtl. b um 1 Digit erweitern, so daß a_len=b_len: if (!(a_len==b_len)) { lsprefnext(b_MSDptr) = 0; b_len++; } // c := x1*a-y1*b bilden: mulu_loop_lsp(likobi.x1,a_LSDptr,c_LSDptr,a_len); @@ -436,7 +436,7 @@ namespace cln { mulu_loop_lsp(likobi.y2,b_LSDptr,d_LSDptr,a_len); /* lspref(d_LSDptr,a_len) -= */ mulusub_loop_lsp(likobi.x2,a_LSDptr,d_LSDptr,a_len); - // Wir wissen, daß 0 < c < b und 0 < d < a. Daher müßten + // Wir wissen, daß 0 < c < b und 0 < d < a. Daher müßten // lspref(c_LSDptr,a_len) und lspref(d_LSDptr,a_len) =0 sein. // a := c und b := d kopieren: copy_loop_lsp(c_LSDptr,a_LSDptr,a_len); @@ -449,7 +449,7 @@ namespace cln { NUDS_likobi0_NUDS(&uAa,&uAb); // uAa := uAa + uAb NUDS_likobi0_NUDS(&uBa,&uBb); // uBa := uBa + uBb if (!( subfrom_loop_lsp(b_LSDptr,a_LSDptr,b_len) ==0)) - // Übertrag nach b_len Stellen, muß also a_len=b_len+1 sein. + // Übertrag nach b_len Stellen, muß also a_len=b_len+1 sein. { mspref(a_MSDptr,0) -= 1; } } // a normalisieren: @@ -463,7 +463,7 @@ namespace cln { cl_UDS_divide(a_MSDptr,a_len,a_LSDptr,b_MSDptr,b_len,b_LSDptr, divroomptr, &q,&r); a_MSDptr = b_MSDptr; a_len = b_len; a_LSDptr = b_LSDptr; // a := b b_len = r.len; if (b_len==0) goto return_a_coeffsb; // b=0 -> fertig - b_LSDptr = old_a_LSDptr; // b übernimmt den vorherigen Platz von a + b_LSDptr = old_a_LSDptr; // b übernimmt den vorherigen Platz von a b_MSDptr = copy_loop_lsp(r.LSDptr,b_LSDptr,b_len); // b := r kopieren // (uAa,uAb) := (uAb,uAa+q*uAb) : if (!(uAb.len==0)) @@ -472,7 +472,7 @@ namespace cln { c.LSDptr = c_LSDptr; c.len = q.len + uAb.len; if (lspref(c_LSDptr,c.len-1)==0) { c.len--; } // normalisieren NUDS_likobi0_NUDS(&uAa,&c); // zu uAa addieren - } // noch uAa,uAb vertauschen (später) + } // noch uAa,uAb vertauschen (später) // (uBa,uBb) := (uBb,uBa+q*uBb) : if (!(uBb.len==0)) { cl_UDS_mul(q.LSDptr,q.len,uBb.LSDptr,uBb.len,c_LSDptr); // q * uBb @@ -480,14 +480,14 @@ namespace cln { c.LSDptr = c_LSDptr; c.len = q.len + uBb.len; if (lspref(c_LSDptr,c.len-1)==0) { c.len--; } // normalisieren NUDS_likobi0_NUDS(&uBa,&c); // zu uBa addieren - } // noch uBa,uBb vertauschen (später) + } // noch uBa,uBb vertauschen (später) goto a_greater_b_swap; // Nun ist a>b>0 }} } - // Nun ist a = b. Wähle diejenige der beiden Linearkombinationen + // Nun ist a = b. Wähle diejenige der beiden Linearkombinationen // a = uAa*sA * A + -uBa*sB * B // b = -uAb*sA * A + uBb*sB * B - // die die betragsmäßig kleinsten Koeffizienten hat. + // die die betragsmäßig kleinsten Koeffizienten hat. // Teste auf uBa < uBb. (Das kann auftreten, z.B. bei // A=560014183, B=312839871 wird a=b=1, uAa < uAb, uBa < uBb.) // Falls uBa = uBb, teste auf uAa < uAb. (Das kann auftreten, z.B. bei diff --git a/src/integer/gcd/cl_low_gcd.cc b/src/integer/gcd/cl_low_gcd.cc index 3a268b5..ed32bfd 100644 --- a/src/integer/gcd/cl_low_gcd.cc +++ b/src/integer/gcd/cl_low_gcd.cc @@ -16,7 +16,7 @@ namespace cln { // > a,b: zwei Integers // < ergebnis: (gcd a b), ein Integer >=0 uintV gcd (uintV a, uintV b) -// binäre Methode: +// binäre Methode: // (gcd a b) :== // (prog ((j 0)) // 1 {a,b >0} @@ -38,7 +38,7 @@ namespace cln { // 5 {a=b>0} // (return (ash a j)) // ) -// Statt j zu erhöhen und immer Bit 0 von a und b abfragen, +// Statt j zu erhöhen und immer Bit 0 von a und b abfragen, // fragen wir stattdessen immer Bit j von a und b ab; Bits j-1..0 sind =0. { #ifdef DUMMER_GGT // so macht's ein Mathematiker: diff --git a/src/integer/misc/cl_I_eqhashcode.cc b/src/integer/misc/cl_I_eqhashcode.cc index 572be44..113bcda 100644 --- a/src/integer/misc/cl_I_eqhashcode.cc +++ b/src/integer/misc/cl_I_eqhashcode.cc @@ -44,7 +44,7 @@ inline uint32 equal_hashcode (const cl_BN& x) var const uintD* MSDptr; var uintC len; BN_to_NDS_nocopy(x, MSDptr = , len = ,); - // Nicht alle führenden intDsize+1 Bits sind gleich. + // Nicht alle führenden intDsize+1 Bits sind gleich. #if (intDsize==64) var uint64 msd = mspref(MSDptr,0); var uint64 msd2 = (len >= 2 ? mspref(MSDptr,1) : 0); @@ -64,7 +64,7 @@ inline uint32 equal_hashcode (const cl_BN& x) sign = 0; } var sintC exp = len * intDsize; - // Nicht alle führenden 65 Bits sind =0. + // Nicht alle führenden 65 Bits sind =0. if (msd==0) { msd = msd2; exp -= 64; @@ -109,14 +109,14 @@ inline uint32 equal_hashcode (const cl_BN& x) sign = 0; } var sintC exp = len * intDsize; - // Nicht alle führenden intDsize+1 Bits sind =0. - // Wegen intDsize<=32: Nicht alle führenden 33 Bits sind =0. + // Nicht alle führenden intDsize+1 Bits sind =0. + // Wegen intDsize<=32: Nicht alle führenden 33 Bits sind =0. if (msd==0) { msd = msd2; exp -= 32; } - // Nicht alle führenden 32 Bits sind =0. - // Führendes Bit auf 1 normalisieren: + // Nicht alle führenden 32 Bits sind =0. + // Führendes Bit auf 1 normalisieren: else { var uintL s; integerlength32(msd, s = 32 - ); diff --git a/src/integer/misc/cl_I_oddp.cc b/src/integer/misc/cl_I_oddp.cc index 27b6ac8..5721e10 100644 --- a/src/integer/misc/cl_I_oddp.cc +++ b/src/integer/misc/cl_I_oddp.cc @@ -17,13 +17,13 @@ namespace cln { bool oddp (const cl_I& x) { if (fixnump(x)) { - // Fixnum: Bit 0 abprüfen + // Fixnum: Bit 0 abprüfen if (x.word & bit(cl_value_shift)) return true; else return false; } else { - // Bignum: Bit 0 im letzten Digit abprüfen + // Bignum: Bit 0 im letzten Digit abprüfen if (lspref(BN_LSDptr(x),0) & bit(0)) return true; else diff --git a/src/integer/misc/cl_I_ord2.cc b/src/integer/misc/cl_I_ord2.cc index 46a7977..efa70f6 100644 --- a/src/integer/misc/cl_I_ord2.cc +++ b/src/integer/misc/cl_I_ord2.cc @@ -24,8 +24,8 @@ namespace cln { // Sei n = ord2(x). Dann ist lognot(logior(x,-x)) = 2^n-1. // Also (ord2 x) = (integer-length (lognot (logior x (- x)))) . // Methode 2: -// Nullbits am Schluß von x abzählen: -// (ord2 x) = intDsize * Anzahl der Nulldigits am Schluß +// Nullbits am Schluß von x abzählen: +// (ord2 x) = intDsize * Anzahl der Nulldigits am Schluß // + Anzahl der Nullbits am Ende des letzten Digits /=0. uintC ord2 (const cl_I& x) // x /= 0 @@ -43,9 +43,9 @@ uintC ord2 (const cl_I& x) // x /= 0 { var uintC bitcount = 0; var const uintD* ptr; BN_to_NDS_nocopy(x, ,,ptr=); // normalisierte DS zu x bilden. - while (lspref(ptr,0) == 0) { lsshrink(ptr); bitcount += intDsize; } // Nulldigits abzählen + while (lspref(ptr,0) == 0) { lsshrink(ptr); bitcount += intDsize; } // Nulldigits abzählen var uintD lsd = lspref(ptr,0); // letztes Digit /=0 - ord2_D(lsd,bitcount +=); // dessen Nullbits abzählen + ord2_D(lsd,bitcount +=); // dessen Nullbits abzählen return bitcount; } } diff --git a/src/integer/misc/cl_I_power2p.cc b/src/integer/misc/cl_I_power2p.cc index dc29c24..26ec641 100644 --- a/src/integer/misc/cl_I_power2p.cc +++ b/src/integer/misc/cl_I_power2p.cc @@ -37,7 +37,7 @@ uintC power2p (const cl_I& x) // x > 0 var uintD msd = mspref(MSDptr,0); if (msd==0) { msshrink(MSDptr); msd = mspref(MSDptr,0); len--; } // len = Anzahl der Digits ab MSDptr, len>0, msd = erstes Digit (/=0) - if (!((msd & (msd-1)) == 0)) return 0; // erstes Digit muß Zweierpotenz sein + if (!((msd & (msd-1)) == 0)) return 0; // erstes Digit muß Zweierpotenz sein if (DS_test_loop(MSDptr mspop 1,len-1,LSDptr)) return 0; // danach alles Nullen {var uintL msdlen; integerlengthD(msd, msdlen=); diff --git a/src/integer/misc/combin/cl_I_combin.h b/src/integer/misc/combin/cl_I_combin.h index 5a565eb..473dcf4 100644 --- a/src/integer/misc/combin/cl_I_combin.h +++ b/src/integer/misc/combin/cl_I_combin.h @@ -8,7 +8,7 @@ namespace cln { -// UP für Fakultät: +// UP für Fakultät: // Bilde das Produkt prod(a < i <= b, 2*i+1), wobei 0 <= a < b klein. extern const cl_I cl_I_prod_ungerade (uintL a, uintL b); diff --git a/src/integer/misc/combin/cl_I_doublefactorial.cc b/src/integer/misc/combin/cl_I_doublefactorial.cc index 58ba188..0f4621a 100644 --- a/src/integer/misc/combin/cl_I_doublefactorial.cc +++ b/src/integer/misc/combin/cl_I_doublefactorial.cc @@ -137,9 +137,9 @@ const cl_I doublefactorial (uintL n) // assume n >= 0 small var uintL A = n; var uintL B = n; // obere Intervallgrenze floor(n/2^(k-1)) loop - { // 'A' enthält floor(n/2^(k-1)). + { // 'A' enthält floor(n/2^(k-1)). A = A >> 1; // untere Grenze floor(n/2^k) - // 'A' enthält floor(n/2^k). + // 'A' enthält floor(n/2^k). // Bilde Teilprodukt prod(A < i <= B & oddp(i), i) // = prod(floor((A-1)/2) < i <= floor((B-1)/2), 2*i+1) // wobei B = floor(n/2^(k-1)), A = floor(n/2^k) = floor(B/2). @@ -159,9 +159,9 @@ const cl_I doublefactorial (uintL n) // assume n >= 0 small var uintL A = m; var uintL B = m; // obere Intervallgrenze floor(m/2^(k-1)) loop - { // 'A' enthält floor(m/2^(k-1)). + { // 'A' enthält floor(m/2^(k-1)). A = A >> 1; // untere Grenze floor(m/2^k) - // 'A' enthält floor(m/2^k). + // 'A' enthält floor(m/2^k). // Bilde Teilprodukt prod(A < i <= B & oddp(i), i) // = prod(floor((A-1)/2) < i <= floor((B-1)/2), 2*i+1) // wobei B = floor(m/2^(k-1)), A = floor(m/2^k) = floor(B/2). diff --git a/src/integer/misc/combin/cl_I_factorial.cc b/src/integer/misc/combin/cl_I_factorial.cc index a66420b..520519a 100644 --- a/src/integer/misc/combin/cl_I_factorial.cc +++ b/src/integer/misc/combin/cl_I_factorial.cc @@ -19,15 +19,15 @@ namespace cln { // Methode: // n <= 10 -> Ergebnis (Fixnum) aus Tabelle // Sonst: - // Zweierpotenzen extra am Schluß durch einen Shift um + // Zweierpotenzen extra am Schluß durch einen Shift um // ord2(n!) = sum(k>=1, floor(n/2^k) ) = n - logcount(n) Bits. - // Für k>=1 wird jede ungerade Zahl m im Intervall n/2^k < m <= n/2^(k-1) + // Für k>=1 wird jede ungerade Zahl m im Intervall n/2^k < m <= n/2^(k-1) // genau k mal gebraucht (als ungerader Anteil von m*2^0,...,m*2^(k-1) ). // Zur Bestimmung des Produkts aller ungeraden Zahlen in einem Intervall // a < m <= b verwenden wir eine rekursive Funktion, die nach Divide-and- - // Conquer das Produkt über die Intervalle a < m <= c und c < m <= b + // Conquer das Produkt über die Intervalle a < m <= c und c < m <= b // (c := floor((a+b)/2)) bestimmt und beide zusammenmultipliziert. Dies - // vermeidet, daß oft große Zahlen mit ganz kleinen Zahlen multipliziert + // vermeidet, daß oft große Zahlen mit ganz kleinen Zahlen multipliziert // werden. static uintV const fakul_table [] = { @@ -103,9 +103,9 @@ const cl_I factorial (uintL n) // assume n >= 0 small var uintL A = n; var uintL B = n; // obere Intervallgrenze floor(n/2^(k-1)) loop - { // 'A' enthält floor(n/2^(k-1)). + { // 'A' enthält floor(n/2^(k-1)). A = A >> 1; // untere Grenze floor(n/2^k) - // 'A' enthält floor(n/2^k). + // 'A' enthält floor(n/2^k). // Bilde Teilprodukt prod(A < i <= B & oddp(i), i) // = prod(floor((A-1)/2) < i <= floor((B-1)/2), 2*i+1) // wobei B = floor(n/2^(k-1)), A = floor(n/2^k) = floor(B/2). diff --git a/src/integer/misc/combin/cl_I_factorial_aux.cc b/src/integer/misc/combin/cl_I_factorial_aux.cc index 888b0a5..67d6abb 100644 --- a/src/integer/misc/combin/cl_I_factorial_aux.cc +++ b/src/integer/misc/combin/cl_I_factorial_aux.cc @@ -22,7 +22,7 @@ const cl_I cl_I_prod_ungerade (uintL a, uintL b) var cl_I produkt = faktor; var uintC count; dotimesC(count,diff-1, - { faktor = faktor-2; // nächster Faktor + { faktor = faktor-2; // nächster Faktor produkt = faktor*produkt; // mit bisherigem Produkt multiplizieren }); return produkt; diff --git a/src/integer/output/cl_I_decstring.cc b/src/integer/output/cl_I_decstring.cc index 14f8236..67f3847 100644 --- a/src/integer/output/cl_I_decstring.cc +++ b/src/integer/output/cl_I_decstring.cc @@ -19,7 +19,7 @@ char * cl_decimal_string (const cl_I& x) { CL_ALLOCA_STACK; var uintC need = cl_digits_need(x,10); - var uintB* ziffern = cl_alloc_array(uintB,need); // Platz für die Ziffern + var uintB* ziffern = cl_alloc_array(uintB,need); // Platz für die Ziffern var cl_digits erg; erg.LSBptr = &ziffern[need]; I_to_digits(x,10,&erg); // Umwandlung in Ziffern var char* result = cl_sstring((char*)erg.MSBptr,erg.len); // Ziffern in String schreiben diff --git a/src/integer/output/cl_I_print.cc b/src/integer/output/cl_I_print.cc index b8447f9..eceb6b9 100644 --- a/src/integer/output/cl_I_print.cc +++ b/src/integer/output/cl_I_print.cc @@ -26,7 +26,7 @@ void print_integer (std::ostream& stream, unsigned int base, const cl_I& z) abs_z = z; CL_ALLOCA_STACK; var uintC need = cl_digits_need(abs_z,base); - var uintB* ziffern = cl_alloc_array(uintB,need); // Platz für die Ziffern + var uintB* ziffern = cl_alloc_array(uintB,need); // Platz für die Ziffern var cl_digits erg; erg.LSBptr = &ziffern[need]; I_to_digits(abs_z,(uintD)base,&erg); // Umwandlung in Ziffern // Ziffern ausgeben: diff --git a/src/integer/output/cl_I_print_string.cc b/src/integer/output/cl_I_print_string.cc index 27d198a..d3d1068 100644 --- a/src/integer/output/cl_I_print_string.cc +++ b/src/integer/output/cl_I_print_string.cc @@ -20,14 +20,14 @@ char * print_integer_to_string (unsigned int base, const cl_I& z) var bool minus_p = false; var cl_I abs_z; if (minusp(z)) { - // z<0 -> später Vorzeichen ausgeben: + // z<0 -> später Vorzeichen ausgeben: minus_p = true; abs_z = -z; } else abs_z = z; CL_ALLOCA_STACK; var uintC need = 1+cl_digits_need(abs_z,base); - var uintB* ziffern = cl_alloc_array(uintB,need); // Platz für die Ziffern + var uintB* ziffern = cl_alloc_array(uintB,need); // Platz für die Ziffern var cl_digits erg; erg.LSBptr = &ziffern[need]; I_to_digits(abs_z,(uintD)base,&erg); // Umwandlung in Ziffern // Vorzeichen ankleben: diff --git a/src/polynomial/elem/cl_asm_sparc_GF2.cc b/src/polynomial/elem/cl_asm_sparc_GF2.cc index 815b686..a251cfe 100644 --- a/src/polynomial/elem/cl_asm_sparc_GF2.cc +++ b/src/polynomial/elem/cl_asm_sparc_GF2.cc @@ -1,7 +1,7 @@ // Externe Routinen // Prozessor: SPARC // Compiler: GNU-C oder SUN-C -// Parameter-Übergabe: in Registern %o0-%o5. +// Parameter-Übergabe: in Registern %o0-%o5. // Einstellungen: intCsize=32, intDsize=32. #ifdef ASM_UNDERSCORE /* SunOS 4 */ @@ -27,11 +27,11 @@ #define DECLARE_FUNCTION(name) #endif - // Indikatoren für Anweisungen (Instruktionen) in Delay-Slots - // (diese werden VOR der vorigen Instruktion ausgeführt): - #define _ // Instruktion, die stets ausgeführt wird - #define __ // Instruktion, die nur im Sprung-Fall ausgeführt wird - // Abkürzungen für Anweisungen: + // Indikatoren für Anweisungen (Instruktionen) in Delay-Slots + // (diese werden VOR der vorigen Instruktion ausgeführt): + #define _ // Instruktion, die stets ausgeführt wird + #define __ // Instruktion, die nur im Sprung-Fall ausgeführt wird + // Abkürzungen für Anweisungen: #define ret jmp %i7+8 // return from subroutine #define retl jmp %o7+8 // return from leaf subroutine (no save/restore) diff --git a/src/rational/algebraic/cl_RA_rootp.cc b/src/rational/algebraic/cl_RA_rootp.cc index 70b98c8..8c458ab 100644 --- a/src/rational/algebraic/cl_RA_rootp.cc +++ b/src/rational/algebraic/cl_RA_rootp.cc @@ -18,7 +18,7 @@ bool rootp (const cl_RA& x, uintL n, cl_RA* w) { // Methode: // Bei Integers: klar. -// Bei Brüchen a/b : muß a=c^n und b=d^n sein. Dann ist die Wurzel = c/d +// Bei Brüchen a/b : muß a=c^n und b=d^n sein. Dann ist die Wurzel = c/d // (mit ggT(c,d)=1 und d>1). if (integerp(x)) { DeclareType(cl_I,x); @@ -32,7 +32,7 @@ bool rootp (const cl_RA& x, uintL n, cl_RA* w) 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 + if (!rootp(a,n,&c)) // Zähler auf n-te Potenz testen return false; // beides n-te Potenzen -> Quotient der Wurzeln bilden *w = I_I_to_RT(c,d); return true; diff --git a/src/rational/algebraic/cl_RA_rootp_I.cc b/src/rational/algebraic/cl_RA_rootp_I.cc index 66f7969..4abcc2e 100644 --- a/src/rational/algebraic/cl_RA_rootp_I.cc +++ b/src/rational/algebraic/cl_RA_rootp_I.cc @@ -18,7 +18,7 @@ bool rootp (const cl_RA& x, const cl_I& n, cl_RA* w) { // Methode: // Bei Integers: klar. -// Bei Brüchen a/b : muß a=c^n und b=d^n sein. Dann ist die Wurzel = c/d +// Bei Brüchen a/b : muß a=c^n und b=d^n sein. Dann ist die Wurzel = c/d // (mit ggT(c,d)=1 und d>1). if (integerp(x)) { DeclareType(cl_I,x); @@ -32,7 +32,7 @@ bool rootp (const cl_RA& x, const cl_I& n, cl_RA* w) 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 + if (!rootp(a,n,&c)) // Zähler auf n-te Potenz testen return false; // beides n-te Potenzen -> Quotient der Wurzeln bilden *w = I_I_to_RT(c,d); return true; diff --git a/src/rational/algebraic/cl_RA_sqrtp.cc b/src/rational/algebraic/cl_RA_sqrtp.cc index 31174b9..c534779 100644 --- a/src/rational/algebraic/cl_RA_sqrtp.cc +++ b/src/rational/algebraic/cl_RA_sqrtp.cc @@ -18,7 +18,7 @@ bool sqrtp (const cl_RA& x, cl_RA* w) { // Methode: // Bei Integers: klar. -// Bei Brüchen a/b : muß a=c^2 und b=d^2 sein. Dann ist die Wurzel = c/d +// Bei Brüchen a/b : muß a=c^2 und b=d^2 sein. Dann ist die Wurzel = c/d // (mit ggT(c,d)=1 und d>1). if (integerp(x)) { DeclareType(cl_I,x); @@ -32,7 +32,7 @@ bool sqrtp (const cl_RA& x, cl_RA* w) return false; var const cl_I& a = numerator(x); var cl_I c; - if (!sqrtp(a,&c)) // Zähler auf Quadratzahl testen + if (!sqrtp(a,&c)) // Zähler auf Quadratzahl testen return false; // beides Quadratzahlen -> Quotient der Wurzeln bilden *w = I_I_to_RT(c,d); return true; diff --git a/src/rational/cl_RA.h b/src/rational/cl_RA.h index 4244135..5adb633 100644 --- a/src/rational/cl_RA.h +++ b/src/rational/cl_RA.h @@ -133,7 +133,7 @@ inline bool eq (const cl_RA& x, sint32 y) // I_I_div_RA(a,b) extern const cl_RA I_I_div_RA (const cl_I& a, const cl_I& b); -// Liefert den Zähler einer rationalen Zahl. +// Liefert den Zähler einer rationalen Zahl. // numerator(r) inline const cl_I numerator (const cl_RA& r) { @@ -154,7 +154,7 @@ inline const cl_I denominator (const cl_RA& r) return TheRatio(r)->denominator; } -// Liefert Zähler und Nenner einer rationalen Zahl. +// Liefert Zähler und Nenner einer rationalen Zahl. // RA_numden_I_I(r, num=,den=); // > r: rationale Zahl // < num: (numerator r) @@ -162,7 +162,7 @@ inline const cl_I denominator (const cl_RA& r) #define RA_numden_I_I(r,num_zuweisung,den_zuweisung) \ { if (integerp(r)) \ { num_zuweisung *(const cl_I *)&r; \ - den_zuweisung 1; /* Zähler = r, Nenner = 1 */ \ + den_zuweisung 1; /* Zähler = r, Nenner = 1 */ \ } \ else \ { num_zuweisung TheRatio(r)->numerator; \ diff --git a/src/rational/elem/cl_RA_minus.cc b/src/rational/elem/cl_RA_minus.cc index 31fda3b..9d02c1c 100644 --- a/src/rational/elem/cl_RA_minus.cc +++ b/src/rational/elem/cl_RA_minus.cc @@ -41,8 +41,8 @@ const cl_RA operator- (const cl_RA& r, const cl_RA& s) // ) // Sonst b' := b/g, d' := d/g. e := a*d'-b'*c, f:= b'*d = b*d'. // Es ist g = ggT(g*b',g*d') = g*ggT(b',d'), also ggT(b',d')=1. -// Es ist r-s = (a*d-b*c)/(b*d) = (nach Kürzen mit g) e/f. -// Außerdem: +// Es ist r-s = (a*d-b*c)/(b*d) = (nach Kürzen mit g) e/f. +// Außerdem: // ggT(a,b') teilt ggT(a,b)=1, also ggT(a,b')=1. Mit ggT(d',b')=1 folgt // 1 = ggT(a*d',b') = ggT(a*d'-b'*c,b') = ggT(e,b'). // ggT(c,d') teilt ggT(c,d)=1, also ggT(c,d')=1. Mit ggT(b',d')=1 folgt diff --git a/src/rational/elem/cl_RA_plus.cc b/src/rational/elem/cl_RA_plus.cc index bfb1a78..e304671 100644 --- a/src/rational/elem/cl_RA_plus.cc +++ b/src/rational/elem/cl_RA_plus.cc @@ -36,8 +36,8 @@ const cl_RA operator+ (const cl_RA& r, const cl_RA& s) // ) // Sonst b' := b/g, d' := d/g. e := a*d'+b'*c, f:= b'*d = b*d'. // Es ist g = ggT(g*b',g*d') = g*ggT(b',d'), also ggT(b',d')=1. -// Es ist r+s = (a*d+b*c)/(b*d) = (nach Kürzen mit g) e/f. -// Außerdem: +// Es ist r+s = (a*d+b*c)/(b*d) = (nach Kürzen mit g) e/f. +// Außerdem: // ggT(a,b') teilt ggT(a,b)=1, also ggT(a,b')=1. Mit ggT(d',b')=1 folgt // 1 = ggT(a*d',b') = ggT(a*d'+b'*c,b') = ggT(e,b'). // ggT(c,d') teilt ggT(c,d)=1, also ggT(c,d')=1. Mit ggT(b',d')=1 folgt diff --git a/src/rational/input/cl_RA_readparsed.cc b/src/rational/input/cl_RA_readparsed.cc index 480560a..44e3ae9 100644 --- a/src/rational/input/cl_RA_readparsed.cc +++ b/src/rational/input/cl_RA_readparsed.cc @@ -22,7 +22,7 @@ const cl_RA read_rational (unsigned int base, cl_signean sign, const char * stri digits_to_I(&string[index3_1],index2-index3_1,(uintD)base); if (zerop(den)) // Division durch 0 abfangen { throw division_by_0_exception(); } - var cl_I num = // Zähler + var cl_I num = // Zähler digits_to_I(&string[index1],index3-index1,(uintD)base); if (!(sign == 0)) num = -num; // incl. Vorzeichen diff --git a/src/rational/misc/cl_RA_expt.cc b/src/rational/misc/cl_RA_expt.cc index 9d66f34..e73e0a1 100644 --- a/src/rational/misc/cl_RA_expt.cc +++ b/src/rational/misc/cl_RA_expt.cc @@ -14,9 +14,9 @@ namespace cln { const cl_RA expt (const cl_RA& x, sintL y) { // Methode: -// Für y>0: klar. -// Für y=0: Ergebnis 1. -// Für y<0: (/ (expt x (- y))). +// Für y>0: klar. +// Für y=0: Ergebnis 1. +// Für y<0: (/ (expt x (- y))). if (y > 0) return expt_pos(x,(uintL)y); elif (y == 0) diff --git a/src/rational/misc/cl_RA_expt_I.cc b/src/rational/misc/cl_RA_expt_I.cc index 748b269..1da2036 100644 --- a/src/rational/misc/cl_RA_expt_I.cc +++ b/src/rational/misc/cl_RA_expt_I.cc @@ -17,9 +17,9 @@ namespace cln { const cl_RA expt (const cl_RA& x, const cl_I& y) { // Methode: -// Für y>0: klar. -// Für y=0: Ergebnis 1. -// Für y<0: (/ (expt x (- y))). +// Für y>0: klar. +// Für y=0: Ergebnis 1. +// Für y<0: (/ (expt x (- y))). if (minusp(y)) return recip(expt_pos(x,-y)); elif (zerop(y)) diff --git a/src/rational/misc/cl_RA_exptpos.cc b/src/rational/misc/cl_RA_exptpos.cc index e5e4c3b..4483a17 100644 --- a/src/rational/misc/cl_RA_exptpos.cc +++ b/src/rational/misc/cl_RA_exptpos.cc @@ -18,7 +18,7 @@ const cl_RA expt_pos (const cl_RA& x, uintL y) { // Methode: // x Integer -> klar - // x Ratio a/b -> x^y = (a^y)/(b^y), gekürzt, mit b^y>=b>1. + // x Ratio a/b -> x^y = (a^y)/(b^y), gekürzt, mit b^y>=b>1. if (integerp(x)) { DeclareType(cl_I,x); return expt_pos(x,y); diff --git a/src/rational/misc/cl_RA_exptpos_I.cc b/src/rational/misc/cl_RA_exptpos_I.cc index 46f7001..ee9c6cf 100644 --- a/src/rational/misc/cl_RA_exptpos_I.cc +++ b/src/rational/misc/cl_RA_exptpos_I.cc @@ -18,7 +18,7 @@ const cl_RA expt_pos (const cl_RA& x, const cl_I& y) { // Methode: // x Integer -> klar - // x Ratio a/b -> x^y = (a^y)/(b^y), gekürzt, mit b^y>=b>1. + // x Ratio a/b -> x^y = (a^y)/(b^y), gekürzt, mit b^y>=b>1. if (integerp(x)) { DeclareType(cl_I,x); return expt_pos(x,y); diff --git a/src/rational/output/cl_RA_dprint.cc b/src/rational/output/cl_RA_dprint.cc index 5e8bcce..86e45c2 100644 --- a/src/rational/output/cl_RA_dprint.cc +++ b/src/rational/output/cl_RA_dprint.cc @@ -56,7 +56,7 @@ void print_rational (std::ostream& stream, const cl_print_rational_flags& flags, print_integer(stream,base,z); } else { DeclareType(cl_RT,z); - // Ratio in Basis base ausgeben; Zähler / Nenner + // Ratio in Basis base ausgeben; Zähler / Nenner print_integer(stream,base,numerator(z)); fprintchar(stream,'/'); print_integer(stream,base,denominator(z)); diff --git a/src/rational/output/cl_RA_print.cc b/src/rational/output/cl_RA_print.cc index a4f359e..f0dbe88 100644 --- a/src/rational/output/cl_RA_print.cc +++ b/src/rational/output/cl_RA_print.cc @@ -24,8 +24,8 @@ void print_rational (std::ostream& stream, unsigned int base, const cl_RA& z) DeclareType(cl_RT,z); var const cl_I& num = numerator(z); var const cl_I& den = denominator(z); - // Der Zähler trägt das Vorzeichen. - print_integer(stream,base,num); // Zähler ausgeben + // Der Zähler trägt das Vorzeichen. + print_integer(stream,base,num); // Zähler ausgeben fprintchar(stream,'/'); print_integer(stream,base,den); // Nenner ausgeben } diff --git a/src/rational/transcendental/cl_I_logp.cc b/src/rational/transcendental/cl_I_logp.cc index d0e02de..c17c80e 100644 --- a/src/rational/transcendental/cl_I_logp.cc +++ b/src/rational/transcendental/cl_I_logp.cc @@ -29,23 +29,23 @@ bool logp (const cl_I& a, const cl_I& b, cl_RA* l) // Wegen a>=2^c, b>=2^d sind c,d < (integer-length a,b) < intDsize*2^intCsize. // In Matrizenschreibweise: // Wenn eine Folge von Divisionsschritten D und Vertauschungsschritten V -// ausgeführt werden muß, z.B. (a,b) V D D = (1,*), so ist +// ausgeführt werden muß, z.B. (a,b) V D D = (1,*), so ist // ( c ) ( 0 ) ( 1 1 ) ( 0 1 ) // ( d ) = V D D ( 1 ) wobei D = ( 0 1 ) und V = ( 1 0 ). -// Man baut diese Matrizen nun von links nach rechts auf, zum Schluß von +// Man baut diese Matrizen nun von links nach rechts auf, zum Schluß von // ( 0 ) // rechts mit ( 1 ) multiplizieren. // Entrekursiviert: -// Wir werden (a,b) und damit auch c/d = log(a/b) verändern. -// Invariante: Statt (c,d) wollen wir (uc*c+ud*d,vc*c+vd*d) zurückliefern. +// Wir werden (a,b) und damit auch c/d = log(a/b) verändern. +// Invariante: Statt (c,d) wollen wir (uc*c+ud*d,vc*c+vd*d) zurückliefern. // ( uc ud ) // D.h. die bisherige Matrix von links ist ( vc vd ). // uc:=1, ud:=0, vc:=0, vd:=1. // Solange a>1, // a>=b -> Dividiere a durch b. Rest da -> geht nicht. -// Sonst a:=a/b, und (für später c:=c+d) ud:=uc+ud, vd:=vc+vd. +// Sonst a:=a/b, und (für später c:=c+d) ud:=uc+ud, vd:=vc+vd. // 1 vertausche a und b, uc und ud, vc und vd. -// Liefere (ud,vd), der Bruch ud/vd ist gekürzt. +// Liefere (ud,vd), der Bruch ud/vd ist gekürzt. { Mutable(cl_I,a); Mutable(cl_I,b); var uintL uc = 1; diff --git a/src/real/cl_R.h b/src/real/cl_R.h index c6033b5..24fbd53 100644 --- a/src/real/cl_R.h +++ b/src/real/cl_R.h @@ -67,7 +67,7 @@ inline bool exact_zerop (const cl_R& x) // Macro: verteilt je nach Real-Typ eines Floats x auf 2 Statements, -// die x vom jeweiligen Real-Typ benutzen dürfen. +// die x vom jeweiligen Real-Typ benutzen dürfen. // realcase2(x, RA_statement,F_statement); // x sollte eine Variable sein. #define realcase2(x, RA_statement,F_statement) \ @@ -114,7 +114,7 @@ inline bool exact_zerop (const cl_R& x) #endif // Macro: verteilt je nach Real-Typ eines Floats x auf 7 Statements, -// die x vom jeweiligen Real-Typ benutzen dürfen. +// die x vom jeweiligen Real-Typ benutzen dürfen. // realcase7(x, FN_statement,BN_statement,RT_statement,SF_statement,FF_statement,DF_statement,LF_statement); // x sollte eine Variable sein. #define realcase7(x, FN_statement,BN_statement,RT_statement,SF_statement,FF_statement,DF_statement,LF_statement) \ @@ -129,7 +129,7 @@ inline bool exact_zerop (const cl_R& x) ) // Macro: verteilt je nach Real-Typ eines Floats x auf 6 Statements, -// die x vom jeweiligen Real-Typ benutzen dürfen. +// die x vom jeweiligen Real-Typ benutzen dürfen. // realcase6(x, I_statement,RT_statement,SF_statement,FF_statement,DF_statement,LF_statement); // x sollte eine Variable sein. #define realcase6(x, I_statement,RT_statement,SF_statement,FF_statement,DF_statement,LF_statement) \ @@ -189,7 +189,7 @@ extern const cl_R contagion (const cl_R& x, const cl_R& y); } // cl_somefloat(x,y) wandelt eine reelle Zahl x in ein Float-Format um -// (das von y, falls x rational ist) und rundet dabei nötigenfalls. +// (das von y, falls x rational ist) und rundet dabei nötigenfalls. // > x: eine reelle Zahl // > y: ein Float // < ergebnis: x als Float diff --git a/src/real/elem/cl_R_div.cc b/src/real/elem/cl_R_div.cc index 46e6d02..546c30a 100644 --- a/src/real/elem/cl_R_div.cc +++ b/src/real/elem/cl_R_div.cc @@ -32,7 +32,7 @@ ALL_cl_LF_OPERATIONS_SAME_PRECISION() const cl_R operator/ (const cl_R& x, const cl_R& y) { if (eq(x,0)) - // 0 / y = exakte 0, außer wenn y=0 + // 0 / y = exakte 0, außer wenn y=0 { if (zerop(y)) { throw division_by_0_exception(); } else diff --git a/src/real/elem/cl_R_equal.cc b/src/real/elem/cl_R_equal.cc index b3060ce..bc35397 100644 --- a/src/real/elem/cl_R_equal.cc +++ b/src/real/elem/cl_R_equal.cc @@ -25,7 +25,7 @@ bool equal (const cl_R& x, const cl_R& y) // Methode: // Beide rational oder beide Floats -> klar. // Eine rational, eine Float -> -// Die rationale Zahl muß einen Zweierpotenz-Nenner haben, sonst verschieden. +// Die rationale Zahl muß einen Zweierpotenz-Nenner haben, sonst verschieden. // Die rationale Zahl zum Float machen, vergleichen. // Verschieden -> Das war's. // Gleich -> Das Float mit RATIONAL rational machen, nochmals vergleichen. diff --git a/src/real/format-output/TODO-format b/src/real/format-output/TODO-format index c6bff7b..2caab68 100644 --- a/src/real/format-output/TODO-format +++ b/src/real/format-output/TODO-format @@ -8,7 +8,7 @@ ; gibt die Floating-Point-Zahl arg in Festkommadarstellung auf stream aus. (defun format-float-for-f (w d k overflowchar padchar plus-sign-flag arg stream) (let ((width (if w (if (or plus-sign-flag (minusp arg)) (1- w) w) nil))) - ; width = zur Verfügung stehende Zeichen ohne Vorzeichen + ; width = zur Verfügung stehende Zeichen ohne Vorzeichen (multiple-value-bind (digits digitslength leadingpoint trailingpoint) (format-float-to-string arg width d k nil) (when (eql d 0) (setq trailingpoint nil)) ; d=0 -> keine Zusatz-Null hinten @@ -21,7 +21,7 @@ (if (> width 0) (setq width (1- width)) (setq trailingpoint nil)) ) ) - ; Es bleiben noch width Zeichen übrig. + ; Es bleiben noch width Zeichen übrig. (if (and overflowchar w (minusp width)) (format-padding w overflowchar stream) ; Zu wenig Platz -> overflow (progn @@ -50,11 +50,11 @@ ; (Der Defaultwert in FORMAT-EXPONENTIAL-FLOAT ist k=1.) ; Vor der Mantisse das Vorzeichen (ein + nur falls arg>=0 und plus-sign-flag). ; Dann der Exponent, eingeleitet durch exponentchar, dann Vorzeichen des -; Exponenten (stets + oder -), dann e Stellen für den Exponenten. -; Dann wird das Ganze mit padchars auf w Zeichen Breite aufgefüllt. -; Sollte das (auch nach evtl. Unterdrückung einer führenden Null) mehr als +; Exponenten (stets + oder -), dann e Stellen für den Exponenten. +; Dann wird das Ganze mit padchars auf w Zeichen Breite aufgefüllt. +; Sollte das (auch nach evtl. Unterdrückung einer führenden Null) mehr als ; w Zeichen ergeben, so werden statt dessen w overflowchars ausgegeben, oder -; (falls overflowchar = nil) die Zahl mit so vielen Stellen wie nötig +; (falls overflowchar = nil) die Zahl mit so vielen Stellen wie nötig ; ausgegeben. (defun format-float-for-e (w d e k overflowchar padchar exponentchar plus-sign-flag arg stream) @@ -62,15 +62,15 @@ (let* ((exponent (if (zerop arg) 0 (- oldexponent k))) ; auszugebender Exponent (expdigits (write-to-string (abs exponent) :base 10. :radix nil :readably nil)) (expdigitsneed (if e (max (length expdigits) e) (length expdigits))) - ; expdigitsneed = Anzahl der Stellen, die für die Ziffern des - ; Exponenten nötig sind. + ; expdigitsneed = Anzahl der Stellen, die für die Ziffern des + ; Exponenten nötig sind. (mantd (if d (if (> k 0) (1+ (- d k)) d) nil)) ; mantd = Anzahl der Mantissenstellen hinter dem Punkt - (dmin (if (minusp k) (- 1 k) nil)) ; nachher: fordere, daß + (dmin (if (minusp k) (- 1 k) nil)) ; nachher: fordere, daß ; nicht in die ersten (+ 1 (abs k)) Stellen hineingerundet wird. (mantwidth (if w (- w 2 expdigitsneed) nil)) - ; mantwidth = Anzahl der für die Mantisse (inkl. Vorzeichen, Punkt) - ; zur Verfügung stehenden Zeichen (oder nil) + ; mantwidth = Anzahl der für die Mantisse (inkl. Vorzeichen, Punkt) + ; zur Verfügung stehenden Zeichen (oder nil) ) (declare (simple-string expdigits) (fixnum exponent expdigitsneed)) (if (and overflowchar w e (> expdigitsneed e)) @@ -80,8 +80,8 @@ (if w (if (or plus-sign-flag (minusp arg)) (setq mantwidth (1- mantwidth))) ) - ; mantwidth = Anzahl der für die Mantisse (ohne Vorzeichen, - ; inklusive Punkt) zur Verfügung stehenden Zeichen (oder nil) + ; mantwidth = Anzahl der für die Mantisse (ohne Vorzeichen, + ; inklusive Punkt) zur Verfügung stehenden Zeichen (oder nil) (multiple-value-bind (mantdigits mantdigitslength leadingpoint trailingpoint) (format-float-to-string mantissa mantwidth mantd k dmin) @@ -98,7 +98,7 @@ (setq leadingpoint nil) ) ) ) - ; Es bleiben noch mantwidth Zeichen übrig. + ; Es bleiben noch mantwidth Zeichen übrig. (if (and overflowchar w (minusp mantwidth)) (format-padding w overflowchar stream) ; Zu wenig Platz -> overflow (progn diff --git a/src/real/format-output/cl_fmt_floatstring.cc b/src/real/format-output/cl_fmt_floatstring.cc index 0addbd3..5bd5fcd 100644 --- a/src/real/format-output/cl_fmt_floatstring.cc +++ b/src/real/format-output/cl_fmt_floatstring.cc @@ -26,7 +26,7 @@ namespace cln { // format_float_to_string(arg,width,d,k,dmin) // ergibt einen String zum Floating-point arg: // er hat den Wert von abs(arg)*expt(10,k), dabei mind. d Nachkommastellen -// und höchstens die Länge width (width<=0 -> keine Einschränkung). +// und höchstens die Länge width (width<=0 -> keine Einschränkung). // Trotzdem wird nicht auf weniger als dmin Stellen gerundet. const digits_with_dot format_float_to_string (const cl_F& arg, const sintL width, const sintL d, const sintL k, const sintL dmin) @@ -54,11 +54,11 @@ const digits_with_dot format_float_to_string (const cl_F& arg, const sintL width // mantprec : Anzahl der echten Mantissenbits von significand // (also 2^mantprec <= significand < 2^(mantprec+1)) // width : Anzahl Stellen, die die Zahl (inklusive Punkt) nicht - // überschreiten soll, oder 0 + // überschreiten soll, oder 0 // d : Mindestanzahl Nachkommastellen oder 0 // k : Skalierungsfaktor (siehe CLTL S.394) // dmin : Mindestanzahl von Dezimaltellen, die (trotz Angabe von width - // oder d) nicht gerundet werden dürfen. + // oder d) nicht gerundet werden dürfen. // (Nur interessant, falls d <= dmin <= (precision der Zahl).) // wandelt die Zahl significand*2^expon um in einen Dezimalstring um. // Es ist kein Exponent dabei. @@ -73,7 +73,7 @@ const digits_with_dot format_float_to_string (const cl_F& arg, const sintL width // einer Erniedrigung von numerator um abrund_einh. var cl_I aufrund_einh = 1; // Aufrundungseinheit: // Aufrunden um 1 in der letzten aufrundbaren Stelle entspricht - // einer Erhöhung von numerator um aufrund_einh. + // einer Erhöhung von numerator um aufrund_einh. digitstring.reset(); if (expon > 0) { numerator = numerator << expon; @@ -86,18 +86,18 @@ const digits_with_dot format_float_to_string (const cl_F& arg, const sintL width // Zahl = numerator/denominator if (significand == ash(1,mantprec)) { // Ist der Significand=2^mantprec, so ist abrund-einh zu halbieren. - // Man kann stattdessen auch alle 3 anderen Grössen verdoppeln: + // Man kann stattdessen auch alle 3 anderen Grössen verdoppeln: aufrund_einh = aufrund_einh << 1; numerator = numerator << 1; denominator = denominator << 1; } - // Defaultmäßig: Auf-/Abrunde-Einheit = eine Einheit in der letzten - // BINÄRstelle. + // Defaultmäßig: Auf-/Abrunde-Einheit = eine Einheit in der letzten + // BINÄRstelle. // Zahl = numerator/denominator // Skalierungsfaktor k in die Zahl mit einbeziehen (vgl. CLTL S.394) // k<0 -> Mantisse durch 10^|k| dividieren // k>0 -> Mantisse mit 10^k multiplizieren - // Dabei aufrund-einh, abrund-einh im Verhältnis zu numerator beibehalten. + // Dabei aufrund-einh, abrund-einh im Verhältnis zu numerator beibehalten. if (k != 0) { if (k < 0) { var cl_I skal_faktor = expt_pos(10,-k); @@ -111,23 +111,23 @@ const digits_with_dot format_float_to_string (const cl_F& arg, const sintL width } } // Stellen: 0 = 1. Stelle vor dem Punkt, -1 = 1. Stelle nach dem Punkt. - var sintL stelle = 0; // Stelle der als nächstes auszugebenden Ziffer + var sintL stelle = 0; // Stelle der als nächstes auszugebenden Ziffer // auf >= 1/10 adjustieren: - // (jeweils numerator mit 10 multiplizieren, eine führende 0 mehr vorsehen) + // (jeweils numerator mit 10 multiplizieren, eine führende 0 mehr vorsehen) until (10*numerator >= denominator) { stelle = stelle-1; numerator = numerator * 10; aufrund_einh = aufrund_einh * 10; abrund_einh = abrund_einh * 10; } - // stelle = Stelle der letzten führenden 0 + // stelle = Stelle der letzten führenden 0 // = 1 + Stelle der 1. signifikanten Ziffer // oder =0, falls k>=0 - // Ausführung der Rundung: + // Ausführung der Rundung: 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 bool halbzahlig = 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: @@ -149,14 +149,14 @@ const digits_with_dot format_float_to_string (const cl_F& arg, const sintL width elif (width > 0) { // Falls nicht d, nur width angegeben: if (stelle < 0) - // Es kommen führende Nullen nach dem Punkt -> d:=width-1 + // Es kommen führende Nullen nach dem Punkt -> d:=width-1 letzte_stelle = 1-width; else - // Es kommen keine führenden Nullen nach dem Punkt -> + // Es kommen keine führenden Nullen nach dem Punkt -> // Es wird stelle Vorkommaziffern geben, d:=width-1-stelle letzte_stelle = 1+stelle-width; // also letzte_stelle = -(width-1 - max(stelle,0)) - // wieder dmin berücksichtigen: + // wieder dmin berücksichtigen: if (dmin > 0) if (letzte_stelle > -dmin) letzte_stelle = -dmin; @@ -171,9 +171,9 @@ const digits_with_dot format_float_to_string (const cl_F& arg, const sintL width dezimal_einh = dezimal_einh*expt_pos(10,ziffernzahl); elif (ziffernzahl < 0) dezimal_einh = ceiling1(dezimal_einh,expt_pos(10,-ziffernzahl)); - // dezimal-einh = Um wieviel numerator erhöht bzw. erniedigt werden - // müßte, damit sich die Dezimaldarstellung um genau 1 an der - // Position letzte_stelle verändert. + // dezimal-einh = Um wieviel numerator erhöht bzw. erniedigt werden + // müßte, damit sich die Dezimaldarstellung um genau 1 an der + // Position letzte_stelle verändert. if (abrund_einh < dezimal_einh) abrund_einh = dezimal_einh; if (aufrund_einh < dezimal_einh) @@ -186,9 +186,9 @@ const digits_with_dot format_float_to_string (const cl_F& arg, const sintL width // stelle = Position der ersten signifikanten Stelle + 1 var uintL digit_count = 0; // Zahl der bisher in digit-string // ausgegebenen Ziffern (exklusive den Punkt) - var uintL point_pos = 0; // Punkt-Position = Zahl führender Stellen + var uintL point_pos = 0; // Punkt-Position = Zahl führender Stellen // = Zahl der Ziffern vor dem Punkt - // Führenden Punkt und nachfolgende Nullen ausgeben: + // Führenden Punkt und nachfolgende Nullen ausgeben: if (stelle < 0) { digitstring.push('.'); point_pos = digit_count; diff --git a/src/real/format-output/cl_fmt_integer.cc b/src/real/format-output/cl_fmt_integer.cc index ec20622..0f50610 100644 --- a/src/real/format-output/cl_fmt_integer.cc +++ b/src/real/format-output/cl_fmt_integer.cc @@ -33,12 +33,12 @@ void format_integer (std::ostream& stream, const cl_I& arg, 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 - // newstring füllen: + // newstring füllen: { // Erst Vorzeichen +: if (positive_sign) newstring[0] = '+'; - // Dann oldstring in newstring übertragen, dabei Kommata überspringen: + // Dann oldstring in newstring übertragen, dabei Kommata überspringen: var uintL oldpos = oldstring_length; var uintL oldpos_mod = 0; // = (oldstring_length - oldpos) % commainterval var uintL newpos = newstring_length; @@ -48,7 +48,7 @@ void format_integer (std::ostream& stream, const cl_I& arg, // Check whether ((oldstring_length - oldpos) % commainterval) == 0 if (++oldpos_mod == commainterval) { oldpos_mod = 0; - // noch ein Komma einzufügen + // noch ein Komma einzufügen newstring[--newpos] = commachar; number_of_commas--; } diff --git a/src/real/format-output/cl_fmt_scaleexp.cc b/src/real/format-output/cl_fmt_scaleexp.cc index b24868b..404b71e 100644 --- a/src/real/format-output/cl_fmt_scaleexp.cc +++ b/src/real/format-output/cl_fmt_scaleexp.cc @@ -86,7 +86,7 @@ const decoded_float format_scale_exponent (const cl_F& arg) var cl_F abs_arg = abs(arg); var decoded_float decoded = decode_float(abs_arg); var cl_I& expon = decoded.exponent; - var cl_I expon10a = truncate1(expon*lg2); // nicht round, um Überlauf zu vermeiden + var cl_I expon10a = truncate1(expon*lg2); // nicht round, um Überlauf zu vermeiden var cl_F signif10a = abs_arg / expt(ten,expon10a); // Maybe need to increment expon10. var cl_I expon10b = expon10a; diff --git a/src/real/format-output/cl_format.h b/src/real/format-output/cl_format.h index a13d551..6ee9043 100644 --- a/src/real/format-output/cl_format.h +++ b/src/real/format-output/cl_format.h @@ -1,4 +1,4 @@ -// Formatted output functions à la Common Lisp. +// Formatted output functions à la Common Lisp. #ifndef _CL_FORMAT_H #define _CL_FORMAT_H @@ -9,10 +9,10 @@ namespace cln { -// gibt arg als römische Zahl auf stream aus, z.B. 4 als IIII. +// gibt arg als römische Zahl auf stream aus, z.B. 4 als IIII. extern void format_old_roman (std::ostream& stream, const cl_I& arg); -// gibt arg als römische Zahl auf stream aus, z.B. 4 als IV. +// gibt arg als römische Zahl auf stream aus, z.B. 4 als IV. extern void format_new_roman (std::ostream& stream, const cl_I& arg); extern const char * const cl_format_tens [10]; @@ -20,7 +20,7 @@ extern const char * const cl_format_tens [10]; // gibt die ganze Zahl arg im Klartext auf englisch auf den Stream aus. extern void format_cardinal (std::ostream& stream, const cl_I& arg); -// gibt eine ganze Zahl arg als Abzählnummer im Klartext auf englisch +// gibt eine ganze Zahl arg als Abzählnummer im Klartext auf englisch // auf den stream aus. extern void format_ordinal (std::ostream& stream, const cl_I& arg); @@ -32,17 +32,17 @@ inline void format_padding (std::ostream& stream, sintL count, char ch) } // gibt auf den Stream stream aus: -// den String str, eventuell aufgefüllt mit Padding characters padchar. -// Und zwar so, daß die Breite mindestens mincol ist. Um das zu erreichen, -// werden mindestens minpad Zeichen eingefügt, eventuelle weitere dann in -// Blöcken à colinc Zeichen. Falls padleftflag, werden sie links eingefügt, +// den String str, eventuell aufgefüllt mit Padding characters padchar. +// Und zwar so, daß die Breite mindestens mincol ist. Um das zu erreichen, +// 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, 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 +// 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, bool commaflag, bool positive_sign_flag); @@ -57,7 +57,7 @@ CL_REQUIRE(cl_fmt_scaleexp) // format_float_to_string(arg,width,d,k,dmin) // ergibt einen String zum Floating-point arg: // er hat den Wert von abs(arg)*expt(10,k), dabei mind. d Nachkommastellen -// und höchstens die Länge width (width<=0 -> keine Einschränkung). +// und höchstens die Länge width (width<=0 -> keine Einschränkung). // Trotzdem wird nicht auf weniger als dmin Stellen gerundet. struct digits_with_dot { char * string; // Mit malloc_hook() alloziert, mit free_hook() freizugeben. diff --git a/src/real/misc/cl_R_expt.cc b/src/real/misc/cl_R_expt.cc index c1f581d..7a6afc3 100644 --- a/src/real/misc/cl_R_expt.cc +++ b/src/real/misc/cl_R_expt.cc @@ -16,15 +16,15 @@ namespace cln { // Methode: -// Für y>0: +// Für y>0: // a:=x, b:=y. // Solange b gerade, setze a:=a*a, b:=b/2. [a^b bleibt invariant, = x^y.] // c:=a. // Solange b:=floor(b/2) >0 ist, // setze a:=a*a, und falls b ungerade, setze c:=a*c. // Ergebnis c. -// Für y=0: Ergebnis 1. -// Für y<0: (/ (expt x (- y))). +// Für y=0: Ergebnis 1. +// Für y<0: (/ (expt x (- y))). // Assume y>0. inline const cl_R expt_pos (const cl_R& x, uintL y) diff --git a/src/real/misc/cl_R_expt_I.cc b/src/real/misc/cl_R_expt_I.cc index 14d5425..2bbeec2 100644 --- a/src/real/misc/cl_R_expt_I.cc +++ b/src/real/misc/cl_R_expt_I.cc @@ -17,15 +17,15 @@ namespace cln { // Methode: -// Für y>0: +// Für y>0: // a:=x, b:=y. // Solange b gerade, setze a:=a*a, b:=b/2. [a^b bleibt invariant, = x^y.] // c:=a. // Solange b:=floor(b/2) >0 ist, // setze a:=a*a, und falls b ungerade, setze c:=a*c. // Ergebnis c. -// Für y=0: Ergebnis 1. -// Für y<0: (/ (expt x (- y))). +// Für y=0: Ergebnis 1. +// Für y<0: (/ (expt x (- y))). // Assume y>0. inline const cl_R expt_pos (const cl_R& x, const cl_I& y) diff --git a/src/real/misc/cl_R_rationalize.cc b/src/real/misc/cl_R_rationalize.cc index 1e752a8..4112d28 100644 --- a/src/real/misc/cl_R_rationalize.cc +++ b/src/real/misc/cl_R_rationalize.cc @@ -26,9 +26,9 @@ namespace cln { // (Integer-Decode-Float x) liefert m,e,s=1. // Falls e>=0 : Liefere x=m*2^e als Ergebnis. // Suche rationale Zahl zwischen a=(m-1/2)*2^e und b=(m+1/2)*2^e mit -// möglichst kleinem Zähler und Nenner. (a,b einschließlich, aber da a,b -// den Nenner 2^(|e|+1) haben, während x selbst den Nenner <=2^|e| hat, -// können weder a noch b als Ergebnis herauskommen.) +// möglichst kleinem Zähler und Nenner. (a,b einschließlich, aber da a,b +// den Nenner 2^(|e|+1) haben, während x selbst den Nenner <=2^|e| hat, +// können weder a noch b als Ergebnis herauskommen.) // Suche also bei gegebenem a,b (0=0 -> m*2^e*s als Ergebnis (darin ist x=0.0 inbegriffen). // Bilde a:=(2*m-1)*2^(e-1) und b:=(2*m+1)*2^(e-1), rationale Zahlen >0, -// (unkürzbar, da Nenner Zweierpotenz und Zähler ungerade). +// (unkürzbar, da Nenner Zweierpotenz und Zähler ungerade). // Starte Kettenbruchentwicklung (d.h. p[-1]:=0, p[0]:=1, q[-1]:=1, q[0]:=0, i:=0.) // Schleife: // c:=(ceiling a) @@ -52,7 +52,7 @@ namespace cln { // (Dabei bedeutet "Ziffer a" die Iteration // i:=i+1, p[i]:=a*p[i-1]+p[i-2], q[i]:=a*q[i-1]+q[i-2].) // Ende, liefere s * (p[i]/q[i]), das ist wegen der Invarianten -// p[i]*q[i-1]-p[i-1]*q[i]=(-1)^i ein bereits gekürzter Bruch. +// p[i]*q[i-1]-p[i-1]*q[i]=(-1)^i ein bereits gekürzter Bruch. inline const cl_RA rationalize (const cl_RA& x) { diff --git a/src/real/random/cl_R_random.cc b/src/real/random/cl_R_random.cc index 6c4a9b1..f81143c 100644 --- a/src/real/random/cl_R_random.cc +++ b/src/real/random/cl_R_random.cc @@ -20,7 +20,7 @@ namespace cln { const cl_R random_R (random_state& r, const cl_R& n) { - // n muß eine reelle Zahl sein, >0 und Float oder Integer + // n muß eine reelle Zahl sein, >0 und Float oder Integer if (plusp(n)) { if (floatp(n)) { DeclareType(cl_F,n); diff --git a/src/real/transcendental/cl_R_atan2.cc b/src/real/transcendental/cl_R_atan2.cc index a5d7260..36b4169 100644 --- a/src/real/transcendental/cl_R_atan2.cc +++ b/src/real/transcendental/cl_R_atan2.cc @@ -29,7 +29,7 @@ const cl_R atan (const cl_R& x, const cl_R& y) // 0 <= |y| <= x -> atan(y/x) // 0 <= |x| <= y -> pi/2 - atan(x/y) // 0 <= |x| <= -y -> -pi/2 - atan(x/y) -// 0 <= |y| <= -x -> für y>=0: pi + atan(y/x), für y<0: -pi + atan(y/x) +// 0 <= |y| <= -x -> für y>=0: pi + atan(y/x), für y<0: -pi + atan(y/x) if (eq(y,0)) { // y=0 (exakt) diff --git a/src/vector/cl_GV_io.h b/src/vector/cl_GV_io.h index 824523d..ed7c8b6 100644 --- a/src/vector/cl_GV_io.h +++ b/src/vector/cl_GV_io.h @@ -13,7 +13,7 @@ namespace cln { // print_vector(stream,flags,fun,z); // > stream: Stream // > flags: Flags -// > fun: Ausgabefunktion für die einzelnen Elemente +// > fun: Ausgabefunktion für die einzelnen Elemente // > vector: Vektor extern void print_vector (std::ostream& stream, const cl_print_flags& flags, void (* fun) (std::ostream&, const cl_print_flags&, const cl_number&), const cl_GV_number& vector); diff --git a/src/vector/cl_SV_io.h b/src/vector/cl_SV_io.h index 51de4df..e43b0c6 100644 --- a/src/vector/cl_SV_io.h +++ b/src/vector/cl_SV_io.h @@ -13,7 +13,7 @@ namespace cln { // print_vector(stream,flags,fun,z); // > stream: Stream // > flags: Flags -// > fun: Ausgabefunktion für die einzelnen Elemente +// > fun: Ausgabefunktion für die einzelnen Elemente // > vector: Vektor extern void print_vector (std::ostream& stream, const cl_print_flags& flags, void (* fun) (std::ostream&, const cl_print_flags&, const cl_number&), const cl_SV_number& vector); -- 2.45.2