+2005-12-04 Bruno Haible <bruno@clisp.org>
+
+ * src/integer/conv/cl_I_to_digits.cc (I_to_digits_noshrink): Set
+ erg->len at the end.
+
+2005-12-04 Bruno Haible <bruno@clisp.org>
+
+ Extend the fixnum range from 32 bits to 61 bits on 64-bit platforms.
+ * doc/cln.tex (gcd, jacobi): Take 'long' instead of 'int32' arguments.
+ * include/cln/object.h (cl_value_shift): Define as 3, not 32, in the
+ 64-bit case.
+ * include/cln/types.h (intVsize): New macro.
+ (sintV, uintV): New types.
+ * include/cln/integer.h (gcd): Take uintV arguments.
+ * include/cln/numtheory.h (jacobi): Take sintV arguments.
+ * src/complex/input/cl_N_read.cc (read_complex): Call FN_to_UV instead
+ of FN_to_UL.
+ * src/complex/transcendental/cl_C_expt_C.cc: Likewise.
+ * src/float/dfloat/elem/cl_DF_scale_I.cc: Use uintV instead of uintL
+ * src/float/dfloat/elem/cl_DF_from_RA.cc: Don't assume values >= 2^53
+ and < 2^55 are always bignums.
+ where appropriate.
+ * src/float/ffloat/conv/cl_RA_to_float.cc: Call FN_to_UV instead of
+ FN_to_UL.
+ * src/float/ffloat/elem/cl_FF_from_RA.cc: Likewise.
+ * src/float/ffloat/elem/cl_FF_scale_I.cc: Call FN_to_V instead of
+ FN_to_L.
+ * src/float/lfloat/elem/cl_LF_scale_I.cc: Likewise.
+ * src/float/output/cl_F_dprint.cc: Likewise.
+ * src/float/sfloat/elem/cl_SF_from_RA.cc: Call FN_to_UV instead of
+ FN_to_UL.
+ * src/float/sfloat/elem/cl_SF_scale_I.cc: Call FN_to_V instead of
+ FN_to_L.
+ * src/integer/cl_I.h (FN_to_UV): Renamed from FN_to_UL, change return
+ type.
+ (FN_to_V): Renamed from FN_to_L, change return type.
+ (FN_V_zerop): Renamed from FN_L_zerop.
+ (FN_V_minusp): Renamed from FN_L_minusp.
+ (cl_I_constructor_from_L2, cl_I_constructor_from_UL2): Define as an
+ inline function on 64-bit platforms.
+ (V_to_I, UV_to_I): New macros.
+ (pFN_maxlength_digits_at): Return an uintV instead of an uint32.
+ (set_pFN_maxlength_digits_at): Take an uintV instead of an uint32.
+ * src/integer/algebraic/cl_I_sqrtp.cc: Call FN_to_UV instead of
+ FN_to_UL.
+ * src/integer/bitwise/cl_I_ash_I.cc: Call FN_to_V instead of FN_to_L.
+ * src/integer/bitwise/cl_I_ilength.cc: Likewise.
+ * src/integer/bitwise/cl_I_log_aux.cc: Likewise.
+ * src/integer/bitwise/cl_I_logbitp_I.cc: Likewise.
+ * src/integer/bitwise/cl_I_logcount.cc: Likewise.
+ * src/integer/bitwise/cl_I_logtest.cc: Likewise.
+ * src/integer/conv/cl_I_from_L2.cc: Don't produce code on 64-bit
+ platforms.
+ * src/integer/conv/cl_I_from_UL2.cc: Likewise.
+ * src/integer/conv/cl_I_from_NDS.cc: Update.
+ * src/integer/conv/cl_I_from_Q.cc: Remove cast to sint32.
+ * src/integer/conv/cl_I_from_UQ.cc: Remove cast to uint32.
+ * src/integer/conv/cl_I_to_L.cc: Check again fixnum that needs more
+ than 32 bits.
+ * src/integer/conv/cl_I_to_Q.cc: Call FN_to_V instead of FN_to_L.
+ * src/integer/conv/cl_I_to_UL.cc: Likewise.
+ * src/integer/conv/cl_I_to_UQ.cc: Likewise.
+ * src/integer/elem/cl_I_div.cc: Treat fixnums that need more than 32
+ bits like bignums.
+ * src/integer/elem/cl_I_minus.cc: Call FN_to_V instead of FN_to_L.
+ * src/integer/elem/cl_I_mul.cc: Likewise.
+ * src/integer/elem/cl_I_plus.cc: Likewise.
+ * src/integer/elem/cl_I_square.cc: Likewise.
+ * src/integer/elem/cl_I_uminus.cc: Likewise.
+ * src/integer/gcd/cl_I_gcd.cc: Likewise.
+ * src/integer/gcd/cl_low_gcd.cc (gcd): Take uintV arguments.
+ * src/integer/hash/cl_I_hashcode.cc: Call FN_to_V instead of FN_to_L.
+ * src/integer/input/cl_I_read.cc (read_integer): Call FN_to_UV instead
+ of FN_to_UL.
+ * src/integer/misc/cl_I_ord2.cc (ord2): Call ord2_64 on 64-bit
+ platforms.
+ * src/integer/misc/cl_I_power2p.cc: Call FN_to_UV instead of FN_to_UL.
+ * src/integer/misc/combin/cl_I_doublefactorial.cc (doublefakul_table):
+ Extend table for larger fixnums.
+ (doublefactorial): Update.
+ * src/integer/misc/combin/cl_I_factorial.cc (fakul_table): Extend table
+ for larger fixnums.
+ (factorial): Update.
+ * src/modinteger/cl_MI_fix16.h: Call FN_to_UV instead of FN_to_UL.
+ * src/modinteger/cl_MI_fix29.h: Likewise.
+ * src/modinteger/cl_MI_fix32.h: Likewise.
+ * src/modinteger/cl_MI_std.h: Likewise.
+ * src/numtheory/cl_nt_cornacchia4.cc: Call FN_to_V instead of FN_to_L.
+ * src/numtheory/cl_nt_jacobi.cc: Likewise.
+ * src/numtheory/cl_nt_jacobi_low.cc (jacobi_aux): Take uintV arguments
+ instead of uint32 arguments.
+ (jacobi): Take sintV argument instead of a sint32 argument.
+ * src/rational/input/cl_RA_read.cc: Call FN_to_UV instead of FN_to_UL.
+ * src/real/input/cl_R_read.cc: Likewise.
+ * src/vector/cl_GV_I.cc: Likewise.
+ * tests/timefact.cc: Call FN_to_V instead of FN_to_L.
+
+2005-12-04 Bruno Haible <bruno@clisp.org>
+
+ More complete 64-bit division macros.
+ * src/base/cl_low.h (divu_6432_3232_w): Choose a different macro
+ expansion on x86_64.
+ (divu_6432_6432): New macro.
+ (divu_6464_6464): Choose a different macro expansion for all CPUs
+ except sparc64 and x86_64.
+ (divu_12864_6464): Define NEED_VAR_divu_64_rest here.
+ * src/base/low/cl_low_div.cc (divu_64_rest): Avoid defining it twice.
+ (divu_6464_6464_): New function.
+
+2005-12-04 Bruno Haible <bruno@clisp.org>
+
+ * src/base/cl_low.h (ord2_64): New macro.
+
+2005-12-02 Bruno Haible <bruno@clisp.org>
+
+ * src/base/cl_low.h (mulu64) [x86_64]: Change asm restriction, since
+ mulq doesn't accept immediate arguments.
+
+2005-11-26 Bruno Haible <bruno@clisp.org>
+
+ * src/base/cl_low.h (GENERIC_INTEGERLENGTH32): New macro.
+ (integerlength64): Define using integerlength32 if integerlength32
+ is not defined generically.
+
+2005-11-26 Bruno Haible <bruno@clisp.org>
+
+ * src/base/cl_low.h (mulu32) [SPARC64]: Remove rd instruction, since
+ umul returns the complete 64-bit product in a register.
+ (mulu32_w) [SPARC64]: Prefer umul over mulx instruction.
+ (divu_6432_3232_w) [SPARC64]: Prefer umul/udiv over mulx/udivx
+ instructions.
+
+2005-11-26 Bruno Haible <bruno@clisp.org>
+
+ * src/base/cl_low.h (divu_3216_1616): Prepend underscore to local
+ variables.
+
+2005-11-26 Bruno Haible <bruno@clisp.org>
+
+ * src/base/cl_low.h (ord2_32): Parenthesize macro argument.
+
2005-12-17 Richard B. Kreckel <kreckel@ginac.de>
* Created branch cln_1-1 for maintenance patches.
* autoconf/ltmain.sh: Upgrade to libtool-1.5.6.
* m4/libtool.m4: New file, from libtool-1.5.6 with modifications:
2004-08-22 Bruno Haible <bruno@clisp.org>
- * m4/libtool.m4: Add support for Comeau C++ on Linux.
- Reported by Prof. Roberto Bagnara <bagnara@cs.unipr.it>.
+ * m4/libtool.m4: Add support for Comeau C++ on Linux.
+ Reported by Prof. Roberto Bagnara <bagnara@cs.unipr.it>.
* autoconf/aclocal.m4: Regenerate.
2004-08-19 Bruno Haible <bruno@clisp.org>
2002-02-16 Richard Kreckel <kreckel@ginac.de>
- * cln.m4: quote macro name.
- Pointed out by Roberto Bagnara.
+ * cln.m4: quote macro name.
+ Pointed out by Roberto Bagnara.
2002-01-20 Richard Kreckel <kreckel@ginac.de>
- * autoconf/config.{guess,sub}: Update to GNU version 2002-01-02.
- (the old one was broken on Linux/Mips.)
+ * autoconf/config.{guess,sub}: Update to GNU version 2002-01-02.
+ (the old one was broken on Linux/Mips.)
2002-01-04 Richard Kreckel <kreckel@ginac.de>
- * autoconf/autoconf.m4f: get brutal in order to adhere to FHS.
- * Version 1.1.4 released.
+ * autoconf/autoconf.m4f: get brutal in order to adhere to FHS.
+ * Version 1.1.4 released.
2002-01-03 Richard Kreckel <kreckel@ginac.de>
- * autoconf/acinclude.m4: revamp MPN-matcher.
- * autoconf/aclocal.m4: upgrade to autoconf-2.52 infrastructure,
- sync with CLisp from CVS.
- * autoconf/autoconf: Likewise.
- * autoconf/autoconf.m4f: Likewise (new file).
- * configure.ac: Likewise (new file, replaces configure.in).
- * configure.in: Likewise (deleted, replaced by configure.ac).
- * autoconf/config.{guess,sub}: Update to GNU version 2001-12-13.
- * src/Makefile.in: made VPATH safe for autoconf-2.52.
- * include/cln/config.h.in: Add __s390__.
+ * autoconf/acinclude.m4: revamp MPN-matcher.
+ * autoconf/aclocal.m4: upgrade to autoconf-2.52 infrastructure,
+ sync with CLisp from CVS.
+ * autoconf/autoconf: Likewise.
+ * autoconf/autoconf.m4f: Likewise (new file).
+ * configure.ac: Likewise (new file, replaces configure.in).
+ * configure.in: Likewise (deleted, replaced by configure.ac).
+ * autoconf/config.{guess,sub}: Update to GNU version 2001-12-13.
+ * src/Makefile.in: made VPATH safe for autoconf-2.52.
+ * include/cln/config.h.in: Add __s390__.
2001-12-31 Richard Kreckel <kreckel@ginac.de>
- * src/base/digitseq/cl_DS.h: <gmp.h> is not included extern "C"
- any more since GMP4 has some C++ support in it.
+ * src/base/digitseq/cl_DS.h: <gmp.h> is not included extern "C"
+ any more since GMP4 has some C++ support in it.
2001-12-14 Richard Kreckel <kreckel@ginac.de>
- * include/cln/modules.h, include/cln/object.h: add support for
- s390.
- * src/numtheory/cl_nt_sqrtmodp.cc: workaround for GCC2.x compiler-bug
- on s390, provided by Gerhard Tonn.
+ * include/cln/modules.h, include/cln/object.h: add support for
+ s390.
+ * src/numtheory/cl_nt_sqrtmodp.cc: workaround for GCC2.x compiler-bug
+ on s390, provided by Gerhard Tonn.
2001-11-05 Richard Kreckel <kreckel@ginac.de>
- * autoconf/ltmain.sh: Upgrade to libtool-1.4.2.
- * autoconf/config.{guess,sub}: Update to GNU version 2001-09-07.
- * Version 1.1.3 released.
+ * autoconf/ltmain.sh: Upgrade to libtool-1.4.2.
+ * autoconf/config.{guess,sub}: Update to GNU version 2001-09-07.
+ * Version 1.1.3 released.
2001-11-04 Bruno Haible <haible@clisp.cons.org>
- Interoperability with gcc-3.0 -fuse-cxa-atexit.
- * autoconf/aclocal.m4 (CL_GLOBAL_CONSTRUCTORS): Add test whether
- global destructors actually exist.
- * include/cln/modules.h (CL_PROVIDE, CL_PROVIDE_END, CL_PROVIDE_END):
- Don't hack the global destructors if there is no global destructors
- function.
+ Interoperability with gcc-3.0 -fuse-cxa-atexit.
+ * autoconf/aclocal.m4 (CL_GLOBAL_CONSTRUCTORS): Add test whether
+ global destructors actually exist.
+ * include/cln/modules.h (CL_PROVIDE, CL_PROVIDE_END, CL_PROVIDE_END):
+ Don't hack the global destructors if there is no global destructors
+ function.
2001-11-03 Richard Kreckel <kreckel@ginac.de>
- * src/float/transcendental/cl_F_sinx.cc (sinx_naive): For small
- values of x, return square(x) instead of x.
- * src/float/transcendental/cl_F_sinhx.cc (sinhx_naive): Likewise.
+ * src/float/transcendental/cl_F_sinx.cc (sinx_naive): For small
+ values of x, return square(x) instead of x.
+ * src/float/transcendental/cl_F_sinhx.cc (sinhx_naive): Likewise.
2001-07-25 Richard Kreckel <kreckel@ginac.de>
- * Version 1.1.2 released.
+ * Version 1.1.2 released.
2001-07-24 Richard Kreckel <kreckel@ginac.de>
- * src/base/hash/cl_hash.h: declare _cl_hashtable_iterator<htentry> a
- friend of cl_heap_hashtable<htentry>.
+ * src/base/hash/cl_hash.h: declare _cl_hashtable_iterator<htentry> a
+ friend of cl_heap_hashtable<htentry>.
2001-07-22 Richard Kreckel <kreckel@ginac.de>
- * src/float/base/cl_ieee.cc: try to do magic to the FPU only if
- _FPU_IEEE is really defined.
- * include/cln/modules.h: change assembler labels from `label' to
- `label:' on hppa, needed by Linux (see comment).
- * autoconf/acinclude.m4: new file (for storing CLN-specific macros).
- * Makefile.devel: adjusted.
- * autoconf/aclocal.m4: regenerate.
- * src/base/low/cl_low_mul.cc: moved POD variables that are declared
- extern "C" elsewhere out of the namespace.
- * src/base/low/cl_low_div.cc: Likewise.
+ * src/float/base/cl_ieee.cc: try to do magic to the FPU only if
+ _FPU_IEEE is really defined.
+ * include/cln/modules.h: change assembler labels from `label' to
+ `label:' on hppa, needed by Linux (see comment).
+ * autoconf/acinclude.m4: new file (for storing CLN-specific macros).
+ * Makefile.devel: adjusted.
+ * autoconf/aclocal.m4: regenerate.
+ * src/base/low/cl_low_mul.cc: moved POD variables that are declared
+ extern "C" elsewhere out of the namespace.
+ * src/base/low/cl_low_div.cc: Likewise.
2001-06-08 Bruno Haible <haible@clisp.cons.org>
- * autoconf/config.{guess,sub}: Update to GNU version 2001-05-11.
- * autoconf/aclocal.m4: Upgrade to libtool-1.4.
- * autoconf/ltmain.sh: Likewise.
- * autoconf/ltconfig: Remove file.
- * autoconf/install-sh: New file.
- * configure.in: Add AC_CONFIG_AUX_DIR call.
+ * autoconf/config.{guess,sub}: Update to GNU version 2001-05-11.
+ * autoconf/aclocal.m4: Upgrade to libtool-1.4.
+ * autoconf/ltmain.sh: Likewise.
+ * autoconf/ltconfig: Remove file.
+ * autoconf/install-sh: New file.
+ * configure.in: Add AC_CONFIG_AUX_DIR call.
2001-06-05 Richard Kreckel <kreckel@ginac.de>
- * tests/tests.cc: resolve namespace ambiguity about strcmp().
+ * tests/tests.cc: resolve namespace ambiguity about strcmp().
2001-05-31 Richard Kreckel <kreckel@ginac.de>
- * Version 1.1.1 released.
+ * Version 1.1.1 released.
2001-05-28 Richard Kreckel <kreckel@ginac.de>
- * cln/cln.tex: documented problems with shared library on Sparc
- using gcc older than 2.95.3.
- * configure.in: Fixed typos in versioning docu.
+ * cln/cln.tex: documented problems with shared library on Sparc
+ using gcc older than 2.95.3.
+ * configure.in: Fixed typos in versioning docu.
2001-05-25 Bruno Haible <haible@clisp.cons.org>
- * src/base/digitseq/cl_asm_arm_.cc: Use #0x instead of #& to designate
- hexadecimal constants.
+ * src/base/digitseq/cl_asm_arm_.cc: Use #0x instead of #& to designate
+ hexadecimal constants.
2001-05-25 Richard Kreckel <kreckel@ginac.de>
- * autoconf/floatparam.c (double_wordorder_bigendian_p): new symbol.
- * src/float/dfloat/cl_DF.h: Check for double_wordorder_bigendian_p.
- * Removed LiDIA interface since that is now outdated (namespace cln)
- and maintained elsewhere.
- * Adjusted dates and final touches for 1.1.1.
+ * autoconf/floatparam.c (double_wordorder_bigendian_p): new symbol.
+ * src/float/dfloat/cl_DF.h: Check for double_wordorder_bigendian_p.
+ * Removed LiDIA interface since that is now outdated (namespace cln)
+ and maintained elsewhere.
+ * Adjusted dates and final touches for 1.1.1.
2001-05-19 Richard Kreckel <kreckel@ginac.de>
- * INSTALL: Update toolchain info: no egcs, some more platforms.
- * doc/cln.tex: Likewise.
+ * INSTALL: Update toolchain info: no egcs, some more platforms.
+ * doc/cln.tex: Likewise.
2001-05-18 Richard Kreckel <kreckel@ginac.de>
- * src/base/cl_low.h: prepended variables declared inside macros
- with underscore. Fixes equal_hashcode() on various platforms.
+ * src/base/cl_low.h: prepended variables declared inside macros
+ with underscore. Fixes equal_hashcode() on various platforms.
2001-04-25 Richard Kreckel <kreckel@ginac.de>
- * src/base/cl_low.h: Added several checks if NO_ASM is defined, so
- this definition becomes actually useful. This is needed for
- compilation on Arm until somebody fixes the assembler files for Arm.
- * src/base/digitseq/cl_asm.h: Likewise.
- * src/base/digitseq/cl_asm_.cc: Likewise.
- * */Makefile.in: Added `override' in front of `CPPFLAGS +=' so
- one can say `make CPPFLAGS=-DFOOBAR'.
+ * src/base/cl_low.h: Added several checks if NO_ASM is defined, so
+ this definition becomes actually useful. This is needed for
+ compilation on Arm until somebody fixes the assembler files for Arm.
+ * src/base/digitseq/cl_asm.h: Likewise.
+ * src/base/digitseq/cl_asm_.cc: Likewise.
+ * */Makefile.in: Added `override' in front of `CPPFLAGS +=' so
+ one can say `make CPPFLAGS=-DFOOBAR'.
2001-03-26 Arvid Norberg <c99ang@cs.umu.se>
- * src/base/random/cl_random_from.cc: ported to beos.
+ * src/base/random/cl_random_from.cc: ported to beos.
2001-03-05 Richard Kreckel <kreckel@ginac.de>
- * include/cln/modules.h (CL_JUMP_TO): Fix IA64 brokenness.
+ * include/cln/modules.h (CL_JUMP_TO): Fix IA64 brokenness.
2001-01-28 Richard Kreckel <kreckel@ginac.de>
- * include/cln/number.h (cl_as_N): Remove bogus comment.
+ * include/cln/number.h (cl_as_N): Remove bogus comment.
2001-01-22 Richard Kreckel <kreckel@ginac.de>
- * configure.in: Make build in separate builddir possible (again).
+ * configure.in: Make build in separate builddir possible (again).
2001-01-22 Richard Kreckel <kreckel@ginac.de>
- * include/cln/*.h: Change signatures of all classes' methods
- cln::cl_foo::operator new(size_t, cl_foo*) to
- cln::cl_foo::operator new(size_t, void*) so one can declare
- std::vector<cln::cl_foo>, std::list<cln::cl_foo> etc. for
- certain STL implementations (like libstdc++-v3).
+ * include/cln/*.h: Change signatures of all classes' methods
+ cln::cl_foo::operator new(size_t, cl_foo*) to
+ cln::cl_foo::operator new(size_t, void*) so one can declare
+ std::vector<cln::cl_foo>, std::list<cln::cl_foo> etc. for
+ certain STL implementations (like libstdc++-v3).
2000-12-14 Richard Kreckel <kreckel@ginac.de>
- * Version 1.1 released.
+ * Version 1.1 released.
2000-12-13 Richard Kreckel <kreckel@ginac.de>
- * */*: cl_istream -> std::istream, cl_ostream -> std::ostream.
+ * */*: cl_istream -> std::istream, cl_ostream -> std::ostream.
2000-12-05 Richard Kreckel <kreckel@ginac.de>
- * Makefile.in, src/Makefile.in, doc/Makefile.in: Use mkdir -p.
- * include/cln/version.h.in, src/base/verion.cc: New files.
- * configure.in: Generate include/cln/version.h.
- * cln.m4: Rewrote it. Check result of cln-config without compiling.
- Do cross-check library version and header version information.
+ * Makefile.in, src/Makefile.in, doc/Makefile.in: Use mkdir -p.
+ * include/cln/version.h.in, src/base/verion.cc: New files.
+ * configure.in: Generate include/cln/version.h.
+ * cln.m4: Rewrote it. Check result of cln-config without compiling.
+ Do cross-check library version and header version information.
2000-12-02 Christian Bauer <cbauer@ginac.de>
- * Makefile.in, src/Makefile.in, doc/Makefile.in: Added $DESTDIR.
- * cln.m4, cln.spec.in: some minor fixes with respect to RPM package
- building.
+ * Makefile.in, src/Makefile.in, doc/Makefile.in: Added $DESTDIR.
+ * cln.m4, cln.spec.in: some minor fixes with respect to RPM package
+ building.
2000-11-24 Richard Kreckel <kreckel@ginac.de>
- * */*: Removed problematic stdin, stdout and stderr definitions.
- Use std::cin, std::cout, std::cerr instead (obsoletes 2000-10-29).
+ * */*: Removed problematic stdin, stdout and stderr definitions.
+ Use std::cin, std::cout, std::cerr instead (obsoletes 2000-10-29).
2000-11-20 Bruno Haible
- * cln-config.1: change title.
+ * cln-config.1: change title.
2000-11-18 Richard Kreckel <kreckel@ginac.de>
- * cln.m4: New file.
- * doc/cln.tex: Document package tools cln-config and cln.m4.
- * Makefile.in: Care about cln.m4.
+ * cln.m4: New file.
+ * doc/cln.tex: Document package tools cln-config and cln.m4.
+ * Makefile.in: Care about cln.m4.
2000-11-17 Richard Kreckel <kreckel@ginac.de>
- * cln-config.1: added manpage, as required by a couple of distros.
- * Makefile.in, doc/Makefile.in: target install depends on installdirs.
+ * cln-config.1: added manpage, as required by a couple of distros.
+ * Makefile.in, doc/Makefile.in: target install depends on installdirs.
2000-11-16 Richard Kreckel <kreckel@ginac.de>
- * autoconf/aclocal.m4 (CL_GMP_SET_UINTD): New macro...
- * configure.in: ...used here.
- * include/cln/config.h.in: Put in macros defined by CL_GMP_SET_UINTD...
- * include/cln/types.h: ...used here.
- * autoconf/acgeneral.m4, autoconf/aclocal.m4: Adhere to FHS.
+ * autoconf/aclocal.m4 (CL_GMP_SET_UINTD): New macro...
+ * configure.in: ...used here.
+ * include/cln/config.h.in: Put in macros defined by CL_GMP_SET_UINTD...
+ * include/cln/types.h: ...used here.
+ * autoconf/acgeneral.m4, autoconf/aclocal.m4: Adhere to FHS.
2000-11-13 Richard Kreckel <kreckel@ginac.de>
- * src/base/digitseq/cl_asm.h: Test if (intDsize==32) for MIPS and HPPA,
- in order to guard against an accidented configuration.
- * src/integer/conv/cl_I_to_digits.cc (table): member b_hoch_k of
- struct power_table_entry initialized as ULL instead of as UL, if
- intDsize==64 (caused misprinting on MIPS w/ GMP).
- * src/base/cl_macros.h (minus_bitm, bitc): implemented ULL, if
- HAVE_FAST_LONGLONG.
- * src/integer/bitwise/cl_I_mkfx.cc (mkf_extract): Likewise.
- * src/integer/conv/cl_I_from_L.cc (cl_I_from_L): Added trival
- generation of Bignum for intDsize==64 and a notreached-check at end.
- * autoconf/config.guess, autoconf/config.sub: updated from FSF.
- * include/cln/config.h.in: Prepared support for IA64.
- * include/cln/types.h: Likewise.
- * include/cln/object.h: Likewise.
- * include/cln/modules.h: Likewise.
- * src/base/cl_macros.h (nonreturning_function): Likewise (NUE's
- compiler claims __GNUC_MINOR__==9).
+ * src/base/digitseq/cl_asm.h: Test if (intDsize==32) for MIPS and HPPA,
+ in order to guard against an accidented configuration.
+ * src/integer/conv/cl_I_to_digits.cc (table): member b_hoch_k of
+ struct power_table_entry initialized as ULL instead of as UL, if
+ intDsize==64 (caused misprinting on MIPS w/ GMP).
+ * src/base/cl_macros.h (minus_bitm, bitc): implemented ULL, if
+ HAVE_FAST_LONGLONG.
+ * src/integer/bitwise/cl_I_mkfx.cc (mkf_extract): Likewise.
+ * src/integer/conv/cl_I_from_L.cc (cl_I_from_L): Added trival
+ generation of Bignum for intDsize==64 and a notreached-check at end.
+ * autoconf/config.guess, autoconf/config.sub: updated from FSF.
+ * include/cln/config.h.in: Prepared support for IA64.
+ * include/cln/types.h: Likewise.
+ * include/cln/object.h: Likewise.
+ * include/cln/modules.h: Likewise.
+ * src/base/cl_macros.h (nonreturning_function): Likewise (NUE's
+ compiler claims __GNUC_MINOR__==9).
2000-11-03 Richard Kreckel <kreckel@ginac.de>
- * src/base/cl_macros.h (bit, minus_bit): changed criterion for ULL from
- HAVE_DD to HAVE_FAST_LONGLONG.
- * src/base/cl_macros.h (bitm): implemented ULL, if HAVE_FAST_LONGLONG.
- * src/base/cl_low.h: actually no need to include "cln/types.h" here.
- * src/base/cl_low.h (logcount_64): always ULL, independent of HAVE_DD.
- * src/base/random/cl_UL_random.cc (random32): a is always ULL.
+ * src/base/cl_macros.h (bit, minus_bit): changed criterion for ULL from
+ HAVE_DD to HAVE_FAST_LONGLONG.
+ * src/base/cl_macros.h (bitm): implemented ULL, if HAVE_FAST_LONGLONG.
+ * src/base/cl_low.h: actually no need to include "cln/types.h" here.
+ * src/base/cl_low.h (logcount_64): always ULL, independent of HAVE_DD.
+ * src/base/random/cl_UL_random.cc (random32): a is always ULL.
2000-11-01 Richard Kreckel <kreckel@ginac.de>
- * include/cln/object.h (cl_combine): define additional signatures, if
- HAVE_LONGLONG is defined, in order to keep the compiler happy.
- * src/base/cl_macros.h: include "cln/types.h", since we need HAVE_DD...
- * src/base/cl_macros.h (bit): ...for this macro...
- * src/base/cl_macros.h (minus_bit): ...and this one.
- * src/base/cl_low.h: include "cln/types.h", since we need HAVE_DD...
- * src/base/cl_low.h (logcount_64): ...for this macro.
- * src/base/random/cl_UL_random.cc (random32): if HAVE_DD a is an ULL.
- * src/integer/gcd/cl_I_gcd_aux2.cc (floorDD): fixed algorithmic bug.
- that turned up when intDsize==32 and cl_word_size==64.
- * src/float/dfloat/elem/cl_DF_div.cc (operator/): fixed a missing cast
- to uint64 that turned up when intDsize==32 and cl_word_size==64.
+ * include/cln/object.h (cl_combine): define additional signatures, if
+ HAVE_LONGLONG is defined, in order to keep the compiler happy.
+ * src/base/cl_macros.h: include "cln/types.h", since we need HAVE_DD...
+ * src/base/cl_macros.h (bit): ...for this macro...
+ * src/base/cl_macros.h (minus_bit): ...and this one.
+ * src/base/cl_low.h: include "cln/types.h", since we need HAVE_DD...
+ * src/base/cl_low.h (logcount_64): ...for this macro.
+ * src/base/random/cl_UL_random.cc (random32): if HAVE_DD a is an ULL.
+ * src/integer/gcd/cl_I_gcd_aux2.cc (floorDD): fixed algorithmic bug.
+ that turned up when intDsize==32 and cl_word_size==64.
+ * src/float/dfloat/elem/cl_DF_div.cc (operator/): fixed a missing cast
+ to uint64 that turned up when intDsize==32 and cl_word_size==64.
2000-10-29 Richard Kreckel <kreckel@ginac.de>
- * src/real/input/cl_R_read.cc, src/complex/input/cl_N_read.cc:
- #undef stderr, if it's defined so cln::stderr isn't confused.
- * src/base/input/cl_read_globals.cc: stdin should not be extern.
+ * src/real/input/cl_R_read.cc, src/complex/input/cl_N_read.cc:
+ #undef stderr, if it's defined so cln::stderr isn't confused.
+ * src/base/input/cl_read_globals.cc: stdin should not be extern.
2000-09-05 Richard Kreckel <kreckel@ginac.de>
- * include/cln/number.h (As): Fix it in namespace by suffixing `_As'
- to the appropiate method instead of prefixing `as_'.
- * src/complex/misc/cl_N_as.cc (cl_N_As): Likewise.
- * src/real/misc/cl_R_as.cc (cl_R_As): Likewise.
- * src/rational/misc/cl_RA_as.cc (cl_RA_As): Likewise.
- * src/integer/misc/cl_I_as.cc (cl_I_As): Likewise.
- * src/float/misc/cl_F_as.cc (cl_F_As): Likewise.
- * src/float/sfloat/misc/cl_SF_as.cc (cl_SF_As): Likewise.
- * src/float/lfloat/misc/cl_LF_as.cc (cl_LF_As): Likewise.
- * src/float/ffloat/misc/cl_FF_as.cc (cl_FF_As): Likewise.
- * src/float/dfloat/misc/cl_DF_as.cc (cl_DF_As): Likewise.
+ * include/cln/number.h (As): Fix it in namespace by suffixing `_As'
+ to the appropiate method instead of prefixing `as_'.
+ * src/complex/misc/cl_N_as.cc (cl_N_As): Likewise.
+ * src/real/misc/cl_R_as.cc (cl_R_As): Likewise.
+ * src/rational/misc/cl_RA_as.cc (cl_RA_As): Likewise.
+ * src/integer/misc/cl_I_as.cc (cl_I_As): Likewise.
+ * src/float/misc/cl_F_as.cc (cl_F_As): Likewise.
+ * src/float/sfloat/misc/cl_SF_as.cc (cl_SF_As): Likewise.
+ * src/float/lfloat/misc/cl_LF_as.cc (cl_LF_As): Likewise.
+ * src/float/ffloat/misc/cl_FF_as.cc (cl_FF_As): Likewise.
+ * src/float/dfloat/misc/cl_DF_as.cc (cl_DF_As): Likewise.
2000-09-05 Richard Kreckel <kreckel@ginac.de>
- * src/complex/transcendental/cl_C_expt_C.cc (expt): fix logic for
- the 0^y cases.
+ * src/complex/transcendental/cl_C_expt_C.cc (expt): fix logic for
+ the 0^y cases.
2000-08-30 Richard Kreckel <kreckel@ginac.de>
- * include/cln/number.h, cl_number::_as_cl_private_thing(): removed.
- Rearranged for a clearer distinction between macros and remaining
- identifiers, so Cint can parse it smoothly.
+ * include/cln/number.h, cl_number::_as_cl_private_thing(): removed.
+ Rearranged for a clearer distinction between macros and remaining
+ identifiers, so Cint can parse it smoothly.
2000-08-29 Richard Kreckel <kreckel@ginac.de>
- * include/cln/number.h, the(const cl_number& x): New template
- function.
+ * include/cln/number.h, the(const cl_number& x): New template
+ function.
2000-08-29 Richard Kreckel <kreckel@ginac.de>
- * */*: Pushed CLN into a namespace `cln'. While doing so, the
- following identifiers got their poor-man's namespace (i.e. the
- prefix `cl_') stripped off:
- cl_catalanconst() -> catalanconst()
- cl_compare() -> compare()
- cl_cos_sin() -> cos_sin()
- cl_cos_sin_t -> cos_sin_t
- cl_cosh_sinh() -> cosh_sinh()
- cl_cosh_sinh_t -> cosh_sinh_t
- cl_decoded_dfloat -> decoded_dfloat
- cl_decoded_ffloat -> decoded_ffloat
- cl_decoded_float -> decoded_float
- cl_decoded_lfloat -> decoded_lfloat
- cl_decoded_sfloat -> decoded_sfloat
- cl_default_float_format -> default_float_format
- cl_default_print_flags -> default_print_flags
- cl_default_random_state -> default_random_state
- cl_double_approx() -> double_approx()
- cl_equal() -> equal()
- cl_equal_hashcode() -> equal_hashcode()
- cl_eulerconst() -> eulerconst()
- cl_find_modint_ring() -> find_modint_ring()
- cl_find_univpoly_ring() -> find_univ_poly_ring()
- cl_float_approx() -> float_approx
- cl_float_format() -> float_format()
- cl_float_format_t -> float_format_t
- cl_free_hook() -> free_hook()
- cl_hermite() -> hermite()
- cl_laguerre() -> laguerre()
- cl_legendre() -> legandre()
- cl_malloc_hook() -> malloc_hook()
- cl_pi() -> pi()
- cl_tschebychev() -> tschebychev()
- cl_zeta() -> zeta()
- NB: For functions these changes includes all signatures.
- * include/*: moved to include/cln/*, stripped `cl_' off filenames.
- * cln-config.in: new file.
+ * */*: Pushed CLN into a namespace `cln'. While doing so, the
+ following identifiers got their poor-man's namespace (i.e. the
+ prefix `cl_') stripped off:
+ cl_catalanconst() -> catalanconst()
+ cl_compare() -> compare()
+ cl_cos_sin() -> cos_sin()
+ cl_cos_sin_t -> cos_sin_t
+ cl_cosh_sinh() -> cosh_sinh()
+ cl_cosh_sinh_t -> cosh_sinh_t
+ cl_decoded_dfloat -> decoded_dfloat
+ cl_decoded_ffloat -> decoded_ffloat
+ cl_decoded_float -> decoded_float
+ cl_decoded_lfloat -> decoded_lfloat
+ cl_decoded_sfloat -> decoded_sfloat
+ cl_default_float_format -> default_float_format
+ cl_default_print_flags -> default_print_flags
+ cl_default_random_state -> default_random_state
+ cl_double_approx() -> double_approx()
+ cl_equal() -> equal()
+ cl_equal_hashcode() -> equal_hashcode()
+ cl_eulerconst() -> eulerconst()
+ cl_find_modint_ring() -> find_modint_ring()
+ cl_find_univpoly_ring() -> find_univ_poly_ring()
+ cl_float_approx() -> float_approx
+ cl_float_format() -> float_format()
+ cl_float_format_t -> float_format_t
+ cl_free_hook() -> free_hook()
+ cl_hermite() -> hermite()
+ cl_laguerre() -> laguerre()
+ cl_legendre() -> legandre()
+ cl_malloc_hook() -> malloc_hook()
+ cl_pi() -> pi()
+ cl_tschebychev() -> tschebychev()
+ cl_zeta() -> zeta()
+ NB: For functions these changes includes all signatures.
+ * include/*: moved to include/cln/*, stripped `cl_' off filenames.
+ * cln-config.in: new file.
2000-08-26 Bruno Haible <haible@clisp.cons.org>
- * autoconf/acgeneral.m4 (AC_OUTPUT): Use braces in exec_prefix default
- value, not parens.
+ * autoconf/acgeneral.m4 (AC_OUTPUT): Use braces in exec_prefix default
+ value, not parens.
2000-08-18 Bruno Haible <haible@clisp.cons.org>
- * include/cl_univpoly_modint.h: Fix typo.
+ * include/cl_univpoly_modint.h: Fix typo.
2000-07-13 Bruno Haible <haible@clisp.cons.org>
- * src/float/input/cl_F_read_stream.cc (number_char_p): Accept '_',
- used as precision marker for floats.
- Reported by Keith Briggs (in 1998) and Thomas Roessler.
- * src/integer/input/cl_I_read_stream.cc (number_char_p): Likewise.
- * src/rational/input/cl_RA_read_stream.cc (number_char_p): Likewise.
- * src/real/input/cl_R_read_stream.cc (number_char_p): Likewise.
- * src/complex/input/cl_N_read_stream.cc (number_char_p): Likewise.
+ * src/float/input/cl_F_read_stream.cc (number_char_p): Accept '_',
+ used as precision marker for floats.
+ Reported by Keith Briggs (in 1998) and Thomas Roessler.
+ * src/integer/input/cl_I_read_stream.cc (number_char_p): Likewise.
+ * src/rational/input/cl_RA_read_stream.cc (number_char_p): Likewise.
+ * src/real/input/cl_R_read_stream.cc (number_char_p): Likewise.
+ * src/complex/input/cl_N_read_stream.cc (number_char_p): Likewise.
2000-06-22 Bruno Haible <haible@clisp.cons.org>
- * include/cl_object.h: Rename cl_word_size to cl_pointer_size.
- * include/cl_types.h (HAVE_FAST_LONGLONG): Also define on Irix6
- with N32 ABI.
- (cl_word_size): New macro.
- * src/float/sfloat/cl_SF.h: Use cl_pointer_size instead of
- cl_word_size.
+ * include/cl_object.h: Rename cl_word_size to cl_pointer_size.
+ * include/cl_types.h (HAVE_FAST_LONGLONG): Also define on Irix6
+ with N32 ABI.
+ (cl_word_size): New macro.
+ * src/float/sfloat/cl_SF.h: Use cl_pointer_size instead of
+ cl_word_size.
2000-05-31 Bruno Haible <haible@clisp.cons.org>
- * tests/exam_I_floor.cc (integer_floor_tests): Add one more entry.
- From a sample that fails with gcc-2.95.2 on Sparc.
- * tests/exam_I_gcd.cc (integer_gcd_tests): Likewise.
+ * tests/exam_I_floor.cc (integer_floor_tests): Add one more entry.
+ From a sample that fails with gcc-2.95.2 on Sparc.
+ * tests/exam_I_gcd.cc (integer_gcd_tests): Likewise.
2000-05-30 Richard Kreckel <kreckel@ginac.de>
- * configure.in, autoconf/aclocal.m4 (CL_GMP_H_VERSION, CL_GMP_CHECK):
- New macros.
- * configure.in, include/cl_config.h.in (CL_VERSION, CL_VERSION_MINOR,
- CL_VERSION_PATCHLEVEL): New definitions.
- * autoconf/config.guess, autoconf/config.sub, autoconf/ltconfig,
- autoconf/ltmain.sh: updated from FSF (libtool 1.3.5, etc).
- * src/Makefile.in, configure.in: release-variables renamed from
- CLN_* to CL_*.
- * configure.in: default to build both shared and static library
- (i.e. default to the most common behaviour).
+ * configure.in, autoconf/aclocal.m4 (CL_GMP_H_VERSION, CL_GMP_CHECK):
+ New macros.
+ * configure.in, include/cl_config.h.in (CL_VERSION, CL_VERSION_MINOR,
+ CL_VERSION_PATCHLEVEL): New definitions.
+ * autoconf/config.guess, autoconf/config.sub, autoconf/ltconfig,
+ autoconf/ltmain.sh: updated from FSF (libtool 1.3.5, etc).
+ * src/Makefile.in, configure.in: release-variables renamed from
+ CLN_* to CL_*.
+ * configure.in: default to build both shared and static library
+ (i.e. default to the most common behaviour).
2000-05-29 Richard Kreckel <kreckel@ginac.de>
- * autoconf/aclocal.m4 (CL_CANONICAL_HOST): Added missing changequote
- environment around the patch of 2000-05-23.
+ * autoconf/aclocal.m4 (CL_CANONICAL_HOST): Added missing changequote
+ environment around the patch of 2000-05-23.
2000-05-29 Bruno Haible <haible@clisp.cons.org>
- * autoconf/aclocal.m4 (CL_PROG_INSTALL): Fix typo.
- Reported by Thomas Klausner <wiz@danbala.ifoer.tuwien.ac.at>.
+ * autoconf/aclocal.m4 (CL_PROG_INSTALL): Fix typo.
+ Reported by Thomas Klausner <wiz@danbala.ifoer.tuwien.ac.at>.
2000-05-27 Richard Kreckel <kreckel@ginac.de>
- * src/float/lfloat/algebraic/cl_LF_sqrt.cc,
- src/base/digitseq/cl_DS_sqrt.cc: Readjusted break-even points.
+ * src/float/lfloat/algebraic/cl_LF_sqrt.cc,
+ src/base/digitseq/cl_DS_sqrt.cc: Readjusted break-even points.
2000-05-24 Richard Kreckel <kreckel@ginac.de>
- * autoconf/config.*: Updated to new version from FSF
- (the new libtool wants this).
- * src/Makefile.in: added $(LDFLAGS) to link step.
- * src/base/digitseq/cl_2DS_div.cc, cl_2DS_recip.cc: Readjusted
- break-even points.
+ * autoconf/config.*: Updated to new version from FSF
+ (the new libtool wants this).
+ * src/Makefile.in: added $(LDFLAGS) to link step.
+ * src/base/digitseq/cl_2DS_div.cc, cl_2DS_recip.cc: Readjusted
+ break-even points.
2000-05-23 Bruno Haible <haible@clisp.cons.org>
- * autoconf/aclocal.m4 (CL_CANONICAL_HOST): Determine host_cpu,
- host_vendor, host_os correctly if $host has more than two hyphens.
+ * autoconf/aclocal.m4 (CL_CANONICAL_HOST): Determine host_cpu,
+ host_vendor, host_os correctly if $host has more than two hyphens.
2000-05-19 Richard Kreckel <kreckel@ginac.de>
- * src/base/digitseq/cl_DS_mul.cc: Rearranged break-even points to
- better match present-day CPUs whenever GMP3 is used.
- * src/base/digitseq/cl_DS_div.cc: dto.
- * src/TUNING: Added comment about order of tuning.
- * configure, configure.in: Safer GMP3-detection.
- * INSTALL.generic: Clarified behaviour of --with-gmp.
- * autoconf/config.guess: updated from Clisp-2000-03-06 sources.
+ * src/base/digitseq/cl_DS_mul.cc: Rearranged break-even points to
+ better match present-day CPUs whenever GMP3 is used.
+ * src/base/digitseq/cl_DS_div.cc: dto.
+ * src/TUNING: Added comment about order of tuning.
+ * configure, configure.in: Safer GMP3-detection.
+ * INSTALL.generic: Clarified behaviour of --with-gmp.
+ * autoconf/config.guess: updated from Clisp-2000-03-06 sources.
2000-05-04 Richard Kreckel <kreckel@ginac.de>
- * gmp/: removed completely. From now on we are going to link
- externally against libgmp3.0 or above!
- * configure, configure.in, Makefile.in, */Makeflags: removed support
- of internal gmp 2.0.2, like $GMP_INCLUDES, which should be done by
- setting $CPPFLAGS instead.
- * Makefile.in: Added libtool inter-library dependency for -lgmp and
- conforming interface versioning (-version-info).
- * autoconf/ltconfig, autoconf/ltmain.sh: Updated to newer versions
- from libtool 1.3.4.
+ * gmp/: removed completely. From now on we are going to link
+ externally against libgmp3.0 or above!
+ * configure, configure.in, Makefile.in, */Makeflags: removed support
+ of internal gmp 2.0.2, like $GMP_INCLUDES, which should be done by
+ setting $CPPFLAGS instead.
+ * Makefile.in: Added libtool inter-library dependency for -lgmp and
+ conforming interface versioning (-version-info).
+ * autoconf/ltconfig, autoconf/ltmain.sh: Updated to newer versions
+ from libtool 1.3.4.
2000-02-22 Bruno Haible <haible@clisp.cons.org>
- * src/base/digitseq/cl_asm_mips_.cc: Starting at argument 5 the
- parameter passing was changed for the MIPS n32 ABI.
+ * src/base/digitseq/cl_asm_mips_.cc: Starting at argument 5 the
+ parameter passing was changed for the MIPS n32 ABI.
2000-01-24 Richard Kreckel <kreckel@ginac.de>
- * gmp/*: Replaced the complete mpn sources with the ones from
- Debian since they are maintained while the ones from FSF
- aren't and there were problems on some architectures, PowerPC
- in particular. See the file gmp/README.CLN. This way the
- hard links in this directory have vanished, they were causing
- trouble for people working in AFS. This became necessary for
- Debian, because there it woudn't compile on PPC.
+ * gmp/*: Replaced the complete mpn sources with the ones from
+ Debian since they are maintained while the ones from FSF
+ aren't and there were problems on some architectures, PowerPC
+ in particular. See the file gmp/README.CLN. This way the
+ hard links in this directory have vanished, they were causing
+ trouble for people working in AFS. This became necessary for
+ Debian, because there it woudn't compile on PPC.
2000-01-13 Richard Kreckel <kreckel@ginac.de>
- * Version 1.0.3 released.
+ * Version 1.0.3 released.
2000-01-13 Richard Kreckel <kreckel@ginac.de>
- * src/base/cl_macros.h (nonreturning_function): For egcs and newer
- use __attribute__ ((__noreturn__)) instead of the __volatile__
- storage class.
- (nonreturning): Remove macro.
- * include/*: Minor fixes to stop -ansi -pedantic from complaining.
- * include/cl_integer.h: (doublefactorial): New declaration.
- * src/integer/misc/combin/cl_I_doublefactorial.cc: New file.
+ * src/base/cl_macros.h (nonreturning_function): For egcs and newer
+ use __attribute__ ((__noreturn__)) instead of the __volatile__
+ storage class.
+ (nonreturning): Remove macro.
+ * include/*: Minor fixes to stop -ansi -pedantic from complaining.
+ * include/cl_integer.h: (doublefactorial): New declaration.
+ * src/integer/misc/combin/cl_I_doublefactorial.cc: New file.
1999-12-18 Bruno Haible <haible@clisp.cons.org>
- * autoconf/acgeneral.m4 (AC_ARG_PROGRAM): Create conftestsed using
- "cat", not "echo".
- * autoconf/ltconfig: Improve support for recent FreeBSD 3.
- * include/cl_GV.h (cl_GV_vectorops): Change return type from 'T' to
- 'const T', to match definition in src/vector/cl_GV_number.cc.
- Reported by Duncan Simpson <dps@io.stargate.co.uk>.
- * gmp/mpn/Makefile.in (.S.lo): Use 'if', not '&&', because '&&' may
- yield return code 1.
+ * autoconf/acgeneral.m4 (AC_ARG_PROGRAM): Create conftestsed using
+ "cat", not "echo".
+ * autoconf/ltconfig: Improve support for recent FreeBSD 3.
+ * include/cl_GV.h (cl_GV_vectorops): Change return type from 'T' to
+ 'const T', to match definition in src/vector/cl_GV_number.cc.
+ Reported by Duncan Simpson <dps@io.stargate.co.uk>.
+ * gmp/mpn/Makefile.in (.S.lo): Use 'if', not '&&', because '&&' may
+ yield return code 1.
1999-09-07 Bruno Haible <haible@clisp.cons.org>
- * Version 1.0.2 released.
+ * Version 1.0.2 released.
1999-09-06 Bruno Haible <haible@clisp.cons.org>
- * src/rational/cl_RA.h (integerp, ratiop): Instead of returning a
- boolean expression, write alternatives ending with either
- "return cl_true;" or "return cl_false;". This way, g++ does a
- better job inlining it.
- * src/float/cl_F.h (longfloatp): Likewise.
- * src/real/cl_R.h (rationalp, integerp, floatp): Likewise.
- * src/complex/cl_C.h (realp, complexp): Likewise.
+ * src/rational/cl_RA.h (integerp, ratiop): Instead of returning a
+ boolean expression, write alternatives ending with either
+ "return cl_true;" or "return cl_false;". This way, g++ does a
+ better job inlining it.
+ * src/float/cl_F.h (longfloatp): Likewise.
+ * src/real/cl_R.h (rationalp, integerp, floatp): Likewise.
+ * src/complex/cl_C.h (realp, complexp): Likewise.
1999-09-05 Bruno Haible <haible@clisp.cons.org>
- * include/cl_integer.h (cl_equal_hashcode): New declaration.
- * include/cl_rational.h (cl_equal_hashcode): New declaration.
- * include/cl_sfloat.h (cl_equal_hashcode): New declaration.
- * include/cl_ffloat.h (cl_equal_hashcode): New declaration.
- * include/cl_dfloat.h (cl_equal_hashcode): New declaration.
- * include/cl_lfloat.h (cl_equal_hashcode): New declaration.
- * include/cl_float.h (cl_equal_hashcode): New declaration.
- * include/cl_real.h (cl_equal_hashcode): New declaration.
- * include/cl_complex.h (cl_equal_hashcode): New declaration.
- * src/base/cl_N.h (equal_hashcode_low, equal_hashcode_one): New macros.
- * src/integer/misc/cl_I_eqhashcode.cc: New file.
- * src/rational/misc/cl_RA_eqhashcode.cc: New file.
- * src/float/sfloat/misc/cl_SF_eqhashcode.cc: New file.
- * src/float/ffloat/misc/cl_FF_eqhashcode.cc: New file.
- * src/float/dfloat/misc/cl_DF_eqhashcode.cc: New file.
- * src/float/lfloat/misc/cl_LF_eqhashcode.cc: New file.
- * src/float/misc/cl_F_eqhashcode.cc: New file.
- * src/real/misc/cl_R_eqhashcode.cc: New file.
- * src/complex/misc/cl_C_eqhashcode.cc: New file.
- * doc/cln.tex: Document `cl_equal_hashcode'.
+ * include/cl_integer.h (cl_equal_hashcode): New declaration.
+ * include/cl_rational.h (cl_equal_hashcode): New declaration.
+ * include/cl_sfloat.h (cl_equal_hashcode): New declaration.
+ * include/cl_ffloat.h (cl_equal_hashcode): New declaration.
+ * include/cl_dfloat.h (cl_equal_hashcode): New declaration.
+ * include/cl_lfloat.h (cl_equal_hashcode): New declaration.
+ * include/cl_float.h (cl_equal_hashcode): New declaration.
+ * include/cl_real.h (cl_equal_hashcode): New declaration.
+ * include/cl_complex.h (cl_equal_hashcode): New declaration.
+ * src/base/cl_N.h (equal_hashcode_low, equal_hashcode_one): New macros.
+ * src/integer/misc/cl_I_eqhashcode.cc: New file.
+ * src/rational/misc/cl_RA_eqhashcode.cc: New file.
+ * src/float/sfloat/misc/cl_SF_eqhashcode.cc: New file.
+ * src/float/ffloat/misc/cl_FF_eqhashcode.cc: New file.
+ * src/float/dfloat/misc/cl_DF_eqhashcode.cc: New file.
+ * src/float/lfloat/misc/cl_LF_eqhashcode.cc: New file.
+ * src/float/misc/cl_F_eqhashcode.cc: New file.
+ * src/real/misc/cl_R_eqhashcode.cc: New file.
+ * src/complex/misc/cl_C_eqhashcode.cc: New file.
+ * doc/cln.tex: Document `cl_equal_hashcode'.
1999-09-05 Bruno Haible <haible@clisp.cons.org>
- * include/cl_ring.h (cl_number_ring_ops): Add `contains' member.
- (cl_number_ring): New class.
- (cl_specialized_number_ring<T>): Inherit from cl_number_ring.
- (instanceof): New function.
- * src/integer/ring/cl_I_ring.cc (cl_I_p): New function.
- * src/integer/misc/cl_I_as.cc (cl_I_p): Add comment.
- * src/rational/ring/cl_RA_ring.cc (cl_RA_p): New function.
- * src/rational/misc/cl_RA_as.cc (cl_RA_p): Add comment.
- * src/real/ring/cl_R_ring.cc (cl_R_p): New function.
- * src/real/misc/cl_R_as.cc (cl_R_p): Add comment.
- * src/complex/ring/cl_C_ring.cc (cl_N_p): New function.
- * src/complex/misc/cl_N_as.cc (cl_N_p): Add comment.
- * doc/cln.tex: Document `instanceof'.
+ * include/cl_ring.h (cl_number_ring_ops): Add `contains' member.
+ (cl_number_ring): New class.
+ (cl_specialized_number_ring<T>): Inherit from cl_number_ring.
+ (instanceof): New function.
+ * src/integer/ring/cl_I_ring.cc (cl_I_p): New function.
+ * src/integer/misc/cl_I_as.cc (cl_I_p): Add comment.
+ * src/rational/ring/cl_RA_ring.cc (cl_RA_p): New function.
+ * src/rational/misc/cl_RA_as.cc (cl_RA_p): Add comment.
+ * src/real/ring/cl_R_ring.cc (cl_R_p): New function.
+ * src/real/misc/cl_R_as.cc (cl_R_p): Add comment.
+ * src/complex/ring/cl_C_ring.cc (cl_N_p): New function.
+ * src/complex/misc/cl_N_as.cc (cl_N_p): Add comment.
+ * doc/cln.tex: Document `instanceof'.
1999-09-05 Bruno Haible <haible@clisp.cons.org>
- * include/cl_rational.h (numerator, denominator): New declarations.
- * src/rational/elem/cl_RA_numerator.cc: New file.
- * src/rational/elem/cl_RA_denominator.cc: New file.
- * include/cl_integer.h (numerator, denominator): New inline functions.
- * doc/cln.tex: Document `numerator' and `denominator'.
+ * include/cl_rational.h (numerator, denominator): New declarations.
+ * src/rational/elem/cl_RA_numerator.cc: New file.
+ * src/rational/elem/cl_RA_denominator.cc: New file.
+ * include/cl_integer.h (numerator, denominator): New inline functions.
+ * doc/cln.tex: Document `numerator' and `denominator'.
1999-09-05 Bruno Haible <haible@clisp.cons.org>
- * src/rational/algebraic/cl_RA_rootp.cc (rootp): Fix endless loop
- in the integer case.
- * src/rational/algebraic/cl_RA_rootp_I.cc (rootp): Likewise.
+ * src/rational/algebraic/cl_RA_rootp.cc (rootp): Fix endless loop
+ in the integer case.
+ * src/rational/algebraic/cl_RA_rootp_I.cc (rootp): Likewise.
1999-09-05 Bruno Haible <haible@clisp.cons.org>
- * include/cl_config.h.in: Support for sparc64 CPU.
- * include/cl_modules.h: Likewise.
- * include/cl_types.h: Likewise.
- * include/cl_object.h: Likewise.
- * include/cl_GV.h: Likewise.
- * src/Makefile.in: Likewise.
- * src/base/cl_alloca.h: Likewise.
- * src/base/cl_macros.h: Likewise.
- * src/base/cl_sysdep.h: Likewise.
- * src/base/cl_low.h: Likewise.
- * src/base/digitseq/cl_asm.h: Likewise.
- * src/base/digitseq/cl_asm_.cc: Likewise.
- * src/base/digitseq/cl_asm_sparc64.h: New file.
- * src/base/digitseq/cl_asm_sparc64_.cc: New file.
- * src/modinteger/cl_MI_int.h: Support for sparc64 CPU.
- * src/polynomial/elem/cl_UP_no_ring.cc: Likewise.
- * src/polynomial/elem/cl_UP_GF2.h: Likewise.
- * src/polynomial/elem/cl_asm_GF2.cc: Likewise.
+ * include/cl_config.h.in: Support for sparc64 CPU.
+ * include/cl_modules.h: Likewise.
+ * include/cl_types.h: Likewise.
+ * include/cl_object.h: Likewise.
+ * include/cl_GV.h: Likewise.
+ * src/Makefile.in: Likewise.
+ * src/base/cl_alloca.h: Likewise.
+ * src/base/cl_macros.h: Likewise.
+ * src/base/cl_sysdep.h: Likewise.
+ * src/base/cl_low.h: Likewise.
+ * src/base/digitseq/cl_asm.h: Likewise.
+ * src/base/digitseq/cl_asm_.cc: Likewise.
+ * src/base/digitseq/cl_asm_sparc64.h: New file.
+ * src/base/digitseq/cl_asm_sparc64_.cc: New file.
+ * src/modinteger/cl_MI_int.h: Support for sparc64 CPU.
+ * src/polynomial/elem/cl_UP_no_ring.cc: Likewise.
+ * src/polynomial/elem/cl_UP_GF2.h: Likewise.
+ * src/polynomial/elem/cl_asm_GF2.cc: Likewise.
1999-09-04 Bruno Haible <haible@clisp.cons.org>
- * src/base/digitseq/cl_asm_sparc_.cc (orc2_loop_up, orc2_loop_down):
- Use the `orn' instruction.
+ * src/base/digitseq/cl_asm_sparc_.cc (orc2_loop_up, orc2_loop_down):
+ Use the `orn' instruction.
1999-08-14 Bruno Haible <haible@clisp.cons.org>
- Assume all platforms have <stdlib.h> and clock_t.
- * configure.in: Don't call CL_STDLIB_H and CL_CLOCK_T.
- * src/base/cl_base_config.h.in (CLOCK_T): Remove definition.
- * src/base/random/cl_random_from.cc: Use clock_t instead of CLOCK_T.
- * src/timing/cl_t_config.h.in (CLOCK_T): Remove definition.
- * src/timing/cl_t_current2.cc: Use clock_t instead of CLOCK_T.
+ Assume all platforms have <stdlib.h> and clock_t.
+ * configure.in: Don't call CL_STDLIB_H and CL_CLOCK_T.
+ * src/base/cl_base_config.h.in (CLOCK_T): Remove definition.
+ * src/base/random/cl_random_from.cc: Use clock_t instead of CLOCK_T.
+ * src/timing/cl_t_config.h.in (CLOCK_T): Remove definition.
+ * src/timing/cl_t_current2.cc: Use clock_t instead of CLOCK_T.
1999-07-18 Bruno Haible <haible@clisp.cons.org>
- * gmp/config.guess: Link to autoconf/config.guess.
- gmp/config.sub: Link to autoconf/config.sub.
- Needed for Win32 platforms.
+ * gmp/config.guess: Link to autoconf/config.guess.
+ gmp/config.sub: Link to autoconf/config.sub.
+ Needed for Win32 platforms.
1999-07-17 Bruno Haible <haible@clisp.cons.org>
- * autoconf/aclocal.m4 (CL_CANONICAL_HOST_CPU): Distinguish "sparc" and
- "sparc64" according to the C compiler, not the uname result.
+ * autoconf/aclocal.m4 (CL_CANONICAL_HOST_CPU): Distinguish "sparc" and
+ "sparc64" according to the C compiler, not the uname result.
1999-06-17 Bruno Haible <haible@clisp.cons.org>
- * src/base/digitseq/cl_asm_sparc_.cc (compare_loop_up): Fix
- COUNTER_LOOPS version, fortunately not used yet.
+ * src/base/digitseq/cl_asm_sparc_.cc (compare_loop_up): Fix
+ COUNTER_LOOPS version, fortunately not used yet.
- * include/cl_modules.h: Prepare for gcc version 3.
+ * include/cl_modules.h: Prepare for gcc version 3.
1999-06-12 Bruno Haible <haible@clisp.cons.org>
- * src/rational/elem/cl_RA_plus.cc, src/rational/elem/cl_RA_minus.cc:
- Change the last call from I_I_to_RT to I_I_to_RA.
+ * src/rational/elem/cl_RA_plus.cc, src/rational/elem/cl_RA_minus.cc:
+ Change the last call from I_I_to_RT to I_I_to_RA.
1999-06-09 Bruno Haible <haible@clisp.cons.org>
- * Version 1.0.1 released.
+ * Version 1.0.1 released.
1999-06-09 Bruno Haible <haible@clisp.cons.org>
- * src/integer/cl_I.h (pFN_maxlength_digits_at): Define also when
- intDsize==64.
+ * src/integer/cl_I.h (pFN_maxlength_digits_at): Define also when
+ intDsize==64.
1999-06-08 Bruno Haible <haible@clisp.cons.org>
- * autoconf/intparam.c (printf_underscored): Change argument type to
- `const char*'.
- * include/cl_modules.h (CL_OUTPUT_LABEL, CL_JUMP_TO): New macros.
- (CL_PROVIDE, CL_PROVIDE_END): Use them.
- * include/cl_string.h (cl_heap_string::operator new): Return 1, not 0.
- * include/cl_GV.h (cl_GV_inner<T>::operator new): Likewise.
- * src/base/ring/cl_no_ring.cc (dummy_canonhom, dummy_expt_pos): Don't
- cast a cl_I to void here. Works around a bug in g++-2.95.
- * src/complex/misc/cl_C_class.cc: Include "cl_C.h".
- * src/polynomial/elem/cl_UP_no_ring.cc (dummy_canonhom,
- dummy_expt_pos): Don't cast a cl_I to void here. Works around a bug
- in g++-2.95.
- * src/polynomial/elem/cl_asm_sparc_GF2.cc (DECLARE_FUNCTION): New
- macro.
- * src/rational/misc/cl_RA_class.cc: Include "cl_RA.h".
- * src/vector/cl_GV_I.cc (cl_heap_GV_I_general::operator new,
- DEFINE_cl_heap_GV_I_bits): Return 1, not 0.
- * src/vector/cl_GV_number.cc (cl_heap_GV_number_general::operator new):
- Likewise.
+ * autoconf/intparam.c (printf_underscored): Change argument type to
+ `const char*'.
+ * include/cl_modules.h (CL_OUTPUT_LABEL, CL_JUMP_TO): New macros.
+ (CL_PROVIDE, CL_PROVIDE_END): Use them.
+ * include/cl_string.h (cl_heap_string::operator new): Return 1, not 0.
+ * include/cl_GV.h (cl_GV_inner<T>::operator new): Likewise.
+ * src/base/ring/cl_no_ring.cc (dummy_canonhom, dummy_expt_pos): Don't
+ cast a cl_I to void here. Works around a bug in g++-2.95.
+ * src/complex/misc/cl_C_class.cc: Include "cl_C.h".
+ * src/polynomial/elem/cl_UP_no_ring.cc (dummy_canonhom,
+ dummy_expt_pos): Don't cast a cl_I to void here. Works around a bug
+ in g++-2.95.
+ * src/polynomial/elem/cl_asm_sparc_GF2.cc (DECLARE_FUNCTION): New
+ macro.
+ * src/rational/misc/cl_RA_class.cc: Include "cl_RA.h".
+ * src/vector/cl_GV_I.cc (cl_heap_GV_I_general::operator new,
+ DEFINE_cl_heap_GV_I_bits): Return 1, not 0.
+ * src/vector/cl_GV_number.cc (cl_heap_GV_number_general::operator new):
+ Likewise.
1999-06-01 Bruno Haible <haible@clisp.cons.org>
- * autoconf/aclocal.m4 (CL_CANONICAL_HOST_CPU): Canonicalize alpha
- variants to alpha.
+ * autoconf/aclocal.m4 (CL_CANONICAL_HOST_CPU): Canonicalize alpha
+ variants to alpha.
1999-05-29 Bruno Haible <haible@clisp.cons.org>
- * src/base/digitseq/cl_asm_i386_.cc (DECLARE_FUNCTION): Treat
- OpenBSD like NetBSD.
- * src/base/digitseq/cl_asm_sparc_.cc (DECLARE_FUNCTION): Likewise.
- * src/base/digitseq/cl_asm_m68k_.cc (DECLARE_FUNCTION): Treat
- OpenBSD like NetBSD, and Linux/ELF like SVR4.
+ * src/base/digitseq/cl_asm_i386_.cc (DECLARE_FUNCTION): Treat
+ OpenBSD like NetBSD.
+ * src/base/digitseq/cl_asm_sparc_.cc (DECLARE_FUNCTION): Likewise.
+ * src/base/digitseq/cl_asm_m68k_.cc (DECLARE_FUNCTION): Treat
+ OpenBSD like NetBSD, and Linux/ELF like SVR4.
1999-05-16 Bruno Haible <haible@clisp.cons.org>
- * src/base/cl_low.h (integerlength32) [__rs6000__]: Use old assembler
- syntax on AIX systems and new assembler syntax on non-AIX systems.
+ * src/base/cl_low.h (integerlength32) [__rs6000__]: Use old assembler
+ syntax on AIX systems and new assembler syntax on non-AIX systems.
1999-05-01 Bruno Haible <haible@clisp.cons.org>
- * autoconf/config.guess, autoconf/config.sub: Upgrade to newest
- version from GNU CVS.
+ * autoconf/config.guess, autoconf/config.sub: Upgrade to newest
+ version from GNU CVS.
1999-04-24 Bruno Haible <haible@clisp.cons.org>
- * src/integer/bitwise/cl_I_logand.cc (logand): Optimize the case when
- either operand is a positive fixnum, O(1) instead of O(N).
- * src/integer/bitwise/cl_I_lognand.cc (lognand): Likewise.
- * src/integer/bitwise/cl_I_logandc2.cc (logandc2): Likewise for the
- first operand.
+ * src/integer/bitwise/cl_I_logand.cc (logand): Optimize the case when
+ either operand is a positive fixnum, O(1) instead of O(N).
+ * src/integer/bitwise/cl_I_lognand.cc (lognand): Likewise.
+ * src/integer/bitwise/cl_I_logandc2.cc (logandc2): Likewise for the
+ first operand.
1999-04-14 Bruno Haible <haible@clisp.cons.org>
- * autoconf/aclocal.m4 (CL_GLOBAL_CONSTRUCTORS): Add check whether
- ctor/dtor needs to be exported.
- * include/cl_config.h.in (CL_NEED_GLOBALIZE_CTORDTOR): New macro.
- * include/cl_modules.h (CL_GLOBALIZE_JUMP_LABEL): Renamed from
- CL_GLOBALIZE_LABEL.
- (CL_GLOBALIZE_LABEL): New macro.
- (CL_GLOBALIZE_CTORDTOR_LABEL): Renamed from CL_GLOBALIZE_ASM_LABEL.
- (CL_PROVIDE): Update.
+ * autoconf/aclocal.m4 (CL_GLOBAL_CONSTRUCTORS): Add check whether
+ ctor/dtor needs to be exported.
+ * include/cl_config.h.in (CL_NEED_GLOBALIZE_CTORDTOR): New macro.
+ * include/cl_modules.h (CL_GLOBALIZE_JUMP_LABEL): Renamed from
+ CL_GLOBALIZE_LABEL.
+ (CL_GLOBALIZE_LABEL): New macro.
+ (CL_GLOBALIZE_CTORDTOR_LABEL): Renamed from CL_GLOBALIZE_ASM_LABEL.
+ (CL_PROVIDE): Update.
1999-04-12 Bruno Haible <haible@clisp.cons.org>
- * src/Makefile.in ($(ASMFILES_S)): On HPPA, ignore preprocessing
- errors ("unterminated string or character constant").
- ($(ASMFILES_LO)): On HPPA, try with various settings of
- COMPILER_PATH, in order to try /usr/ccs/bin/as and /bin/as.
+ * src/Makefile.in ($(ASMFILES_S)): On HPPA, ignore preprocessing
+ errors ("unterminated string or character constant").
+ ($(ASMFILES_LO)): On HPPA, try with various settings of
+ COMPILER_PATH, in order to try /usr/ccs/bin/as and /bin/as.
1999-04-11 Bruno Haible <haible@clisp.cons.org>
- * INSTALL: Mention gmp problems on MIPS.
- * doc/cln.tex: Likewise.
+ * INSTALL: Mention gmp problems on MIPS.
+ * doc/cln.tex: Likewise.
1999-03-24 Mumit Khan <khan@xraylith.wisc.edu>
- * src/Makefile.in (SUBDIRS): Filter out CVS and RCS directories from
- the source tree.
- * include/cl_modules.h (CL_GLOBALIZE_LABEL): Define for Win32.
- (CL_GLOBALIZE_ASM_LABEL): New macro.
- (CL_PROVIDE): Use it.
- * src/base/random/cl_random_from.cc: Handle WIN32.
- * src/timing/cl_t_current.cc: Likewise.
+ * src/Makefile.in (SUBDIRS): Filter out CVS and RCS directories from
+ the source tree.
+ * include/cl_modules.h (CL_GLOBALIZE_LABEL): Define for Win32.
+ (CL_GLOBALIZE_ASM_LABEL): New macro.
+ (CL_PROVIDE): Use it.
+ * src/base/random/cl_random_from.cc: Handle WIN32.
+ * src/timing/cl_t_current.cc: Likewise.
1999-03-15 Bruno Haible <haible@clisp.cons.org>
- * autoconf/intparam.c (main7): Use %lX instead of %X for a `long'.
- (main8): Adapt for C++.
+ * autoconf/intparam.c (main7): Use %lX instead of %X for a `long'.
+ (main8): Adapt for C++.
1999-03-09 Bruno Haible <haible@clisp.cons.org>
- * INSTALL: Mention egcs-1.1 problems on Sparc.
- * doc/cln.tex: Likewise.
+ * INSTALL: Mention egcs-1.1 problems on Sparc.
+ * doc/cln.tex: Likewise.
1999-03-08 Bruno Haible <haible@clisp.cons.org>
- * autoconf/aclocal.m4 (CL_FPU_CONTROL): Fix the "checking for"
- messages.
+ * autoconf/aclocal.m4 (CL_FPU_CONTROL): Fix the "checking for"
+ messages.
1999-02-25 Bruno Haible <haible@clisp.cons.org>
- * autoconf/aclocal.m4: In test programs, declare `int main()', not
- `main()'.
+ * autoconf/aclocal.m4: In test programs, declare `int main()', not
+ `main()'.
- * lidia-interface/src/interfaces/integers/cln/bigint.c
- (bigint_to_string): Fix for negative arguments.
+ * lidia-interface/src/interfaces/integers/cln/bigint.c
+ (bigint_to_string): Fix for negative arguments.
- * src/base/cl_low.h: Check for `__sparc__', not `SPARC'.
- * src/base/cl_alloca.h: Likewise.
+ * src/base/cl_low.h: Check for `__sparc__', not `SPARC'.
+ * src/base/cl_alloca.h: Likewise.
- * src/base/cl_low.h: Eliminate CLISP style "# " comments.
- * src/base/digitseq/cl_asm_arm_.cc,
- src/base/digitseq/cl_asm_mips_.cc,
- src/float/dfloat/elem/cl_DF_mul.cc: Likewise.
+ * src/base/cl_low.h: Eliminate CLISP style "# " comments.
+ * src/base/digitseq/cl_asm_arm_.cc,
+ src/base/digitseq/cl_asm_mips_.cc,
+ src/float/dfloat/elem/cl_DF_mul.cc: Likewise.
- * src/modinteger/cl_MI_pow2.h,
- src/modinteger/cl_MI_pow2m1.h,
- src/modinteger/cl_MI_pow2p1.h: Workaround g++-2.7.2 inlining bug.
+ * src/modinteger/cl_MI_pow2.h,
+ src/modinteger/cl_MI_pow2m1.h,
+ src/modinteger/cl_MI_pow2p1.h: Workaround g++-2.7.2 inlining bug.
1999-01-18 Bruno Haible <haible@clisp.cons.org>
- * autoconf/acgeneral.m4,
- autoconf/acspecific.m4: Upgrade to autoconf-2.13.
- * autoconf/config.guess, autoconf/config.sub: Likewise.
- * autoconf/aclocal.m4 (CL_ALLOCA): Test for _MSC_VER and alloca being
- a macro. Use ${ac_objext}.
- * src/base/cl_macros.h (alloca): Put _MSC_VER test before the others,
- conforming with CL_ALLOCA.
+ * autoconf/acgeneral.m4,
+ autoconf/acspecific.m4: Upgrade to autoconf-2.13.
+ * autoconf/config.guess, autoconf/config.sub: Likewise.
+ * autoconf/aclocal.m4 (CL_ALLOCA): Test for _MSC_VER and alloca being
+ a macro. Use ${ac_objext}.
+ * src/base/cl_macros.h (alloca): Put _MSC_VER test before the others,
+ conforming with CL_ALLOCA.
1999-01-12 Bruno Haible <haible@clisp.cons.org>
- * Version 1.0 released.
+ * Version 1.0 released.
@subsection Number theoretic functions
@table @code
-@item uint32 gcd (uint32 a, uint32 b)
+@item uint32 gcd (unsigned long a, unsigned long b)
@cindex @code{gcd ()}
@itemx cl_I gcd (const cl_I& a, const cl_I& b)
This function returns the greatest common divisor of @code{a} and @code{b},
rational number, this function returns true and sets *l = log(a,b), else
it returns false.
-@item int jacobi (sint32 a, sint32 b)
+@item int jacobi (signed long a, signed long b)
@cindex @code{jacobi()}
@itemx int jacobi (const cl_I& a, const cl_I& b)
Returns the Jacobi symbol
// > a,b: zwei Integers
// < ergebnis: (gcd a b), ein Integer >=0
extern const cl_I gcd (const cl_I& a, const cl_I& b);
- extern uint32 gcd (uint32 a, uint32 b);
+ extern uintV gcd (uintV a, uintV b);
// Liefert den ggT zweier Integers samt Beifaktoren.
// g = xgcd(a,b,&u,&v)
// ( --- )
// ( b )
// a, b must be integers, b > 0, b odd. The result is 0 iff gcd(a,b) > 1.
- extern int jacobi (sint32 a, sint32 b);
+ extern int jacobi (sintV a, sintV b);
extern int jacobi (const cl_I& a, const cl_I& b);
// isprobprime(n), n integer > 0,
#define cl_tag_len 3
#endif
#define cl_tag_shift 0
-#if (cl_pointer_size == 64)
- #define cl_value_shift 32
-#else
- #define cl_value_shift (cl_tag_len+cl_tag_shift)
-#endif
+#define cl_value_shift (cl_tag_len+cl_tag_shift)
#define cl_value_len (cl_pointer_size - cl_value_shift)
#define cl_tag_mask (((1UL << cl_tag_len) - 1) << cl_tag_shift)
#define cl_value_mask (((1UL << cl_value_len) - 1) << cl_value_shift)
typedef long sintP;
typedef unsigned long uintP;
+// Integer type used for the value of a fixnum.
+ #define intVsize long_bitsize
+ typedef long sintV;
+ typedef unsigned long uintV;
+
// Numbers in the heap are stored as "digit" sequences.
// A digit is an unsigned int with intDsize bits.
// intDsize should be 8 or 16 or 32 or 64 and it should match mp_limb_t,
})
#elif defined(__GNUC__) && defined(__sparc64__) && !defined(NO_ASM)
#define mulu32(x,y,hi_zuweisung,lo_zuweisung) \
- ({ var register uint64 _hi; \
- var register uint64 _lo; \
- __asm__("umul %2,%3,%1\n\trd %y,%0" \
- : "=r" (_hi), "=r" (_lo) \
+ ({ var register uint64 _prod; \
+ __asm__("umul %1,%2,%0" \
+ : "=r" (_prod) \
: "r" ((uint32)(x)), "r" ((uint32)(y)) \
); \
- hi_zuweisung (uint32)_hi; lo_zuweisung (uint32)_lo; \
+ hi_zuweisung (uint32)(_prod>>32); \
+ lo_zuweisung (uint32)(_prod); \
})
#elif defined(__GNUC__) && defined(__sparc__) && !defined(NO_ASM)
#define mulu32(x,y,hi_zuweisung,lo_zuweisung) \
// mulu32_w(arg1,arg2)
// > arg1, arg2 : zwei 32-Bit-Zahlen
// < result : eine 64-Bit-Zahl
-#if defined(__GNUC__)
+#if defined(__GNUC__) && defined(__sparc64__) && !defined(NO_ASM)
+ // Prefer the umul instruction over the mulx instruction (overkill).
+ #define mulu32_w(x,y) \
+ ({ var register uint64 _prod; \
+ __asm__("umul %1,%2,%0" \
+ : "=r" (_prod) \
+ : "r" ((uint32)(x)), "r" ((uint32)(y)) \
+ ); \
+ _prod; \
+ })
+#elif defined(__GNUC__)
#define mulu32_w(x,y) ((uint64)(uint32)(x) * (uint64)(uint32)(y))
#else
extern "C" uint64 mulu32_w (uint32 arg1, uint32 arg2);
var register uint64 _lo; \
__asm__("mulq %2" \
: "=d" /* %rdx */ (_hi), "=a" /* %rax */ (_lo) \
- : "g" ((uint64)(x)), "1" /* %rax */ ((uint64)(y)) \
+ : "rm" ((uint64)(x)), "1" /* %rax */ ((uint64)(y)) \
); \
hi_zuweisung _hi; lo_zuweisung _lo; \
})
})
#elif defined(__GNUC__) && defined(__arm__) && 0 // see comment cl_asm_arm.cc
#define divu_3216_1616(x,y,q_zuweisung,r_zuweisung) \
- { var uint32 _q = divu_3216_1616_(x,y); /* extern in Assembler */ \
- var register uint32 _r __asm__("%r1"/*"%a2"*/); \
- q_zuweisung _q; r_zuweisung _r; \
+ { var uint32 __q = divu_3216_1616_(x,y); /* extern in Assembler */ \
+ var register uint32 __r __asm__("%r1"/*"%a2"*/); \
+ q_zuweisung __q; r_zuweisung __r; \
}
#elif defined(__GNUC__) && !defined(__arm__)
#define divu_3216_1616(x,y,q_zuweisung,r_zuweisung) \
// < uint32 q: floor(x/y)
// < uint32 r: x mod y
// < x = q*y+r
-#if defined(__GNUC__)
+#if defined(__GNUC__) && defined(__sparc64__) && !defined(NO_ASM)
+ // Prefer the udiv and umul instructions over the udivx and mulx instructions
+ // (overkill).
+ #define divu_6432_3232_w(x,y,q_zuweisung,r_zuweisung) \
+ ({var uint64 __x = (x); \
+ var uint32 __xhi = high32(__x); \
+ var uint32 __xlo = low32(__x); \
+ var uint32 __y = (y); \
+ var uint64 __q; \
+ var uint64 __r; \
+ __asm__ __volatile__ ( \
+ "wr %2,%%g0,%%y\n\t" \
+ "udiv %3,%4,%0\n\t" \
+ "umul %0,%4,%1" \
+ "sub %3,%1,%1" \
+ : "=&r" (__q), "=&r" (__r) \
+ : "r" (__xhi), "r" (__xlo), "r" (__y)); \
+ q_zuweisung (uint32)__q; \
+ r_zuweisung (uint32)__r; \
+ })
+#elif defined(__GNUC__) && (defined(__alpha__) || defined(__ia64__) || defined(__mips64__) || defined(__sparc64__))
+ // On __alpha__, computing the remainder by multiplication is just two
+ // instructions, compared to the __remqu (libc) function call for the %
+ // operator.
+ // On __ia64__, computing the remainder by multiplication is just four
+ // instructions, compared to the __umoddi3 (libgcc) function call for the %
+ // operator.
+ // On __mips64__, computing the remainder by multiplication is just two
+ // instructions, compared to the __umoddi3 (libgcc) function call for the %
+ // operator.
+ // On __sparc64__, computing the remainder by multiplication uses a 32-bit
+ // multiplication instruction, compared to a 64-bit multiplication when the %
+ // operator is used.
#define divu_6432_3232_w(x,y,q_zuweisung,r_zuweisung) \
({var uint64 __x = (x); \
var uint32 __y = (y); \
var uint32 __q = floor(__x,(uint64)__y); \
q_zuweisung __q; r_zuweisung (uint32)__x - __q * __y; \
})
+#elif defined(__GNUC__) && defined(__x86_64__)
+ // On __x86_64__, gcc 4.0 performs both quotient and remainder computation
+ // in a single instruction.
+ #define divu_6432_3232_w(x,y,q_zuweisung,r_zuweisung) \
+ ({var uint64 __x = (x); \
+ var uint32 __y = (y); \
+ var uint32 __q = floor(__x,(uint64)__y); \
+ q_zuweisung __q; r_zuweisung __x % (uint64)__y; \
+ })
#else
#define divu_6432_3232_w(x,y,q_zuweisung,r_zuweisung) \
{ var uint64 __x = (x); \
}
#endif
+// 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
+// > uint32 y: Nenner
+// > Es sei bekannt, daß y>0.
+// < uint64 q: floor(x/y)
+// < uint32 r: x mod y
+// < x = q*y+r
+#if defined(__GNUC__) && (defined(__alpha__) || defined(__ia64__) || defined(__mips64__) || defined(__sparc64__))
+ // On __alpha__, computing the remainder by multiplication is just two
+ // instructions, compared to the __remqu (libc) function call for the %
+ // operator.
+ // On __ia64__, computing the remainder by multiplication is just four
+ // instructions, compared to the __umoddi3 (libgcc) function call for the %
+ // operator.
+ // On __mips64__, computing the remainder by multiplication is just two
+ // instructions, compared to the __umoddi3 (libgcc) function call for the %
+ // operator.
+ // On __sparc64__, computing the remainder by multiplication uses a 32-bit
+ // multiplication instruction, compared to a 64-bit multiplication when the %
+ // operator is used.
+ #define divu_6432_6432(x,y,q_zuweisung,r_zuweisung) \
+ ({var uint64 _x = (x); \
+ var uint32 _y = (y); \
+ var uint64 _q; \
+ q_zuweisung _q = floor(_x,(uint64)_y); \
+ r_zuweisung low32(_x) - low32(_q) * _y; \
+ })
+#elif defined(__GNUC__) && defined(__x86_64__)
+ // On __x86_64__, gcc 4.0 performs both quotient and remainder computation
+ // in a single instruction.
+ #define divu_6432_6432(x,y,q_zuweisung,r_zuweisung) \
+ ({var uint64 _x = (x); \
+ var uint32 _y = (y); \
+ q_zuweisung floor(_x,(uint64)_y); \
+ r_zuweisung _x % (uint64)_y; \
+ })
+#else
+ // Methode: (beta = 2^32)
+ // x = x1*beta+x0 schreiben.
+ // Division mit Rest: x1 = q1*y + r1, wobei 0 <= x1 < beta <= beta*y.
+ // Also 0 <= q1 < beta, 0 <= r1 < y.
+ // Division mit Rest: (r1*beta+x0) = q0*y + r0, wobei 0 <= r1*beta+x0 < beta*y.
+ // Also 0 <= q0 < beta, 0 <= r0 < y
+ // und x = x1*beta+x0 = (q1*beta+q0)*y + r0.
+ // Setze q := q1*beta+q0 und r := r0.
+ #if defined(__GNUC__)
+ #define divu_6432_6432(x,y,q_zuweisung,r_zuweisung) \
+ ({var uint64 _x = (x); \
+ var uint32 _y = (y); \
+ var uint32 _q1; \
+ var uint32 _q0; \
+ var uint32 _r1; \
+ divu_6432_3232(0,high32(_x),_y, _q1 = , _r1 = ); \
+ divu_6432_3232(_r1,low32(_x),_y, _q0 = , r_zuweisung); \
+ q_zuweisung highlow64(_q1,_q0); \
+ })
+ #else
+ #define divu_6432_6432(x,y,q_zuweisung,r_zuweisung) \
+ {var uint64 _x = (x); \
+ var uint32 _y = (y); \
+ var uint32 _q1; \
+ var uint32 _q0; \
+ var uint32 _r1; \
+ divu_6432_3232(0,high32(_x),_y, _q1 = , _r1 = ); \
+ divu_6432_3232(_r1,low32(_x),_y, _q0 = , r_zuweisung); \
+ q_zuweisung highlow64(_q1,_q0); \
+ }
+ #endif
+#endif
+
// 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 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
-#if defined(__alpha__) || 1
+#if defined(__GNUC__) && (defined(__alpha__) || defined(__ia64__) || defined(__mips64__) || defined(__sparc64__))
+ // On __alpha__, computing the remainder by multiplication is just two
+ // instructions, compared to the __remqu (libc) function call for the %
+ // operator.
+ // On __ia64__, computing the remainder by multiplication is just four
+ // instructions, compared to the __umoddi3 (libgcc) function call for the %
+ // operator.
+ // On __mips64__, computing the remainder by multiplication is just two
+ // instructions, compared to the __umoddi3 (libgcc) function call for the %
+ // operator.
+ // On __sparc64__, it doesn't matter.
#define divu_6464_6464(x,y,q_zuweisung,r_zuweisung) \
- { var uint64 __x = (x); \
- var uint64 __y = (y); \
- q_zuweisung (__x / __y); \
- r_zuweisung (__x % __y); \
- }
+ ({var uint64 _x = (x); \
+ var uint64 _y = (y); \
+ var uint64 _q; \
+ q_zuweisung _q = floor(_x,_y); \
+ r_zuweisung _x - _q * _y; \
+ })
+#elif defined(__GNUC__) && (defined(__sparc64__) || defined(__x86_64__))
+ // On __sparc64__, it doesn't matter.
+ // On __x86_64__, gcc 4.0 performs both quotient and remainder computation
+ // in a single instruction.
+ #define divu_6464_6464(x,y,q_zuweisung,r_zuweisung) \
+ ({var uint64 _x = (x); \
+ var uint64 _y = (y); \
+ q_zuweisung floor(_x,_y); \
+ r_zuweisung _x % _y; \
+ })
+#else
+ // For unknown CPUs, we don't know whether gcc's __udivdi3 function plus a
+ // multiplication is slower or faster than our own divu_6464_6464_ routine.
+ // Anyway, call our own routine.
+ extern "C" uint64 divu_6464_6464_ (uint64 x, uint64 y); // -> Quotient q
+ extern "C" uint64 divu_64_rest; // -> Rest r
+ #define divu_6464_6464(x,y,q_zuweisung,r_zuweisung) \
+ { q_zuweisung divu_6464_6464_(x,y); r_zuweisung divu_64_rest; }
+ #define NEED_VAR_divu_64_rest
+ #define NEED_FUNCTION_divu_6464_6464_
#endif
// Dividiert eine 128-Bit-Zahl durch eine 64-Bit-Zahl und
#else
#define divu_12864_6464(xhi,xlo,y,q_zuweisung,r_zuweisung) \
{ q_zuweisung divu_12864_6464_(xhi,xlo,y); r_zuweisung divu_64_rest; }
+ #define NEED_VAR_divu_64_rest
#define NEED_FUNCTION_divu_12864_6464_
#endif
/* _x32 hat höchstens 4 Bits. */\
if (_x32 >= bit(2)) { _x32 = _x32>>2; _bitsize += 2; } \
/* _x32 hat höchstens 2 Bits. */\
- if (_x32 >= bit(1)) { /* _x32 = _x32>>1; */ _bitsize += 1; } \
+ if (_x32 >= bit(1)) { /* _x32 = _x32>>1; */ _bitsize += 1; } \
/* _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:
// 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); \
+ var uint64 _x64 = (uint64)(digit); \
/* _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 4 Bits. */\
if (_x64 >= bit(2)) { _x64 = _x64>>2; _bitsize += 2; } \
/* _x64 hat höchstens 2 Bits. */\
- if (_x64 >= bit(1)) { /* _x64 = _x64>>1; */ _bitsize += 1; } \
+ if (_x64 >= bit(1)) { /* _x64 = _x64>>1; */ _bitsize += 1; } \
/* _x64 hat höchstens 1 Bit. Dieses Bit muß gesetzt sein. */\
size_zuweisung _bitsize; \
}
+#else
+ #define integerlength64(digit,size_zuweisung) \
+ { var uint64 _x64 = (digit); \
+ var uintC _bitsize64 = 0; \
+ var uint32 _x32_from_integerlength64; \
+ if (_x64 >= (1ULL << 32)) { \
+ _x32_from_integerlength64 = _x64>>32; _bitsize64 += 32; \
+ } else { \
+ _x32_from_integerlength64 = _x64; \
+ } \
+ integerlength32(_x32_from_integerlength64, size_zuweisung _bitsize64 + ); \
+ }
+#endif
// Hintere Nullbits eines 32-Bit-Wortes zählen:
// ord2_32(digit,count=);
// Sei n = ord2(x). Dann ist logxor(x,x-1) = 2^n + (2^n-1) = 2^(n+1)-1.
// Also (ord2 x) = (1- (integer-length (logxor x (1- x)))) .
#define ord2_32(digit,count_zuweisung) \
- { var uint32 _digit = digit ^ (digit - 1); \
+ { var uint32 _digit = (digit) ^ ((digit) - 1); \
integerlength32(_digit,count_zuweisung -1 + ) \
}
#endif
+// 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
+// < count: >=0, <64, mit 2^count | digit, digit/2^count ungerade
+ // Sei n = ord2(x). Dann ist logxor(x,x-1) = 2^n + (2^n-1) = 2^(n+1)-1.
+ // Also (ord2 x) = (1- (integer-length (logxor x (1- x)))) .
+ #define ord2_64(digit,count_zuweisung) \
+ { var uint64 _digit = (digit) ^ ((digit) - 1); \
+ integerlength64(_digit,count_zuweisung -1 + ) \
+ }
+
// Bits eines Wortes zählen.
// logcount_NN();
uint64 divu_64_rest;
#endif
+#ifdef NEED_FUNCTION_divu_6464_6464_
+namespace cln {
+uint64 divu_6464_6464_(uint64 x, uint64 y)
+// Methode: (beta = 2^n = 2^32, n = 32)
+// Falls y < beta, handelt es sich um eine 64-durch-32-Bit-Division.
+// Falls y >= beta:
+// Quotient q = floor(x/y) < beta (da 0 <= x < beta^2, y >= beta).
+// 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)
+// 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
+// (denn x1/(y1+1) = (x1*2^k)/((y1+1)*2^k) <= (x1*2^k)/y <= x/y
+// und x/y - x1/(y1+1) = (x+x*y1-x1*y)/(y*(y1+1))
+// = (x+x0*y1-x1*y0)/(y*(y1+1)) <= (x+x0*y1)/(y*(y1+1))
+// <= x/(y*(y1+1)) + x0/y
+// <= 2^(2n)/(2^(n+k-1)*(2^(n-1)+1)) + 2^k/2^(n+k-1)
+// = 2^(n-k+1)/(2^(n-1)+1) + 2^(1-n) <= 2^n/(2^(n-1)+1) + 2^(1-n) < 2 )
+// 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
+// incrementieren, um den Quotienten q = floor(x/y) und den Rest
+// x-floor(x/y)*y der Division zu bekommen.
+{
+ if (y <= (uint64)(((uint64)1<<32)-1))
+ { var uint32 q1;
+ var uint32 q0;
+ var uint32 r1;
+ divu_6432_3232(0,high32(x),y, q1 = , r1 = );
+ divu_6432_3232(r1,low32(x),y, q0 = , divu_64_rest = );
+ return highlow64(q1,q0);
+ }
+ else
+ { 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
+ while (!(y1 <= (uint64)(((uint64)1<<32)-1))); // bis y1 < beta
+ { var uint32 y2 = low32(y1)+1; // y1+1 bilden
+ if (y2==0)
+ { q = high32(x1); } // y1+1=beta -> ein Shift
+ else
+ { 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 -= 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:
+ if (x >= y)
+ { q += 1; x -= y;
+ if (x >= y)
+ { q += 1; x -= y;
+ } }
+ divu_64_rest = x;
+ return (uint64)q;
+ }
+}
+} // namespace cln
+#endif
+
#ifdef NEED_FUNCTION_divu_12864_6464_
-uint64 divu_64_rest;
namespace cln {
uint64 divu_12864_6464_(uint64 xhi, uint64 xlo, uint64 y)
// Methode:
fprint(std::cerr, "\n");
cl_abort();
}
- rational_base = FN_to_UL(base); ptr = base_end_ptr;
+ rational_base = FN_to_UV(base); ptr = base_end_ptr;
break;
}
ptr++;
}
}
if (fixnump(m) && fixnump(n)) { // |m| und n klein?
- var uintL _n = FN_to_UL(n);
+ var uintV _n = FN_to_UV(n);
if ((_n & (_n-1)) == 0) { // n Zweierpotenz?
Mutable(cl_N,x);
until ((_n = _n >> 1) == 0)
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;
- // 2^53 <= q < 2^55, also ist q Bignum mit ceiling(55/intDsize) Digits.
- var const uintD* ptr = BN_MSDptr(q);
#if (cl_word_size==64)
+ #if (cl_value_len>=55)
+ // 2^53 <= q < 2^55: q is fixnum.
+ var uint64 mant = FN_to_UV(q);
+ #else
+ // 2^53 <= q < 2^55: q is bignum with one Digit.
+ var const uintD* ptr = BN_MSDptr(q);
var uint64 mant = get_max64_Dptr(55,ptr);
+ #endif
if (mant >= bit(DF_mant_len+2))
// 2^54 <= q < 2^55, schiebe um 2 Bits nach rechts
{ var uint64 rounding_bits = mant & (bit(2)-1);
ab:
// Fertig.
return encode_DF(sign,lendiff,mant);
- #else
+ #else // (cl_word_size<64)
+ // 2^53 <= q < 2^55: q is bignum with two Digits.
+ var const uintD* ptr = BN_MSDptr(q);
var uint32 manthi = get_max32_Dptr(23,ptr);
var uint32 mantlo = get_32_Dptr(ptr mspop ceiling(23,intDsize));
if (manthi >= bit(DF_mant_len-32+2))
#endif
if (!minusp(delta))
// delta>=0
- { var uintL udelta;
+ { var uintV udelta;
if (fixnump(delta)
- && ((udelta = FN_to_L(delta)) <= (uintL)(DF_exp_high-DF_exp_low))
+ && ((udelta = FN_to_V(delta)) <= (uintV)(DF_exp_high-DF_exp_low))
)
{ exp = exp+udelta;
#if (cl_word_size==64)
// delta<0
{ var uintL udelta;
if (fixnump(delta)
- && ((udelta = -FN_to_L(delta)) <= (uintL)(DF_exp_high-DF_exp_low))
- && ((cl_value_len+1<intLsize) || !(udelta==0))
+ && ((udelta = -FN_to_V(delta)) <= (uintV)(DF_exp_high-DF_exp_low))
+ && ((cl_value_len+1<intVsize) || !(udelta==0))
)
{ exp = exp-udelta;
#if (cl_word_size==64)
var cl_I& r = q_r.remainder;
// 2^24 <= q < 2^26, also ist q Fixnum oder Bignum mit bn_minlength Digits.
var uint32 mant = ((FF_mant_len+3 < cl_value_len)
- ? FN_to_UL(q)
+ ? FN_to_UV(q)
: cl_I_to_UL(q)
);
if (mant >= bit(FF_mant_len+2))
var cl_I& r = q_r.remainder;
// 2^24 <= q < 2^26, also ist q Fixnum oder Bignum mit bn_minlength Digits.
var uint32 mant = ((FF_mant_len+3 < cl_value_len)
- ? FN_to_UL(q)
+ ? FN_to_UV(q)
: cl_I_to_UL(q)
);
if (mant >= bit(FF_mant_len+2))
FF_decode(x, { return x; }, sign=,exp=,mant=);
if (!minusp(delta))
// delta>=0
- { var uintL udelta;
+ { var uintV udelta;
if (fixnump(delta)
- && ((udelta = FN_to_L(delta)) <= (uintL)(FF_exp_high-FF_exp_low))
+ && ((udelta = FN_to_V(delta)) <= (uintV)(FF_exp_high-FF_exp_low))
)
{ exp = exp+udelta;
return encode_FF(sign,exp,mant);
}
else
// delta<0
- { var uintL udelta;
+ { var uintV udelta;
if (fixnump(delta)
- && ((udelta = -FN_to_L(delta)) <= (uintL)(FF_exp_high-FF_exp_low))
- && ((cl_value_len+1<intLsize) || !(udelta==0))
+ && ((udelta = -FN_to_V(delta)) <= (uintV)(FF_exp_high-FF_exp_low))
+ && ((cl_value_len+1<intVsize) || !(udelta==0))
)
{ exp = exp-udelta;
return encode_FF(sign,exp,mant);
if (eq(delta,0)) { return x; } // delta=0 -> x als Ergebnis
var uintL uexp = TheLfloat(x)->expo;
if (uexp==0) { return x; }
- var uintL udelta;
+ var uintV udelta;
// |delta| muß <= LF_exp_high-LF_exp_low < 2^32 sein. Wie bei I_to_UL:
if (fixnump(delta)) {
// Fixnum
- var sint32 sdelta = FN_to_L(delta);
+ var sintV sdelta = FN_to_V(delta);
if (sdelta >= 0)
{ udelta = sdelta; goto pos; }
else
// erst Null und Punkt, dann -expo Nullen, dann alle Ziffern
fprintchar(stream,'0');
fprintchar(stream,'.');
- for (uintL i = -FN_to_L(expo); i > 0; i--)
+ for (uintV i = -FN_to_V(expo); i > 0; i--)
fprintchar(stream,'0');
fprint(stream,mantstring);
expo = 0; // auszugebender Exponent ist 0
} else {
// "fixed-point notation" mit expo > 0 oder "scientific notation"
- var uintL scale = (flag ? FN_to_L(expo) : 1);
+ var uintV scale = (flag ? FN_to_V(expo) : 1);
// Der Dezimalpunkt wird um scale Stellen nach rechts geschoben,
// d.h. es gibt scale Vorkommastellen. scale > 0.
if (scale < mantlen) {
// scale>=mantlen -> es bleibt nichts für die Nachkommastellen.
// alle Ziffern, dann scale-mantlen Nullen, dann Punkt und Null
fprint(stream,mantstring);
- for (uintL i = mantlen; i < scale; i++)
+ for (uintV i = mantlen; i < scale; i++)
fprintchar(stream,'0');
fprintchar(stream,'.');
fprintchar(stream,'0');
var cl_I& q = q_r.quotient;
var cl_I& r = q_r.remainder;
// 2^17 <= q < 2^19, also ist q Fixnum.
- var uint32 mant = FN_to_UL(q);
+ var uint32 mant = FN_to_UV(q);
if (mant >= bit(SF_mant_len+2))
// 2^18 <= q < 2^19, schiebe um 2 Bits nach rechts
{ var uintL rounding_bits = mant & (bit(2)-1);
SF_decode(x, { return x; }, sign=,exp=,mant=);
if (!minusp(delta))
// delta>=0
- { var uintL udelta;
+ { var uintV udelta;
if (fixnump(delta)
- && ((udelta = FN_to_L(delta)) <= (uintL)(SF_exp_high-SF_exp_low))
+ && ((udelta = FN_to_V(delta)) <= (uintV)(SF_exp_high-SF_exp_low))
)
{ exp = exp+udelta;
return encode_SF(sign,exp,mant);
}
else
// delta<0
- { var uintL udelta;
+ { var uintV udelta;
if (fixnump(delta)
- && ((udelta = -FN_to_L(delta)) <= (uintL)(SF_exp_high-SF_exp_low))
- && ((cl_value_len+1<intLsize) || !(udelta==0))
+ && ((udelta = -FN_to_V(delta)) <= (uintV)(SF_exp_high-SF_exp_low))
+ && ((cl_value_len+1<intVsize) || !(udelta==0))
)
{ exp = exp-udelta;
return encode_SF(sign,exp,mant);
}
// Check mod 63.
{ var cl_I_div_t div63 = cl_divide(x,L_to_FN(63));
- if (!squares_mod_63[FN_to_UL(div63.remainder)])
+ if (!squares_mod_63[FN_to_UV(div63.remainder)])
{ return cl_false; } // not a square mod 63 -> not a square
}
// Check mod 65.
{ var cl_I_div_t div65 = cl_divide(x,L_to_FN(65));
- if (!squares_mod_65[FN_to_UL(div65.remainder)])
+ if (!squares_mod_65[FN_to_UV(div65.remainder)])
{ return cl_false; } // not a square mod 65 -> not a square
}
// Check mod 11.
{ var cl_I_div_t div11 = cl_divide(x,L_to_FN(11));
- if (!squares_mod_11[FN_to_UL(div11.remainder)])
+ if (!squares_mod_11[FN_to_UV(div11.remainder)])
{ return cl_false; } // not a square mod 11 -> not a square
}
// Check with full precision.
if (!minusp(y)) {
// y>=0
var uintL i; // i = y mod intDsize, >=0, <intDsize
- var uintL k; // k = y div intDsize, >=0, <2^intCsize
+ var cl_uint k; // k = y div intDsize, >=0, <2^intCsize
if (bignump(y)) {
#if (log2_intDsize+intCsize <= cl_value_len-1)
// y >= 2^(cl_value_len-1) >= intDsize*2^intCsize
i = lspref(arrayLSDptr(bn->data,len),0) % intDsize;
#endif
} else {
- var uintL y_ = FN_to_L(y); // Wert von y, >=0, <intDsize*2^intCsize
+ var uintV y_ = FN_to_V(y); // Wert von y, >=0, <intDsize*2^intCsize
i = y_%intDsize;
k = floor(y_,intDsize);
}
} else {
// y<0
var uintL i; // i = (-y) mod intDsize, >=0, <intDsize
- var uintL k; // k = (-y) div intDsize, >=0, <2^intCsize
+ var cl_uint k; // k = (-y) div intDsize, >=0, <2^intCsize
if (bignump(y)) {
#if (log2_intDsize+intCsize <= cl_value_len-1)
// -y-1 >= 2^(cl_value_len-1) >= intDsize*2^intCsize
goto sign;
#endif
} else {
- var uintL y_ = -FN_to_L(y); // Wert von -y, >0, <intDsize*2^intCsize
+ var uintV y_ = -FN_to_V(y); // Wert von -y, >0, <intDsize*2^intCsize
i = y_%intDsize;
k = floor(y_,intDsize);
}
{
if (fixnump(x))
{ var uintL bitcount = 0;
- var uint32 x_ = FN_to_L(x); // x als 32-Bit-Zahl
- if (FN_L_minusp(x,(sint32)x_)) { x_ = ~ x_; } // falls <0, komplementieren
- if (!(x_==0)) { integerlength32(x_,bitcount=); }
- return bitcount; // 0 <= bitcount < 32.
+ var uintV x_ = FN_to_V(x); // x als intVsize-Bit-Zahl
+ if (FN_V_minusp(x,(sintV)x_)) { x_ = ~ x_; } // falls <0, komplementieren
+ if (!(x_==0)) {
+ #if (intVsize>32)
+ integerlength64(x_,bitcount=);
+ #else
+ integerlength32(x_,bitcount=);
+ #endif
+ }
+ return bitcount; // 0 <= bitcount < intVsize.
}
else
{ var const uintD* MSDptr;
#if (intDsize==64) // && (FN_maxlength==1)
lsprefnext(destptr) = FN_to_Q(obj);
#else // (intDsize<=32)
- var uint32 wert = FN_to_L(obj);
- #define FN_maxlength_a (intLsize/intDsize)
+ var uintV wert = FN_to_V(obj);
+ #define FN_maxlength_a (intVsize/intDsize)
#define FN_maxlength_b (FN_maxlength<=FN_maxlength_a ? FN_maxlength : FN_maxlength_a)
// FN_maxlength Digits ablegen. Davon kann man FN_maxlength_b Digits aus wert nehmen.
#if (FN_maxlength_b > 1)
#endif
lsprefnext(destptr) = (uintD)wert;
#if (FN_maxlength > FN_maxlength_b)
- // Es ist oint_data_len = intLsize, brauche
+ // Es ist cl_value_len-1 = intVsize, brauche
// noch FN_maxlength-FN_maxlength_b = 1 Digit.
- lsprefnext(destptr) = (sintD)sign_of(FN_to_L(obj));
+ lsprefnext(destptr) = (sintD)sign_of(FN_to_V(obj));
#endif
#endif
n -= FN_maxlength;
// Sonst x=intDsize*k+i, Teste Bit i vom Worte Nr. k+1 (von oben herab).
if (!minusp(x)) // x>=0 ?
{ if (fixnump(x))
- { var uintL x_ = FN_to_L(x);
+ { var uintV x_ = FN_to_V(x);
var uintC ylen;
var const uintD* yLSDptr;
I_to_NDS_nocopy(y, ,ylen=,yLSDptr=,cl_true, { return cl_false; } ); // DS zu y
uintL logcount (const cl_I& x)
{
if (fixnump(x))
- { var uint32 x32 = FN_to_L(x); // x als 32-Bit-Zahl
- if (FN_L_minusp(x,(sint32)x32)) { x32 = ~ x32; } // falls <0, komplementieren
+ { var uintV x32 = FN_to_V(x); // x als intDsize-Bit-Zahl
+ 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
+ #undef x64
+ #else
logcount_32(); // Bits von x32 zählen
+ #endif
return x32;
}
else
}
else
// x Fixnum, y Bignum, also ist x echt kürzer
- { if (FN_L_minusp(x,FN_to_L(x))) return cl_true; // x<0 -> ja.
+ { if (FN_V_minusp(x,FN_to_V(x))) return cl_true; // x<0 -> ja.
// x>=0. Kombiniere x mit den pFN_maxlength letzten Digits von y.
{var const uintD* yLSDptr;
- var uintL x_ = FN_to_L(x);
+ var uintV x_ = FN_to_V(x);
BN_to_NDS_nocopy(y, ,,yLSDptr=);
#if (pFN_maxlength > 1)
doconsttimes(pFN_maxlength-1,
else
if (fixnump(y))
// x Bignum, y Fixnum, analog wie oben, nur x und y vertauscht
- { if (FN_L_minusp(y,FN_to_L(y))) return cl_true; // y<0 -> ja.
+ { if (FN_V_minusp(y,FN_to_V(y))) return cl_true; // y<0 -> ja.
// y>=0. Kombiniere y mit den pFN_maxlength letzten Digits von x.
{var const uintD* xLSDptr;
- var uintL y_ = FN_to_L(y);
+ var uintV y_ = FN_to_V(y);
BN_to_NDS_nocopy(x, ,,xLSDptr=);
#if (pFN_maxlength > 1)
doconsttimes(pFN_maxlength-1,
// Umwandlungsroutinen Integer <--> Longword:
// Wandelt Fixnum >=0 in Unsigned Longword um.
-// FN_to_UL(obj)
+// FN_to_UV(obj)
// > obj: ein Fixnum >=0
-// < ergebnis: der Wert des Fixnum als 32-Bit-Zahl.
-inline uint32 FN_to_UL (const cl_I& x)
+// < ergebnis: der Wert des Fixnum als intVsize-Bit-Zahl.
+inline uintV FN_to_UV (const cl_I& x)
{
// This assumes cl_value_shift + cl_value_len == cl_pointer_size.
return (cl_uint)(x.word) >> cl_value_shift;
}
// Wandelt Fixnum in Longword um.
-// FN_to_L(obj)
+// FN_to_V(obj)
// > obj: ein Fixnum
-// < ergebnis: der Wert des Fixnum als 32-Bit-Zahl.
-inline sint32 FN_to_L (const cl_I& x)
+// < ergebnis: der Wert des Fixnum als intVsize-Bit-Zahl.
+inline sintV FN_to_V (const cl_I& x)
{
// This assumes cl_value_shift + cl_value_len == cl_pointer_size.
return (cl_sint)(x.word) >> cl_value_shift;
}
-// FN_L_zerop(x,x_) stellt fest, ob x = 0 ist.
-// Dabei ist x ein Fixnum und x_ = FN_to_L(x).
- #define FN_L_zerop(x,x_) (x_==0)
+// FN_V_zerop(x,x_) stellt fest, ob x = 0 ist.
+// Dabei ist x ein Fixnum und x_ = FN_to_V(x).
+ #define FN_V_zerop(x,x_) (x_==0)
-// FN_L_minusp(x,x_) stellt fest, ob x < 0 ist.
-// Dabei ist x ein Fixnum und x_ = FN_to_L(x).
- #define FN_L_minusp(x,x_) (x_<0)
+// FN_V_minusp(x,x_) stellt fest, ob x < 0 ist.
+// Dabei ist x ein Fixnum und x_ = FN_to_V(x).
+ #define FN_V_minusp(x,x_) (x_<0)
#ifdef intQsize
}
#endif
+#ifdef intQsize
+
+// Wandelt Quadword in Integer um.
+// Q_to_I(wert)
+// > wert: Wert des Integers, ein signed 64-Bit-Integer.
+// < ergebnis: Integer mit diesem Wert.
+ extern cl_private_thing cl_I_constructor_from_Q (sint64 wert);
+ inline const cl_I Q_to_I (sint64 wert)
+ {
+ return cl_I(cl_I_constructor_from_Q(wert));
+ }
+
+// Wandelt Unsigned Quadword in Integer >=0 um.
+// UQ_to_I(wert)
+// > wert: Wert des Integers, ein unsigned 64-Bit-Integer.
+// < ergebnis: Integer mit diesem Wert.
+ extern cl_private_thing cl_I_constructor_from_UQ (uint64 wert);
+ inline const cl_I UQ_to_I (uint64 wert)
+ {
+ return cl_I(cl_I_constructor_from_UQ(wert));
+ }
+
+#endif
+
// Wandelt Doppel-Longword in Integer um.
// L2_to_I(wert_hi,wert_lo)
// > wert_hi|wert_lo: Wert des Integers, ein signed 64-Bit-Integer.
// < ergebnis: Integer mit diesem Wert.
+#if (cl_word_size==64)
+ inline cl_private_thing cl_I_constructor_from_L2 (sint32 wert_hi, uint32 wert_lo)
+ {
+ return cl_I_constructor_from_Q(((sint64)wert_hi<<32) | (sint64)wert_lo);
+ }
+#else
extern cl_private_thing cl_I_constructor_from_L2 (sint32 wert_hi, uint32 wert_lo);
+#endif
inline const cl_I L2_to_I (sint32 wert_hi, uint32 wert_lo)
{
return cl_I(cl_I_constructor_from_L2(wert_hi,wert_lo));
// UL2_to_I(wert_hi,wert_lo)
// > wert_hi|wert_lo: Wert des Integers, ein unsigned 64-Bit-Integer.
// < ergebnis: Integer mit diesem Wert.
+#if (cl_word_size==64)
+ inline cl_private_thing cl_I_constructor_from_UL2 (uint32 wert_hi, uint32 wert_lo)
+ {
+ return cl_I_constructor_from_UQ(((uint64)wert_hi<<32) | (uint64)wert_lo);
+ }
+#else
extern cl_private_thing cl_I_constructor_from_UL2 (uint32 wert_hi, uint32 wert_lo);
+#endif
inline const cl_I UL2_to_I (uint32 wert_hi, uint32 wert_lo)
{
return cl_I(cl_I_constructor_from_UL2(wert_hi,wert_lo));
}
-#ifdef intQsize
-
-// Wandelt Quadword in Integer um.
-// Q_to_I(wert)
-// > wert: Wert des Integers, ein signed 64-Bit-Integer.
+// Wandelt sintV in Integer um.
+// V_to_I(wert)
+// > wert: Wert des Integers, ein sintV.
// < ergebnis: Integer mit diesem Wert.
- extern cl_private_thing cl_I_constructor_from_Q (sint64 wert);
- inline const cl_I Q_to_I (sint64 wert)
- {
- return cl_I(cl_I_constructor_from_Q(wert));
- }
+#if (intVsize<=32)
+ #define V_to_I(wert) L_to_I(wert)
+#else
+ #define V_to_I(wert) Q_to_I(wert)
+#endif
-// Wandelt Unsigned Quadword in Integer >=0 um.
-// UQ_to_I(wert)
-// > wert: Wert des Integers, ein unsigned 64-Bit-Integer.
+// Wandelt uintV in Integer >=0 um.
+// UV_to_I(wert)
+// > wert: Wert des Integers, ein uintV.
// < ergebnis: Integer mit diesem Wert.
- extern cl_private_thing cl_I_constructor_from_UQ (uint64 wert);
- inline const cl_I UQ_to_I (uint64 wert)
- {
- return cl_I(cl_I_constructor_from_UQ(wert));
- }
-
+#if (intVsize<=32)
+ #define UV_to_I(wert) UL_to_I(wert)
+#else
+ #define UV_to_I(wert) UQ_to_I(wert)
#endif
// Wandelt uintD in Integer >=0 um.
#if (intDsize<=32)
-// Holt die nächsten pFN_maxlength Digits in ein uint32.
-inline uint32 pFN_maxlength_digits_at (const uintD* ptr)
+// Holt die nächsten pFN_maxlength Digits in ein uintV.
+inline uintV pFN_maxlength_digits_at (const uintD* ptr)
{
#if (pFN_maxlength==1)
- return (uint32)lspref(ptr,0);
+ return (uintV)lspref(ptr,0);
#elif (pFN_maxlength==2)
- return ((uint32)lspref(ptr,1)<<intDsize) | (uint32)lspref(ptr,0);
+ return ((uintV)lspref(ptr,1)<<intDsize) | (uintV)lspref(ptr,0);
#elif (pFN_maxlength==3)
- return ((((uint32)lspref(ptr,2)<<intDsize) | (uint32)lspref(ptr,1))<<intDsize) | (uint32)lspref(ptr,0);
+ return ((((uintV)lspref(ptr,2)<<intDsize) | (uintV)lspref(ptr,1))<<intDsize) | (uintV)lspref(ptr,0);
#elif (pFN_maxlength==4)
- return ((((((uint32)lspref(ptr,3)<<intDsize) | (uint32)lspref(ptr,2))<<intDsize) | (uint32)lspref(ptr,1))<<intDsize) | (uint32)lspref(ptr,0);
+ return ((((((uintV)lspref(ptr,3)<<intDsize) | (uintV)lspref(ptr,2))<<intDsize) | (uintV)lspref(ptr,1))<<intDsize) | (uintV)lspref(ptr,0);
+#elif (pFN_maxlength==5)
+ return ((((((((uintV)lspref(ptr,4)<<intDsize) | (uintV)lspref(ptr,3))<<intDsize) | (uintV)lspref(ptr,2))<<intDsize) | (uintV)lspref(ptr,1))<<intDsize) | (uintV)lspref(ptr,0);
+#elif (pFN_maxlength==6)
+ return ((((((((((uintV)lspref(ptr,5)<<intDsize) | (uintV)lspref(ptr,4))<<intDsize) | (uintV)lspref(ptr,3))<<intDsize) | (uintV)lspref(ptr,2))<<intDsize) | (uintV)lspref(ptr,1))<<intDsize) | (uintV)lspref(ptr,0);
+#elif (pFN_maxlength==7)
+ return ((((((((((((uintV)lspref(ptr,6)<<intDsize) | (uintV)lspref(ptr,5))<<intDsize) | (uintV)lspref(ptr,4))<<intDsize) | (uintV)lspref(ptr,3))<<intDsize) | (uintV)lspref(ptr,2))<<intDsize) | (uintV)lspref(ptr,1))<<intDsize) | (uintV)lspref(ptr,0);
+#elif (pFN_maxlength==8)
+ return ((((((((((((((uintV)lspref(ptr,7)<<intDsize) | (uintV)lspref(ptr,6))<<intDsize) | (uintV)lspref(ptr,5))<<intDsize) | (uintV)lspref(ptr,4))<<intDsize) | (uintV)lspref(ptr,3))<<intDsize) | (uintV)lspref(ptr,2))<<intDsize) | (uintV)lspref(ptr,1))<<intDsize) | (uintV)lspref(ptr,0);
#endif
}
-// Schreibt ein uint32 in die nächsten pFN_maxlength Digits.
-inline void set_pFN_maxlength_digits_at (uintD* ptr, uint32 wert)
+// Schreibt ein uintV in die nächsten pFN_maxlength Digits.
+inline void set_pFN_maxlength_digits_at (uintD* ptr, uintV wert)
{
#if (pFN_maxlength==1)
lspref(ptr,0) = (uintD)wert;
lspref(ptr,2) = (uintD)(wert>>(2*intDsize));
lspref(ptr,1) = (uintD)(wert>>intDsize);
lspref(ptr,0) = (uintD)(wert);
+#elif (pFN_maxlength==5)
+ lspref(ptr,4) = (uintD)(wert>>(4*intDsize));
+ lspref(ptr,3) = (uintD)(wert>>(3*intDsize));
+ lspref(ptr,2) = (uintD)(wert>>(2*intDsize));
+ lspref(ptr,1) = (uintD)(wert>>intDsize);
+ lspref(ptr,0) = (uintD)(wert);
+#elif (pFN_maxlength==6)
+ lspref(ptr,5) = (uintD)(wert>>(5*intDsize));
+ lspref(ptr,4) = (uintD)(wert>>(4*intDsize));
+ lspref(ptr,3) = (uintD)(wert>>(3*intDsize));
+ lspref(ptr,2) = (uintD)(wert>>(2*intDsize));
+ lspref(ptr,1) = (uintD)(wert>>intDsize);
+ lspref(ptr,0) = (uintD)(wert);
+#elif (pFN_maxlength==7)
+ lspref(ptr,6) = (uintD)(wert>>(6*intDsize));
+ lspref(ptr,5) = (uintD)(wert>>(5*intDsize));
+ lspref(ptr,4) = (uintD)(wert>>(4*intDsize));
+ lspref(ptr,3) = (uintD)(wert>>(3*intDsize));
+ lspref(ptr,2) = (uintD)(wert>>(2*intDsize));
+ lspref(ptr,1) = (uintD)(wert>>intDsize);
+ lspref(ptr,0) = (uintD)(wert);
+#elif (pFN_maxlength==8)
+ lspref(ptr,7) = (uintD)(wert>>(7*intDsize));
+ lspref(ptr,6) = (uintD)(wert>>(6*intDsize));
+ lspref(ptr,5) = (uintD)(wert>>(5*intDsize));
+ lspref(ptr,4) = (uintD)(wert>>(4*intDsize));
+ lspref(ptr,3) = (uintD)(wert>>(3*intDsize));
+ lspref(ptr,2) = (uintD)(wert>>(2*intDsize));
+ lspref(ptr,1) = (uintD)(wert>>intDsize);
+ lspref(ptr,0) = (uintD)(wert);
#endif
}
// Implementation.
#include "cln/number.h"
+
+#if (cl_word_size < 64)
+
#include "cl_DS.h"
namespace cln {
}
} // namespace cln
+
+#endif
// 5 Digits
len_5:
{ wert = get_sint4D_Dptr(MSDptr mspop 5); }
+ return L_to_FN(wert);
#else // (cl_word_size==64)
var sint64 wert;
#if (intDsize==32)
{ wert = ((sint64)(sintD)mspref(MSDptr,0) << intDsize) | (uint64)(uintD)mspref(MSDptr,1); }
#endif
#if (intDsize==64)
- if (TRUE)
+ if (FALSE)
// 1 Digit
len_1:
{ wert = (sintD)mspref(MSDptr,0); }
#endif
+ return cl_I_from_word(cl_combine(cl_FN_tag,wert));
#endif
- return L_to_FN(wert);
}
#if (cl_value_len > (bn_minlength-1)*intDsize)
if (len == bn_minlength)
var uint64 test = wert & (sint64)minus_bit(cl_value_len-1);
// 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,(sint32)wert));
+ return (cl_private_thing)(cl_combine(cl_FN_tag,wert));
// Bignum erzeugen:
// (dessen Länge bn_minlength <= n <= ceiling(32/intDsize) erfüllt)
if (wert >= 0) {
// Implementation.
#include "cln/number.h"
+
+#if (cl_word_size < 64)
+
#include "cl_DS.h"
namespace cln {
}
} // namespace cln
+
+#endif
{
if ((wert & (sint64)minus_bit(cl_value_len-1)) == 0)
// Bits, die nicht in den Fixnum-Wert >= 0 reinpassen.
- return (cl_private_thing)(cl_combine(cl_FN_tag,(uint32)wert));
+ return (cl_private_thing)(cl_combine(cl_FN_tag,wert));
// Bignum erzeugen:
// (dessen Länge bn_minlength <= n <= ceiling((32+1)/intDsize) erfüllt)
#define UQ_maxlength ceiling(64+1,intDsize)
sint32 cl_I_to_L (const cl_I& obj)
{
- if (fixnump(obj))
+ if (fixnump(obj)) {
// Fixnum
- return FN_to_L(obj);
- { // Bignum
- var cl_heap_bignum* bn = TheBignum(obj);
- var uintC len = bn->length;
- 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 (len == i) /* genau i Digits? */ \
- /* 2^((i-1)*intDsize-1) <= obj < 2^(i*intDsize-1) */ \
- if ( (i*intDsize > 32) \
- && ( ((i-1)*intDsize >= 32) \
- || (mspref(arrayMSDptr(bn->data,len),0) >= (uintD)bitc(31-(i-1)*intDsize)) \
- ) ) \
- goto bad; \
- else
- IF_LENGTH(1)
- return get_uint1D_Dptr(arrayLSDptr(bn->data,1));
- IF_LENGTH(2)
- return get_uint2D_Dptr(arrayLSDptr(bn->data,2));
- IF_LENGTH(3)
- return get_uint3D_Dptr(arrayLSDptr(bn->data,3));
- IF_LENGTH(4)
- return get_uint4D_Dptr(arrayLSDptr(bn->data,4));
- #undef IF_LENGTH
- } else {
- // Bignum < 0
- #define IF_LENGTH(i) \
- 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) \
- && ( ((i-1)*intDsize >= 32) \
- || (mspref(arrayMSDptr(bn->data,len),0) < (uintD)(-bitc(31-(i-1)*intDsize))) \
- ) ) \
- goto bad; \
- else
- IF_LENGTH(1)
- return get_sint1D_Dptr(arrayLSDptr(bn->data,1));
- IF_LENGTH(2)
- return get_sint2D_Dptr(arrayLSDptr(bn->data,2));
- IF_LENGTH(3)
- return get_sint3D_Dptr(arrayLSDptr(bn->data,3));
- IF_LENGTH(4)
- return get_sint4D_Dptr(arrayLSDptr(bn->data,4));
- #undef IF_LENGTH
+ var sintV wert = FN_to_V(obj);
+ #if (intVsize>32)
+ if ((sintV)(sint32)wert != wert)
+ goto bad;
+ #endif
+ return (sint32)wert;
+ } else { // Bignum
+ var cl_heap_bignum* bn = TheBignum(obj);
+ var uintC len = bn->length;
+ 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 (len == i) /* genau i Digits? */ \
+ /* 2^((i-1)*intDsize-1) <= obj < 2^(i*intDsize-1) */ \
+ if ( (i*intDsize > 32) \
+ && ( ((i-1)*intDsize >= 32) \
+ || (mspref(arrayMSDptr(bn->data,len),0) >= (uintD)bitc(31-(i-1)*intDsize)) \
+ ) ) \
+ goto bad; \
+ else
+ IF_LENGTH(1)
+ return get_uint1D_Dptr(arrayLSDptr(bn->data,1));
+ IF_LENGTH(2)
+ return get_uint2D_Dptr(arrayLSDptr(bn->data,2));
+ IF_LENGTH(3)
+ return get_uint3D_Dptr(arrayLSDptr(bn->data,3));
+ IF_LENGTH(4)
+ return get_uint4D_Dptr(arrayLSDptr(bn->data,4));
+ #undef IF_LENGTH
+ } else {
+ // Bignum < 0
+ #define IF_LENGTH(i) \
+ 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) \
+ && ( ((i-1)*intDsize >= 32) \
+ || (mspref(arrayMSDptr(bn->data,len),0) < (uintD)(-bitc(31-(i-1)*intDsize))) \
+ ) ) \
+ goto bad; \
+ else
+ IF_LENGTH(1)
+ return get_sint1D_Dptr(arrayLSDptr(bn->data,1));
+ IF_LENGTH(2)
+ return get_sint2D_Dptr(arrayLSDptr(bn->data,2));
+ IF_LENGTH(3)
+ return get_sint3D_Dptr(arrayLSDptr(bn->data,3));
+ IF_LENGTH(4)
+ return get_sint4D_Dptr(arrayLSDptr(bn->data,4));
+ #undef IF_LENGTH
+ }
}
bad: // unpassendes Objekt
fprint(std::cerr, "Not a 32-bit integer: ");
fprint(std::cerr, obj);
fprint(std::cerr, "\n");
cl_abort();
- }
}
} // namespace cln
{
if (fixnump(obj))
// Fixnum
- return (sint64)(sint32)FN_to_L(obj);
+ return (sint64)(sintV)FN_to_V(obj);
{ // Bignum
var cl_heap_bignum* bn = TheBignum(obj);
var uintC len = bn->length;
{
if (fixnump(obj)) {
// Fixnum
- var sint32 wert = FN_to_L(obj);
+ var sintV wert = FN_to_V(obj);
if (wert >= 0)
- return (uint32)wert;
+ #if (intVsize>32)
+ if (wert < bit(32))
+ #endif
+ return (uint32)wert;
goto bad;
} else { // Bignum
var cl_heap_bignum* bn = TheBignum(obj);
{
if (fixnump(obj)) {
// Fixnum
- var sint32 wert = FN_to_L(obj);
+ var sintV wert = FN_to_V(obj);
if (wert >= 0)
- return (uint64)(uint32)wert;
+ return (uint64)(uintV)wert;
goto bad;
} else { // Bignum
var cl_heap_bignum* bn = TheBignum(obj);
if (count > 0)
{ var uintB* ptr = erg->MSBptr;
do { *--ptr = '0'; } while (--count > 0);
- erg->MSBptr = ptr; erg->len = erg->len;
+ erg->MSBptr = ptr; erg->len = erg_len;
}
}
// x Fixnum >=0
{ if (fixnump(y))
// auch y Fixnum >=0
- { var uint32 x_ = FN_to_UL(x);
- var uint32 y_ = FN_to_UL(y);
+ { var uintV x_ = FN_to_UV(x);
+ var uintV y_ = FN_to_UV(y);
if (y_==0) { cl_error_division_by_0(); }
elif (x_ < y_)
// Trivialfall: q=0, r=x
goto trivial;
- elif (y_ < bit(16))
- // 32-durch-16-Bit-Division
- { var uint32 q;
- var uint16 r;
- divu_3216_3216(x_,y_,q=,r=);
- return cl_I_div_t(
- /* result.quotient = */ UL_to_I(q),
- /* result.remainder = */ L_to_FN((uintL)r)
- );
- }
else
- // volle 32-durch-32-Bit-Division
- { var uint32 q;
- var uint32 r;
- divu_3232_3232(x_,y_,q=,r=);
- return cl_I_div_t(
- /* result.quotient = */ UL_to_I(q),
- /* result.remainder = */ UL_to_I(r)
- );
+ {
+ #if (intVsize>32)
+ if (x_ >= bit(32))
+ { if (y_ < bit(32))
+ // 64-durch-32-Bit-Division
+ { var uint64 q;
+ var uint32 r;
+ divu_6432_6432(x_,y_,q=,r=);
+ return cl_I_div_t(
+ /* result.quotient = */ UQ_to_I(q),
+ /* result.remainder = */ UL_to_I(r)
+ );
+ }
+ else
+ // volle 64-durch-64-Bit-Division
+ { var uint64 q;
+ var uint64 r;
+ divu_6464_6464(x_,y_,q=,r=);
+ return cl_I_div_t(
+ /* result.quotient = */ UQ_to_I(q),
+ /* result.remainder = */ UQ_to_I(r)
+ );
+ }
+ }
+ else
+ #endif
+ { if (y_ < bit(16))
+ // 32-durch-16-Bit-Division
+ { var uint32 q;
+ var uint16 r;
+ divu_3216_3216(x_,y_,q=,r=);
+ return cl_I_div_t(
+ /* result.quotient = */ UL_to_I(q),
+ /* result.remainder = */ L_to_FN((uintL)r)
+ );
+ }
+ else
+ // volle 32-durch-32-Bit-Division
+ { var uint32 q;
+ var uint32 r;
+ divu_3232_3232(x_,y_,q=,r=);
+ return cl_I_div_t(
+ /* result.quotient = */ UL_to_I(q),
+ /* result.remainder = */ UL_to_I(r)
+ );
+ }
+ }
}
}
else
{ // x ist Fixnum
if (fixnump(y))
{ // x,y sind Fixnums
- #if (cl_value_len < intLsize)
- return L_to_I( FN_to_L(x) - FN_to_L(y) ); // als 32-Bit-Zahlen subtrahieren
+ #if (cl_value_len < intVsize)
+ return V_to_I( FN_to_V(x) - FN_to_V(y) ); // als intVsize-Bit-Zahlen subtrahieren
#elif (cl_word_size==64)
return Q_to_I( FN_to_Q(x) - FN_to_Q(y) ); // als 64-Bit-Zahlen subtrahieren
- #else // (cl_value_len == intLsize)
- var sint32 xhi = sign_of(FN_to_L(x));
- var uint32 xlo = FN_to_L(x);
- var sint32 yhi = sign_of(FN_to_L(y));
- var uint32 ylo = FN_to_L(y);
+ #elif (intVsize==32) // && (cl_value_len == intVsize)
+ var sint32 xhi = sign_of(FN_to_V(x));
+ var uint32 xlo = FN_to_V(x);
+ var sint32 yhi = sign_of(FN_to_V(y));
+ var uint32 ylo = FN_to_V(y);
xhi -= yhi;
if (xlo < ylo) { xhi -= 1; }
xlo -= ylo;
else
{ // x ist Fixnum, y ist Bignum, also y länger
#if (intDsize==64)
- var sint64 x_ = FN_to_L(x); // Wert von x
+ var sint64 x_ = FN_to_V(x); // Wert von x
#else
- var sint32 x_ = FN_to_L(x); // Wert von x
+ var sintV x_ = FN_to_V(x); // Wert von x
#endif
- if (FN_L_zerop(x,x_)) { return -y; } // bei x=0 Ergebnis (- y)
+ if (FN_V_zerop(x,x_)) { return -y; } // bei x=0 Ergebnis (- y)
CL_ALLOCA_STACK;
BN_to_NDS_1(y, MSDptr=,len=,LSDptr=); // NDS zu y bilden.
// vorsorglich 1 Digit mehr belegen:
var uint64 y_new = y_+(uint64)x_;
lspref(LSDptr,0) = y_new;
#else
- var uint32 y_ = pFN_maxlength_digits_at(LSDptr);
- var uint32 y_new = y_+(uint32)x_;
+ var uintV y_ = pFN_maxlength_digits_at(LSDptr);
+ var uintV y_new = y_+(uintV)x_;
set_pFN_maxlength_digits_at(LSDptr,y_new);
#endif
var uintD* midptr = LSDptr lspop pFN_maxlength;
if (y_new < y_)
{ // Carry.
- if (!FN_L_minusp(x,x_)) // kürzerer Summand war positiv
+ 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_L_minusp(x,x_)) // kürzerer Summand war negativ
+ 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); }
if (fixnump(y))
{ // x ist Bignum, y ist Fixnum, also x länger
#if (intDsize==64)
- var sint64 y_ = FN_to_L(y); // Wert von y
+ var sint64 y_ = FN_to_V(y); // Wert von y
#else
- var sint32 y_ = FN_to_L(y); // Wert von y
+ var sintV y_ = FN_to_V(y); // Wert von y
#endif
- if (FN_L_zerop(y,y_)) { return x; } // bei y=0 Ergebnis x
+ if (FN_V_zerop(y,y_)) { return x; } // bei y=0 Ergebnis x
CL_ALLOCA_STACK;
BN_to_NDS_1(x, MSDptr=,len=,LSDptr=); // NDS zu x bilden.
// len>=bn_minlength. len>pFN_maxlength erzwingen:
var uint64 x_new = x_-(uint64)y_;
lspref(LSDptr,0) = x_new;
#else
- var uint32 x_ = pFN_maxlength_digits_at(LSDptr);
- var uint32 x_new = x_-(uint32)y_;
+ var uintV x_ = pFN_maxlength_digits_at(LSDptr);
+ var uintV x_new = x_-(uintV)y_;
set_pFN_maxlength_digits_at(LSDptr,x_new);
#endif
var uintD* midptr = LSDptr lspop pFN_maxlength;
if (x_new > x_)
{ // Carry.
- if (!FN_L_minusp(y,y_)) // kürzerer Summand war positiv
+ 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_L_minusp(y,y_)) // kürzerer Summand war negativ
+ 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); }
if (zerop(y))
{ return 0; }
if (fixnump(x) && fixnump(y))
- { var sint32 x_ = FN_to_L(x);
- var sint32 y_ = FN_to_L(y);
- // Werte direkt multiplizieren:
- 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 (y_ < 0) { hi -= (uint32)x_; } // (vgl. DS_DS_mul_DS)
- return L2_to_I(hi,lo);
+ { 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:
+ if (((uintV)((sintV)sign_of(x_) ^ x_) < bit(31))
+ && ((uintV)((sintV)sign_of(y_) ^ y_) < bit(31)))
+ #endif
+ {
+ // Werte direkt multiplizieren:
+ 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 (y_ < 0) { hi -= (uint32)x_; } // (vgl. DS_DS_mul_DS)
+ return L2_to_I(hi,lo);
+ }
}
CL_ALLOCA_STACK;
var const uintD* xMSDptr;
{ // x ist Fixnum
if (fixnump(y))
{ // x,y sind Fixnums
- #if (cl_value_len < intLsize)
- return L_to_I( FN_to_L(x) + FN_to_L(y) ); // als 32-Bit-Zahlen addieren
+ #if (cl_value_len < intVsize)
+ return V_to_I( FN_to_V(x) + FN_to_V(y) ); // als intVsize-Bit-Zahlen addieren
#elif (cl_word_size==64)
return Q_to_I( FN_to_Q(x) + FN_to_Q(y) ); // als 64-Bit-Zahlen addieren
- #else // (cl_value_len == intLsize)
- var sint32 xhi = sign_of(FN_to_L(x));
- var uint32 xlo = FN_to_L(x);
- var sint32 yhi = sign_of(FN_to_L(y));
- var uint32 ylo = FN_to_L(y);
+ #elif (intVsize==32) // && (cl_value_len == intVsize)
+ var sint32 xhi = sign_of(FN_to_V(x));
+ var uint32 xlo = FN_to_V(x);
+ var sint32 yhi = sign_of(FN_to_V(y));
+ var uint32 ylo = FN_to_V(y);
xhi += yhi;
xlo += ylo;
if (xlo < ylo) { xhi += 1; }
else
{ // x ist Fixnum, y ist Bignum, also y länger
#if (intDsize==64)
- var sint64 x_ = FN_to_L(x); // Wert von x
+ var sint64 x_ = FN_to_V(x); // Wert von x
#else
- var sint32 x_ = FN_to_L(x); // Wert von x
+ var sintV x_ = FN_to_V(x); // Wert von x
#endif
- if (FN_L_zerop(x,x_)) { return y; } // bei x=0 Ergebnis y
+ if (FN_V_zerop(x,x_)) { return y; } // bei x=0 Ergebnis y
CL_ALLOCA_STACK;
BN_to_NDS_1(y, MSDptr=,len=,LSDptr=); // NDS zu y bilden.
// len>=bn_minlength. len>pFN_maxlength erzwingen:
var uint64 y_new = y_+(uint64)x_;
lspref(LSDptr,0) = y_new;
#else
- var uint32 y_ = pFN_maxlength_digits_at(LSDptr);
- var uint32 y_new = y_+(uint32)x_;
+ var uintV y_ = pFN_maxlength_digits_at(LSDptr);
+ var uintV y_new = y_+(uintV)x_;
set_pFN_maxlength_digits_at(LSDptr,y_new);
#endif
var uintD* midptr = LSDptr lspop pFN_maxlength;
if (y_new < y_)
{ // Carry.
- if (!FN_L_minusp(x,x_)) // kürzerer Summand war positiv
+ 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_L_minusp(x,x_)) // kürzerer Summand war negativ
+ 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); }
if (fixnump(y))
{ // x ist Bignum, y ist Fixnum, also x länger
#if (intDsize==64)
- var sint64 y_ = FN_to_L(y); // Wert von y
+ var sint64 y_ = FN_to_V(y); // Wert von y
#else
- var sint32 y_ = FN_to_L(y); // Wert von y
+ var sintV y_ = FN_to_V(y); // Wert von y
#endif
- if (FN_L_zerop(y,y_)) { return x; } // bei y=0 Ergebnis x
+ if (FN_V_zerop(y,y_)) { return x; } // bei y=0 Ergebnis x
CL_ALLOCA_STACK;
BN_to_NDS_1(x, MSDptr=,len=,LSDptr=); // NDS zu x bilden.
// len>=bn_minlength. len>pFN_maxlength erzwingen:
var uint64 x_new = x_+(uint64)y_;
lspref(LSDptr,0) = x_new;
#else
- var uint32 x_ = pFN_maxlength_digits_at(LSDptr);
- var uint32 x_new = x_+(uint32)y_;
+ var uintV x_ = pFN_maxlength_digits_at(LSDptr);
+ var uintV x_new = x_+(uintV)y_;
set_pFN_maxlength_digits_at(LSDptr,x_new);
#endif
var uintD* midptr = LSDptr lspop pFN_maxlength;
if (x_new < x_)
{ // Carry.
- if (!FN_L_minusp(y,y_)) // kürzerer Summand war positiv
+ 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_L_minusp(y,y_)) // kürzerer Summand war negativ
+ 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); }
// x Fixnum -> direkt multiplizieren
// sonst: zu DS machen, multiplizieren.
if (fixnump(x))
- { var sint32 x_ = FN_to_L(x);
- // Werte direkt multiplizieren:
- 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
- return L2_to_I(hi,lo);
+ { var sintV x_ = FN_to_V(x);
+ #if (cl_value_len > 32)
+ // nur falls x ein Integer mit höchstens 32 Bit ist:
+ if ((uintV)((sintV)sign_of(x_) ^ x_) < bit(31))
+ #endif
+ {
+ // Werte direkt multiplizieren:
+ 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
+ return L2_to_I(hi,lo);
+ }
}
CL_ALLOCA_STACK;
var const uintD* xMSDptr;
const cl_I operator- (const cl_I& x)
{
if (fixnump(x)) {
- #if (cl_value_len < intLsize)
- return L_to_I(- FN_to_L(x));
+ #if (cl_value_len < intVsize)
+ return V_to_I(- FN_to_V(x));
#elif (cl_word_size==64)
return Q_to_I(- FN_to_Q(x));
- #else // (cl_value_len == intLsize)
- var sint32 xhi = sign_of(FN_to_L(x));
- var uint32 xlo = FN_to_L(x);
+ #elif (intVsize==32) // && (cl_value_len == intVsize)
+ var sint32 xhi = sign_of(FN_to_V(x));
+ var uint32 xlo = FN_to_V(x);
return L2_to_I(-xhi-(xlo!=0),-xlo);
#endif
} else {
var cl_I& b = abs_b;
if (fixnump(a) && fixnump(b)) // ggT zweier Fixnums >0
{ // bleibt Fixnum, da (gcd a b) <= (min a b)
- return L_to_FN(gcd(FN_to_UL(a),FN_to_UL(b)));
+ return V_to_FN(gcd(FN_to_UV(a),FN_to_UV(b)));
}
{ var cl_signean vergleich = compare(a,b);
if (vergleich == 0) { return a; } // a=b -> fertig
if (eq(b,0)) { return abs(a); } // b=0 -> (abs a)
if (eq(a,0)) { return abs(b); } // a=0 -> (abs b)
if (fixnump(a) && fixnump(b)) // ggT zweier Fixnums /=0
- { var sintL a_ = FN_to_L(a);
+ { var sintV a_ = FN_to_V(a);
if (a_ < 0) { a_ = -a_; }
- var sintL b_ = FN_to_L(b);
+ var sintV b_ = FN_to_V(b);
if (b_ < 0) { b_ = -b_; }
- return UL_to_I(gcd((uint32)a_,(uint32)b_));
+ return UV_to_I(gcd((uintV)a_,(uintV)b_));
}
CL_ALLOCA_STACK;
var uintD* a_MSDptr;
// gcd(a,b)
// > a,b: zwei Integers
// < ergebnis: (gcd a b), ein Integer >=0
- uint32 gcd (uint32 a, uint32 b)
+ uintV gcd (uintV a, uintV b)
// binäre Methode:
// (gcd a b) :==
// (prog ((j 0))
#ifdef DUMMER_GGT // so macht's ein Mathematiker:
if (a==0) { return b; }
if (b==0) { return a; }
- var uint32 bit_j = bit(0);
+ var uintV bit_j = bit(0);
loop
{ // a,b >0
if (!((a & bit_j) ==0))
bit_j = bit_j<<1;
}
#else // Trick von B. Degel:
- var uint32 bit_j = (a | b); // endet mit einer 1 und j Nullen
+ var uintV bit_j = (a | b); // endet mit einer 1 und j Nullen
bit_j = bit_j ^ (bit_j - 1); // Maske = bit(j) | bit(j-1) | ... | bit(0)
if (!((a & bit_j) ==0))
{ if (!((b & bit_j) ==0))
// integers, but it's better than completely ignoring some limbs.
if (fixnump(x)) {
#if (cl_value_len <= intLsize)
- code += FN_to_L(x);
+ code += FN_to_V(x);
#elif (cl_word_size==64)
code += FN_to_Q(x);
code ^= (code >> 32);
fprint(std::cerr, "\n");
cl_abort();
}
- rational_base = FN_to_UL(base); ptr = base_end_ptr;
+ rational_base = FN_to_UV(base); ptr = base_end_ptr;
break;
}
ptr++;
inline uint32 equal_hashcode (const cl_FN& x)
{
var cl_signean sign;
- var uint32 x32 = FN_to_L(x); // x als 32-Bit-Zahl
- if (FN_L_minusp(x,(sint32)x32)) {
- x32 = -x32;
+ var uintV x_ = FN_to_V(x); // x als intVsize-Bit-Zahl
+ if (FN_V_minusp(x,(sintV)x_)) {
+ x_ = -x_;
sign = -1;
} else {
sign = 0;
- if (x32 == 0)
+ if (x_ == 0)
return 0;
}
var uintL s;
- integerlength32(x32, s = 32 - );
- var uint32 msd = x32 << s;
+ #if (intVsize > 32)
+ integerlength64(x_, s = 64 - );
+ var uint32 msd = (x_ << s) >> 32;
+ var sintL exp = 64-s;
+ #else
+ integerlength32(x_, s = 32 - );
+ var uint32 msd = x_ << s;
var sintL exp = 32-s;
+ #endif
return equal_hashcode_low(msd,exp,sign);
}
uintL ord2 (const cl_I& x) // x /= 0
{
if (fixnump(x))
- { var uint32 x_ = FN_to_L(x); // x als 32-Bit-Zahl
- ord2_32(x_,return);
+ { var uintV x_ = FN_to_V(x); // x als intVsize-Bit-Zahl
+ // This assumes cl_value_len <= intVsize.
+ #if (intVsize>32)
+ ord2_64(x_,return);
+ #else
+ ord2_32(x_,return);
+ #endif
}
else
{ var uintL bitcount = 0;
// Methode 3: Wenn das erste Digit /=0 eine Zweierpotenz ist und alle weiteren
// Digits Null sind.
if (fixnump(x))
- { var uintL x_ = FN_to_UL(x);
+ { var uintV x_ = FN_to_UV(x);
if (!((x_ & (x_-1)) == 0)) return 0; // keine Zweierpotenz
+ #if (intVsize>32)
+ integerlength64(x_,return); // Zweierpotenz: n = integer_length(x)
+ #else
integerlength32(x_,return); // Zweierpotenz: n = integer_length(x)
+ #endif
}
else
{ var const uintD* MSDptr;
// two in factorial(m).
static cl_I const doublefakul_table [] = {
- L_to_FN(1),
- L_to_FN(1UL),
- L_to_FN(1UL*2),
- L_to_FN(1UL*3),
+ 1,
+ 1UL,
+ 1UL*2,
+ 1UL*3,
#if (cl_value_len>=5)
- L_to_FN(1UL*2*4),
- L_to_FN(1UL*3*5),
+ 1UL*2*4,
+ 1UL*3*5,
#if (cl_value_len>=7)
- L_to_FN(1UL*2*4*6),
+ 1UL*2*4*6,
#if (cl_value_len>=8)
- L_to_FN(1UL*3*5*7),
+ 1UL*3*5*7,
#if (cl_value_len>=10)
- L_to_FN(1UL*2*4*6*8),
+ 1UL*2*4*6*8,
#if (cl_value_len>=11)
- L_to_FN(1UL*3*5*7*9),
+ 1UL*3*5*7*9,
#if (cl_value_len>=13)
- L_to_FN(1UL*2*4*6*8*10),
+ 1UL*2*4*6*8*10,
#if (cl_value_len>=15)
- L_to_FN(1UL*3*5*7*9*11),
+ 1UL*3*5*7*9*11,
#if (cl_value_len>=17)
- L_to_FN(1UL*2*4*6*8*10*12),
+ 1UL*2*4*6*8*10*12,
#if (cl_value_len>=19)
- L_to_FN(1UL*3*5*7*9*11*13),
+ 1UL*3*5*7*9*11*13,
#if (cl_value_len>=21)
- L_to_FN(1UL*2*4*6*8*10*12*14),
+ 1UL*2*4*6*8*10*12*14,
#if (cl_value_len>=22)
- L_to_FN(1UL*3*5*7*9*11*13*15),
+ 1UL*3*5*7*9*11*13*15,
#if (cl_value_len>=25)
- L_to_FN(1UL*2*4*6*8*10*12*14*16),
+ 1UL*2*4*6*8*10*12*14*16,
#if (cl_value_len>=27)
- L_to_FN(1UL*3*5*7*9*11*13*15*17),
+ 1UL*3*5*7*9*11*13*15*17,
#if (cl_value_len>=29)
- L_to_FN(1UL*2*4*6*8*10*12*14*16*18),
+ 1UL*2*4*6*8*10*12*14*16*18,
#if (cl_value_len>=31)
- L_to_FN(1UL*3*5*7*9*11*13*15*17*19),
+ 1UL*3*5*7*9*11*13*15*17*19,
#if (cl_value_len>=33)
+ 1UL*2*4*6*8*10*12*14*16*18*20,
+ #if (cl_value_len>=35)
+ 1UL*3*5*7*9*11*13*15*17*19*21,
+ #if (cl_value_len>=38)
+ 1UL*2*4*6*8*10*12*14*16*18*20*22,
+ #if (cl_value_len>=40)
+ 1UL*3*5*7*9*11*13*15*17*19*21*23,
+ #if (cl_value_len>=42)
+ 1UL*2*4*6*8*10*12*14*16*18*20*22*24,
+ #if (cl_value_len>=44)
+ 1UL*3*5*7*9*11*13*15*17*19*21*23*25,
+ #if (cl_value_len>=47)
+ 1UL*2*4*6*8*10*12*14*16*18*20*22*24*26,
+ #if (cl_value_len>=49)
+ 1UL*3*5*7*9*11*13*15*17*19*21*23*25*27,
+ #if (cl_value_len>=52)
+ 1UL*2*4*6*8*10*12*14*16*18*20*22*24*26*28,
+ #if (cl_value_len>=54)
+ 1UL*3*5*7*9*11*13*15*17*19*21*23*25*27*29,
+ #if (cl_value_len>=57)
+ 1UL*2*4*6*8*10*12*14*16*18*20*22*24*26*28*30,
+ #if (cl_value_len>=59)
+ 1UL*3*5*7*9*11*13*15*17*19*21*23*25*27*29*31,
+ #if (cl_value_len>=62)
+ 1UL*2*4*6*8*10*12*14*16*18*20*22*24*26*28*30*32,
+ #if (cl_value_len>=64)
+ 1UL*3*5*7*9*11*13*15*17*19*21*23*25*27*29*31*33,
+ #if (cl_value_len>=67)
...
#endif
#endif
#endif
#endif
#endif
+ #endif
+ #endif
+ #endif
+ #endif
+ #endif
+ #endif
+ #endif
+ #endif
+ #endif
+ #endif
+ #endif
+ #endif
+ #endif
+ #endif
};
const cl_I doublefactorial (uintL n) // assume n >= 0 small
// vermeidet, daß oft große Zahlen mit ganz kleinen Zahlen multipliziert
// werden.
-static cl_I const fakul_table [] = {
- L_to_FN(1),
- L_to_FN(1UL),
- L_to_FN(1UL*2),
+static uintV const fakul_table [] = {
+ 1,
+ 1UL,
+ 1UL*2,
#if (cl_value_len>=4)
- L_to_FN(1UL*2*3),
+ 1UL*2*3,
#if (cl_value_len>=6)
- L_to_FN(1UL*2*3*4),
+ 1UL*2*3*4,
#if (cl_value_len>=8)
- L_to_FN(1UL*2*3*4*5),
+ 1UL*2*3*4*5,
#if (cl_value_len>=11)
- L_to_FN(1UL*2*3*4*5*6),
+ 1UL*2*3*4*5*6,
#if (cl_value_len>=14)
- L_to_FN(1UL*2*3*4*5*6*7),
+ 1UL*2*3*4*5*6*7,
#if (cl_value_len>=17)
- L_to_FN(1UL*2*3*4*5*6*7*8),
+ 1UL*2*3*4*5*6*7*8,
#if (cl_value_len>=20)
- L_to_FN(1UL*2*3*4*5*6*7*8*9),
+ 1UL*2*3*4*5*6*7*8*9,
#if (cl_value_len>=23)
- L_to_FN(1UL*2*3*4*5*6*7*8*9*10),
+ 1UL*2*3*4*5*6*7*8*9*10,
#if (cl_value_len>=27)
- L_to_FN(1UL*2*3*4*5*6*7*8*9*10*11),
+ 1UL*2*3*4*5*6*7*8*9*10*11,
#if (cl_value_len>=30)
- L_to_FN(1UL*2*3*4*5*6*7*8*9*10*11*12),
+ 1UL*2*3*4*5*6*7*8*9*10*11*12,
#if (cl_value_len>=34)
+ 1UL*2*3*4*5*6*7*8*9*10*11*12*13,
+ #if (cl_value_len>=38)
+ 1UL*2*3*4*5*6*7*8*9*10*11*12*13*14,
+ #if (cl_value_len>=42)
+ 1UL*2*3*4*5*6*7*8*9*10*11*12*13*14*15,
+ #if (cl_value_len>=46)
+ 1UL*2*3*4*5*6*7*8*9*10*11*12*13*14*15*16,
+ #if (cl_value_len>=50)
+ 1UL*2*3*4*5*6*7*8*9*10*11*12*13*14*15*16*17,
+ #if (cl_value_len>=54)
+ 1UL*2*3*4*5*6*7*8*9*10*11*12*13*14*15*16*17*18,
+ #if (cl_value_len>=58)
+ 1UL*2*3*4*5*6*7*8*9*10*11*12*13*14*15*16*17*18*19,
+ #if (cl_value_len>=63)
+ 1UL*2*3*4*5*6*7*8*9*10*11*12*13*14*15*16*17*18*19*20,
+ #if (cl_value_len>=67)
...
#endif
#endif
#endif
#endif
#endif
+ #endif
+ #endif
+ #endif
+ #endif
+ #endif
+ #endif
+ #endif
+ #endif
};
const cl_I factorial (uintL n) // assume n >= 0 small
{
if (n < sizeof(fakul_table)/sizeof(cl_I))
- { return fakul_table[n]; }
+ { return UV_to_I(fakul_table[n]); }
else
{ var cl_I prod = 1; // bisheriges Produkt := 1
var uintL k = 1;
static const _cl_MI fix16_plus (cl_heap_modint_ring* R, const _cl_MI& x, const _cl_MI& y)
{
- var uint32 zr = FN_to_UL(x.rep) + FN_to_UL(y.rep);
- if (zr >= FN_to_UL(R->modulus)) { zr = zr - FN_to_UL(R->modulus); }
+ var uint32 zr = FN_to_UV(x.rep) + FN_to_UV(y.rep);
+ if (zr >= FN_to_UV(R->modulus)) { zr = zr - FN_to_UV(R->modulus); }
return _cl_MI(R, L_to_FN(zr));
}
static const _cl_MI fix16_minus (cl_heap_modint_ring* R, const _cl_MI& x, const _cl_MI& y)
{
- var uint32 xr = FN_to_UL(x.rep);
- var uint32 yr = FN_to_UL(y.rep);
+ var uint32 xr = FN_to_UV(x.rep);
+ var uint32 yr = FN_to_UV(y.rep);
var sint32 zr = xr - yr;
- if (zr < 0) { zr = zr + FN_to_UL(R->modulus); }
+ if (zr < 0) { zr = zr + FN_to_UV(R->modulus); }
return _cl_MI(R, L_to_FN(zr));
}
static const _cl_MI fix16_uminus (cl_heap_modint_ring* R, const _cl_MI& x)
{
- var uint32 xr = FN_to_UL(x.rep);
- var uint32 zr = (xr==0 ? 0 : FN_to_UL(R->modulus)-xr);
+ var uint32 xr = FN_to_UV(x.rep);
+ var uint32 zr = (xr==0 ? 0 : FN_to_UV(R->modulus)-xr);
return _cl_MI(R, L_to_FN(zr));
}
static const _cl_MI fix16_mul (cl_heap_modint_ring* R, const _cl_MI& x, const _cl_MI& y)
{
- var uint32 xr = FN_to_UL(x.rep);
- var uint32 yr = FN_to_UL(y.rep);
+ var uint32 xr = FN_to_UV(x.rep);
+ var uint32 yr = FN_to_UV(y.rep);
var uint32 zr = mulu16(xr,yr);
- divu_3216_1616(zr,FN_to_UL(R->modulus),,zr=);
+ divu_3216_1616(zr,FN_to_UV(R->modulus),,zr=);
return _cl_MI(R, L_to_FN(zr));
}
static const _cl_MI fix16_square (cl_heap_modint_ring* R, const _cl_MI& x)
{
- var uint32 xr = FN_to_UL(x.rep);
+ var uint32 xr = FN_to_UV(x.rep);
var uint32 zr = mulu16(xr,xr);
- divu_3216_1616(zr,FN_to_UL(R->modulus),,zr=);
+ divu_3216_1616(zr,FN_to_UV(R->modulus),,zr=);
return _cl_MI(R, L_to_FN(zr));
}
static const _cl_MI fix29_plus (cl_heap_modint_ring* R, const _cl_MI& x, const _cl_MI& y)
{
- var uint32 zr = FN_to_UL(x.rep) + FN_to_UL(y.rep);
- if (zr >= FN_to_UL(R->modulus)) { zr = zr - FN_to_UL(R->modulus); }
+ var uint32 zr = FN_to_UV(x.rep) + FN_to_UV(y.rep);
+ if (zr >= FN_to_UV(R->modulus)) { zr = zr - FN_to_UV(R->modulus); }
return _cl_MI(R, L_to_FN(zr));
}
static const _cl_MI fix29_minus (cl_heap_modint_ring* R, const _cl_MI& x, const _cl_MI& y)
{
- var uint32 xr = FN_to_UL(x.rep);
- var uint32 yr = FN_to_UL(y.rep);
+ var uint32 xr = FN_to_UV(x.rep);
+ var uint32 yr = FN_to_UV(y.rep);
var sint32 zr = xr - yr;
- if (zr < 0) { zr = zr + FN_to_UL(R->modulus); }
+ if (zr < 0) { zr = zr + FN_to_UV(R->modulus); }
return _cl_MI(R, L_to_FN(zr));
}
static const _cl_MI fix29_uminus (cl_heap_modint_ring* R, const _cl_MI& x)
{
- var uint32 xr = FN_to_UL(x.rep);
- var uint32 zr = (xr==0 ? 0 : FN_to_UL(R->modulus)-xr);
+ var uint32 xr = FN_to_UV(x.rep);
+ var uint32 zr = (xr==0 ? 0 : FN_to_UV(R->modulus)-xr);
return _cl_MI(R, L_to_FN(zr));
}
static const _cl_MI fix29_mul (cl_heap_modint_ring* R, const _cl_MI& x, const _cl_MI& y)
{
- var uint32 xr = FN_to_UL(x.rep);
- var uint32 yr = FN_to_UL(y.rep);
+ var uint32 xr = FN_to_UV(x.rep);
+ var uint32 yr = FN_to_UV(y.rep);
var uint32 zrhi;
var uint32 zrlo;
mulu32(xr,yr,zrhi=,zrlo=);
var uint32 zr;
- divu_6432_3232(zrhi,zrlo,FN_to_UL(R->modulus),,zr=);
+ divu_6432_3232(zrhi,zrlo,FN_to_UV(R->modulus),,zr=);
return _cl_MI(R, L_to_FN(zr));
}
static const _cl_MI fix29_square (cl_heap_modint_ring* R, const _cl_MI& x)
{
- var uint32 xr = FN_to_UL(x.rep);
+ var uint32 xr = FN_to_UV(x.rep);
var uint32 zrhi;
var uint32 zrlo;
mulu32(xr,xr,zrhi=,zrlo=);
var uint32 zr;
- divu_6432_3232(zrhi,zrlo,FN_to_UL(R->modulus),,zr=);
+ divu_6432_3232(zrhi,zrlo,FN_to_UV(R->modulus),,zr=);
return _cl_MI(R, L_to_FN(zr));
}
static const _cl_MI fix32_plus (cl_heap_modint_ring* R, const _cl_MI& x, const _cl_MI& y)
{
- var uint32 xr = FN_to_UL(x.rep);
- var uint32 yr = FN_to_UL(y.rep);
+ var uint32 xr = FN_to_UV(x.rep);
+ var uint32 yr = FN_to_UV(y.rep);
var uint32 zr = xr + yr;
- var uint32 m = FN_to_UL(R->modulus);
+ var uint32 m = FN_to_UV(R->modulus);
if ((zr < xr) || (zr >= m)) { zr = zr - m; }
return _cl_MI(R, L_to_FN(zr));
}
static const _cl_MI fix32_minus (cl_heap_modint_ring* R, const _cl_MI& x, const _cl_MI& y)
{
- var uint32 xr = FN_to_UL(x.rep);
- var uint32 yr = FN_to_UL(y.rep);
- var sint32 zr = (xr >= yr ? xr - yr : xr - yr + FN_to_UL(R->modulus));
+ var uint32 xr = FN_to_UV(x.rep);
+ var uint32 yr = FN_to_UV(y.rep);
+ var sint32 zr = (xr >= yr ? xr - yr : xr - yr + FN_to_UV(R->modulus));
return _cl_MI(R, L_to_FN(zr));
}
static const _cl_MI fix32_uminus (cl_heap_modint_ring* R, const _cl_MI& x)
{
- var uint32 xr = FN_to_UL(x.rep);
- var uint32 zr = (xr==0 ? 0 : FN_to_UL(R->modulus)-xr);
+ var uint32 xr = FN_to_UV(x.rep);
+ var uint32 zr = (xr==0 ? 0 : FN_to_UV(R->modulus)-xr);
return _cl_MI(R, L_to_FN(zr));
}
static const _cl_MI fix32_mul (cl_heap_modint_ring* R, const _cl_MI& x, const _cl_MI& y)
{
- var uint32 xr = FN_to_UL(x.rep);
- var uint32 yr = FN_to_UL(y.rep);
+ var uint32 xr = FN_to_UV(x.rep);
+ var uint32 yr = FN_to_UV(y.rep);
var uint32 zrhi;
var uint32 zrlo;
mulu32(xr,yr,zrhi=,zrlo=);
var uint32 zr;
- divu_6432_3232(zrhi,zrlo,FN_to_UL(R->modulus),,zr=);
+ divu_6432_3232(zrhi,zrlo,FN_to_UV(R->modulus),,zr=);
return _cl_MI(R, L_to_FN(zr));
}
static const _cl_MI fix32_square (cl_heap_modint_ring* R, const _cl_MI& x)
{
- var uint32 xr = FN_to_UL(x.rep);
+ var uint32 xr = FN_to_UV(x.rep);
var uint32 zrhi;
var uint32 zrlo;
mulu32(xr,xr,zrhi=,zrlo=);
var uint32 zr;
- divu_6432_3232(zrhi,zrlo,FN_to_UL(R->modulus),,zr=);
+ divu_6432_3232(zrhi,zrlo,FN_to_UV(R->modulus),,zr=);
return _cl_MI(R, L_to_FN(zr));
}
// n has nn bits.
if (nn <= 8) {
// k = 1, normal Left-Right Binary algorithm.
- var uintL _n = FN_to_UL(n);
+ var uintL _n = FN_to_UV(n);
var _cl_MI a = x;
for (var int i = nn-2; i >= 0; i--) {
a = R->_square(a);
if (d==7) return cornacchia_t(1, 1,1);
return cornacchia_t(0);
}
- switch (FN_to_L(logand(d,7))) {
+ switch (FN_to_V(logand(d,7))) {
case 0: case 4: {
// d == 0 mod 4
var cornacchia_t s = cornacchia1(d>>2,p);
a = mod(a,b);
// If a and b are fixnums, choose faster routine.
if (fixnump(b))
- return jacobi(FN_to_L(a),FN_to_L(b));
+ return jacobi(FN_to_V(a),FN_to_V(b));
var int v = 1;
for (;;) {
// (a/b) * v is invariant.
// a > b/2, so (a/b) = (-1/b) * ((b-a)/b),
// and (-1/b) = -1 if b==3 mod 4.
a = b-a;
- if (FN_to_L(logand(b,3)) == 3)
+ if (FN_to_V(logand(b,3)) == 3)
v = -v;
continue;
}
// b>1 and a=2a', so (a/b) = (2/b) * (a'/b),
// and (2/b) = -1 if b==3,5 mod 8.
a = a>>1;
- switch (FN_to_L(logand(b,7))) {
+ switch (FN_to_V(logand(b,7))) {
case 3: case 5: v = -v; break;
}
continue;
}
// a and b odd, 0 < a < b/2 < b, so apply quadratic reciprocity
// law (a/b) = (-1)^((a-1)/2)((b-1)/2) * (b/a).
- if (FN_to_L(logand(logand(a,b),3)) == 3)
+ if (FN_to_V(logand(logand(a,b),3)) == 3)
v = -v;
swap(cl_I, a,b);
// Now a > 2*b, set a := a mod b.
namespace cln {
// Assume 0 <= a < b.
-inline int jacobi_aux (uint32 a, uint32 b)
+inline int jacobi_aux (uintV a, uintV b)
{
var int v = 1;
for (;;) {
// law (a/b) = (-1)^((a-1)/2)((b-1)/2) * (b/a).
if ((a & b & 3) == 3)
v = -v;
- swap(sint32, a,b);
+ swap(uintV, a,b);
// Now a > 2*b, set a := a mod b.
if ((a >> 3) >= b)
a = a % b;
}
}
-int jacobi (sint32 a, sint32 b)
+int jacobi (sintV a, sintV b)
{
// Check b > 0, b odd.
if (!(b > 0))
cl_abort();
// Ensure 0 <= a < b.
if (a >= 0)
- a = (uint32)a % (uint32)b;
+ a = (uintV)a % (uintV)b;
else
- a = b-1-((uint32)(~a) % (uint32)b);
+ a = b-1-((uintV)(~a) % (uintV)b);
return jacobi_aux(a,b);
}
fprint(std::cerr, "\n");
cl_abort();
}
- rational_base = FN_to_UL(base); ptr = base_end_ptr;
+ rational_base = FN_to_UV(base); ptr = base_end_ptr;
break;
}
ptr++;
fprint(std::cerr, "\n");
cl_abort();
}
- rational_base = FN_to_UL(base); ptr = base_end_ptr;
+ rational_base = FN_to_UV(base); ptr = base_end_ptr;
break;
}
ptr++;
}
static void bits1_set_element (cl_GV_inner<cl_I>* vec, uintL index, const cl_I& x)
{
- var uint32 xval;
+ var uintV xval;
if (fixnump(x)) {
- xval = FN_to_UL(x);
+ xval = FN_to_UV(x);
if (xval <= 0x1) {
var uintD* ptr = &((cl_heap_GV_I_bits1 *) outcast(vec))->data[index/intDsize];
index = index%intDsize;
}
static void bits2_set_element (cl_GV_inner<cl_I>* vec, uintL index, const cl_I& x)
{
- var uint32 xval;
+ var uintV xval;
if (fixnump(x)) {
- xval = FN_to_UL(x);
+ xval = FN_to_UV(x);
if (xval <= 0x3) {
var uintD* ptr = &((cl_heap_GV_I_bits2 *) outcast(vec))->data[index/(intDsize/2)];
index = 2*(index%(intDsize/2));
}
static void bits4_set_element (cl_GV_inner<cl_I>* vec, uintL index, const cl_I& x)
{
- var uint32 xval;
+ var uintV xval;
if (fixnump(x)) {
- xval = FN_to_UL(x);
+ xval = FN_to_UV(x);
if (xval <= 0xF) {
var uintD* ptr = &((cl_heap_GV_I_bits4 *) outcast(vec))->data[index/(intDsize/4)];
index = 4*(index%(intDsize/4));
}
static void bits8_set_element (cl_GV_inner<cl_I>* vec, uintL index, const cl_I& x)
{
- var uint32 xval;
+ var uintV xval;
if (fixnump(x)) {
- xval = FN_to_UL(x);
+ xval = FN_to_UV(x);
if (xval <= 0xFF) {
#if CL_CPU_BIG_ENDIAN_P
var uintD* ptr = &((cl_heap_GV_I_bits8 *) outcast(vec))->data[index/(intDsize/8)];
}
static void bits16_set_element (cl_GV_inner<cl_I>* vec, uintL index, const cl_I& x)
{
- var uint32 xval;
+ var uintV xval;
if (fixnump(x)) {
- xval = FN_to_UL(x);
+ xval = FN_to_UV(x);
if (xval <= 0xFFFF) {
#if CL_CPU_BIG_ENDIAN_P
var uintD* ptr = &((cl_heap_GV_I_bits16 *) outcast(vec))->data[index/(intDsize/16)];
cl_I m = cl_I(argv[1]);
{ CL_TIMING;
for (int rep = repetitions; rep > 0; rep--)
- cl_I f = factorial(FN_to_L(m));
+ cl_I f = factorial(FN_to_V(m));
}
}