From: Ben Pfaff Date: Thu, 11 Dec 2003 07:40:52 +0000 (+0000) Subject: Wed Dec 10 23:36:16 2003 Ben Pfaff X-Git-Tag: v0.4.0~478 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fa77efde13ecbb261b90109142453850b283b950;p=pspp-builds.git Wed Dec 10 23:36:16 2003 Ben Pfaff * lib/gmp/: Removed, because it no longer compiles with recent GCC versions. --- diff --git a/ChangeLog b/ChangeLog index e45419e8..99a9aae2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Wed Dec 10 23:36:16 2003 Ben Pfaff + + * lib/gmp/: Removed, because it no longer compiles with recent GCC + versions. + Wed Dec 10 23:32:47 2003 Ben Pfaff * sysdeps/: Removed, because everything was too old to be useful diff --git a/lib/gmp/COPYING.LIB b/lib/gmp/COPYING.LIB deleted file mode 100644 index 92b8903f..00000000 --- a/lib/gmp/COPYING.LIB +++ /dev/null @@ -1,481 +0,0 @@ - GNU LIBRARY GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the library GPL. It is - numbered 2 because it goes with version 2 of the ordinary GPL.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Library General Public License, applies to some -specially designated Free Software Foundation software, and to any -other libraries whose authors decide to use it. You can use it for -your libraries, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if -you distribute copies of the library, or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link a program with the library, you must provide -complete object files to the recipients so that they can relink them -with the library, after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - Our method of protecting your rights has two steps: (1) copyright -the library, and (2) offer you this license which gives you legal -permission to copy, distribute and/or modify the library. - - Also, for each distributor's protection, we want to make certain -that everyone understands that there is no warranty for this free -library. If the library is modified by someone else and passed on, we -want its recipients to know that what they have is not the original -version, so that any problems introduced by others will not reflect on -the original authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that companies distributing free -software will individually obtain patent licenses, thus in effect -transforming the program into proprietary software. To prevent this, -we have made it clear that any patent must be licensed for everyone's -free use or not licensed at all. - - Most GNU software, including some libraries, is covered by the ordinary -GNU General Public License, which was designed for utility programs. This -license, the GNU Library General Public License, applies to certain -designated libraries. This license is quite different from the ordinary -one; be sure to read it in full, and don't assume that anything in it is -the same as in the ordinary license. - - The reason we have a separate public license for some libraries is that -they blur the distinction we usually make between modifying or adding to a -program and simply using it. Linking a program with a library, without -changing the library, is in some sense simply using the library, and is -analogous to running a utility program or application program. However, in -a textual and legal sense, the linked executable is a combined work, a -derivative of the original library, and the ordinary General Public License -treats it as such. - - Because of this blurred distinction, using the ordinary General -Public License for libraries did not effectively promote software -sharing, because most developers did not use the libraries. We -concluded that weaker conditions might promote sharing better. - - However, unrestricted linking of non-free programs would deprive the -users of those programs of all benefit from the free status of the -libraries themselves. This Library General Public License is intended to -permit developers of non-free programs to use free libraries, while -preserving your freedom as a user of such programs to change the free -libraries that are incorporated in them. (We have not seen how to achieve -this as regards changes in header files, but we have achieved it as regards -changes in the actual functions of the Library.) The hope is that this -will lead to faster development of free libraries. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, while the latter only -works together with the library. - - Note that it is possible for a library to be covered by the ordinary -General Public License rather than by this special one. - - GNU LIBRARY GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library which -contains a notice placed by the copyright holder or other authorized -party saying it may be distributed under the terms of this Library -General Public License (also called "this License"). Each licensee is -addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also compile or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - c) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - d) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the source code distributed need not include anything that is normally -distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Library General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! diff --git a/lib/gmp/ChangeLog b/lib/gmp/ChangeLog deleted file mode 100644 index e398ea69..00000000 --- a/lib/gmp/ChangeLog +++ /dev/null @@ -1,29 +0,0 @@ -Mon Dec 14 11:52:05 1998 Ben Pfaff - - * Makefile.am, mpn/Makefile.am, mpf/Makefile.am: (INCLUDES) Add - -I$(top_srcdir)/intl. Thanks to OKUJI Yoshinori - . - -Thu Nov 19 12:35:13 1998 Ben Pfaff - - * Thanks to Hans Olav Eggestad and others - for reporting bug fixed below. - - * Makefile.am: (libgmp_a_SOURCES) Add mp_clz_tab.c. - - * longlong.h: Define LONGLONG_STANDALONE unconditionally since we - don't include architecture-specific directories. - - * mp_clz_tab.c: New file. - -Sun Aug 9 11:17:02 1998 Ben Pfaff - - * Makefile.am: Fixed for renamed file. - - * extract-double.c: Renamed extract-dbl.c. - ----------------------------------------------------------------------- -Local Variables: -mode: change-log -version-control: never -End: diff --git a/lib/gmp/INSTALL b/lib/gmp/INSTALL deleted file mode 100644 index 7e4ae38d..00000000 --- a/lib/gmp/INSTALL +++ /dev/null @@ -1,43 +0,0 @@ -(Other sections omitted because they're not useful in use along with -PSPP. -blp) - -Known Build Problems --------------------- - -Note that GCC 2.7.2 (as well as 2.6.3) for the RS/6000 and PowerPC can not -be used to compile GMP, due to a bug in GCC. If you want to use GCC, you -need to apply the patch at the end of this file, or use a later version of -the compiler. - -If you are on a Sequent Symmetry, use GAS instead of the system's assembler -due to the latter's serious bugs. - -The system compiler on NeXT is a massacred and old gcc, even if the -compiler calls itself cc. This compiler cannot be used to build GMP. You -need to get a real gcc, and install that before you compile GMP. (NeXT -might have fixed this in newer releases of their system.) - -Please report other problems to bug-gmp@prep.ai.mit.edu. - - -Patch to apply to GCC 2.6.3 and 2.7.2: - -*** config/rs6000/rs6000.md Sun Feb 11 08:22:11 1996 ---- config/rs6000/rs6000.md.new Sun Feb 18 03:33:37 1996 -*************** -*** 920,926 **** - (set (match_operand:SI 0 "gpc_reg_operand" "=r") - (not:SI (match_dup 1)))] - "" -! "nor. %0,%2,%1" - [(set_attr "type" "compare")]) - - (define_insn "" ---- 920,926 ---- - (set (match_operand:SI 0 "gpc_reg_operand" "=r") - (not:SI (match_dup 1)))] - "" -! "nor. %0,%1,%1" - [(set_attr "type" "compare")]) - - (define_insn "" diff --git a/lib/gmp/Makefile.am b/lib/gmp/Makefile.am deleted file mode 100644 index b563f67b..00000000 --- a/lib/gmp/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ -## Process this file with automake to produce Makefile.in -*- makefile -*- - -INCLUDES = -I$(srcdir) -I$(top_srcdir) -I$(top_srcdir)/src -I$(top_srcdir)/intl - -SUBDIRS = mpn mpf - -noinst_LIBRARIES = libgmp.a -libgmp_a_SOURCES = extract-dbl.c gmp-mparam.h longlong.h gmp-impl.h \ -gmp.h memory.c mp_clz_tab.c - -MAINTAINERCLEANFILES = Makefile.in diff --git a/lib/gmp/Makefile.in b/lib/gmp/Makefile.in deleted file mode 100644 index 3586e75f..00000000 --- a/lib/gmp/Makefile.in +++ /dev/null @@ -1,371 +0,0 @@ -# Makefile.in generated automatically by automake 1.4 from Makefile.am - -# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - - -SHELL = @SHELL@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -bindir = @bindir@ -sbindir = @sbindir@ -libexecdir = @libexecdir@ -datadir = @datadir@ -sysconfdir = @sysconfdir@ -sharedstatedir = @sharedstatedir@ -localstatedir = @localstatedir@ -libdir = @libdir@ -infodir = @infodir@ -mandir = @mandir@ -includedir = @includedir@ -oldincludedir = /usr/include - -DESTDIR = - -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ - -top_builddir = ../.. - -ACLOCAL = @ACLOCAL@ -AUTOCONF = @AUTOCONF@ -AUTOMAKE = @AUTOMAKE@ -AUTOHEADER = @AUTOHEADER@ - -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -transform = @program_transform_name@ - -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_alias = @build_alias@ -build_triplet = @build@ -host_alias = @host_alias@ -host_triplet = @host@ -target_alias = @target_alias@ -target_triplet = @target@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -DATADIRNAME = @DATADIRNAME@ -GENCAT = @GENCAT@ -GMOFILES = @GMOFILES@ -GMP_LIBS = @GMP_LIBS@ -GMP_SUBDIRS = @GMP_SUBDIRS@ -GMSGFMT = @GMSGFMT@ -GT_NO = @GT_NO@ -GT_YES = @GT_YES@ -INSTOBJEXT = @INSTOBJEXT@ -INTLDEPS = @INTLDEPS@ -INTLLIBS = @INTLLIBS@ -INTLOBJS = @INTLOBJS@ -LN_S = @LN_S@ -LOCAL_CC = @LOCAL_CC@ -MAKEINFO = @MAKEINFO@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MSGFMT = @MSGFMT@ -PACKAGE = @PACKAGE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -RANLIB = @RANLIB@ -U = @U@ -USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ -USE_NLS = @USE_NLS@ -VERSION = @VERSION@ -l = @l@ - -INCLUDES = -I$(srcdir) -I$(top_srcdir) -I$(top_srcdir)/src -I$(top_srcdir)/intl - -SUBDIRS = mpn mpf - -noinst_LIBRARIES = libgmp.a -libgmp_a_SOURCES = extract-dbl.c gmp-mparam.h longlong.h gmp-impl.h gmp.h memory.c mp_clz_tab.c - - -MAINTAINERCLEANFILES = Makefile.in -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = ../../config.h -CONFIG_CLEAN_FILES = -LIBRARIES = $(noinst_LIBRARIES) - - -DEFS = @DEFS@ -I. -I$(srcdir) -I../.. -CPPFLAGS = @CPPFLAGS@ -LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ -libgmp_a_LIBADD = -libgmp_a_OBJECTS = extract-dbl.o memory.o mp_clz_tab.o -AR = ar -COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ -DIST_COMMON = COPYING.LIB ChangeLog INSTALL Makefile.am Makefile.in - - -DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) - -TAR = tar -GZIP_ENV = --best -SOURCES = $(libgmp_a_SOURCES) -OBJECTS = $(libgmp_a_OBJECTS) - -all: all-redirect -.SUFFIXES: -.SUFFIXES: .S .c .o .s -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps lib/gmp/Makefile - -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) \ - && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status - - -mostlyclean-noinstLIBRARIES: - -clean-noinstLIBRARIES: - -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) - -distclean-noinstLIBRARIES: - -maintainer-clean-noinstLIBRARIES: - -.c.o: - $(COMPILE) -c $< - -.s.o: - $(COMPILE) -c $< - -.S.o: - $(COMPILE) -c $< - -mostlyclean-compile: - -rm -f *.o core *.core - -clean-compile: - -distclean-compile: - -rm -f *.tab.c - -maintainer-clean-compile: - -libgmp.a: $(libgmp_a_OBJECTS) $(libgmp_a_DEPENDENCIES) - -rm -f libgmp.a - $(AR) cru libgmp.a $(libgmp_a_OBJECTS) $(libgmp_a_LIBADD) - $(RANLIB) libgmp.a - -# This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. - -@SET_MAKE@ - -all-recursive install-data-recursive install-exec-recursive \ -installdirs-recursive install-recursive uninstall-recursive \ -check-recursive installcheck-recursive info-recursive dvi-recursive: - @set fnord $(MAKEFLAGS); amf=$$2; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -mostlyclean-recursive clean-recursive distclean-recursive \ -maintainer-clean-recursive: - @set fnord $(MAKEFLAGS); amf=$$2; \ - dot_seen=no; \ - rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \ - rev="$$subdir $$rev"; \ - test "$$subdir" = "." && dot_seen=yes; \ - done; \ - test "$$dot_seen" = "no" && rev=". $$rev"; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done - -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) - list='$(SOURCES) $(HEADERS)'; \ - unique=`for i in $$list; do echo $$i; done | \ - awk ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - here=`pwd` && cd $(srcdir) \ - && mkid -f$$here/ID $$unique $(LISP) - -TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ - fi; \ - done; \ - list='$(SOURCES) $(HEADERS)'; \ - unique=`for i in $$list; do echo $$i; done | \ - awk ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ - || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) - -mostlyclean-tags: - -clean-tags: - -distclean-tags: - -rm -f TAGS ID - -maintainer-clean-tags: - -distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) - -subdir = lib/gmp - -distdir: $(DISTFILES) - @for file in $(DISTFILES); do \ - d=$(srcdir); \ - if test -d $$d/$$file; then \ - cp -pr $$d/$$file $(distdir)/$$file; \ - else \ - test -f $(distdir)/$$file \ - || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ - || cp -p $$d/$$file $(distdir)/$$file || :; \ - fi; \ - done - for subdir in $(SUBDIRS); do \ - if test "$$subdir" = .; then :; else \ - test -d $(distdir)/$$subdir \ - || mkdir $(distdir)/$$subdir \ - || exit 1; \ - chmod 777 $(distdir)/$$subdir; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(top_distdir) distdir=../$(distdir)/$$subdir distdir) \ - || exit 1; \ - fi; \ - done - -info-am: -info: info-recursive -dvi-am: -dvi: dvi-recursive -check-am: all-am -check: check-recursive -installcheck-am: -installcheck: installcheck-recursive -install-exec-am: -install-exec: install-exec-recursive - -install-data-am: -install-data: install-data-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -install: install-recursive -uninstall-am: -uninstall: uninstall-recursive -all-am: Makefile $(LIBRARIES) -all-redirect: all-recursive -install-strip: - $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install -installdirs: installdirs-recursive -installdirs-am: - - -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) - -rm -f config.cache config.log stamp-h stamp-h[0-9]* - -maintainer-clean-generic: - -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) -mostlyclean-am: mostlyclean-noinstLIBRARIES mostlyclean-compile \ - mostlyclean-tags mostlyclean-generic - -mostlyclean: mostlyclean-recursive - -clean-am: clean-noinstLIBRARIES clean-compile clean-tags clean-generic \ - mostlyclean-am - -clean: clean-recursive - -distclean-am: distclean-noinstLIBRARIES distclean-compile \ - distclean-tags distclean-generic clean-am - -distclean: distclean-recursive - -maintainer-clean-am: maintainer-clean-noinstLIBRARIES \ - maintainer-clean-compile maintainer-clean-tags \ - maintainer-clean-generic distclean-am - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." - -maintainer-clean: maintainer-clean-recursive - -.PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \ -clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \ -mostlyclean-compile distclean-compile clean-compile \ -maintainer-clean-compile install-data-recursive \ -uninstall-data-recursive install-exec-recursive \ -uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \ -all-recursive check-recursive installcheck-recursive info-recursive \ -dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \ -maintainer-clean-recursive tags tags-recursive mostlyclean-tags \ -distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ -dvi-am dvi check check-am installcheck-am installcheck install-exec-am \ -install-exec install-data-am install-data install-am install \ -uninstall-am uninstall all-redirect all-am all installdirs-am \ -installdirs mostlyclean-generic distclean-generic clean-generic \ -maintainer-clean-generic clean mostlyclean distclean maintainer-clean - - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/lib/gmp/extract-dbl.c b/lib/gmp/extract-dbl.c deleted file mode 100644 index 84bd661a..00000000 --- a/lib/gmp/extract-dbl.c +++ /dev/null @@ -1,161 +0,0 @@ -/* __gmp_extract_double -- convert from double to array of mp_limb_t. - -Copyright (C) 1996 Free Software Foundation, Inc. - -This file is part of the GNU MP Library. - -The GNU MP Library is free software; you can redistribute it and/or modify -it under the terms of the GNU Library General Public License as published by -the Free Software Foundation; either version 2 of the License, or (at your -option) any later version. - -The GNU MP Library is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public -License for more details. - -You should have received a copy of the GNU Library General Public License -along with the GNU MP Library; see the file COPYING.LIB. If not, write to -the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -MA 02111-1307, USA. */ - -#include -#include "gmp.h" -#include "gmp-impl.h" - -#ifdef XDEBUG -#undef _GMP_IEEE_FLOATS -#endif - -#ifndef _GMP_IEEE_FLOATS -#define _GMP_IEEE_FLOATS 0 -#endif - -#define MP_BASE_AS_DOUBLE (2.0 * ((mp_limb_t) 1 << (BITS_PER_MP_LIMB - 1))) - -/* Extract a non-negative double in d. */ - -int -#if __STDC__ -__gmp_extract_double (mp_ptr rp, double d) -#else -__gmp_extract_double (rp, d) - mp_ptr rp; - double d; -#endif -{ - long exp; - unsigned sc; - mp_limb_t manh, manl; - - /* BUGS - - 1. Should handle Inf and NaN in IEEE specific code. - 2. Handle Inf and NaN also in default code, to avoid hangs. - 3. Generalize to handle all BITS_PER_MP_LIMB >= 32. - 4. This lits is incomplete and misspelled. - */ - - if (d == 0.0) - { - rp[0] = 0; - rp[1] = 0; -#if BITS_PER_MP_LIMB == 32 - rp[2] = 0; -#endif - return 0; - } - -#if _GMP_IEEE_FLOATS - { - union ieee_double_extract x; - x.d = d; - - exp = x.s.exp; - sc = (unsigned) (exp + 2) % BITS_PER_MP_LIMB; -#if BITS_PER_MP_LIMB == 64 - manl = (((mp_limb_t) 1 << 63) - | ((mp_limb_t) x.s.manh << 43) | ((mp_limb_t) x.s.manl << 11)); -#else - manh = ((mp_limb_t) 1 << 31) | (x.s.manh << 11) | (x.s.manl >> 21); - manl = x.s.manl << 11; -#endif - } -#else - { - /* Unknown (or known to be non-IEEE) double format. */ - exp = 0; - if (d >= 1.0) - { - if (d * 0.5 == d) - abort (); - - while (d >= 32768.0) - { - d *= (1.0 / 65536.0); - exp += 16; - } - while (d >= 1.0) - { - d *= 0.5; - exp += 1; - } - } - else if (d < 0.5) - { - while (d < (1.0 / 65536.0)) - { - d *= 65536.0; - exp -= 16; - } - while (d < 0.5) - { - d *= 2.0; - exp -= 1; - } - } - - sc = (unsigned) exp % BITS_PER_MP_LIMB; - - d *= MP_BASE_AS_DOUBLE; -#if BITS_PER_MP_LIMB == 64 - manl = d; -#else - manh = d; - manl = (d - manh) * MP_BASE_AS_DOUBLE; -#endif - - exp += 1022; - } -#endif - - exp = (unsigned) (exp + 1) / BITS_PER_MP_LIMB - 1024 / BITS_PER_MP_LIMB + 1; - -#if BITS_PER_MP_LIMB == 64 - if (sc != 0) - { - rp[1] = manl >> (BITS_PER_MP_LIMB - sc); - rp[0] = manl << sc; - } - else - { - rp[1] = manl; - rp[0] = 0; - } -#else - if (sc != 0) - { - rp[2] = manh >> (BITS_PER_MP_LIMB - sc); - rp[1] = (manl >> (BITS_PER_MP_LIMB - sc)) | (manh << sc); - rp[0] = manl << sc; - } - else - { - rp[2] = manh; - rp[1] = manl; - rp[0] = 0; - } -#endif - - return exp; -} diff --git a/lib/gmp/gmp-impl.h b/lib/gmp/gmp-impl.h deleted file mode 100644 index a838ba65..00000000 --- a/lib/gmp/gmp-impl.h +++ /dev/null @@ -1,374 +0,0 @@ -/* Include file for internal GNU MP types and definitions. - -Copyright (C) 1991, 1993, 1994, 1995, 1996 Free Software Foundation, Inc. - -This file is part of the GNU MP Library. - -The GNU MP Library is free software; you can redistribute it and/or modify -it under the terms of the GNU Library General Public License as published by -the Free Software Foundation; either version 2 of the License, or (at your -option) any later version. - -The GNU MP Library is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public -License for more details. - -You should have received a copy of the GNU Library General Public License -along with the GNU MP Library; see the file COPYING.LIB. If not, write to -the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -MA 02111-1307, USA. */ - -#if 0 /* PSPP has its own alloca */ -/* When using gcc, make sure to use its builtin alloca. */ -#if ! defined (alloca) && defined (__GNUC__) -#define alloca __builtin_alloca -#define HAVE_ALLOCA -#endif - -/* When using cc, do whatever necessary to allow use of alloca. For many - machines, this means including alloca.h. IBM's compilers need a #pragma - in "each module that needs to use alloca". */ -#if ! defined (alloca) -/* We need lots of variants for MIPS, to cover all versions and perversions - of OSes for MIPS. */ -#if defined (__mips) || defined (MIPSEL) || defined (MIPSEB) \ - || defined (_MIPSEL) || defined (_MIPSEB) || defined (__sgi) \ - || defined (__alpha) || defined (__sparc) || defined (sparc) \ - || defined (__ksr__) -#include -#define HAVE_ALLOCA -#endif -#if defined (_IBMR2) -#pragma alloca -#define HAVE_ALLOCA -#endif -#if defined (__DECC) -#define alloca(x) __ALLOCA(x) -#define HAVE_ALLOCA -#endif -#endif -#endif /* 0 */ - -#if ! defined (HAVE_ALLOCA) || USE_STACK_ALLOC -#include "stack-alloc.h" -#else -#define TMP_DECL(m) -#define TMP_ALLOC(x) alloca(x) -#define TMP_MARK(m) -#define TMP_FREE(m) -#endif - -#ifndef NULL -#define NULL ((void *) 0) -#endif - -#if ! defined (__GNUC__) -#define inline /* Empty */ -#endif - -#define ABS(x) (x >= 0 ? x : -x) -#define MIN(l,o) ((l) < (o) ? (l) : (o)) -#define MAX(h,i) ((h) > (i) ? (h) : (i)) - -/* Field access macros. */ -#define SIZ(x) ((x)->_mp_size) -#define ABSIZ(x) ABS (SIZ (x)) -#define PTR(x) ((x)->_mp_d) -#define EXP(x) ((x)->_mp_exp) -#define PREC(x) ((x)->_mp_prec) -#define ALLOC(x) ((x)->_mp_alloc) - -#include "gmp-mparam.h" -/* #include "longlong.h" */ - -#if defined (__STDC__) || defined (__cplusplus) -void *malloc (size_t); -void *realloc (void *, size_t); -void free (void *); - -extern void * (*_mp_allocate_func) (size_t); -extern void * (*_mp_reallocate_func) (void *, size_t, size_t); -extern void (*_mp_free_func) (void *, size_t); - -void *_mp_default_allocate (size_t); -void *_mp_default_reallocate (void *, size_t, size_t); -void _mp_default_free (void *, size_t); - -#else - -#define const /* Empty */ -#define signed /* Empty */ - -void *malloc (); -void *realloc (); -void free (); - -extern void * (*_mp_allocate_func) (); -extern void * (*_mp_reallocate_func) (); -extern void (*_mp_free_func) (); - -void *_mp_default_allocate (); -void *_mp_default_reallocate (); -void _mp_default_free (); -#endif - -/* Copy NLIMBS *limbs* from SRC to DST. */ -#define MPN_COPY_INCR(DST, SRC, NLIMBS) \ - do { \ - mp_size_t __i; \ - for (__i = 0; __i < (NLIMBS); __i++) \ - (DST)[__i] = (SRC)[__i]; \ - } while (0) -#define MPN_COPY_DECR(DST, SRC, NLIMBS) \ - do { \ - mp_size_t __i; \ - for (__i = (NLIMBS) - 1; __i >= 0; __i--) \ - (DST)[__i] = (SRC)[__i]; \ - } while (0) -#define MPN_COPY MPN_COPY_INCR - -/* Zero NLIMBS *limbs* AT DST. */ -#define MPN_ZERO(DST, NLIMBS) \ - do { \ - mp_size_t __i; \ - for (__i = 0; __i < (NLIMBS); __i++) \ - (DST)[__i] = 0; \ - } while (0) - -#define MPN_NORMALIZE(DST, NLIMBS) \ - do { \ - while (NLIMBS > 0) \ - { \ - if ((DST)[(NLIMBS) - 1] != 0) \ - break; \ - NLIMBS--; \ - } \ - } while (0) -#define MPN_NORMALIZE_NOT_ZERO(DST, NLIMBS) \ - do { \ - while (1) \ - { \ - if ((DST)[(NLIMBS) - 1] != 0) \ - break; \ - NLIMBS--; \ - } \ - } while (0) - -/* Initialize the MP_INT X with space for NLIMBS limbs. - X should be a temporary variable, and it will be automatically - cleared out when the running function returns. - We use __x here to make it possible to accept both mpz_ptr and mpz_t - arguments. */ -#define MPZ_TMP_INIT(X, NLIMBS) \ - do { \ - mpz_ptr __x = (X); \ - __x->_mp_alloc = (NLIMBS); \ - __x->_mp_d = (mp_ptr) TMP_ALLOC ((NLIMBS) * BYTES_PER_MP_LIMB); \ - } while (0) - -#define MPN_MUL_N_RECURSE(prodp, up, vp, size, tspace) \ - do { \ - if ((size) < KARATSUBA_THRESHOLD) \ - impn_mul_n_basecase (prodp, up, vp, size); \ - else \ - impn_mul_n (prodp, up, vp, size, tspace); \ - } while (0); -#define MPN_SQR_N_RECURSE(prodp, up, size, tspace) \ - do { \ - if ((size) < KARATSUBA_THRESHOLD) \ - impn_sqr_n_basecase (prodp, up, size); \ - else \ - impn_sqr_n (prodp, up, size, tspace); \ - } while (0); - -/* Structure for conversion between internal binary format and - strings in base 2..36. */ -struct bases -{ - /* Number of digits in the conversion base that always fits in an mp_limb_t. - For example, for base 10 on a machine where a mp_limb_t has 32 bits this - is 9, since 10**9 is the largest number that fits into a mp_limb_t. */ - int chars_per_limb; - - /* log(2)/log(conversion_base) */ - float chars_per_bit_exactly; - - /* base**chars_per_limb, i.e. the biggest number that fits a word, built by - factors of base. Exception: For 2, 4, 8, etc, big_base is log2(base), - i.e. the number of bits used to represent each digit in the base. */ - mp_limb_t big_base; - - /* A BITS_PER_MP_LIMB bit approximation to 1/big_base, represented as a - fixed-point number. Instead of dividing by big_base an application can - choose to multiply by big_base_inverted. */ - mp_limb_t big_base_inverted; -}; - -extern const struct bases __mp_bases[]; -extern mp_size_t __gmp_default_fp_limb_precision; - -/* Divide the two-limb number in (NH,,NL) by D, with DI being the largest - limb not larger than (2**(2*BITS_PER_MP_LIMB))/D - (2**BITS_PER_MP_LIMB). - If this would yield overflow, DI should be the largest possible number - (i.e., only ones). For correct operation, the most significant bit of D - has to be set. Put the quotient in Q and the remainder in R. */ -#define udiv_qrnnd_preinv(q, r, nh, nl, d, di) \ - do { \ - mp_limb_t _q, _ql, _r; \ - mp_limb_t _xh, _xl; \ - umul_ppmm (_q, _ql, (nh), (di)); \ - _q += (nh); /* DI is 2**BITS_PER_MP_LIMB too small */\ - umul_ppmm (_xh, _xl, _q, (d)); \ - sub_ddmmss (_xh, _r, (nh), (nl), _xh, _xl); \ - if (_xh != 0) \ - { \ - sub_ddmmss (_xh, _r, _xh, _r, 0, (d)); \ - _q += 1; \ - if (_xh != 0) \ - { \ - sub_ddmmss (_xh, _r, _xh, _r, 0, (d)); \ - _q += 1; \ - } \ - } \ - if (_r >= (d)) \ - { \ - _r -= (d); \ - _q += 1; \ - } \ - (r) = _r; \ - (q) = _q; \ - } while (0) -/* Like udiv_qrnnd_preinv, but for for any value D. DNORM is D shifted left - so that its most significant bit is set. LGUP is ceil(log2(D)). */ -#define udiv_qrnnd_preinv2gen(q, r, nh, nl, d, di, dnorm, lgup) \ - do { \ - mp_limb_t n2, n10, n1, nadj, q1; \ - mp_limb_t _xh, _xl; \ - n2 = ((nh) << (BITS_PER_MP_LIMB - (lgup))) + ((nl) >> 1 >> (l - 1));\ - n10 = (nl) << (BITS_PER_MP_LIMB - (lgup)); \ - n1 = ((mp_limb_signed_t) n10 >> (BITS_PER_MP_LIMB - 1)); \ - nadj = n10 + (n1 & (dnorm)); \ - umul_ppmm (_xh, _xl, di, n2 - n1); \ - add_ssaaaa (_xh, _xl, _xh, _xl, 0, nadj); \ - q1 = ~(n2 + _xh); \ - umul_ppmm (_xh, _xl, q1, d); \ - add_ssaaaa (_xh, _xl, _xh, _xl, nh, nl); \ - _xh -= (d); \ - (r) = _xl + ((d) & _xh); \ - (q) = _xh - q1; \ - } while (0) -/* Exactly like udiv_qrnnd_preinv, but branch-free. It is not clear which - version to use. */ -#define udiv_qrnnd_preinv2norm(q, r, nh, nl, d, di) \ - do { \ - mp_limb_t n2, n10, n1, nadj, q1; \ - mp_limb_t _xh, _xl; \ - n2 = (nh); \ - n10 = (nl); \ - n1 = ((mp_limb_signed_t) n10 >> (BITS_PER_MP_LIMB - 1)); \ - nadj = n10 + (n1 & (d)); \ - umul_ppmm (_xh, _xl, di, n2 - n1); \ - add_ssaaaa (_xh, _xl, _xh, _xl, 0, nadj); \ - q1 = ~(n2 + _xh); \ - umul_ppmm (_xh, _xl, q1, d); \ - add_ssaaaa (_xh, _xl, _xh, _xl, nh, nl); \ - _xh -= (d); \ - (r) = _xl + ((d) & _xh); \ - (q) = _xh - q1; \ - } while (0) - -#if defined (__GNUC__) -/* Define stuff for longlong.h. */ -typedef unsigned int UQItype __attribute__ ((mode (QI))); -typedef int SItype __attribute__ ((mode (SI))); -typedef unsigned int USItype __attribute__ ((mode (SI))); -typedef int DItype __attribute__ ((mode (DI))); -typedef unsigned int UDItype __attribute__ ((mode (DI))); -#else -typedef unsigned char UQItype; -typedef long SItype; -typedef unsigned long USItype; -#endif - -typedef mp_limb_t UWtype; -typedef unsigned int UHWtype; -#define W_TYPE_SIZE BITS_PER_MP_LIMB - -/* Internal mpn calls */ -#define impn_mul_n_basecase __MPN(impn_mul_n_basecase) -#define impn_mul_n __MPN(impn_mul_n) -#define impn_sqr_n_basecase __MPN(impn_sqr_n_basecase) -#define impn_sqr_n __MPN(impn_sqr_n) - -void impn_mul_n_basecase (mp_ptr prodp, mp_srcptr up, mp_srcptr vp, - mp_size_t size); -void impn_mul_n (mp_ptr prodp, mp_srcptr up, mp_srcptr vp, mp_size_t size, - mp_ptr tspace); - -/* Define ieee_double_extract and _GMP_IEEE_FLOATS. */ - -#if defined (_LITTLE_ENDIAN) || defined (__LITTLE_ENDIAN__) \ - || defined (__alpha) \ - || (defined (__arm__) && defined (__ARMWEL__)) \ - || defined (__clipper__) \ - || defined (__cris) \ - || defined (__i386__) \ - || defined (__i860__) \ - || defined (__i960__) \ - || defined (MIPSEL) || defined (_MIPSEL) \ - || defined (__ns32000__) \ - || defined (__WINNT) || defined (_WIN32) -#define _GMP_IEEE_FLOATS 1 -union ieee_double_extract -{ - struct - { - unsigned int manl:32; - unsigned int manh:20; - unsigned int exp:11; - unsigned int sig:1; - } s; - double d; -}; -#else /* Need this as an #else since the tests aren't made exclusive. */ -#if defined (_BIG_ENDIAN) \ - || defined (__a29k__) || defined (_AM29K) \ - || defined (__arm__) \ - || (defined (__convex__) && defined (_IEEE_FLOAT_)) \ - || defined (__i370__) || defined (__mvs__) \ - || defined (__mc68000__) || defined (__mc68020__) || defined (__NeXT__)\ - || defined(mc68020) \ - || defined (__m88000__) \ - || defined (MIPSEB) || defined (_MIPSEB) \ - || defined (__hppa) \ - || defined (__pyr__) \ - || defined (__ibm032__) \ - || defined (_IBMR2) || defined (_ARCH_PPC) \ - || defined (__sh__) \ - || defined (__sparc) || defined (sparc) \ - || defined (__we32k__) -#define _GMP_IEEE_FLOATS 1 -union ieee_double_extract -{ - struct - { - unsigned int sig:1; - unsigned int exp:11; - unsigned int manh:20; - unsigned int manl:32; - } s; - double d; -}; -#endif -#endif - -#define MP_BASE_AS_DOUBLE (2.0 * ((mp_limb_t) 1 << (BITS_PER_MP_LIMB - 1))) -#if BITS_PER_MP_LIMB == 64 -#define LIMBS_PER_DOUBLE 2 -#else -#define LIMBS_PER_DOUBLE 3 -#endif - -double __gmp_scale2 _PROTO ((double, int)); -int __gmp_extract_double _PROTO((mp_ptr, double)); diff --git a/lib/gmp/gmp-mparam.h b/lib/gmp/gmp-mparam.h deleted file mode 100644 index f3cbe781..00000000 --- a/lib/gmp/gmp-mparam.h +++ /dev/null @@ -1,27 +0,0 @@ -/* gmp-mparam.h -- Compiler/machine parameter header file. - -Copyright (C) 1991, 1993, 1994 Free Software Foundation, Inc. - -This file is part of the GNU MP Library. - -The GNU MP Library is free software; you can redistribute it and/or modify -it under the terms of the GNU Library General Public License as published by -the Free Software Foundation; either version 2 of the License, or (at your -option) any later version. - -The GNU MP Library is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public -License for more details. - -You should have received a copy of the GNU Library General Public License -along with the GNU MP Library; see the file COPYING.LIB. If not, write to -the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -MA 02111-1307, USA. */ - -#define BITS_PER_MP_LIMB (8 * SIZEOF_LONG) -#define BYTES_PER_MP_LIMB SIZEOF_LONG -#define BITS_PER_LONGINT (8 * SIZEOF_LONG) -#define BITS_PER_INT (8 * SIZEOF_INT) -#define BITS_PER_SHORTINT (8 * SIZEOF_SHORT) -#define BITS_PER_CHAR 8 diff --git a/lib/gmp/gmp.h b/lib/gmp/gmp.h deleted file mode 100644 index a1cc1ac7..00000000 --- a/lib/gmp/gmp.h +++ /dev/null @@ -1,632 +0,0 @@ -/* gmp.h -- Definitions for GNU multiple precision functions. - -Copyright (C) 1991, 1993, 1994, 1995, 1996 Free Software Foundation, Inc. - -This file is part of the GNU MP Library. - -The GNU MP Library is free software; you can redistribute it and/or modify -it under the terms of the GNU Library General Public License as published by -the Free Software Foundation; either version 2 of the License, or (at your -option) any later version. - -The GNU MP Library is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public -License for more details. - -You should have received a copy of the GNU Library General Public License -along with the GNU MP Library; see the file COPYING.LIB. If not, write to -the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -MA 02111-1307, USA. */ - -#ifndef __GMP_H__ - -#ifndef __GNU_MP__ -#define __GNU_MP__ 2 -#define __need_size_t -#include -#undef __need_size_t - -#if defined (__STDC__) || defined (__cplusplus) -#define __gmp_const const -#else -#define __gmp_const -#endif - -#if defined (__GNUC__) -#define __gmp_inline __inline__ -#else -#define __gmp_inline -#endif - -#ifndef _EXTERN_INLINE -#ifdef __GNUC__ -#define _EXTERN_INLINE extern __inline__ -#else -#define _EXTERN_INLINE static -#endif -#endif - -#ifdef _SHORT_LIMB -typedef unsigned int mp_limb_t; -typedef int mp_limb_signed_t; -#else -#ifdef _LONG_LONG_LIMB -typedef unsigned long long int mp_limb_t; -typedef long long int mp_limb_signed_t; -#else -typedef unsigned long int mp_limb_t; -typedef long int mp_limb_signed_t; -#endif -#endif - -typedef mp_limb_t * mp_ptr; -typedef __gmp_const mp_limb_t * mp_srcptr; -typedef long int mp_size_t; -typedef long int mp_exp_t; - -#ifndef __MP_SMALL__ -typedef struct -{ - int _mp_alloc; /* Number of *limbs* allocated and pointed - to by the D field. */ - int _mp_size; /* abs(SIZE) is the number of limbs - the last field points to. If SIZE - is negative this is a negative - number. */ - mp_limb_t *_mp_d; /* Pointer to the limbs. */ -} __mpz_struct; -#else -typedef struct -{ - short int _mp_alloc; /* Number of *limbs* allocated and pointed - to by the D field. */ - short int _mp_size; /* abs(SIZE) is the number of limbs - the last field points to. If SIZE - is negative this is a negative - number. */ - mp_limb_t *_mp_d; /* Pointer to the limbs. */ -} __mpz_struct; -#endif -#endif /* __GNU_MP__ */ - -/* User-visible types. */ -typedef __mpz_struct MP_INT; -typedef __mpz_struct mpz_t[1]; - -/* Structure for rational numbers. Zero is represented as 0/any, i.e. - the denominator is ignored. Negative numbers have the sign in - the numerator. */ -typedef struct -{ - __mpz_struct _mp_num; - __mpz_struct _mp_den; -#if 0 - int _mp_num_alloc; /* Number of limbs allocated - for the numerator. */ - int _mp_num_size; /* The absolute value of this field is the - length of the numerator; the sign is the - sign of the entire rational number. */ - mp_ptr _mp_num; /* Pointer to the numerator limbs. */ - int _mp_den_alloc; /* Number of limbs allocated - for the denominator. */ - int _mp_den_size; /* Length of the denominator. (This field - should always be positive.) */ - mp_ptr _mp_den; /* Pointer to the denominator limbs. */ -#endif -} __mpq_struct; - -typedef __mpq_struct MP_RAT; -typedef __mpq_struct mpq_t[1]; - -typedef struct -{ - int _mp_prec; /* Max precision, in number of `mp_limb_t's. - Set by mpf_init and modified by - mpf_set_prec. The area pointed to - by the `d' field contains `prec' + 1 - limbs. */ - int _mp_size; /* abs(SIZE) is the number of limbs - the last field points to. If SIZE - is negative this is a negative - number. */ - mp_exp_t _mp_exp; /* Exponent, in the base of `mp_limb_t'. */ - mp_limb_t *_mp_d; /* Pointer to the limbs. */ -} __mpf_struct; - -/* typedef __mpf_struct MP_FLOAT; */ -typedef __mpf_struct mpf_t[1]; - -/* Types for function declarations in gmp files. */ -/* ??? Should not pollute user name space with these ??? */ -typedef __gmp_const __mpz_struct *mpz_srcptr; -typedef __mpz_struct *mpz_ptr; -typedef __gmp_const __mpf_struct *mpf_srcptr; -typedef __mpf_struct *mpf_ptr; -typedef __gmp_const __mpq_struct *mpq_srcptr; -typedef __mpq_struct *mpq_ptr; - -#ifndef _PROTO -#if defined (__STDC__) || defined (__cplusplus) -#define _PROTO(x) x -#else -#define _PROTO(x) () -#endif -#endif - -#ifndef __MPN -#if defined (__STDC__) || defined (__cplusplus) -#define __MPN(x) __mpn_##x -#else -#define __MPN(x) __mpn_/**/x -#endif -#endif - -#if defined (FILE) || defined (H_STDIO) || defined (_H_STDIO) \ - || defined (_STDIO_H) || defined (_STDIO_H_) || defined (__STDIO_H__) \ - || defined (_STDIO_INCLUDED) -#define _GMP_H_HAVE_FILE 1 -#endif - -void mp_set_memory_functions _PROTO ((void *(*) (size_t), - void *(*) (void *, size_t, size_t), - void (*) (void *, size_t))); -extern __gmp_const int mp_bits_per_limb; - -/**************** Integer (i.e. Z) routines. ****************/ - -#if defined (__cplusplus) -extern "C" { -#endif -void *_mpz_realloc _PROTO ((mpz_ptr, mp_size_t)); - -void mpz_abs _PROTO ((mpz_ptr, mpz_srcptr)); -void mpz_add _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr)); -void mpz_add_ui _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int)); -void mpz_and _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr)); -void mpz_array_init _PROTO ((mpz_ptr, mp_size_t, mp_size_t)); -void mpz_cdiv_q _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr)); -unsigned long int mpz_cdiv_q_ui _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int)); -void mpz_cdiv_qr _PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr)); -unsigned long int mpz_cdiv_qr_ui _PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int)); -void mpz_cdiv_r _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr)); -unsigned long int mpz_cdiv_r_ui _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int)); -unsigned long int mpz_cdiv_ui _PROTO ((mpz_srcptr, unsigned long int)); -void mpz_clear _PROTO ((mpz_ptr)); -void mpz_clrbit _PROTO ((mpz_ptr, unsigned long int)); -int mpz_cmp _PROTO ((mpz_srcptr, mpz_srcptr)); -int mpz_cmp_si _PROTO ((mpz_srcptr, signed long int)); -int mpz_cmp_ui _PROTO ((mpz_srcptr, unsigned long int)); -void mpz_com _PROTO ((mpz_ptr, mpz_srcptr)); -void mpz_divexact _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr)); -void mpz_fac_ui _PROTO ((mpz_ptr, unsigned long int)); -void mpz_fdiv_q _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr)); -void mpz_fdiv_q_2exp _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int)); -unsigned long int mpz_fdiv_q_ui _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int)); -void mpz_fdiv_qr _PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr)); -unsigned long int mpz_fdiv_qr_ui _PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int)); -void mpz_fdiv_r _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr)); -void mpz_fdiv_r_2exp _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int)); -unsigned long int mpz_fdiv_r_ui _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int)); -unsigned long int mpz_fdiv_ui _PROTO ((mpz_srcptr, unsigned long int)); -void mpz_gcd _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr)); -unsigned long int mpz_gcd_ui _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int)); -void mpz_gcdext _PROTO ((mpz_ptr, mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr)); -double mpz_get_d _PROTO ((mpz_srcptr)); -/* signed */ long int mpz_get_si _PROTO ((mpz_srcptr)); -char *mpz_get_str _PROTO ((char *, int, mpz_srcptr)); -unsigned long int mpz_get_ui _PROTO ((mpz_srcptr)); -mp_limb_t mpz_getlimbn _PROTO ((mpz_srcptr, mp_size_t)); -unsigned long int mpz_hamdist _PROTO ((mpz_srcptr, mpz_srcptr)); -void mpz_init _PROTO ((mpz_ptr)); -#ifdef _GMP_H_HAVE_FILE -size_t mpz_inp_binary _PROTO ((mpz_ptr, FILE *)); -size_t mpz_inp_raw _PROTO ((mpz_ptr, FILE *)); -size_t mpz_inp_str _PROTO ((mpz_ptr, FILE *, int)); -#endif -void mpz_init_set _PROTO ((mpz_ptr, mpz_srcptr)); -void mpz_init_set_d _PROTO ((mpz_ptr, double)); -void mpz_init_set_si _PROTO ((mpz_ptr, signed long int)); -int mpz_init_set_str _PROTO ((mpz_ptr, const char *, int)); -void mpz_init_set_ui _PROTO ((mpz_ptr, unsigned long int)); -int mpz_invert _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr)); -void mpz_ior _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr)); -int mpz_jacobi _PROTO ((mpz_srcptr, mpz_srcptr)); -int mpz_legendre _PROTO ((mpz_srcptr, mpz_srcptr)); -void mpz_mod _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr)); -void mpz_mul _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr)); -void mpz_mul_2exp _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int)); -void mpz_mul_ui _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int)); -void mpz_neg _PROTO ((mpz_ptr, mpz_srcptr)); -#ifdef _GMP_H_HAVE_FILE -size_t mpz_out_binary _PROTO ((FILE *, mpz_srcptr)); -size_t mpz_out_raw _PROTO ((FILE *, mpz_srcptr)); -size_t mpz_out_str _PROTO ((FILE *, int, mpz_srcptr)); -#endif -int mpz_perfect_square_p _PROTO ((mpz_srcptr)); -unsigned long int mpz_popcount _PROTO ((mpz_srcptr)); -void mpz_pow_ui _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int)); -void mpz_powm _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr, mpz_srcptr)); -void mpz_powm_ui _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int, mpz_srcptr)); -int mpz_probab_prime_p _PROTO ((mpz_srcptr, int)); -void mpz_random _PROTO ((mpz_ptr, mp_size_t)); -void mpz_random2 _PROTO ((mpz_ptr, mp_size_t)); -unsigned long int mpz_scan0 _PROTO ((mpz_srcptr, unsigned long int)); -unsigned long int mpz_scan1 _PROTO ((mpz_srcptr, unsigned long int)); -void mpz_set _PROTO ((mpz_ptr, mpz_srcptr)); -void mpz_set_d _PROTO ((mpz_ptr, double)); -void mpz_set_f _PROTO ((mpz_ptr, mpf_srcptr)); -void mpz_set_q _PROTO ((mpz_ptr, mpq_srcptr)); -void mpz_set_si _PROTO ((mpz_ptr, signed long int)); -int mpz_set_str _PROTO ((mpz_ptr, const char *, int)); -void mpz_set_ui _PROTO ((mpz_ptr, unsigned long int)); -void mpz_setbit _PROTO ((mpz_ptr, unsigned long int)); -size_t mpz_size _PROTO ((mpz_srcptr)); -size_t mpz_sizeinbase _PROTO ((mpz_srcptr, int)); -void mpz_sqrt _PROTO ((mpz_ptr, mpz_srcptr)); -void mpz_sqrtrem _PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr)); -void mpz_sub _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr)); -void mpz_sub_ui _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int)); -void mpz_tdiv_q _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr)); -void mpz_tdiv_q_2exp _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int)); -void mpz_tdiv_q_ui _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int)); -void mpz_tdiv_qr _PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr)); -void mpz_tdiv_qr_ui _PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int)); -void mpz_tdiv_r _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr)); -void mpz_tdiv_r_2exp _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int)); -void mpz_tdiv_r_ui _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int)); -void mpz_ui_pow_ui _PROTO ((mpz_ptr, unsigned long int, unsigned long int)); - -/**************** Rational (i.e. Q) routines. ****************/ - -void mpq_init _PROTO ((mpq_ptr)); -void mpq_clear _PROTO ((mpq_ptr)); -void mpq_set _PROTO ((mpq_ptr, mpq_srcptr)); -void mpq_set_ui _PROTO ((mpq_ptr, unsigned long int, unsigned long int)); -void mpq_set_si _PROTO ((mpq_ptr, signed long int, unsigned long int)); -void mpq_set_z _PROTO ((mpq_ptr, mpz_srcptr)); -void mpq_add _PROTO ((mpq_ptr, mpq_srcptr, mpq_srcptr)); -void mpq_sub _PROTO ((mpq_ptr, mpq_srcptr, mpq_srcptr)); -void mpq_mul _PROTO ((mpq_ptr, mpq_srcptr, mpq_srcptr)); -void mpq_div _PROTO ((mpq_ptr, mpq_srcptr, mpq_srcptr)); -void mpq_neg _PROTO ((mpq_ptr, mpq_srcptr)); -int mpq_cmp _PROTO ((mpq_srcptr, mpq_srcptr)); -int mpq_cmp_ui _PROTO ((mpq_srcptr, unsigned long int, unsigned long int)); -int mpq_equal _PROTO ((mpq_srcptr, mpq_srcptr)); -void mpq_inv _PROTO ((mpq_ptr, mpq_srcptr)); -void mpq_set_num _PROTO ((mpq_ptr, mpz_srcptr)); -void mpq_set_den _PROTO ((mpq_ptr, mpz_srcptr)); -void mpq_get_num _PROTO ((mpz_ptr, mpq_srcptr)); -void mpq_get_den _PROTO ((mpz_ptr, mpq_srcptr)); -double mpq_get_d _PROTO ((mpq_srcptr)); -void mpq_canonicalize _PROTO ((mpq_ptr)); - -/**************** Float (i.e. F) routines. ****************/ - -void mpf_abs _PROTO ((mpf_ptr, mpf_srcptr)); -void mpf_add _PROTO ((mpf_ptr, mpf_srcptr, mpf_srcptr)); -void mpf_add_ui _PROTO ((mpf_ptr, mpf_srcptr, unsigned long int)); -void mpf_clear _PROTO ((mpf_ptr)); -int mpf_cmp _PROTO ((mpf_srcptr, mpf_srcptr)); -int mpf_cmp_si _PROTO ((mpf_srcptr, signed long int)); -int mpf_cmp_ui _PROTO ((mpf_srcptr, unsigned long int)); -void mpf_div _PROTO ((mpf_ptr, mpf_srcptr, mpf_srcptr)); -void mpf_div_2exp _PROTO ((mpf_ptr, mpf_srcptr, unsigned long int)); -void mpf_div_ui _PROTO ((mpf_ptr, mpf_srcptr, unsigned long int)); -void mpf_dump _PROTO ((mpf_srcptr)); -int mpf_eq _PROTO ((mpf_srcptr, mpf_srcptr, unsigned long int)); -double mpf_get_d _PROTO ((mpf_srcptr)); -unsigned long int mpf_get_prec _PROTO ((mpf_srcptr)); -char *mpf_get_str _PROTO ((char *, mp_exp_t *, int, size_t, mpf_srcptr)); -void mpf_init _PROTO ((mpf_ptr)); -void mpf_init2 _PROTO ((mpf_ptr, unsigned long int)); -#ifdef _GMP_H_HAVE_FILE -size_t mpf_inp_str _PROTO ((mpf_ptr, FILE *, int)); -#endif -void mpf_init_set _PROTO ((mpf_ptr, mpf_srcptr)); -void mpf_init_set_d _PROTO ((mpf_ptr, double)); -void mpf_init_set_si _PROTO ((mpf_ptr, signed long int)); -int mpf_init_set_str _PROTO ((mpf_ptr, const char *, int)); -void mpf_init_set_ui _PROTO ((mpf_ptr, unsigned long int)); -void mpf_mul _PROTO ((mpf_ptr, mpf_srcptr, mpf_srcptr)); -void mpf_mul_2exp _PROTO ((mpf_ptr, mpf_srcptr, unsigned long int)); -void mpf_mul_ui _PROTO ((mpf_ptr, mpf_srcptr, unsigned long int)); -void mpf_neg _PROTO ((mpf_ptr, mpf_srcptr)); -#ifdef _GMP_H_HAVE_FILE -size_t mpf_out_str _PROTO ((FILE *, int, size_t, mpf_srcptr)); -#endif -void mpf_random2 _PROTO ((mpf_ptr, mp_size_t, mp_exp_t)); -void mpf_reldiff _PROTO ((mpf_ptr, mpf_srcptr, mpf_srcptr)); -void mpf_set _PROTO ((mpf_ptr, mpf_srcptr)); -void mpf_set_d _PROTO ((mpf_ptr, double)); -void mpf_set_default_prec _PROTO ((unsigned long int)); -void mpf_set_prec _PROTO ((mpf_ptr, unsigned long int)); -void mpf_set_prec_raw _PROTO ((mpf_ptr, unsigned long int)); -void mpf_set_q _PROTO ((mpf_ptr, mpq_srcptr)); -void mpf_set_si _PROTO ((mpf_ptr, signed long int)); -int mpf_set_str _PROTO ((mpf_ptr, const char *, int)); -void mpf_set_ui _PROTO ((mpf_ptr, unsigned long int)); -void mpf_set_z _PROTO ((mpf_ptr, mpz_srcptr)); -size_t mpf_size _PROTO ((mpf_srcptr)); -void mpf_sqrt _PROTO ((mpf_ptr, mpf_srcptr)); -void mpf_sqrt_ui _PROTO ((mpf_ptr, unsigned long int)); -void mpf_sub _PROTO ((mpf_ptr, mpf_srcptr, mpf_srcptr)); -void mpf_sub_ui _PROTO ((mpf_ptr, mpf_srcptr, unsigned long int)); -void mpf_ui_div _PROTO ((mpf_ptr, unsigned long int, mpf_srcptr)); -void mpf_ui_sub _PROTO ((mpf_ptr, unsigned long int, mpf_srcptr)); -#if defined (__cplusplus) -} -#endif -/************ Low level positive-integer (i.e. N) routines. ************/ - -/* This is ugly, but we need to make usr calls reach the prefixed function. */ -#define mpn_add __MPN(add) -#define mpn_add_1 __MPN(add_1) -#define mpn_add_n __MPN(add_n) -#define mpn_addmul_1 __MPN(addmul_1) -#define mpn_bdivmod __MPN(bdivmod) -#define mpn_cmp __MPN(cmp) -#define mpn_divmod_1 __MPN(divmod_1) -#define mpn_divrem __MPN(divrem) -#define mpn_divrem_1 __MPN(divrem_1) -#define mpn_dump __MPN(dump) -#define mpn_gcd __MPN(gcd) -#define mpn_gcd_1 __MPN(gcd_1) -#define mpn_gcdext __MPN(gcdext) -#define mpn_get_str __MPN(get_str) -#define mpn_hamdist __MPN(hamdist) -#define mpn_lshift __MPN(lshift) -#define mpn_mod_1 __MPN(mod_1) -#define mpn_mul __MPN(mul) -#define mpn_mul_1 __MPN(mul_1) -#define mpn_mul_n __MPN(mul_n) -#define mpn_perfect_square_p __MPN(perfect_square_p) -#define mpn_popcount __MPN(popcount) -#define mpn_preinv_mod_1 __MPN(preinv_mod_1) -#define mpn_random2 __MPN(random2) -#define mpn_rshift __MPN(rshift) -#define mpn_scan0 __MPN(scan0) -#define mpn_scan1 __MPN(scan1) -#define mpn_set_str __MPN(set_str) -#define mpn_sqrtrem __MPN(sqrtrem) -#define mpn_sub __MPN(sub) -#define mpn_sub_1 __MPN(sub_1) -#define mpn_sub_n __MPN(sub_n) -#define mpn_submul_1 __MPN(submul_1) -#define mpn_udiv_w_sdiv __MPN(udiv_w_sdiv) - -#if defined (__cplusplus) -extern "C" { -#endif -mp_limb_t mpn_add _PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr,mp_size_t)); -mp_limb_t mpn_add_1 _PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t)); -mp_limb_t mpn_add_n _PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t)); -mp_limb_t mpn_addmul_1 _PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t)); -mp_limb_t mpn_bdivmod _PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, unsigned long int)); -int mpn_cmp _PROTO ((mp_srcptr, mp_srcptr, mp_size_t)); -mp_limb_t mpn_divmod_1 _PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t)); -mp_limb_t mpn_divrem _PROTO ((mp_ptr, mp_size_t, mp_ptr, mp_size_t, mp_srcptr, mp_size_t)); -mp_limb_t mpn_divrem_1 _PROTO ((mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t)); -void mpn_dump _PROTO ((mp_srcptr, mp_size_t)); -mp_size_t mpn_gcd _PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_ptr, mp_size_t)); -mp_limb_t mpn_gcd_1 _PROTO ((mp_srcptr, mp_size_t, mp_limb_t)); -mp_size_t mpn_gcdext _PROTO ((mp_ptr, mp_ptr, mp_ptr, mp_size_t, mp_ptr, mp_size_t)); -size_t mpn_get_str _PROTO ((unsigned char *, int, mp_ptr, mp_size_t)); -unsigned long int mpn_hamdist _PROTO ((mp_srcptr, mp_srcptr, mp_size_t)); -mp_limb_t mpn_lshift _PROTO ((mp_ptr, mp_srcptr, mp_size_t, unsigned int)); -mp_limb_t mpn_mod_1 _PROTO ((mp_srcptr, mp_size_t, mp_limb_t)); -mp_limb_t mpn_mul _PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t)); -mp_limb_t mpn_mul_1 _PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t)); -void mpn_mul_n _PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t)); -int mpn_perfect_square_p _PROTO ((mp_srcptr, mp_size_t)); -unsigned long int mpn_popcount _PROTO ((mp_srcptr, mp_size_t)); -mp_limb_t mpn_preinv_mod_1 _PROTO ((mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t)); -void mpn_random2 _PROTO ((mp_ptr, mp_size_t)); -mp_limb_t mpn_rshift _PROTO ((mp_ptr, mp_srcptr, mp_size_t, unsigned int)); -unsigned long int mpn_scan0 _PROTO ((mp_srcptr, unsigned long int)); -unsigned long int mpn_scan1 _PROTO ((mp_srcptr, unsigned long int)); -mp_size_t mpn_set_str _PROTO ((mp_ptr, const unsigned char *, size_t, int)); -mp_size_t mpn_sqrtrem _PROTO ((mp_ptr, mp_ptr, mp_srcptr, mp_size_t)); -mp_limb_t mpn_sub _PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr,mp_size_t)); -mp_limb_t mpn_sub_1 _PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t)); -mp_limb_t mpn_sub_n _PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t)); -mp_limb_t mpn_submul_1 _PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t)); -#if defined (__cplusplus) -} -#endif - -#if defined (__GNUC__) || defined (_FORCE_INLINES) -_EXTERN_INLINE mp_limb_t -#if defined (__STDC__) || defined (__cplusplus) -mpn_add_1 (register mp_ptr res_ptr, - register mp_srcptr s1_ptr, - register mp_size_t s1_size, - register mp_limb_t s2_limb) -#else -mpn_add_1 (res_ptr, s1_ptr, s1_size, s2_limb) - register mp_ptr res_ptr; - register mp_srcptr s1_ptr; - register mp_size_t s1_size; - register mp_limb_t s2_limb; -#endif -{ - register mp_limb_t x; - - x = *s1_ptr++; - s2_limb = x + s2_limb; - *res_ptr++ = s2_limb; - if (s2_limb < x) - { - while (--s1_size != 0) - { - x = *s1_ptr++ + 1; - *res_ptr++ = x; - if (x != 0) - goto fin; - } - - return 1; - } - - fin: - if (res_ptr != s1_ptr) - { - mp_size_t i; - for (i = 0; i < s1_size - 1; i++) - res_ptr[i] = s1_ptr[i]; - } - return 0; -} - -_EXTERN_INLINE mp_limb_t -#if defined (__STDC__) || defined (__cplusplus) -mpn_add (register mp_ptr res_ptr, - register mp_srcptr s1_ptr, - register mp_size_t s1_size, - register mp_srcptr s2_ptr, - register mp_size_t s2_size) -#else -mpn_add (res_ptr, s1_ptr, s1_size, s2_ptr, s2_size) - register mp_ptr res_ptr; - register mp_srcptr s1_ptr; - register mp_size_t s1_size; - register mp_srcptr s2_ptr; - register mp_size_t s2_size; -#endif -{ - mp_limb_t cy_limb = 0; - - if (s2_size != 0) - cy_limb = mpn_add_n (res_ptr, s1_ptr, s2_ptr, s2_size); - - if (s1_size - s2_size != 0) - cy_limb = mpn_add_1 (res_ptr + s2_size, - s1_ptr + s2_size, - s1_size - s2_size, - cy_limb); - return cy_limb; -} - -_EXTERN_INLINE mp_limb_t -#if defined (__STDC__) || defined (__cplusplus) -mpn_sub_1 (register mp_ptr res_ptr, - register mp_srcptr s1_ptr, - register mp_size_t s1_size, - register mp_limb_t s2_limb) -#else -mpn_sub_1 (res_ptr, s1_ptr, s1_size, s2_limb) - register mp_ptr res_ptr; - register mp_srcptr s1_ptr; - register mp_size_t s1_size; - register mp_limb_t s2_limb; -#endif -{ - register mp_limb_t x; - - x = *s1_ptr++; - s2_limb = x - s2_limb; - *res_ptr++ = s2_limb; - if (s2_limb > x) - { - while (--s1_size != 0) - { - x = *s1_ptr++; - *res_ptr++ = x - 1; - if (x != 0) - goto fin; - } - - return 1; - } - - fin: - if (res_ptr != s1_ptr) - { - mp_size_t i; - for (i = 0; i < s1_size - 1; i++) - res_ptr[i] = s1_ptr[i]; - } - return 0; -} - -_EXTERN_INLINE mp_limb_t -#if defined (__STDC__) || defined (__cplusplus) -mpn_sub (register mp_ptr res_ptr, - register mp_srcptr s1_ptr, - register mp_size_t s1_size, - register mp_srcptr s2_ptr, - register mp_size_t s2_size) -#else -mpn_sub (res_ptr, s1_ptr, s1_size, s2_ptr, s2_size) - register mp_ptr res_ptr; - register mp_srcptr s1_ptr; - register mp_size_t s1_size; - register mp_srcptr s2_ptr; - register mp_size_t s2_size; -#endif -{ - mp_limb_t cy_limb = 0; - - if (s2_size != 0) - cy_limb = mpn_sub_n (res_ptr, s1_ptr, s2_ptr, s2_size); - - if (s1_size - s2_size != 0) - cy_limb = mpn_sub_1 (res_ptr + s2_size, - s1_ptr + s2_size, - s1_size - s2_size, - cy_limb); - return cy_limb; -} -#endif /* __GNUC__ */ - -/* Allow faster testing for negative, zero, and positive. */ -#define mpz_sgn(Z) ((Z)->_mp_size < 0 ? -1 : (Z)->_mp_size > 0) -#define mpf_sgn(F) ((F)->_mp_size < 0 ? -1 : (F)->_mp_size > 0) -#define mpq_sgn(Q) ((Q)->_mp_num._mp_size < 0 ? -1 : (Q)->_mp_num._mp_size > 0) - -/* Allow direct user access to numerator and denominator of a mpq_t object. */ -#define mpq_numref(Q) (&((Q)->_mp_num)) -#define mpq_denref(Q) (&((Q)->_mp_den)) - -/* When using GCC, optimize certain common comparisons. */ -#if defined (__GNUC__) -#define mpz_cmp_ui(Z,UI) \ - (__builtin_constant_p (UI) && (UI) == 0 \ - ? mpz_sgn (Z) : mpz_cmp_ui (Z,UI)) -#define mpz_cmp_si(Z,UI) \ - (__builtin_constant_p (UI) && (UI) == 0 ? mpz_sgn (Z) \ - : __builtin_constant_p (UI) && (UI) > 0 ? mpz_cmp_ui (Z,UI) \ - : mpz_cmp_si (Z,UI)) -#define mpq_cmp_ui(Q,NUI,DUI) \ - (__builtin_constant_p (NUI) && (NUI) == 0 \ - ? mpq_sgn (Q) : mpq_cmp_ui (Q,NUI,DUI)) -#endif - -#define mpn_divmod(qp,np,nsize,dp,dsize) mpn_divrem (qp,0,np,nsize,dp,dsize) -#if 0 -#define mpn_divmod_1(qp,np,nsize,dlimb) mpn_divrem_1 (qp,0,np,nsize,dlimb) -#endif - -/* Compatibility with GMP 1. */ -#define mpz_mdiv mpz_fdiv_q -#define mpz_mdivmod mpz_fdiv_qr -#define mpz_mmod mpz_fdiv_r -#define mpz_mdiv_ui mpz_fdiv_q_ui -#define mpz_mdivmod_ui(q,r,n,d) \ - ((r == 0) ? mpz_fdiv_q_ui (q,n,d) : mpz_fdiv_qr_ui (q,r,n,d)) -#define mpz_mmod_ui(r,n,d) \ - ((r == 0) ? mpz_fdiv_ui (n,d) : mpz_fdiv_r_ui (r,n,d)) - -/* Useful synonyms, but not quite compatible with GMP 1. */ -#define mpz_div mpz_fdiv_q -#define mpz_divmod mpz_fdiv_qr -#define mpz_div_ui mpz_fdiv_q_ui -#define mpz_divmod_ui mpz_fdiv_qr_ui -#define mpz_mod_ui mpz_fdiv_r_ui -#define mpz_div_2exp mpz_fdiv_q_2exp -#define mpz_mod_2exp mpz_fdiv_r_2exp - -#define __GNU_MP_VERSION 2 -#define __GNU_MP_VERSION_MINOR 0 -#define __GMP_H__ -#endif /* __GMP_H__ */ diff --git a/lib/gmp/longlong.h b/lib/gmp/longlong.h deleted file mode 100644 index e9c25212..00000000 --- a/lib/gmp/longlong.h +++ /dev/null @@ -1,1410 +0,0 @@ -/* longlong.h -- definitions for mixed size 32/64 bit arithmetic. - -Copyright (C) 1991, 1992, 1993, 1994, 1996 Free Software Foundation, Inc. - -This file is free software; you can redistribute it and/or modify -it under the terms of the GNU Library General Public License as published by -the Free Software Foundation; either version 2 of the License, or (at your -option) any later version. - -This file is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public -License for more details. - -You should have received a copy of the GNU Library General Public License -along with this file; see the file COPYING.LIB. If not, write to -the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -MA 02111-1307, USA. */ - -#define LONGLONG_STANDALONE 1 /* blp 1998/10/29 */ - -/* You have to define the following before including this file: - - UWtype -- An unsigned type, default type for operations (typically a "word") - UHWtype -- An unsigned type, at least half the size of UWtype. - UDWtype -- An unsigned type, at least twice as large a UWtype - W_TYPE_SIZE -- size in bits of UWtype - - SItype, USItype -- Signed and unsigned 32 bit types. - DItype, UDItype -- Signed and unsigned 64 bit types. - - On a 32 bit machine UWtype should typically be USItype; - on a 64 bit machine, UWtype should typically be UDItype. -*/ - -#define __BITS4 (W_TYPE_SIZE / 4) -#define __ll_B ((UWtype) 1 << (W_TYPE_SIZE / 2)) -#define __ll_lowpart(t) ((UWtype) (t) & (__ll_B - 1)) -#define __ll_highpart(t) ((UWtype) (t) >> (W_TYPE_SIZE / 2)) - -/* This is used to make sure no undesirable sharing between different libraries - that use this file takes place. */ -#ifndef __MPN -#define __MPN(x) __##x -#endif - -/* Define auxiliary asm macros. - - 1) umul_ppmm(high_prod, low_prod, multipler, multiplicand) multiplies two - UWtype integers MULTIPLER and MULTIPLICAND, and generates a two UWtype - word product in HIGH_PROD and LOW_PROD. - - 2) __umulsidi3(a,b) multiplies two UWtype integers A and B, and returns a - UDWtype product. This is just a variant of umul_ppmm. - - 3) udiv_qrnnd(quotient, remainder, high_numerator, low_numerator, - denominator) divides a UDWtype, composed by the UWtype integers - HIGH_NUMERATOR and LOW_NUMERATOR, by DENOMINATOR and places the quotient - in QUOTIENT and the remainder in REMAINDER. HIGH_NUMERATOR must be less - than DENOMINATOR for correct operation. If, in addition, the most - significant bit of DENOMINATOR must be 1, then the pre-processor symbol - UDIV_NEEDS_NORMALIZATION is defined to 1. - - 4) sdiv_qrnnd(quotient, remainder, high_numerator, low_numerator, - denominator). Like udiv_qrnnd but the numbers are signed. The quotient - is rounded towards 0. - - 5) count_leading_zeros(count, x) counts the number of zero-bits from the - msb to the first non-zero bit in the UWtype X. This is the number of - steps X needs to be shifted left to set the msb. Undefined for X == 0, - unless the symbol COUNT_LEADING_ZEROS_0 is defined to some value. - - 6) count_trailing_zeros(count, x) like count_leading_zeros, but counts - from the least significant end. - - 7) add_ssaaaa(high_sum, low_sum, high_addend_1, low_addend_1, - high_addend_2, low_addend_2) adds two UWtype integers, composed by - HIGH_ADDEND_1 and LOW_ADDEND_1, and HIGH_ADDEND_2 and LOW_ADDEND_2 - respectively. The result is placed in HIGH_SUM and LOW_SUM. Overflow - (i.e. carry out) is not stored anywhere, and is lost. - - 8) sub_ddmmss(high_difference, low_difference, high_minuend, low_minuend, - high_subtrahend, low_subtrahend) subtracts two two-word UWtype integers, - composed by HIGH_MINUEND_1 and LOW_MINUEND_1, and HIGH_SUBTRAHEND_2 and - LOW_SUBTRAHEND_2 respectively. The result is placed in HIGH_DIFFERENCE - and LOW_DIFFERENCE. Overflow (i.e. carry out) is not stored anywhere, - and is lost. - - If any of these macros are left undefined for a particular CPU, - C macros are used. */ - -/* The CPUs come in alphabetical order below. - - Please add support for more CPUs here, or improve the current support - for the CPUs below! */ - -#if defined (__CHECKER__) -#define NO_ASM -#endif - -#if defined (__GNUC__) && !defined (NO_ASM) - -/* We sometimes need to clobber "cc" with gcc2, but that would not be - understood by gcc1. Use cpp to avoid major code duplication. */ -#if __GNUC__ < 2 -#define __CLOBBER_CC -#define __AND_CLOBBER_CC -#else /* __GNUC__ >= 2 */ -#define __CLOBBER_CC : "cc" -#define __AND_CLOBBER_CC , "cc" -#endif /* __GNUC__ < 2 */ - -#if (defined (__a29k__) || defined (_AM29K)) && W_TYPE_SIZE == 32 -#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ - __asm__ ("add %1,%4,%5 - addc %0,%2,%3" \ - : "=r" ((USItype)(sh)), \ - "=&r" ((USItype)(sl)) \ - : "%r" ((USItype)(ah)), \ - "rI" ((USItype)(bh)), \ - "%r" ((USItype)(al)), \ - "rI" ((USItype)(bl))) -#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ - __asm__ ("sub %1,%4,%5 - subc %0,%2,%3" \ - : "=r" ((USItype)(sh)), \ - "=&r" ((USItype)(sl)) \ - : "r" ((USItype)(ah)), \ - "rI" ((USItype)(bh)), \ - "r" ((USItype)(al)), \ - "rI" ((USItype)(bl))) -#define umul_ppmm(xh, xl, m0, m1) \ - do { \ - USItype __m0 = (m0), __m1 = (m1); \ - __asm__ ("multiplu %0,%1,%2" \ - : "=r" ((USItype)(xl)) \ - : "r" (__m0), \ - "r" (__m1)); \ - __asm__ ("multmu %0,%1,%2" \ - : "=r" ((USItype)(xh)) \ - : "r" (__m0), \ - "r" (__m1)); \ - } while (0) -#define udiv_qrnnd(q, r, n1, n0, d) \ - __asm__ ("dividu %0,%3,%4" \ - : "=r" ((USItype)(q)), \ - "=q" ((USItype)(r)) \ - : "1" ((USItype)(n1)), \ - "r" ((USItype)(n0)), \ - "r" ((USItype)(d))) -#define count_leading_zeros(count, x) \ - __asm__ ("clz %0,%1" \ - : "=r" ((USItype)(count)) \ - : "r" ((USItype)(x))) -#define COUNT_LEADING_ZEROS_0 32 -#endif /* __a29k__ */ - -#if defined (__alpha) && W_TYPE_SIZE == 64 -#define umul_ppmm(ph, pl, m0, m1) \ - do { \ - UDItype __m0 = (m0), __m1 = (m1); \ - __asm__ ("umulh %r1,%2,%0" \ - : "=r" ((UDItype) ph) \ - : "%rJ" (__m0), \ - "rI" (__m1)); \ - (pl) = __m0 * __m1; \ - } while (0) -#define UMUL_TIME 46 -#ifndef LONGLONG_STANDALONE -#define udiv_qrnnd(q, r, n1, n0, d) \ - do { UDItype __r; \ - (q) = __udiv_qrnnd (&__r, (n1), (n0), (d)); \ - (r) = __r; \ - } while (0) -extern UDItype __udiv_qrnnd (); -#define UDIV_TIME 220 -#endif /* LONGLONG_STANDALONE */ -#endif /* __alpha */ - -#if defined (__arm__) && W_TYPE_SIZE == 32 -#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ - __asm__ ("adds %1, %4, %5 - adc %0, %2, %3" \ - : "=r" ((USItype)(sh)), \ - "=&r" ((USItype)(sl)) \ - : "%r" ((USItype)(ah)), \ - "rI" ((USItype)(bh)), \ - "%r" ((USItype)(al)), \ - "rI" ((USItype)(bl))) -#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ - __asm__ ("subs %1, %4, %5 - sbc %0, %2, %3" \ - : "=r" ((USItype)(sh)), \ - "=&r" ((USItype)(sl)) \ - : "r" ((USItype)(ah)), \ - "rI" ((USItype)(bh)), \ - "r" ((USItype)(al)), \ - "rI" ((USItype)(bl))) -#define umul_ppmm(xh, xl, a, b) \ - __asm__ ("%@ Inlined umul_ppmm - mov %|r0, %2, lsr #16 - mov %|r2, %3, lsr #16 - bic %|r1, %2, %|r0, lsl #16 - bic %|r2, %3, %|r2, lsl #16 - mul %1, %|r1, %|r2 - mul %|r2, %|r0, %|r2 - mul %|r1, %0, %|r1 - mul %0, %|r0, %0 - adds %|r1, %|r2, %|r1 - addcs %0, %0, #65536 - adds %1, %1, %|r1, lsl #16 - adc %0, %0, %|r1, lsr #16" \ - : "=&r" ((USItype)(xh)), \ - "=r" ((USItype)(xl)) \ - : "r" ((USItype)(a)), \ - "r" ((USItype)(b)) \ - : "r0", "r1", "r2") -#define UMUL_TIME 20 -#define UDIV_TIME 100 -#endif /* __arm__ */ - -#if defined (__clipper__) && W_TYPE_SIZE == 32 -#define umul_ppmm(w1, w0, u, v) \ - ({union {UDItype __ll; \ - struct {USItype __l, __h;} __i; \ - } __xx; \ - __asm__ ("mulwux %2,%0" \ - : "=r" (__xx.__ll) \ - : "%0" ((USItype)(u)), \ - "r" ((USItype)(v))); \ - (w1) = __xx.__i.__h; (w0) = __xx.__i.__l;}) -#define smul_ppmm(w1, w0, u, v) \ - ({union {DItype __ll; \ - struct {SItype __l, __h;} __i; \ - } __xx; \ - __asm__ ("mulwx %2,%0" \ - : "=r" (__xx.__ll) \ - : "%0" ((SItype)(u)), \ - "r" ((SItype)(v))); \ - (w1) = __xx.__i.__h; (w0) = __xx.__i.__l;}) -#define __umulsidi3(u, v) \ - ({UDItype __w; \ - __asm__ ("mulwux %2,%0" \ - : "=r" (__w) \ - : "%0" ((USItype)(u)), \ - "r" ((USItype)(v))); \ - __w; }) -#endif /* __clipper__ */ - -#if defined (__gmicro__) && W_TYPE_SIZE == 32 -#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ - __asm__ ("add.w %5,%1 - addx %3,%0" \ - : "=g" ((USItype)(sh)), \ - "=&g" ((USItype)(sl)) \ - : "%0" ((USItype)(ah)), \ - "g" ((USItype)(bh)), \ - "%1" ((USItype)(al)), \ - "g" ((USItype)(bl))) -#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ - __asm__ ("sub.w %5,%1 - subx %3,%0" \ - : "=g" ((USItype)(sh)), \ - "=&g" ((USItype)(sl)) \ - : "0" ((USItype)(ah)), \ - "g" ((USItype)(bh)), \ - "1" ((USItype)(al)), \ - "g" ((USItype)(bl))) -#define umul_ppmm(ph, pl, m0, m1) \ - __asm__ ("mulx %3,%0,%1" \ - : "=g" ((USItype)(ph)), \ - "=r" ((USItype)(pl)) \ - : "%0" ((USItype)(m0)), \ - "g" ((USItype)(m1))) -#define udiv_qrnnd(q, r, nh, nl, d) \ - __asm__ ("divx %4,%0,%1" \ - : "=g" ((USItype)(q)), \ - "=r" ((USItype)(r)) \ - : "1" ((USItype)(nh)), \ - "0" ((USItype)(nl)), \ - "g" ((USItype)(d))) -#define count_leading_zeros(count, x) \ - __asm__ ("bsch/1 %1,%0" \ - : "=g" (count) \ - : "g" ((USItype)(x)), \ - "0" ((USItype)0)) -#endif - -#if defined (__hppa) && W_TYPE_SIZE == 32 -#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ - __asm__ ("add %4,%5,%1 - addc %2,%3,%0" \ - : "=r" ((USItype)(sh)), \ - "=&r" ((USItype)(sl)) \ - : "%rM" ((USItype)(ah)), \ - "rM" ((USItype)(bh)), \ - "%rM" ((USItype)(al)), \ - "rM" ((USItype)(bl))) -#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ - __asm__ ("sub %4,%5,%1 - subb %2,%3,%0" \ - : "=r" ((USItype)(sh)), \ - "=&r" ((USItype)(sl)) \ - : "rM" ((USItype)(ah)), \ - "rM" ((USItype)(bh)), \ - "rM" ((USItype)(al)), \ - "rM" ((USItype)(bl))) -#if defined (_PA_RISC1_1) -#define umul_ppmm(wh, wl, u, v) \ - do { \ - union {UDItype __ll; \ - struct {USItype __h, __l;} __i; \ - } __xx; \ - __asm__ ("xmpyu %1,%2,%0" \ - : "=*f" (__xx.__ll) \ - : "*f" ((USItype)(u)), \ - "*f" ((USItype)(v))); \ - (wh) = __xx.__i.__h; \ - (wl) = __xx.__i.__l; \ - } while (0) -#define UMUL_TIME 8 -#define UDIV_TIME 60 -#else -#define UMUL_TIME 40 -#define UDIV_TIME 80 -#endif -#ifndef LONGLONG_STANDALONE -#define udiv_qrnnd(q, r, n1, n0, d) \ - do { USItype __r; \ - (q) = __udiv_qrnnd (&__r, (n1), (n0), (d)); \ - (r) = __r; \ - } while (0) -extern USItype __udiv_qrnnd (); -#endif /* LONGLONG_STANDALONE */ -#define count_leading_zeros(count, x) \ - do { \ - USItype __tmp; \ - __asm__ ( \ - "ldi 1,%0 - extru,= %1,15,16,%%r0 ; Bits 31..16 zero? - extru,tr %1,15,16,%1 ; No. Shift down, skip add. - ldo 16(%0),%0 ; Yes. Perform add. - extru,= %1,23,8,%%r0 ; Bits 15..8 zero? - extru,tr %1,23,8,%1 ; No. Shift down, skip add. - ldo 8(%0),%0 ; Yes. Perform add. - extru,= %1,27,4,%%r0 ; Bits 7..4 zero? - extru,tr %1,27,4,%1 ; No. Shift down, skip add. - ldo 4(%0),%0 ; Yes. Perform add. - extru,= %1,29,2,%%r0 ; Bits 3..2 zero? - extru,tr %1,29,2,%1 ; No. Shift down, skip add. - ldo 2(%0),%0 ; Yes. Perform add. - extru %1,30,1,%1 ; Extract bit 1. - sub %0,%1,%0 ; Subtract it. - " : "=r" (count), "=r" (__tmp) : "1" (x)); \ - } while (0) -#endif /* hppa */ - -#if (defined (__i370__) || defined (__mvs__)) && W_TYPE_SIZE == 32 -#define umul_ppmm(xh, xl, m0, m1) \ - do { \ - union {UDItype __ll; \ - struct {USItype __h, __l;} __i; \ - } __xx; \ - USItype __m0 = (m0), __m1 = (m1); \ - __asm__ ("mr %0,%3" \ - : "=r" (__xx.__i.__h), \ - "=r" (__xx.__i.__l) \ - : "%1" (__m0), \ - "r" (__m1)); \ - (xh) = __xx.__i.__h; (xl) = __xx.__i.__l; \ - (xh) += ((((SItype) __m0 >> 31) & __m1) \ - + (((SItype) __m1 >> 31) & __m0)); \ - } while (0) -#define smul_ppmm(xh, xl, m0, m1) \ - do { \ - union {DItype __ll; \ - struct {USItype __h, __l;} __i; \ - } __xx; \ - __asm__ ("mr %0,%3" \ - : "=r" (__xx.__i.__h), \ - "=r" (__xx.__i.__l) \ - : "%1" (m0), \ - "r" (m1)); \ - (xh) = __xx.__i.__h; (xl) = __xx.__i.__l; \ - } while (0) -#define sdiv_qrnnd(q, r, n1, n0, d) \ - do { \ - union {DItype __ll; \ - struct {USItype __h, __l;} __i; \ - } __xx; \ - __xx.__i.__h = n1; __xx.__i.__l = n0; \ - __asm__ ("dr %0,%2" \ - : "=r" (__xx.__ll) \ - : "0" (__xx.__ll), "r" (d)); \ - (q) = __xx.__i.__l; (r) = __xx.__i.__h; \ - } while (0) -#endif - -#if (defined (__i386__) || defined (__i486__)) && W_TYPE_SIZE == 32 -#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ - __asm__ ("addl %5,%1 - adcl %3,%0" \ - : "=r" ((USItype)(sh)), \ - "=&r" ((USItype)(sl)) \ - : "%0" ((USItype)(ah)), \ - "g" ((USItype)(bh)), \ - "%1" ((USItype)(al)), \ - "g" ((USItype)(bl))) -#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ - __asm__ ("subl %5,%1 - sbbl %3,%0" \ - : "=r" ((USItype)(sh)), \ - "=&r" ((USItype)(sl)) \ - : "0" ((USItype)(ah)), \ - "g" ((USItype)(bh)), \ - "1" ((USItype)(al)), \ - "g" ((USItype)(bl))) -#define umul_ppmm(w1, w0, u, v) \ - __asm__ ("mull %3" \ - : "=a" ((USItype)(w0)), \ - "=d" ((USItype)(w1)) \ - : "%0" ((USItype)(u)), \ - "rm" ((USItype)(v))) -#define udiv_qrnnd(q, r, n1, n0, d) \ - __asm__ ("divl %4" \ - : "=a" ((USItype)(q)), \ - "=d" ((USItype)(r)) \ - : "0" ((USItype)(n0)), \ - "1" ((USItype)(n1)), \ - "rm" ((USItype)(d))) -#define count_leading_zeros(count, x) \ - do { \ - USItype __cbtmp; \ - __asm__ ("bsrl %1,%0" \ - : "=r" (__cbtmp) : "rm" ((USItype)(x))); \ - (count) = __cbtmp ^ 31; \ - } while (0) -#define count_trailing_zeros(count, x) \ - __asm__ ("bsfl %1,%0" : "=r" (count) : "rm" ((USItype)(x))) -#ifndef UMUL_TIME -#define UMUL_TIME 40 -#endif -#ifndef UDIV_TIME -#define UDIV_TIME 40 -#endif -#endif /* 80x86 */ - -#if defined (__i860__) && W_TYPE_SIZE == 32 -#define rshift_rhlc(r,h,l,c) \ - __asm__ ("shr %3,r0,r0\;shrd %1,%2,%0" \ - "=r" (r) : "r" (h), "r" (l), "rn" (c)) -#endif /* i860 */ - -#if defined (__i960__) && W_TYPE_SIZE == 32 -#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ - __asm__ ("cmpo 1,0\;addc %5,%4,%1\;addc %3,%2,%0" \ - : "=r" ((USItype)(sh)), \ - "=&r" ((USItype)(sl)) \ - : "%dI" ((USItype)(ah)), \ - "dI" ((USItype)(bh)), \ - "%dI" ((USItype)(al)), \ - "dI" ((USItype)(bl))) -#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ - __asm__ ("cmpo 0,0\;subc %5,%4,%1\;subc %3,%2,%0" \ - : "=r" ((USItype)(sh)), \ - "=&r" ((USItype)(sl)) \ - : "dI" ((USItype)(ah)), \ - "dI" ((USItype)(bh)), \ - "dI" ((USItype)(al)), \ - "dI" ((USItype)(bl))) -#define umul_ppmm(w1, w0, u, v) \ - ({union {UDItype __ll; \ - struct {USItype __l, __h;} __i; \ - } __xx; \ - __asm__ ("emul %2,%1,%0" \ - : "=d" (__xx.__ll) \ - : "%dI" ((USItype)(u)), \ - "dI" ((USItype)(v))); \ - (w1) = __xx.__i.__h; (w0) = __xx.__i.__l;}) -#define __umulsidi3(u, v) \ - ({UDItype __w; \ - __asm__ ("emul %2,%1,%0" \ - : "=d" (__w) \ - : "%dI" ((USItype)(u)), \ - "dI" ((USItype)(v))); \ - __w; }) -#define udiv_qrnnd(q, r, nh, nl, d) \ - do { \ - union {UDItype __ll; \ - struct {USItype __l, __h;} __i; \ - } __nn; \ - __nn.__i.__h = (nh); __nn.__i.__l = (nl); \ - __asm__ ("ediv %d,%n,%0" \ - : "=d" (__rq.__ll) \ - : "dI" (__nn.__ll), \ - "dI" ((USItype)(d))); \ - (r) = __rq.__i.__l; (q) = __rq.__i.__h; \ - } while (0) -#define count_leading_zeros(count, x) \ - do { \ - USItype __cbtmp; \ - __asm__ ("scanbit %1,%0" \ - : "=r" (__cbtmp) \ - : "r" ((USItype)(x))); \ - (count) = __cbtmp ^ 31; \ - } while (0) -#define COUNT_LEADING_ZEROS_0 (-32) /* sic */ -#if defined (__i960mx) /* what is the proper symbol to test??? */ -#define rshift_rhlc(r,h,l,c) \ - do { \ - union {UDItype __ll; \ - struct {USItype __l, __h;} __i; \ - } __nn; \ - __nn.__i.__h = (h); __nn.__i.__l = (l); \ - __asm__ ("shre %2,%1,%0" \ - : "=d" (r) : "dI" (__nn.__ll), "dI" (c)); \ - } -#endif /* i960mx */ -#endif /* i960 */ - -#if (defined (__mc68000__) || defined (__mc68020__) || defined (__NeXT__) || defined(mc68020)) && W_TYPE_SIZE == 32 -#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ - __asm__ ("add%.l %5,%1 - addx%.l %3,%0" \ - : "=d" ((USItype)(sh)), \ - "=&d" ((USItype)(sl)) \ - : "%0" ((USItype)(ah)), \ - "d" ((USItype)(bh)), \ - "%1" ((USItype)(al)), \ - "g" ((USItype)(bl))) -#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ - __asm__ ("sub%.l %5,%1 - subx%.l %3,%0" \ - : "=d" ((USItype)(sh)), \ - "=&d" ((USItype)(sl)) \ - : "0" ((USItype)(ah)), \ - "d" ((USItype)(bh)), \ - "1" ((USItype)(al)), \ - "g" ((USItype)(bl))) -#if (defined (__mc68020__) || defined (__NeXT__) || defined(mc68020)) -#define umul_ppmm(w1, w0, u, v) \ - __asm__ ("mulu%.l %3,%1:%0" \ - : "=d" ((USItype)(w0)), \ - "=d" ((USItype)(w1)) \ - : "%0" ((USItype)(u)), \ - "dmi" ((USItype)(v))) -#define UMUL_TIME 45 -#define udiv_qrnnd(q, r, n1, n0, d) \ - __asm__ ("divu%.l %4,%1:%0" \ - : "=d" ((USItype)(q)), \ - "=d" ((USItype)(r)) \ - : "0" ((USItype)(n0)), \ - "1" ((USItype)(n1)), \ - "dmi" ((USItype)(d))) -#define UDIV_TIME 90 -#define sdiv_qrnnd(q, r, n1, n0, d) \ - __asm__ ("divs%.l %4,%1:%0" \ - : "=d" ((USItype)(q)), \ - "=d" ((USItype)(r)) \ - : "0" ((USItype)(n0)), \ - "1" ((USItype)(n1)), \ - "dmi" ((USItype)(d))) -#define count_leading_zeros(count, x) \ - __asm__ ("bfffo %1{%b2:%b2},%0" \ - : "=d" ((USItype)(count)) \ - : "od" ((USItype)(x)), "n" (0)) -#define COUNT_LEADING_ZEROS_0 32 -#else /* not mc68020 */ -#define umul_ppmm(xh, xl, a, b) \ - do { USItype __umul_tmp1, __umul_tmp2; \ - __asm__ ("| Inlined umul_ppmm - move%.l %5,%3 - move%.l %2,%0 - move%.w %3,%1 - swap %3 - swap %0 - mulu %2,%1 - mulu %3,%0 - mulu %2,%3 - swap %2 - mulu %5,%2 - add%.l %3,%2 - jcc 1f - add%.l %#0x10000,%0 -1: move%.l %2,%3 - clr%.w %2 - swap %2 - swap %3 - clr%.w %3 - add%.l %3,%1 - addx%.l %2,%0 - | End inlined umul_ppmm" \ - : "=&d" ((USItype)(xh)), "=&d" ((USItype)(xl)), \ - "=d" (__umul_tmp1), "=&d" (__umul_tmp2) \ - : "%2" ((USItype)(a)), "d" ((USItype)(b))); \ - } while (0) -#define UMUL_TIME 100 -#define UDIV_TIME 400 -#endif /* not mc68020 */ -#endif /* mc68000 */ - -#if defined (__m88000__) && W_TYPE_SIZE == 32 -#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ - __asm__ ("addu.co %1,%r4,%r5 - addu.ci %0,%r2,%r3" \ - : "=r" ((USItype)(sh)), \ - "=&r" ((USItype)(sl)) \ - : "%rJ" ((USItype)(ah)), \ - "rJ" ((USItype)(bh)), \ - "%rJ" ((USItype)(al)), \ - "rJ" ((USItype)(bl))) -#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ - __asm__ ("subu.co %1,%r4,%r5 - subu.ci %0,%r2,%r3" \ - : "=r" ((USItype)(sh)), \ - "=&r" ((USItype)(sl)) \ - : "rJ" ((USItype)(ah)), \ - "rJ" ((USItype)(bh)), \ - "rJ" ((USItype)(al)), \ - "rJ" ((USItype)(bl))) -#define count_leading_zeros(count, x) \ - do { \ - USItype __cbtmp; \ - __asm__ ("ff1 %0,%1" \ - : "=r" (__cbtmp) \ - : "r" ((USItype)(x))); \ - (count) = __cbtmp ^ 31; \ - } while (0) -#define COUNT_LEADING_ZEROS_0 63 /* sic */ -#if defined (__m88110__) -#define umul_ppmm(wh, wl, u, v) \ - do { \ - union {UDItype __ll; \ - struct {USItype __h, __l;} __i; \ - } __xx; \ - __asm__ ("mulu.d %0,%1,%2" \ - : "=r" (__xx.__ll) \ - : "r" ((USItype)(u)), \ - "r" ((USItype)(v))); \ - (wh) = __xx.__i.__h; \ - (wl) = __xx.__i.__l; \ - } while (0) -#define udiv_qrnnd(q, r, n1, n0, d) \ - ({union {UDItype __ll; \ - struct {USItype __h, __l;} __i; \ - } __xx; \ - USItype __q; \ - __xx.__i.__h = (n1); __xx.__i.__l = (n0); \ - __asm__ ("divu.d %0,%1,%2" \ - : "=r" (__q) \ - : "r" (__xx.__ll), \ - "r" ((USItype)(d))); \ - (r) = (n0) - __q * (d); (q) = __q; }) -#define UMUL_TIME 5 -#define UDIV_TIME 25 -#else -#define UMUL_TIME 17 -#define UDIV_TIME 150 -#endif /* __m88110__ */ -#endif /* __m88000__ */ - -#if defined (__mips__) && W_TYPE_SIZE == 32 -#if __GNUC__ > 2 || __GNUC_MINOR__ >= 7 -#define umul_ppmm(w1, w0, u, v) \ - __asm__ ("multu %2,%3" \ - : "=l" ((USItype)(w0)), \ - "=h" ((USItype)(w1)) \ - : "d" ((USItype)(u)), \ - "d" ((USItype)(v))) -#else -#define umul_ppmm(w1, w0, u, v) \ - __asm__ ("multu %2,%3 - mflo %0 - mfhi %1" \ - : "=d" ((USItype)(w0)), \ - "=d" ((USItype)(w1)) \ - : "d" ((USItype)(u)), \ - "d" ((USItype)(v))) -#endif -#define UMUL_TIME 10 -#define UDIV_TIME 100 -#endif /* __mips__ */ - -#if (defined (__mips) && __mips >= 3) && W_TYPE_SIZE == 64 -#if __GNUC__ > 2 || __GNUC_MINOR__ >= 7 -#define umul_ppmm(w1, w0, u, v) \ - __asm__ ("dmultu %2,%3" \ - : "=l" ((UDItype)(w0)), \ - "=h" ((UDItype)(w1)) \ - : "d" ((UDItype)(u)), \ - "d" ((UDItype)(v))) -#else -#define umul_ppmm(w1, w0, u, v) \ - __asm__ ("dmultu %2,%3 - mflo %0 - mfhi %1" \ - : "=d" ((UDItype)(w0)), \ - "=d" ((UDItype)(w1)) \ - : "d" ((UDItype)(u)), \ - "d" ((UDItype)(v))) -#endif -#define UMUL_TIME 20 -#define UDIV_TIME 140 -#endif /* __mips__ */ - -#if defined (__ns32000__) && W_TYPE_SIZE == 32 -#define umul_ppmm(w1, w0, u, v) \ - ({union {UDItype __ll; \ - struct {USItype __l, __h;} __i; \ - } __xx; \ - __asm__ ("meid %2,%0" \ - : "=g" (__xx.__ll) \ - : "%0" ((USItype)(u)), \ - "g" ((USItype)(v))); \ - (w1) = __xx.__i.__h; (w0) = __xx.__i.__l;}) -#define __umulsidi3(u, v) \ - ({UDItype __w; \ - __asm__ ("meid %2,%0" \ - : "=g" (__w) \ - : "%0" ((USItype)(u)), \ - "g" ((USItype)(v))); \ - __w; }) -#define udiv_qrnnd(q, r, n1, n0, d) \ - ({union {UDItype __ll; \ - struct {USItype __l, __h;} __i; \ - } __xx; \ - __xx.__i.__h = (n1); __xx.__i.__l = (n0); \ - __asm__ ("deid %2,%0" \ - : "=g" (__xx.__ll) \ - : "0" (__xx.__ll), \ - "g" ((USItype)(d))); \ - (r) = __xx.__i.__l; (q) = __xx.__i.__h; }) -#define count_trailing_zeros(count,x) \ - do { - __asm__ ("ffsd %2,%0" \ - : "=r" ((USItype) (count)) \ - : "0" ((USItype) 0), \ - "r" ((USItype) (x))); \ - } while (0) -#endif /* __ns32000__ */ - -#if (defined (_ARCH_PPC) || defined (_IBMR2)) && W_TYPE_SIZE == 32 -#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ - do { \ - if (__builtin_constant_p (bh) && (bh) == 0) \ - __asm__ ("{a%I4|add%I4c} %1,%3,%4\n\t{aze|addze} %0,%2" \ - : "=r" ((USItype)(sh)), \ - "=&r" ((USItype)(sl)) \ - : "%r" ((USItype)(ah)), \ - "%r" ((USItype)(al)), \ - "rI" ((USItype)(bl))); \ - else if (__builtin_constant_p (bh) && (bh) ==~(USItype) 0) \ - __asm__ ("{a%I4|add%I4c} %1,%3,%4\n\t{ame|addme} %0,%2" \ - : "=r" ((USItype)(sh)), \ - "=&r" ((USItype)(sl)) \ - : "%r" ((USItype)(ah)), \ - "%r" ((USItype)(al)), \ - "rI" ((USItype)(bl))); \ - else \ - __asm__ ("{a%I5|add%I5c} %1,%4,%5\n\t{ae|adde} %0,%2,%3" \ - : "=r" ((USItype)(sh)), \ - "=&r" ((USItype)(sl)) \ - : "%r" ((USItype)(ah)), \ - "r" ((USItype)(bh)), \ - "%r" ((USItype)(al)), \ - "rI" ((USItype)(bl))); \ - } while (0) -#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ - do { \ - if (__builtin_constant_p (ah) && (ah) == 0) \ - __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{sfze|subfze} %0,%2" \ - : "=r" ((USItype)(sh)), \ - "=&r" ((USItype)(sl)) \ - : "r" ((USItype)(bh)), \ - "rI" ((USItype)(al)), \ - "r" ((USItype)(bl))); \ - else if (__builtin_constant_p (ah) && (ah) ==~(USItype) 0) \ - __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{sfme|subfme} %0,%2" \ - : "=r" ((USItype)(sh)), \ - "=&r" ((USItype)(sl)) \ - : "r" ((USItype)(bh)), \ - "rI" ((USItype)(al)), \ - "r" ((USItype)(bl))); \ - else if (__builtin_constant_p (bh) && (bh) == 0) \ - __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{ame|addme} %0,%2" \ - : "=r" ((USItype)(sh)), \ - "=&r" ((USItype)(sl)) \ - : "r" ((USItype)(ah)), \ - "rI" ((USItype)(al)), \ - "r" ((USItype)(bl))); \ - else if (__builtin_constant_p (bh) && (bh) ==~(USItype) 0) \ - __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{aze|addze} %0,%2" \ - : "=r" ((USItype)(sh)), \ - "=&r" ((USItype)(sl)) \ - : "r" ((USItype)(ah)), \ - "rI" ((USItype)(al)), \ - "r" ((USItype)(bl))); \ - else \ - __asm__ ("{sf%I4|subf%I4c} %1,%5,%4\n\t{sfe|subfe} %0,%3,%2" \ - : "=r" ((USItype)(sh)), \ - "=&r" ((USItype)(sl)) \ - : "r" ((USItype)(ah)), \ - "r" ((USItype)(bh)), \ - "rI" ((USItype)(al)), \ - "r" ((USItype)(bl))); \ - } while (0) -#define count_leading_zeros(count, x) \ - __asm__ ("{cntlz|cntlzw} %0,%1" \ - : "=r" ((USItype)(count)) \ - : "r" ((USItype)(x))) -#define COUNT_LEADING_ZEROS_0 32 -#if defined (_ARCH_PPC) -#define umul_ppmm(ph, pl, m0, m1) \ - do { \ - USItype __m0 = (m0), __m1 = (m1); \ - __asm__ ("mulhwu %0,%1,%2" \ - : "=r" ((USItype) ph) \ - : "%r" (__m0), \ - "r" (__m1)); \ - (pl) = __m0 * __m1; \ - } while (0) -#define UMUL_TIME 15 -#define smul_ppmm(ph, pl, m0, m1) \ - do { \ - SItype __m0 = (m0), __m1 = (m1); \ - __asm__ ("mulhw %0,%1,%2" \ - : "=r" ((SItype) ph) \ - : "%r" (__m0), \ - "r" (__m1)); \ - (pl) = __m0 * __m1; \ - } while (0) -#define SMUL_TIME 14 -#define UDIV_TIME 120 -#else -#define umul_ppmm(xh, xl, m0, m1) \ - do { \ - USItype __m0 = (m0), __m1 = (m1); \ - __asm__ ("mul %0,%2,%3" \ - : "=r" ((USItype)(xh)), \ - "=q" ((USItype)(xl)) \ - : "r" (__m0), \ - "r" (__m1)); \ - (xh) += ((((SItype) __m0 >> 31) & __m1) \ - + (((SItype) __m1 >> 31) & __m0)); \ - } while (0) -#define UMUL_TIME 8 -#define smul_ppmm(xh, xl, m0, m1) \ - __asm__ ("mul %0,%2,%3" \ - : "=r" ((SItype)(xh)), \ - "=q" ((SItype)(xl)) \ - : "r" (m0), \ - "r" (m1)) -#define SMUL_TIME 4 -#define sdiv_qrnnd(q, r, nh, nl, d) \ - __asm__ ("div %0,%2,%4" \ - : "=r" ((SItype)(q)), "=q" ((SItype)(r)) \ - : "r" ((SItype)(nh)), "1" ((SItype)(nl)), "r" ((SItype)(d))) -#define UDIV_TIME 100 -#endif -#endif /* Power architecture variants. */ - -#if defined (__pyr__) && W_TYPE_SIZE == 32 -#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ - __asm__ ("addw %5,%1 - addwc %3,%0" \ - : "=r" ((USItype)(sh)), \ - "=&r" ((USItype)(sl)) \ - : "%0" ((USItype)(ah)), \ - "g" ((USItype)(bh)), \ - "%1" ((USItype)(al)), \ - "g" ((USItype)(bl))) -#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ - __asm__ ("subw %5,%1 - subwb %3,%0" \ - : "=r" ((USItype)(sh)), \ - "=&r" ((USItype)(sl)) \ - : "0" ((USItype)(ah)), \ - "g" ((USItype)(bh)), \ - "1" ((USItype)(al)), \ - "g" ((USItype)(bl))) -/* This insn works on Pyramids with AP, XP, or MI CPUs, but not with SP. */ -#define umul_ppmm(w1, w0, u, v) \ - ({union {UDItype __ll; \ - struct {USItype __h, __l;} __i; \ - } __xx; \ - __asm__ ("movw %1,%R0 - uemul %2,%0" \ - : "=&r" (__xx.__ll) \ - : "g" ((USItype) (u)), \ - "g" ((USItype)(v))); \ - (w1) = __xx.__i.__h; (w0) = __xx.__i.__l;}) -#endif /* __pyr__ */ - -#if defined (__ibm032__) /* RT/ROMP */ && W_TYPE_SIZE == 32 -#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ - __asm__ ("a %1,%5 - ae %0,%3" \ - : "=r" ((USItype)(sh)), \ - "=&r" ((USItype)(sl)) \ - : "%0" ((USItype)(ah)), \ - "r" ((USItype)(bh)), \ - "%1" ((USItype)(al)), \ - "r" ((USItype)(bl))) -#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ - __asm__ ("s %1,%5 - se %0,%3" \ - : "=r" ((USItype)(sh)), \ - "=&r" ((USItype)(sl)) \ - : "0" ((USItype)(ah)), \ - "r" ((USItype)(bh)), \ - "1" ((USItype)(al)), \ - "r" ((USItype)(bl))) -#define umul_ppmm(ph, pl, m0, m1) \ - do { \ - USItype __m0 = (m0), __m1 = (m1); \ - __asm__ ( \ - "s r2,r2 - mts r10,%2 - m r2,%3 - m r2,%3 - m r2,%3 - m r2,%3 - m r2,%3 - m r2,%3 - m r2,%3 - m r2,%3 - m r2,%3 - m r2,%3 - m r2,%3 - m r2,%3 - m r2,%3 - m r2,%3 - m r2,%3 - m r2,%3 - cas %0,r2,r0 - mfs r10,%1" \ - : "=r" ((USItype)(ph)), \ - "=r" ((USItype)(pl)) \ - : "%r" (__m0), \ - "r" (__m1) \ - : "r2"); \ - (ph) += ((((SItype) __m0 >> 31) & __m1) \ - + (((SItype) __m1 >> 31) & __m0)); \ - } while (0) -#define UMUL_TIME 20 -#define UDIV_TIME 200 -#define count_leading_zeros(count, x) \ - do { \ - if ((x) >= 0x10000) \ - __asm__ ("clz %0,%1" \ - : "=r" ((USItype)(count)) \ - : "r" ((USItype)(x) >> 16)); \ - else \ - { \ - __asm__ ("clz %0,%1" \ - : "=r" ((USItype)(count)) \ - : "r" ((USItype)(x))); \ - (count) += 16; \ - } \ - } while (0) -#endif /* RT/ROMP */ - -#if defined (__sh2__) && W_TYPE_SIZE == 32 -#define umul_ppmm(w1, w0, u, v) \ - __asm__ ( \ - "dmulu.l %2,%3 - sts macl,%1 - sts mach,%0" \ - : "=r" ((USItype)(w1)), \ - "=r" ((USItype)(w0)) \ - : "r" ((USItype)(u)), \ - "r" ((USItype)(v)) \ - : "macl", "mach") -#define UMUL_TIME 5 -#endif - -#if defined (__sparc__) && W_TYPE_SIZE == 32 -#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ - __asm__ ("addcc %r4,%5,%1 - addx %r2,%3,%0" \ - : "=r" ((USItype)(sh)), \ - "=&r" ((USItype)(sl)) \ - : "%rJ" ((USItype)(ah)), \ - "rI" ((USItype)(bh)), \ - "%rJ" ((USItype)(al)), \ - "rI" ((USItype)(bl)) \ - __CLOBBER_CC) -#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ - __asm__ ("subcc %r4,%5,%1 - subx %r2,%3,%0" \ - : "=r" ((USItype)(sh)), \ - "=&r" ((USItype)(sl)) \ - : "rJ" ((USItype)(ah)), \ - "rI" ((USItype)(bh)), \ - "rJ" ((USItype)(al)), \ - "rI" ((USItype)(bl)) \ - __CLOBBER_CC) -#if defined (__sparc_v8__) -/* Don't match immediate range because, 1) it is not often useful, - 2) the 'I' flag thinks of the range as a 13 bit signed interval, - while we want to match a 13 bit interval, sign extended to 32 bits, - but INTERPRETED AS UNSIGNED. */ -#define umul_ppmm(w1, w0, u, v) \ - __asm__ ("umul %2,%3,%1;rd %%y,%0" \ - : "=r" ((USItype)(w1)), \ - "=r" ((USItype)(w0)) \ - : "r" ((USItype)(u)), \ - "r" ((USItype)(v))) -#define UMUL_TIME 5 -#ifndef SUPERSPARC /* SuperSPARC's udiv only handles 53 bit dividends */ -#define udiv_qrnnd(q, r, n1, n0, d) \ - do { \ - USItype __q; \ - __asm__ ("mov %1,%%y;nop;nop;nop;udiv %2,%3,%0" \ - : "=r" ((USItype)(__q)) \ - : "r" ((USItype)(n1)), \ - "r" ((USItype)(n0)), \ - "r" ((USItype)(d))); \ - (r) = (n0) - __q * (d); \ - (q) = __q; \ - } while (0) -#define UDIV_TIME 25 -#endif /* SUPERSPARC */ -#else /* ! __sparc_v8__ */ -#if defined (__sparclite__) -/* This has hardware multiply but not divide. It also has two additional - instructions scan (ffs from high bit) and divscc. */ -#define umul_ppmm(w1, w0, u, v) \ - __asm__ ("umul %2,%3,%1;rd %%y,%0" \ - : "=r" ((USItype)(w1)), \ - "=r" ((USItype)(w0)) \ - : "r" ((USItype)(u)), \ - "r" ((USItype)(v))) -#define UMUL_TIME 5 -#define udiv_qrnnd(q, r, n1, n0, d) \ - __asm__ ("! Inlined udiv_qrnnd - wr %%g0,%2,%%y ! Not a delayed write for sparclite - tst %%g0 - divscc %3,%4,%%g1 - divscc %%g1,%4,%%g1 - divscc %%g1,%4,%%g1 - divscc %%g1,%4,%%g1 - divscc %%g1,%4,%%g1 - divscc %%g1,%4,%%g1 - divscc %%g1,%4,%%g1 - divscc %%g1,%4,%%g1 - divscc %%g1,%4,%%g1 - divscc %%g1,%4,%%g1 - divscc %%g1,%4,%%g1 - divscc %%g1,%4,%%g1 - divscc %%g1,%4,%%g1 - divscc %%g1,%4,%%g1 - divscc %%g1,%4,%%g1 - divscc %%g1,%4,%%g1 - divscc %%g1,%4,%%g1 - divscc %%g1,%4,%%g1 - divscc %%g1,%4,%%g1 - divscc %%g1,%4,%%g1 - divscc %%g1,%4,%%g1 - divscc %%g1,%4,%%g1 - divscc %%g1,%4,%%g1 - divscc %%g1,%4,%%g1 - divscc %%g1,%4,%%g1 - divscc %%g1,%4,%%g1 - divscc %%g1,%4,%%g1 - divscc %%g1,%4,%%g1 - divscc %%g1,%4,%%g1 - divscc %%g1,%4,%%g1 - divscc %%g1,%4,%%g1 - divscc %%g1,%4,%0 - rd %%y,%1 - bl,a 1f - add %1,%4,%1 -1: ! End of inline udiv_qrnnd" \ - : "=r" ((USItype)(q)), \ - "=r" ((USItype)(r)) \ - : "r" ((USItype)(n1)), \ - "r" ((USItype)(n0)), \ - "rI" ((USItype)(d)) \ - : "%g1" __AND_CLOBBER_CC) -#define UDIV_TIME 37 -#define count_leading_zeros(count, x) \ - __asm__ ("scan %1,0,%0" \ - : "=r" ((USItype)(x)) \ - : "r" ((USItype)(count))) -/* Early sparclites return 63 for an argument of 0, but they warn that future - implementations might change this. Therefore, leave COUNT_LEADING_ZEROS_0 - undefined. */ -#endif /* __sparclite__ */ -#endif /* __sparc_v8__ */ -/* Default to sparc v7 versions of umul_ppmm and udiv_qrnnd. */ -#ifndef umul_ppmm -#define umul_ppmm(w1, w0, u, v) \ - __asm__ ("! Inlined umul_ppmm - wr %%g0,%2,%%y ! SPARC has 0-3 delay insn after a wr - sra %3,31,%%g2 ! Don't move this insn - and %2,%%g2,%%g2 ! Don't move this insn - andcc %%g0,0,%%g1 ! Don't move this insn - mulscc %%g1,%3,%%g1 - mulscc %%g1,%3,%%g1 - mulscc %%g1,%3,%%g1 - mulscc %%g1,%3,%%g1 - mulscc %%g1,%3,%%g1 - mulscc %%g1,%3,%%g1 - mulscc %%g1,%3,%%g1 - mulscc %%g1,%3,%%g1 - mulscc %%g1,%3,%%g1 - mulscc %%g1,%3,%%g1 - mulscc %%g1,%3,%%g1 - mulscc %%g1,%3,%%g1 - mulscc %%g1,%3,%%g1 - mulscc %%g1,%3,%%g1 - mulscc %%g1,%3,%%g1 - mulscc %%g1,%3,%%g1 - mulscc %%g1,%3,%%g1 - mulscc %%g1,%3,%%g1 - mulscc %%g1,%3,%%g1 - mulscc %%g1,%3,%%g1 - mulscc %%g1,%3,%%g1 - mulscc %%g1,%3,%%g1 - mulscc %%g1,%3,%%g1 - mulscc %%g1,%3,%%g1 - mulscc %%g1,%3,%%g1 - mulscc %%g1,%3,%%g1 - mulscc %%g1,%3,%%g1 - mulscc %%g1,%3,%%g1 - mulscc %%g1,%3,%%g1 - mulscc %%g1,%3,%%g1 - mulscc %%g1,%3,%%g1 - mulscc %%g1,%3,%%g1 - mulscc %%g1,0,%%g1 - add %%g1,%%g2,%0 - rd %%y,%1" \ - : "=r" ((USItype)(w1)), \ - "=r" ((USItype)(w0)) \ - : "%rI" ((USItype)(u)), \ - "r" ((USItype)(v)) \ - : "%g1", "%g2" __AND_CLOBBER_CC) -#define UMUL_TIME 39 /* 39 instructions */ -#endif -#ifndef udiv_qrnnd -#ifndef LONGLONG_STANDALONE -#define udiv_qrnnd(q, r, n1, n0, d) \ - do { USItype __r; \ - (q) = __udiv_qrnnd (&__r, (n1), (n0), (d)); \ - (r) = __r; \ - } while (0) -extern USItype __udiv_qrnnd (); -#define UDIV_TIME 140 -#endif /* LONGLONG_STANDALONE */ -#endif /* udiv_qrnnd */ -#endif /* __sparc__ */ - -#if defined (__vax__) && W_TYPE_SIZE == 32 -#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ - __asm__ ("addl2 %5,%1 - adwc %3,%0" \ - : "=g" ((USItype)(sh)), \ - "=&g" ((USItype)(sl)) \ - : "%0" ((USItype)(ah)), \ - "g" ((USItype)(bh)), \ - "%1" ((USItype)(al)), \ - "g" ((USItype)(bl))) -#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ - __asm__ ("subl2 %5,%1 - sbwc %3,%0" \ - : "=g" ((USItype)(sh)), \ - "=&g" ((USItype)(sl)) \ - : "0" ((USItype)(ah)), \ - "g" ((USItype)(bh)), \ - "1" ((USItype)(al)), \ - "g" ((USItype)(bl))) -#define umul_ppmm(xh, xl, m0, m1) \ - do { \ - union {UDItype __ll; \ - struct {USItype __l, __h;} __i; \ - } __xx; \ - USItype __m0 = (m0), __m1 = (m1); \ - __asm__ ("emul %1,%2,$0,%0" \ - : "=g" (__xx.__ll) \ - : "g" (__m0), \ - "g" (__m1)); \ - (xh) = __xx.__i.__h; (xl) = __xx.__i.__l; \ - (xh) += ((((SItype) __m0 >> 31) & __m1) \ - + (((SItype) __m1 >> 31) & __m0)); \ - } while (0) -#define sdiv_qrnnd(q, r, n1, n0, d) \ - do { \ - union {DItype __ll; \ - struct {SItype __l, __h;} __i; \ - } __xx; \ - __xx.__i.__h = n1; __xx.__i.__l = n0; \ - __asm__ ("ediv %3,%2,%0,%1" \ - : "=g" (q), "=g" (r) \ - : "g" (__xx.ll), "g" (d)); \ - } while (0) -#endif /* __vax__ */ - -#if defined (__z8000__) && W_TYPE_SIZE == 16 -#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ - __asm__ ("add %H1,%H5\n\tadc %H0,%H3" \ - : "=r" ((unsigned int)(sh)), \ - "=&r" ((unsigned int)(sl)) \ - : "%0" ((unsigned int)(ah)), \ - "r" ((unsigned int)(bh)), \ - "%1" ((unsigned int)(al)), \ - "rQR" ((unsigned int)(bl))) -#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ - __asm__ ("sub %H1,%H5\n\tsbc %H0,%H3" \ - : "=r" ((unsigned int)(sh)), \ - "=&r" ((unsigned int)(sl)) \ - : "0" ((unsigned int)(ah)), \ - "r" ((unsigned int)(bh)), \ - "1" ((unsigned int)(al)), \ - "rQR" ((unsigned int)(bl))) -#define umul_ppmm(xh, xl, m0, m1) \ - do { \ - union {long int __ll; \ - struct {unsigned int __h, __l;} __i; \ - } __xx; \ - unsigned int __m0 = (m0), __m1 = (m1); \ - __asm__ ("mult %S0,%H3" \ - : "=r" (__xx.__i.__h), \ - "=r" (__xx.__i.__l) \ - : "%1" (__m0), \ - "rQR" (__m1)); \ - (xh) = __xx.__i.__h; (xl) = __xx.__i.__l; \ - (xh) += ((((signed int) __m0 >> 15) & __m1) \ - + (((signed int) __m1 >> 15) & __m0)); \ - } while (0) -#endif /* __z8000__ */ - -#endif /* __GNUC__ */ - - -#if !defined (umul_ppmm) && defined (__umulsidi3) -#define umul_ppmm(ph, pl, m0, m1) \ - { \ - UDWtype __ll = __umulsidi3 (m0, m1); \ - ph = (UWtype) (__ll >> W_TYPE_SIZE); \ - pl = (UWtype) __ll; \ - } -#endif - -#if !defined (__umulsidi3) -#define __umulsidi3(u, v) \ - ({UWtype __hi, __lo; \ - umul_ppmm (__hi, __lo, u, v); \ - ((UDWtype) __hi << W_TYPE_SIZE) | __lo; }) -#endif - -/* If this machine has no inline assembler, use C macros. */ - -#if !defined (add_ssaaaa) -#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ - do { \ - UWtype __x; \ - __x = (al) + (bl); \ - (sh) = (ah) + (bh) + (__x < (al)); \ - (sl) = __x; \ - } while (0) -#endif - -#if !defined (sub_ddmmss) -#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ - do { \ - UWtype __x; \ - __x = (al) - (bl); \ - (sh) = (ah) - (bh) - (__x > (al)); \ - (sl) = __x; \ - } while (0) -#endif - -#if !defined (umul_ppmm) -#define umul_ppmm(w1, w0, u, v) \ - do { \ - UWtype __x0, __x1, __x2, __x3; \ - UHWtype __ul, __vl, __uh, __vh; \ - UWtype __u = (u), __v = (v); \ - \ - __ul = __ll_lowpart (__u); \ - __uh = __ll_highpart (__u); \ - __vl = __ll_lowpart (__v); \ - __vh = __ll_highpart (__v); \ - \ - __x0 = (UWtype) __ul * __vl; \ - __x1 = (UWtype) __ul * __vh; \ - __x2 = (UWtype) __uh * __vl; \ - __x3 = (UWtype) __uh * __vh; \ - \ - __x1 += __ll_highpart (__x0);/* this can't give carry */ \ - __x1 += __x2; /* but this indeed can */ \ - if (__x1 < __x2) /* did we get it? */ \ - __x3 += __ll_B; /* yes, add it in the proper pos. */ \ - \ - (w1) = __x3 + __ll_highpart (__x1); \ - (w0) = (__ll_lowpart (__x1) << W_TYPE_SIZE/2) + __ll_lowpart (__x0);\ - } while (0) -#endif - -#if !defined (umul_ppmm) -#define smul_ppmm(w1, w0, u, v) \ - do { \ - UWtype __w1; \ - UWtype __m0 = (u), __m1 = (v); \ - umul_ppmm (__w1, w0, __m0, __m1); \ - (w1) = __w1 - (-(__m0 >> (W_TYPE_SIZE - 1)) & __m1) \ - - (-(__m1 >> (W_TYPE_SIZE - 1)) & __m0); \ - } while (0) -#endif - -/* Define this unconditionally, so it can be used for debugging. */ -#define __udiv_qrnnd_c(q, r, n1, n0, d) \ - do { \ - UWtype __d1, __d0, __q1, __q0, __r1, __r0, __m; \ - __d1 = __ll_highpart (d); \ - __d0 = __ll_lowpart (d); \ - \ - __r1 = (n1) % __d1; \ - __q1 = (n1) / __d1; \ - __m = (UWtype) __q1 * __d0; \ - __r1 = __r1 * __ll_B | __ll_highpart (n0); \ - if (__r1 < __m) \ - { \ - __q1--, __r1 += (d); \ - if (__r1 >= (d)) /* i.e. we didn't get carry when adding to __r1 */\ - if (__r1 < __m) \ - __q1--, __r1 += (d); \ - } \ - __r1 -= __m; \ - \ - __r0 = __r1 % __d1; \ - __q0 = __r1 / __d1; \ - __m = (UWtype) __q0 * __d0; \ - __r0 = __r0 * __ll_B | __ll_lowpart (n0); \ - if (__r0 < __m) \ - { \ - __q0--, __r0 += (d); \ - if (__r0 >= (d)) \ - if (__r0 < __m) \ - __q0--, __r0 += (d); \ - } \ - __r0 -= __m; \ - \ - (q) = (UWtype) __q1 * __ll_B | __q0; \ - (r) = __r0; \ - } while (0) - -/* If the processor has no udiv_qrnnd but sdiv_qrnnd, go through - __udiv_w_sdiv (defined in libgcc or elsewhere). */ -#if !defined (udiv_qrnnd) && defined (sdiv_qrnnd) -#define udiv_qrnnd(q, r, nh, nl, d) \ - do { \ - UWtype __r; \ - (q) = __MPN(udiv_w_sdiv) (&__r, nh, nl, d); \ - (r) = __r; \ - } while (0) -#endif - -/* If udiv_qrnnd was not defined for this processor, use __udiv_qrnnd_c. */ -#if !defined (udiv_qrnnd) -#define UDIV_NEEDS_NORMALIZATION 1 -#define udiv_qrnnd __udiv_qrnnd_c -#endif - -#if !defined (count_leading_zeros) -extern -#ifdef __STDC__ -const -#endif -unsigned char __clz_tab[]; -#define count_leading_zeros(count, x) \ - do { \ - UWtype __xr = (x); \ - UWtype __a; \ - \ - if (W_TYPE_SIZE <= 32) \ - { \ - __a = __xr < ((UWtype) 1 << 2*__BITS4) \ - ? (__xr < ((UWtype) 1 << __BITS4) ? 0 : __BITS4) \ - : (__xr < ((UWtype) 1 << 3*__BITS4) ? 2*__BITS4 : 3*__BITS4);\ - } \ - else \ - { \ - for (__a = W_TYPE_SIZE - 8; __a > 0; __a -= 8) \ - if (((__xr >> __a) & 0xff) != 0) \ - break; \ - } \ - \ - (count) = W_TYPE_SIZE - (__clz_tab[__xr >> __a] + __a); \ - } while (0) -/* This version gives a well-defined value for zero. */ -#define COUNT_LEADING_ZEROS_0 W_TYPE_SIZE -#endif - -#if !defined (count_trailing_zeros) -/* Define count_trailing_zeros using count_leading_zeros. The latter might be - defined in asm, but if it is not, the C version above is good enough. */ -#define count_trailing_zeros(count, x) \ - do { \ - UWtype __ctz_x = (x); \ - UWtype __ctz_c; \ - count_leading_zeros (__ctz_c, __ctz_x & -__ctz_x); \ - (count) = W_TYPE_SIZE - 1 - __ctz_c; \ - } while (0) -#endif - -#ifndef UDIV_NEEDS_NORMALIZATION -#define UDIV_NEEDS_NORMALIZATION 0 -#endif diff --git a/lib/gmp/memory.c b/lib/gmp/memory.c deleted file mode 100644 index 2cd64a1f..00000000 --- a/lib/gmp/memory.c +++ /dev/null @@ -1,98 +0,0 @@ -/* Memory allocation routines. - -Copyright (C) 1991, 1993, 1994 Free Software Foundation, Inc. - -This file is part of the GNU MP Library. - -The GNU MP Library is free software; you can redistribute it and/or modify -it under the terms of the GNU Library General Public License as published by -the Free Software Foundation; either version 2 of the License, or (at your -option) any later version. - -The GNU MP Library is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public -License for more details. - -You should have received a copy of the GNU Library General Public License -along with the GNU MP Library; see the file COPYING.LIB. If not, write to -the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -MA 02111-1307, USA. */ - -#include -#include - -#include "gmp.h" -#include "gmp-impl.h" - -#ifdef __NeXT__ -#define static -#endif - -#if __STDC__ -void * (*_mp_allocate_func) (size_t) = _mp_default_allocate; -void * (*_mp_reallocate_func) (void *, size_t, size_t) - = _mp_default_reallocate; -void (*_mp_free_func) (void *, size_t) = _mp_default_free; -#else -void * (*_mp_allocate_func) () = _mp_default_allocate; -void * (*_mp_reallocate_func) () = _mp_default_reallocate; -void (*_mp_free_func) () = _mp_default_free; -#endif - -/* Default allocation functions. In case of failure to allocate/reallocate - an error message is written to stderr and the program aborts. */ - -void * -#if __STDC__ -_mp_default_allocate (size_t size) -#else -_mp_default_allocate (size) - size_t size; -#endif -{ - void *ret; - - ret = malloc (size); - if (ret == 0) - { - perror ("cannot allocate in gmp"); - abort (); - } - - return ret; -} - -void * -#if __STDC__ -_mp_default_reallocate (void *oldptr, unused size_t old_size, size_t new_size) -#else -_mp_default_reallocate (oldptr, old_size, new_size) - void *oldptr; - size_t old_size; - size_t new_size; -#endif -{ - void *ret; - - ret = realloc (oldptr, new_size); - if (ret == 0) - { - perror ("cannot allocate in gmp"); - abort (); - } - - return ret; -} - -void -#if __STDC__ -_mp_default_free (void *blk_ptr, unused size_t blk_size) -#else -_mp_default_free (blk_ptr, blk_size) - void *blk_ptr; - size_t blk_size; -#endif -{ - free (blk_ptr); -} diff --git a/lib/gmp/mp_clz_tab.c b/lib/gmp/mp_clz_tab.c deleted file mode 100644 index 6fd7e908..00000000 --- a/lib/gmp/mp_clz_tab.c +++ /dev/null @@ -1,40 +0,0 @@ -/* __clz_tab -- support for longlong.h - -Copyright (C) 1991, 1993, 1994, 1996 Free Software Foundation, Inc. - -This file is part of the GNU MP Library. - -The GNU MP Library is free software; you can redistribute it and/or modify -it under the terms of the GNU Library General Public License as published by -the Free Software Foundation; either version 2 of the License, or (at your -option) any later version. - -The GNU MP Library is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public -License for more details. - -You should have received a copy of the GNU Library General Public License -along with the GNU MP Library; see the file COPYING.LIB. If not, write to -the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -MA 02111-1307, USA. */ - -#if 0 -#include "gmp.h" -#include "gmp-impl.h" -#endif - -#if 0 -const -#endif -unsigned char __clz_tab[] = -{ - 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, - 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, - 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, - 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, - 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, -}; diff --git a/lib/gmp/mpf/Makefile.am b/lib/gmp/mpf/Makefile.am deleted file mode 100644 index c048998c..00000000 --- a/lib/gmp/mpf/Makefile.am +++ /dev/null @@ -1,9 +0,0 @@ -## Process this file with automake to produce Makefile.in -*- makefile -*- - -INCLUDES = -I$(srcdir) -I$(srcdir)/.. -I$(top_srcdir) -I$(top_srcdir)/src \ - -I$(top_srcdir)/intl - -noinst_LIBRARIES = libmpf.a -libmpf_a_SOURCES = clear.c get_str.c iset_d.c set_d.c set_dfl_prec.c - -MAINTAINERCLEANFILES = Makefile.in diff --git a/lib/gmp/mpf/Makefile.in b/lib/gmp/mpf/Makefile.in deleted file mode 100644 index a2c1887c..00000000 --- a/lib/gmp/mpf/Makefile.in +++ /dev/null @@ -1,293 +0,0 @@ -# Makefile.in generated automatically by automake 1.4 from Makefile.am - -# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - - -SHELL = @SHELL@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -bindir = @bindir@ -sbindir = @sbindir@ -libexecdir = @libexecdir@ -datadir = @datadir@ -sysconfdir = @sysconfdir@ -sharedstatedir = @sharedstatedir@ -localstatedir = @localstatedir@ -libdir = @libdir@ -infodir = @infodir@ -mandir = @mandir@ -includedir = @includedir@ -oldincludedir = /usr/include - -DESTDIR = - -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ - -top_builddir = ../../.. - -ACLOCAL = @ACLOCAL@ -AUTOCONF = @AUTOCONF@ -AUTOMAKE = @AUTOMAKE@ -AUTOHEADER = @AUTOHEADER@ - -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -transform = @program_transform_name@ - -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_alias = @build_alias@ -build_triplet = @build@ -host_alias = @host_alias@ -host_triplet = @host@ -target_alias = @target_alias@ -target_triplet = @target@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -DATADIRNAME = @DATADIRNAME@ -GENCAT = @GENCAT@ -GMOFILES = @GMOFILES@ -GMP_LIBS = @GMP_LIBS@ -GMP_SUBDIRS = @GMP_SUBDIRS@ -GMSGFMT = @GMSGFMT@ -GT_NO = @GT_NO@ -GT_YES = @GT_YES@ -INSTOBJEXT = @INSTOBJEXT@ -INTLDEPS = @INTLDEPS@ -INTLLIBS = @INTLLIBS@ -INTLOBJS = @INTLOBJS@ -LN_S = @LN_S@ -LOCAL_CC = @LOCAL_CC@ -MAKEINFO = @MAKEINFO@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MSGFMT = @MSGFMT@ -PACKAGE = @PACKAGE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -RANLIB = @RANLIB@ -U = @U@ -USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ -USE_NLS = @USE_NLS@ -VERSION = @VERSION@ -l = @l@ - -INCLUDES = -I$(srcdir) -I$(srcdir)/.. -I$(top_srcdir) -I$(top_srcdir)/src -I$(top_srcdir)/intl - - -noinst_LIBRARIES = libmpf.a -libmpf_a_SOURCES = clear.c get_str.c iset_d.c set_d.c set_dfl_prec.c - -MAINTAINERCLEANFILES = Makefile.in -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = ../../../config.h -CONFIG_CLEAN_FILES = -LIBRARIES = $(noinst_LIBRARIES) - - -DEFS = @DEFS@ -I. -I$(srcdir) -I../../.. -CPPFLAGS = @CPPFLAGS@ -LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ -libmpf_a_LIBADD = -libmpf_a_OBJECTS = clear.o get_str.o iset_d.o set_d.o set_dfl_prec.o -AR = ar -COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ -DIST_COMMON = Makefile.am Makefile.in - - -DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) - -TAR = tar -GZIP_ENV = --best -SOURCES = $(libmpf_a_SOURCES) -OBJECTS = $(libmpf_a_OBJECTS) - -all: all-redirect -.SUFFIXES: -.SUFFIXES: .S .c .o .s -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps lib/gmp/mpf/Makefile - -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) \ - && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status - - -mostlyclean-noinstLIBRARIES: - -clean-noinstLIBRARIES: - -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) - -distclean-noinstLIBRARIES: - -maintainer-clean-noinstLIBRARIES: - -.c.o: - $(COMPILE) -c $< - -.s.o: - $(COMPILE) -c $< - -.S.o: - $(COMPILE) -c $< - -mostlyclean-compile: - -rm -f *.o core *.core - -clean-compile: - -distclean-compile: - -rm -f *.tab.c - -maintainer-clean-compile: - -libmpf.a: $(libmpf_a_OBJECTS) $(libmpf_a_DEPENDENCIES) - -rm -f libmpf.a - $(AR) cru libmpf.a $(libmpf_a_OBJECTS) $(libmpf_a_LIBADD) - $(RANLIB) libmpf.a - -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) - list='$(SOURCES) $(HEADERS)'; \ - unique=`for i in $$list; do echo $$i; done | \ - awk ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - here=`pwd` && cd $(srcdir) \ - && mkid -f$$here/ID $$unique $(LISP) - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS)'; \ - unique=`for i in $$list; do echo $$i; done | \ - awk ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ - || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) - -mostlyclean-tags: - -clean-tags: - -distclean-tags: - -rm -f TAGS ID - -maintainer-clean-tags: - -distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) - -subdir = lib/gmp/mpf - -distdir: $(DISTFILES) - @for file in $(DISTFILES); do \ - d=$(srcdir); \ - if test -d $$d/$$file; then \ - cp -pr $$d/$$file $(distdir)/$$file; \ - else \ - test -f $(distdir)/$$file \ - || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ - || cp -p $$d/$$file $(distdir)/$$file || :; \ - fi; \ - done - -info-am: -info: info-am -dvi-am: -dvi: dvi-am -check-am: all-am -check: check-am -installcheck-am: -installcheck: installcheck-am -install-exec-am: -install-exec: install-exec-am - -install-data-am: -install-data: install-data-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -install: install-am -uninstall-am: -uninstall: uninstall-am -all-am: Makefile $(LIBRARIES) -all-redirect: all-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install -installdirs: - - -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) - -rm -f config.cache config.log stamp-h stamp-h[0-9]* - -maintainer-clean-generic: - -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) -mostlyclean-am: mostlyclean-noinstLIBRARIES mostlyclean-compile \ - mostlyclean-tags mostlyclean-generic - -mostlyclean: mostlyclean-am - -clean-am: clean-noinstLIBRARIES clean-compile clean-tags clean-generic \ - mostlyclean-am - -clean: clean-am - -distclean-am: distclean-noinstLIBRARIES distclean-compile \ - distclean-tags distclean-generic clean-am - -distclean: distclean-am - -maintainer-clean-am: maintainer-clean-noinstLIBRARIES \ - maintainer-clean-compile maintainer-clean-tags \ - maintainer-clean-generic distclean-am - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." - -maintainer-clean: maintainer-clean-am - -.PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \ -clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \ -mostlyclean-compile distclean-compile clean-compile \ -maintainer-clean-compile tags mostlyclean-tags distclean-tags \ -clean-tags maintainer-clean-tags distdir info-am info dvi-am dvi check \ -check-am installcheck-am installcheck install-exec-am install-exec \ -install-data-am install-data install-am install uninstall-am uninstall \ -all-redirect all-am all installdirs mostlyclean-generic \ -distclean-generic clean-generic maintainer-clean-generic clean \ -mostlyclean distclean maintainer-clean - - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/lib/gmp/mpf/clear.c b/lib/gmp/mpf/clear.c deleted file mode 100644 index 00284f55..00000000 --- a/lib/gmp/mpf/clear.c +++ /dev/null @@ -1,36 +0,0 @@ -/* mpf_clear -- de-allocate the space occupied by the dynamic digit space of - an integer. - -Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc. - -This file is part of the GNU MP Library. - -The GNU MP Library is free software; you can redistribute it and/or modify -it under the terms of the GNU Library General Public License as published by -the Free Software Foundation; either version 2 of the License, or (at your -option) any later version. - -The GNU MP Library is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public -License for more details. - -You should have received a copy of the GNU Library General Public License -along with the GNU MP Library; see the file COPYING.LIB. If not, write to -the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -MA 02111-1307, USA. */ - -#include -#include "gmp.h" -#include "gmp-impl.h" - -void -#if __STDC__ -mpf_clear (mpf_ptr m) -#else -mpf_clear (m) - mpf_ptr m; -#endif -{ - (*_mp_free_func) (m->_mp_d, (m->_mp_prec + 1) * BYTES_PER_MP_LIMB); -} diff --git a/lib/gmp/mpf/get_str.c b/lib/gmp/mpf/get_str.c deleted file mode 100644 index f6cf10d2..00000000 --- a/lib/gmp/mpf/get_str.c +++ /dev/null @@ -1,501 +0,0 @@ -/* mpf_get_str (digit_ptr, exp, base, n_digits, a) -- Convert the floating - point number A to a base BASE number and store N_DIGITS raw digits at - DIGIT_PTR, and the base BASE exponent in the word pointed to by EXP. For - example, the number 3.1416 would be returned as "31416" in DIGIT_PTR and - 1 in EXP. - -Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc. - -This file is part of the GNU MP Library. - -The GNU MP Library is free software; you can redistribute it and/or modify -it under the terms of the GNU Library General Public License as published by -the Free Software Foundation; either version 2 of the License, or (at your -option) any later version. - -The GNU MP Library is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public -License for more details. - -You should have received a copy of the GNU Library General Public License -along with the GNU MP Library; see the file COPYING.LIB. If not, write to -the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -MA 02111-1307, USA. */ - -#include -#include "gmp.h" -#include "gmp-impl.h" -#include "longlong.h" - -/* - New algorithm for converting fractions (951019): - 0. Call the fraction to convert F. - 1. Compute [exp * log(2^BITS_PER_MP_LIMB)/log(B)], i.e., - [exp * BITS_PER_MP_LIMB * __mp_bases[B].chars_per_bit_exactly]. Exp is - the number of limbs between the limb point and the most significant - non-zero limb. Call this result n. - 2. Compute B^n. - 3. F*B^n will now be just below 1, which can be converted easily. (Just - multiply by B repeatedly, and see the digits fall out as integers.) - We should interrupt the conversion process of F*B^n as soon as the number - of digits requested have been generated. - - New algorithm for converting integers (951019): - 0. Call the integer to convert I. - 1. Compute [exp * log(2^BITS_PER_MP_LIMB)/log(B)], i.e., - [exp BITS_PER_MP_LIMB * __mp_bases[B].chars_per_bit_exactly]. Exp is - the number of limbs between the limb point and the least significant - non-zero limb. Call this result n. - 2. Compute B^n. - 3. I/B^n can be converted easily. (Just divide by B repeatedly. In GMP, - this is best done by calling mpn_get_str.) - Note that converting I/B^n could yield more digits than requested. For - efficiency, the variable n above should be set larger in such cases, to - kill all undesired digits in the division in step 3. -*/ - -char * -#if __STDC__ -mpf_get_str (char *digit_ptr, mp_exp_t *exp, int base, size_t n_digits, mpf_srcptr u) -#else -mpf_get_str (digit_ptr, exp, base, n_digits, u) - char *digit_ptr; - mp_exp_t *exp; - int base; - size_t n_digits; - mpf_srcptr u; -#endif -{ - mp_size_t usize; - mp_exp_t uexp; - unsigned char *str; - size_t str_size; - char *num_to_text; - long i; /* should be size_t */ - mp_ptr rp; - mp_limb_t big_base; - size_t digits_computed_so_far; - int dig_per_u; - mp_srcptr up; - unsigned char *tstr; - mp_exp_t exp_in_base; - TMP_DECL (marker); - - TMP_MARK (marker); - usize = u->_mp_size; - uexp = u->_mp_exp; - - if (base >= 0) - { - if (base == 0) - base = 10; - num_to_text = (char *) "0123456789abcdefghijklmnopqrstuvwxyz"; - } - else - { - base = -base; - num_to_text = (char *) "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - } - - /* Don't compute more digits than U can accurately represent. - Also, if 0 digits were requested, give *exactly* as many digits - as can be accurately represented. */ - { - size_t max_digits = (((u->_mp_prec - 1) * BITS_PER_MP_LIMB) - * __mp_bases[base].chars_per_bit_exactly); - if (n_digits == 0 || n_digits > max_digits) - n_digits = max_digits; - } - - if (digit_ptr == 0) - { - /* We didn't get a string from the user. Allocate one (and return - a pointer to it) with space for `-' and terminating null. */ - digit_ptr = (char *) (*_mp_allocate_func) (n_digits + 2); - } - - if (usize == 0) - { - *exp = 0; - *digit_ptr = 0; - return digit_ptr; - } - - str = (unsigned char *) digit_ptr; - - /* Allocate temporary digit space. We can't put digits directly in the user - area, since we almost always generate more digits than requested. */ - tstr = (unsigned char *) TMP_ALLOC (n_digits + 3 * BITS_PER_MP_LIMB); - - if (usize < 0) - { - *digit_ptr = '-'; - str++; - usize = -usize; - } - - digits_computed_so_far = 0; - - if (uexp > usize) - { - /* The number has just an integral part. */ - mp_size_t rsize; - mp_size_t exp_in_limbs; - mp_size_t msize; - mp_ptr tp, xp, mp; - int cnt; - mp_limb_t cy; - mp_size_t start_str; - mp_size_t n_limbs; - - n_limbs = 2 + ((mp_size_t) (n_digits / __mp_bases[base].chars_per_bit_exactly) - / BITS_PER_MP_LIMB); - - /* Compute n such that [u/B^n] contains (somewhat) more than n_digits - digits. (We compute less than that only if that is an exact number, - i.e., exp is small enough.) */ - - exp_in_limbs = uexp; - - if (n_limbs >= exp_in_limbs) - { - /* The number is so small that we convert the entire number. */ - exp_in_base = 0; - rp = (mp_ptr) TMP_ALLOC (exp_in_limbs * BYTES_PER_MP_LIMB); - MPN_ZERO (rp, exp_in_limbs - usize); - MPN_COPY (rp + (exp_in_limbs - usize), u->_mp_d, usize); - rsize = exp_in_limbs; - } - else - { - exp_in_limbs -= n_limbs; - exp_in_base = (((exp_in_limbs * BITS_PER_MP_LIMB - 1)) - * __mp_bases[base].chars_per_bit_exactly); - - rsize = exp_in_limbs + 1; - rp = (mp_ptr) TMP_ALLOC (rsize * BYTES_PER_MP_LIMB); - tp = (mp_ptr) TMP_ALLOC (rsize * BYTES_PER_MP_LIMB); - - rp[0] = base; - rsize = 1; - - count_leading_zeros (cnt, exp_in_base); - for (i = BITS_PER_MP_LIMB - cnt - 2; i >= 0; i--) - { - mpn_mul_n (tp, rp, rp, rsize); - rsize = 2 * rsize; - rsize -= tp[rsize - 1] == 0; - xp = tp; tp = rp; rp = xp; - - if (((exp_in_base >> i) & 1) != 0) - { - cy = mpn_mul_1 (rp, rp, rsize, (mp_limb_t) base); - rp[rsize] = cy; - rsize += cy != 0; - } - } - - mp = u->_mp_d; - msize = usize; - - { - mp_ptr qp; - mp_limb_t qflag; - mp_size_t xtra; - if (msize < rsize) - { - mp_ptr tmp = (mp_ptr) TMP_ALLOC ((rsize+1)* BYTES_PER_MP_LIMB); - MPN_ZERO (tmp, rsize - msize); - MPN_COPY (tmp + rsize - msize, mp, msize); - mp = tmp; - msize = rsize; - } - else - { - mp_ptr tmp = (mp_ptr) TMP_ALLOC ((msize+1)* BYTES_PER_MP_LIMB); - MPN_COPY (tmp, mp, msize); - mp = tmp; - } - count_leading_zeros (cnt, rp[rsize - 1]); - cy = 0; - if (cnt != 0) - { - mpn_lshift (rp, rp, rsize, cnt); - cy = mpn_lshift (mp, mp, msize, cnt); - if (cy) - mp[msize++] = cy; - } - - { - mp_size_t qsize = n_limbs + (cy != 0); - qp = (mp_ptr) TMP_ALLOC ((qsize + 1) * BYTES_PER_MP_LIMB); - xtra = qsize - (msize - rsize); - qflag = mpn_divrem (qp, xtra, mp, msize, rp, rsize); - qp[qsize] = qflag; - rsize = qsize + qflag; - rp = qp; - } - } - } - - str_size = mpn_get_str (tstr, base, rp, rsize); - - if (str_size > n_digits + 3 * BITS_PER_MP_LIMB) - abort (); - - start_str = 0; - while (tstr[start_str] == 0) - start_str++; - - for (i = start_str; i < (int) str_size; i++) - { - tstr[digits_computed_so_far++] = tstr[i]; - if (digits_computed_so_far > n_digits) - break; - } - exp_in_base = exp_in_base + str_size - start_str; - goto finish_up; - } - - exp_in_base = 0; - - if (uexp > 0) - { - /* The number has an integral part, convert that first. - If there is a fractional part too, it will be handled later. */ - mp_size_t start_str; - - rp = (mp_ptr) TMP_ALLOC (uexp * BYTES_PER_MP_LIMB); - up = u->_mp_d + usize - uexp; - MPN_COPY (rp, up, uexp); - - str_size = mpn_get_str (tstr, base, rp, uexp); - - start_str = 0; - while (tstr[start_str] == 0) - start_str++; - - for (i = start_str; i < (int) str_size; i++) - { - tstr[digits_computed_so_far++] = tstr[i]; - if (digits_computed_so_far > n_digits) - { - exp_in_base = str_size - start_str; - goto finish_up; - } - } - - exp_in_base = str_size - start_str; - /* Modify somewhat and fall out to convert fraction... */ - usize -= uexp; - uexp = 0; - } - - if (usize <= 0) - goto finish_up; - - /* Convert the fraction. */ - { - mp_size_t rsize, msize; - mp_ptr rp, tp, xp, mp; - int cnt; - mp_limb_t cy; - mp_exp_t nexp; - - big_base = __mp_bases[base].big_base; - dig_per_u = __mp_bases[base].chars_per_limb; - - /* Hack for correctly (although not efficiently) converting to bases that - are powers of 2. If we deem it important, we could handle powers of 2 - by shifting and masking (just like mpn_get_str). */ - if (big_base < 10) /* logarithm of base when power of two */ - { - int logbase = big_base; - if (dig_per_u * logbase == BITS_PER_MP_LIMB) - dig_per_u--; - big_base = (mp_limb_t) 1 << (dig_per_u * logbase); - /* fall out to general code... */ - } - -#if 0 - if (0 && uexp == 0) - { - rp = (mp_ptr) TMP_ALLOC (usize * BYTES_PER_MP_LIMB); - up = u->_mp_d; - MPN_COPY (rp, up, usize); - rsize = usize; - nexp = 0; - } - else - {} -#endif - uexp = -uexp; - if (u->_mp_d[usize - 1] == 0) - cnt = 0; - else - count_leading_zeros (cnt, u->_mp_d[usize - 1]); - - nexp = ((uexp * BITS_PER_MP_LIMB) + cnt) - * __mp_bases[base].chars_per_bit_exactly; - - if (nexp == 0) - { - rp = (mp_ptr) TMP_ALLOC (usize * BYTES_PER_MP_LIMB); - up = u->_mp_d; - MPN_COPY (rp, up, usize); - rsize = usize; - } - else - { - rsize = uexp + 2; - rp = (mp_ptr) TMP_ALLOC (rsize * BYTES_PER_MP_LIMB); - tp = (mp_ptr) TMP_ALLOC (rsize * BYTES_PER_MP_LIMB); - - rp[0] = base; - rsize = 1; - - count_leading_zeros (cnt, nexp); - for (i = BITS_PER_MP_LIMB - cnt - 2; i >= 0; i--) - { - mpn_mul_n (tp, rp, rp, rsize); - rsize = 2 * rsize; - rsize -= tp[rsize - 1] == 0; - xp = tp; tp = rp; rp = xp; - - if (((nexp >> i) & 1) != 0) - { - cy = mpn_mul_1 (rp, rp, rsize, (mp_limb_t) base); - rp[rsize] = cy; - rsize += cy != 0; - } - } - - /* Did our multiplier (base^nexp) cancel with uexp? */ -#if 0 - if (uexp != rsize) - { - do - { - cy = mpn_mul_1 (rp, rp, rsize, big_base); - nexp += dig_per_u; - } - while (cy == 0); - rp[rsize++] = cy; - } -#endif - mp = u->_mp_d; - msize = usize; - - tp = (mp_ptr) TMP_ALLOC ((rsize + msize) * BYTES_PER_MP_LIMB); - if (rsize > msize) - cy = mpn_mul (tp, rp, rsize, mp, msize); - else - cy = mpn_mul (tp, mp, msize, rp, rsize); - rsize += msize; - rsize -= cy == 0; - rp = tp; - - /* If we already output digits (for an integral part) pad - leading zeros. */ - if (digits_computed_so_far != 0) - for (i = 0; i < nexp; i++) - tstr[digits_computed_so_far++] = 0; - } - - while (digits_computed_so_far <= n_digits) - { - /* For speed: skip trailing zeroes. */ - if (rp[0] == 0) - { - rp++; - rsize--; - if (rsize == 0) - { - n_digits = digits_computed_so_far; - break; - } - } - - cy = mpn_mul_1 (rp, rp, rsize, big_base); - if (digits_computed_so_far == 0 && cy == 0) - { - abort (); - nexp += dig_per_u; - continue; - } - /* Convert N1 from BIG_BASE to a string of digits in BASE - using single precision operations. */ - { - unsigned char *s = tstr + digits_computed_so_far + dig_per_u; - for (i = dig_per_u - 1; i >= 0; i--) - { - *--s = cy % base; - cy /= base; - } - } - digits_computed_so_far += dig_per_u; - } - if (exp_in_base == 0) - exp_in_base = -nexp; - } - - finish_up: - - /* We can have at most one leading 0. Remove it. */ - if (tstr[0] == 0) - { - tstr++; - digits_computed_so_far--; - exp_in_base--; - } - - /* We should normally have computed too many digits. Round the result - at the point indicated by n_digits. */ - if (digits_computed_so_far > n_digits) - { - /* Round the result. */ - if (tstr[n_digits] * 2 >= base) - { - digits_computed_so_far = n_digits; - for (i = n_digits - 1; i >= 0; i--) - { - unsigned int x; - x = ++(tstr[i]); - if ((int) x < base) - goto rounded_ok; - digits_computed_so_far--; - } - tstr[0] = 1; - digits_computed_so_far = 1; - exp_in_base++; - rounded_ok:; - } - } - - /* We might have fewer digits than requested as a result of rounding above, - (i.e. 0.999999 => 1.0) or because we have a number that simply doesn't - need many digits in this base (i.e., 0.125 in base 10). */ - if (n_digits > digits_computed_so_far) - n_digits = digits_computed_so_far; - - /* Remove trailing 0. There can be many zeros. */ - while (n_digits != 0 && tstr[n_digits - 1] == 0) - n_digits--; - - /* Translate to ascii and null-terminate. */ - for (i = 0; i < (int) n_digits; i++) - *str++ = num_to_text[tstr[i]]; - *str = 0; - *exp = exp_in_base; - TMP_FREE (marker); - return digit_ptr; -} - -#if COPY_THIS_TO_OTHER_PLACES - /* Use this expression in lots of places in the library instead of the - count_leading_zeros+expression that is used currently. This expression - is much more accurate and will save odles of memory. */ - rsize = ((mp_size_t) (exp_in_base / __mp_bases[base].chars_per_bit_exactly) - + BITS_PER_MP_LIMB) / BITS_PER_MP_LIMB; -#endif diff --git a/lib/gmp/mpf/iset_d.c b/lib/gmp/mpf/iset_d.c deleted file mode 100644 index 3d4427ea..00000000 --- a/lib/gmp/mpf/iset_d.c +++ /dev/null @@ -1,40 +0,0 @@ -/* mpf_init_set_d -- Initialize a float and assign it from a double. - -Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc. - -This file is part of the GNU MP Library. - -The GNU MP Library is free software; you can redistribute it and/or modify -it under the terms of the GNU Library General Public License as published by -the Free Software Foundation; either version 2 of the License, or (at your -option) any later version. - -The GNU MP Library is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public -License for more details. - -You should have received a copy of the GNU Library General Public License -along with the GNU MP Library; see the file COPYING.LIB. If not, write to -the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -MA 02111-1307, USA. */ - -#include -#include "gmp.h" -#include "gmp-impl.h" - -void -#if __STDC__ -mpf_init_set_d (mpf_ptr r, double val) -#else -mpf_init_set_d (r, val) - mpf_ptr r; - double val; -#endif -{ - mp_size_t prec = __gmp_default_fp_limb_precision; - r->_mp_d = (mp_ptr) (*_mp_allocate_func) ((prec + 1) * BYTES_PER_MP_LIMB); - r->_mp_prec = prec; - - mpf_set_d (r, val); -} diff --git a/lib/gmp/mpf/set_d.c b/lib/gmp/mpf/set_d.c deleted file mode 100644 index a9fcfed6..00000000 --- a/lib/gmp/mpf/set_d.c +++ /dev/null @@ -1,48 +0,0 @@ -/* mpf_set_d -- Assign a float from a IEEE double. - -Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc. - -This file is part of the GNU MP Library. - -The GNU MP Library is free software; you can redistribute it and/or modify -it under the terms of the GNU Library General Public License as published by -the Free Software Foundation; either version 2 of the License, or (at your -option) any later version. - -The GNU MP Library is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public -License for more details. - -You should have received a copy of the GNU Library General Public License -along with the GNU MP Library; see the file COPYING.LIB. If not, write to -the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -MA 02111-1307, USA. */ - -#include -#include "gmp.h" -#include "gmp-impl.h" - -void -#if __STDC__ -mpf_set_d (mpf_ptr r, double d) -#else -mpf_set_d (r, d) - mpf_ptr r; - double d; -#endif -{ - int negative; - - if (d == 0) - { - SIZ(r) = 0; - EXP(r) = 0; - return; - } - negative = d < 0; - d = ABS (d); - - EXP(r) = __gmp_extract_double (PTR(r), d); - SIZ(r) = negative ? -LIMBS_PER_DOUBLE : LIMBS_PER_DOUBLE; -} diff --git a/lib/gmp/mpf/set_dfl_prec.c b/lib/gmp/mpf/set_dfl_prec.c deleted file mode 100644 index c8db2d6e..00000000 --- a/lib/gmp/mpf/set_dfl_prec.c +++ /dev/null @@ -1,41 +0,0 @@ -/* mpf_set_default_prec -- - -Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc. - -This file is part of the GNU MP Library. - -The GNU MP Library is free software; you can redistribute it and/or modify -it under the terms of the GNU Library General Public License as published by -the Free Software Foundation; either version 2 of the License, or (at your -option) any later version. - -The GNU MP Library is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public -License for more details. - -You should have received a copy of the GNU Library General Public License -along with the GNU MP Library; see the file COPYING.LIB. If not, write to -the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -MA 02111-1307, USA. */ - -#include -#include "gmp.h" -#include "gmp-impl.h" - -mp_size_t __gmp_default_fp_limb_precision - = (53 + 2 * BITS_PER_MP_LIMB - 1) / BITS_PER_MP_LIMB; - -void -#if __STDC__ -mpf_set_default_prec (unsigned long int prec_in_bits) -#else -mpf_set_default_prec (prec_in_bits) - unsigned long int prec_in_bits; -#endif -{ - mp_size_t prec; - - prec = (MAX (53, prec_in_bits) + 2 * BITS_PER_MP_LIMB - 1)/BITS_PER_MP_LIMB; - __gmp_default_fp_limb_precision = prec; -} diff --git a/lib/gmp/mpn/Makefile.am b/lib/gmp/mpn/Makefile.am deleted file mode 100644 index 80b7c64d..00000000 --- a/lib/gmp/mpn/Makefile.am +++ /dev/null @@ -1,10 +0,0 @@ -## Process this file with automake to produce Makefile.in -*- makefile -*- - -INCLUDES = -I$(srcdir) -I$(srcdir)/.. -I$(top_srcdir) -I$(top_srcdir)/src \ - -I$(top_srcdir)/intl - -noinst_LIBRARIES = libmpn.a -libmpn_a_SOURCES = add_n.c addmul_1.c cmp.c divrem.c get_str.c \ -inlines.c lshift.c mp_bases.c mul.c mul_1.c mul_n.c sub_n.c submul_1.c - -MAINTAINERCLEANFILES = Makefile.in diff --git a/lib/gmp/mpn/Makefile.in b/lib/gmp/mpn/Makefile.in deleted file mode 100644 index b7b27c44..00000000 --- a/lib/gmp/mpn/Makefile.in +++ /dev/null @@ -1,295 +0,0 @@ -# Makefile.in generated automatically by automake 1.4 from Makefile.am - -# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - - -SHELL = @SHELL@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -bindir = @bindir@ -sbindir = @sbindir@ -libexecdir = @libexecdir@ -datadir = @datadir@ -sysconfdir = @sysconfdir@ -sharedstatedir = @sharedstatedir@ -localstatedir = @localstatedir@ -libdir = @libdir@ -infodir = @infodir@ -mandir = @mandir@ -includedir = @includedir@ -oldincludedir = /usr/include - -DESTDIR = - -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ - -top_builddir = ../../.. - -ACLOCAL = @ACLOCAL@ -AUTOCONF = @AUTOCONF@ -AUTOMAKE = @AUTOMAKE@ -AUTOHEADER = @AUTOHEADER@ - -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -transform = @program_transform_name@ - -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_alias = @build_alias@ -build_triplet = @build@ -host_alias = @host_alias@ -host_triplet = @host@ -target_alias = @target_alias@ -target_triplet = @target@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -DATADIRNAME = @DATADIRNAME@ -GENCAT = @GENCAT@ -GMOFILES = @GMOFILES@ -GMP_LIBS = @GMP_LIBS@ -GMP_SUBDIRS = @GMP_SUBDIRS@ -GMSGFMT = @GMSGFMT@ -GT_NO = @GT_NO@ -GT_YES = @GT_YES@ -INSTOBJEXT = @INSTOBJEXT@ -INTLDEPS = @INTLDEPS@ -INTLLIBS = @INTLLIBS@ -INTLOBJS = @INTLOBJS@ -LN_S = @LN_S@ -LOCAL_CC = @LOCAL_CC@ -MAKEINFO = @MAKEINFO@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MSGFMT = @MSGFMT@ -PACKAGE = @PACKAGE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -RANLIB = @RANLIB@ -U = @U@ -USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ -USE_NLS = @USE_NLS@ -VERSION = @VERSION@ -l = @l@ - -INCLUDES = -I$(srcdir) -I$(srcdir)/.. -I$(top_srcdir) -I$(top_srcdir)/src -I$(top_srcdir)/intl - - -noinst_LIBRARIES = libmpn.a -libmpn_a_SOURCES = add_n.c addmul_1.c cmp.c divrem.c get_str.c inlines.c lshift.c mp_bases.c mul.c mul_1.c mul_n.c sub_n.c submul_1.c - - -MAINTAINERCLEANFILES = Makefile.in -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = ../../../config.h -CONFIG_CLEAN_FILES = -LIBRARIES = $(noinst_LIBRARIES) - - -DEFS = @DEFS@ -I. -I$(srcdir) -I../../.. -CPPFLAGS = @CPPFLAGS@ -LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ -libmpn_a_LIBADD = -libmpn_a_OBJECTS = add_n.o addmul_1.o cmp.o divrem.o get_str.o \ -inlines.o lshift.o mp_bases.o mul.o mul_1.o mul_n.o sub_n.o submul_1.o -AR = ar -COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ -DIST_COMMON = Makefile.am Makefile.in - - -DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) - -TAR = tar -GZIP_ENV = --best -SOURCES = $(libmpn_a_SOURCES) -OBJECTS = $(libmpn_a_OBJECTS) - -all: all-redirect -.SUFFIXES: -.SUFFIXES: .S .c .o .s -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps lib/gmp/mpn/Makefile - -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) \ - && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status - - -mostlyclean-noinstLIBRARIES: - -clean-noinstLIBRARIES: - -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) - -distclean-noinstLIBRARIES: - -maintainer-clean-noinstLIBRARIES: - -.c.o: - $(COMPILE) -c $< - -.s.o: - $(COMPILE) -c $< - -.S.o: - $(COMPILE) -c $< - -mostlyclean-compile: - -rm -f *.o core *.core - -clean-compile: - -distclean-compile: - -rm -f *.tab.c - -maintainer-clean-compile: - -libmpn.a: $(libmpn_a_OBJECTS) $(libmpn_a_DEPENDENCIES) - -rm -f libmpn.a - $(AR) cru libmpn.a $(libmpn_a_OBJECTS) $(libmpn_a_LIBADD) - $(RANLIB) libmpn.a - -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) - list='$(SOURCES) $(HEADERS)'; \ - unique=`for i in $$list; do echo $$i; done | \ - awk ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - here=`pwd` && cd $(srcdir) \ - && mkid -f$$here/ID $$unique $(LISP) - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS)'; \ - unique=`for i in $$list; do echo $$i; done | \ - awk ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ - || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) - -mostlyclean-tags: - -clean-tags: - -distclean-tags: - -rm -f TAGS ID - -maintainer-clean-tags: - -distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) - -subdir = lib/gmp/mpn - -distdir: $(DISTFILES) - @for file in $(DISTFILES); do \ - d=$(srcdir); \ - if test -d $$d/$$file; then \ - cp -pr $$d/$$file $(distdir)/$$file; \ - else \ - test -f $(distdir)/$$file \ - || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ - || cp -p $$d/$$file $(distdir)/$$file || :; \ - fi; \ - done - -info-am: -info: info-am -dvi-am: -dvi: dvi-am -check-am: all-am -check: check-am -installcheck-am: -installcheck: installcheck-am -install-exec-am: -install-exec: install-exec-am - -install-data-am: -install-data: install-data-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -install: install-am -uninstall-am: -uninstall: uninstall-am -all-am: Makefile $(LIBRARIES) -all-redirect: all-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install -installdirs: - - -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) - -rm -f config.cache config.log stamp-h stamp-h[0-9]* - -maintainer-clean-generic: - -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) -mostlyclean-am: mostlyclean-noinstLIBRARIES mostlyclean-compile \ - mostlyclean-tags mostlyclean-generic - -mostlyclean: mostlyclean-am - -clean-am: clean-noinstLIBRARIES clean-compile clean-tags clean-generic \ - mostlyclean-am - -clean: clean-am - -distclean-am: distclean-noinstLIBRARIES distclean-compile \ - distclean-tags distclean-generic clean-am - -distclean: distclean-am - -maintainer-clean-am: maintainer-clean-noinstLIBRARIES \ - maintainer-clean-compile maintainer-clean-tags \ - maintainer-clean-generic distclean-am - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." - -maintainer-clean: maintainer-clean-am - -.PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \ -clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \ -mostlyclean-compile distclean-compile clean-compile \ -maintainer-clean-compile tags mostlyclean-tags distclean-tags \ -clean-tags maintainer-clean-tags distdir info-am info dvi-am dvi check \ -check-am installcheck-am installcheck install-exec-am install-exec \ -install-data-am install-data install-am install uninstall-am uninstall \ -all-redirect all-am all installdirs mostlyclean-generic \ -distclean-generic clean-generic maintainer-clean-generic clean \ -mostlyclean distclean maintainer-clean - - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/lib/gmp/mpn/add_n.c b/lib/gmp/mpn/add_n.c deleted file mode 100644 index ecaec46c..00000000 --- a/lib/gmp/mpn/add_n.c +++ /dev/null @@ -1,63 +0,0 @@ -/* mpn_add_n -- Add two limb vectors of equal, non-zero length. - -Copyright (C) 1992, 1993, 1994, 1996 Free Software Foundation, Inc. - -This file is part of the GNU MP Library. - -The GNU MP Library is free software; you can redistribute it and/or modify -it under the terms of the GNU Library General Public License as published by -the Free Software Foundation; either version 2 of the License, or (at your -option) any later version. - -The GNU MP Library is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public -License for more details. - -You should have received a copy of the GNU Library General Public License -along with the GNU MP Library; see the file COPYING.LIB. If not, write to -the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -MA 02111-1307, USA. */ - -#include -#include "gmp.h" -#include "gmp-impl.h" - -mp_limb_t -#if __STDC__ -mpn_add_n (mp_ptr res_ptr, mp_srcptr s1_ptr, mp_srcptr s2_ptr, mp_size_t size) -#else -mpn_add_n (res_ptr, s1_ptr, s2_ptr, size) - register mp_ptr res_ptr; - register mp_srcptr s1_ptr; - register mp_srcptr s2_ptr; - mp_size_t size; -#endif -{ - register mp_limb_t x, y, cy; - register mp_size_t j; - - /* The loop counter and index J goes from -SIZE to -1. This way - the loop becomes faster. */ - j = -size; - - /* Offset the base pointers to compensate for the negative indices. */ - s1_ptr -= j; - s2_ptr -= j; - res_ptr -= j; - - cy = 0; - do - { - y = s2_ptr[j]; - x = s1_ptr[j]; - y += cy; /* add previous carry to one addend */ - cy = (y < cy); /* get out carry from that addition */ - y = x + y; /* add other addend */ - cy = (y < x) + cy; /* get out carry from that add, combine */ - res_ptr[j] = y; - } - while (++j != 0); - - return cy; -} diff --git a/lib/gmp/mpn/addmul_1.c b/lib/gmp/mpn/addmul_1.c deleted file mode 100644 index ec580917..00000000 --- a/lib/gmp/mpn/addmul_1.c +++ /dev/null @@ -1,66 +0,0 @@ -/* mpn_addmul_1 -- multiply the S1_SIZE long limb vector pointed to by S1_PTR - by S2_LIMB, add the S1_SIZE least significant limbs of the product to the - limb vector pointed to by RES_PTR. Return the most significant limb of - the product, adjusted for carry-out from the addition. - -Copyright (C) 1992, 1993, 1994, 1996 Free Software Foundation, Inc. - -This file is part of the GNU MP Library. - -The GNU MP Library is free software; you can redistribute it and/or modify -it under the terms of the GNU Library General Public License as published by -the Free Software Foundation; either version 2 of the License, or (at your -option) any later version. - -The GNU MP Library is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public -License for more details. - -You should have received a copy of the GNU Library General Public License -along with the GNU MP Library; see the file COPYING.LIB. If not, write to -the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -MA 02111-1307, USA. */ - -#include -#include "gmp.h" -#include "gmp-impl.h" -#include "longlong.h" - -mp_limb_t -mpn_addmul_1 (res_ptr, s1_ptr, s1_size, s2_limb) - register mp_ptr res_ptr; - register mp_srcptr s1_ptr; - mp_size_t s1_size; - register mp_limb_t s2_limb; -{ - register mp_limb_t cy_limb; - register mp_size_t j; - register mp_limb_t prod_high, prod_low; - register mp_limb_t x; - - /* The loop counter and index J goes from -SIZE to -1. This way - the loop becomes faster. */ - j = -s1_size; - - /* Offset the base pointers to compensate for the negative indices. */ - res_ptr -= j; - s1_ptr -= j; - - cy_limb = 0; - do - { - umul_ppmm (prod_high, prod_low, s1_ptr[j], s2_limb); - - prod_low += cy_limb; - cy_limb = (prod_low < cy_limb) + prod_high; - - x = res_ptr[j]; - prod_low = x + prod_low; - cy_limb += (prod_low < x); - res_ptr[j] = prod_low; - } - while (++j != 0); - - return cy_limb; -} diff --git a/lib/gmp/mpn/cmp.c b/lib/gmp/mpn/cmp.c deleted file mode 100644 index 95d44f95..00000000 --- a/lib/gmp/mpn/cmp.c +++ /dev/null @@ -1,57 +0,0 @@ -/* mpn_cmp -- Compare two low-level natural-number integers. - -Copyright (C) 1991, 1993, 1994, 1996 Free Software Foundation, Inc. - -This file is part of the GNU MP Library. - -The GNU MP Library is free software; you can redistribute it and/or modify -it under the terms of the GNU Library General Public License as published by -the Free Software Foundation; either version 2 of the License, or (at your -option) any later version. - -The GNU MP Library is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public -License for more details. - -You should have received a copy of the GNU Library General Public License -along with the GNU MP Library; see the file COPYING.LIB. If not, write to -the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -MA 02111-1307, USA. */ - -#include -#include "gmp.h" -#include "gmp-impl.h" - -/* Compare OP1_PTR/OP1_SIZE with OP2_PTR/OP2_SIZE. - There are no restrictions on the relative sizes of - the two arguments. - Return 1 if OP1 > OP2, 0 if they are equal, and -1 if OP1 < OP2. */ - -int -#if __STDC__ -mpn_cmp (mp_srcptr op1_ptr, mp_srcptr op2_ptr, mp_size_t size) -#else -mpn_cmp (op1_ptr, op2_ptr, size) - mp_srcptr op1_ptr; - mp_srcptr op2_ptr; - mp_size_t size; -#endif -{ - mp_size_t i; - mp_limb_t op1_word, op2_word; - - for (i = size - 1; i >= 0; i--) - { - op1_word = op1_ptr[i]; - op2_word = op2_ptr[i]; - if (op1_word != op2_word) - goto diff; - } - return 0; - diff: - /* This can *not* be simplified to - op2_word - op2_word - since that expression might give signed overflow. */ - return (op1_word > op2_word) ? 1 : -1; -} diff --git a/lib/gmp/mpn/divrem.c b/lib/gmp/mpn/divrem.c deleted file mode 100644 index 1b41f6c9..00000000 --- a/lib/gmp/mpn/divrem.c +++ /dev/null @@ -1,246 +0,0 @@ -/* mpn_divrem -- Divide natural numbers, producing both remainder and - quotient. - -Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc. - -This file is part of the GNU MP Library. - -The GNU MP Library is free software; you can redistribute it and/or modify -it under the terms of the GNU Library General Public License as published by -the Free Software Foundation; either version 2 of the License, or (at your -option) any later version. - -The GNU MP Library is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public -License for more details. - -You should have received a copy of the GNU Library General Public License -along with the GNU MP Library; see the file COPYING.LIB. If not, write to -the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -MA 02111-1307, USA. */ - -#include -#include "gmp.h" -#include "gmp-impl.h" -#include "longlong.h" - -/* Divide num (NP/NSIZE) by den (DP/DSIZE) and write - the NSIZE-DSIZE least significant quotient limbs at QP - and the DSIZE long remainder at NP. If QEXTRA_LIMBS is - non-zero, generate that many fraction bits and append them after the - other quotient limbs. - Return the most significant limb of the quotient, this is always 0 or 1. - - Preconditions: - 0. NSIZE >= DSIZE. - 1. The most significant bit of the divisor must be set. - 2. QP must either not overlap with the input operands at all, or - QP + DSIZE >= NP must hold true. (This means that it's - possible to put the quotient in the high part of NUM, right after the - remainder in NUM. - 3. NSIZE >= DSIZE, even if QEXTRA_LIMBS is non-zero. */ - -mp_limb_t -#if __STDC__ -mpn_divrem (mp_ptr qp, mp_size_t qextra_limbs, - mp_ptr np, mp_size_t nsize, - mp_srcptr dp, mp_size_t dsize) -#else -mpn_divrem (qp, qextra_limbs, np, nsize, dp, dsize) - mp_ptr qp; - mp_size_t qextra_limbs; - mp_ptr np; - mp_size_t nsize; - mp_srcptr dp; - mp_size_t dsize; -#endif -{ - mp_limb_t most_significant_q_limb = 0; - - switch (dsize) - { - case 0: - /* We are asked to divide by zero, so go ahead and do it! (To make - the compiler not remove this statement, return the value.) */ - return 1 / dsize; - - case 1: - { - mp_size_t i; - mp_limb_t n1; - mp_limb_t d; - - d = dp[0]; - n1 = np[nsize - 1]; - - if (n1 >= d) - { - n1 -= d; - most_significant_q_limb = 1; - } - - qp += qextra_limbs; - for (i = nsize - 2; i >= 0; i--) - udiv_qrnnd (qp[i], n1, n1, np[i], d); - qp -= qextra_limbs; - - for (i = qextra_limbs - 1; i >= 0; i--) - udiv_qrnnd (qp[i], n1, n1, 0, d); - - np[0] = n1; - } - break; - - case 2: - { - mp_size_t i; - mp_limb_t n1, n0, n2; - mp_limb_t d1, d0; - - np += nsize - 2; - d1 = dp[1]; - d0 = dp[0]; - n1 = np[1]; - n0 = np[0]; - - if (n1 >= d1 && (n1 > d1 || n0 >= d0)) - { - sub_ddmmss (n1, n0, n1, n0, d1, d0); - most_significant_q_limb = 1; - } - - for (i = qextra_limbs + nsize - 2 - 1; i >= 0; i--) - { - mp_limb_t q; - mp_limb_t r; - - if (i >= qextra_limbs) - np--; - else - np[0] = 0; - - if (n1 == d1) - { - /* Q should be either 111..111 or 111..110. Need special - treatment of this rare case as normal division would - give overflow. */ - q = ~(mp_limb_t) 0; - - r = n0 + d1; - if (r < d1) /* Carry in the addition? */ - { - add_ssaaaa (n1, n0, r - d0, np[0], 0, d0); - qp[i] = q; - continue; - } - n1 = d0 - (d0 != 0); - n0 = -d0; - } - else - { - udiv_qrnnd (q, r, n1, n0, d1); - umul_ppmm (n1, n0, d0, q); - } - - n2 = np[0]; - q_test: - if (n1 > r || (n1 == r && n0 > n2)) - { - /* The estimated Q was too large. */ - q--; - - sub_ddmmss (n1, n0, n1, n0, 0, d0); - r += d1; - if (r >= d1) /* If not carry, test Q again. */ - goto q_test; - } - - qp[i] = q; - sub_ddmmss (n1, n0, r, n2, n1, n0); - } - np[1] = n1; - np[0] = n0; - } - break; - - default: - { - mp_size_t i; - mp_limb_t dX, d1, n0; - - np += nsize - dsize; - dX = dp[dsize - 1]; - d1 = dp[dsize - 2]; - n0 = np[dsize - 1]; - - if (n0 >= dX) - { - if (n0 > dX || mpn_cmp (np, dp, dsize - 1) >= 0) - { - mpn_sub_n (np, np, dp, dsize); - n0 = np[dsize - 1]; - most_significant_q_limb = 1; - } - } - - for (i = qextra_limbs + nsize - dsize - 1; i >= 0; i--) - { - mp_limb_t q; - mp_limb_t n1, n2; - mp_limb_t cy_limb; - - if (i >= qextra_limbs) - { - np--; - n2 = np[dsize]; - } - else - { - n2 = np[dsize - 1]; - MPN_COPY_DECR (np + 1, np, dsize); - np[0] = 0; - } - - if (n0 == dX) - /* This might over-estimate q, but it's probably not worth - the extra code here to find out. */ - q = ~(mp_limb_t) 0; - else - { - mp_limb_t r; - - udiv_qrnnd (q, r, n0, np[dsize - 1], dX); - umul_ppmm (n1, n0, d1, q); - - while (n1 > r || (n1 == r && n0 > np[dsize - 2])) - { - q--; - r += dX; - if (r < dX) /* I.e. "carry in previous addition?" */ - break; - n1 -= n0 < d1; - n0 -= d1; - } - } - - /* Possible optimization: We already have (q * n0) and (1 * n1) - after the calculation of q. Taking advantage of that, we - could make this loop make two iterations less. */ - - cy_limb = mpn_submul_1 (np, dp, dsize, q); - - if (n2 != cy_limb) - { - mpn_add_n (np, np, dp, dsize); - q--; - } - - qp[i] = q; - n0 = np[dsize - 1]; - } - } - } - - return most_significant_q_limb; -} diff --git a/lib/gmp/mpn/get_str.c b/lib/gmp/mpn/get_str.c deleted file mode 100644 index 77c16436..00000000 --- a/lib/gmp/mpn/get_str.c +++ /dev/null @@ -1,212 +0,0 @@ -/* mpn_get_str -- Convert a MSIZE long limb vector pointed to by MPTR - to a printable string in STR in base BASE. - -Copyright (C) 1991, 1992, 1993, 1994, 1996 Free Software Foundation, Inc. - -This file is part of the GNU MP Library. - -The GNU MP Library is free software; you can redistribute it and/or modify -it under the terms of the GNU Library General Public License as published by -the Free Software Foundation; either version 2 of the License, or (at your -option) any later version. - -The GNU MP Library is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public -License for more details. - -You should have received a copy of the GNU Library General Public License -along with the GNU MP Library; see the file COPYING.LIB. If not, write to -the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -MA 02111-1307, USA. */ - -#include -#include "gmp.h" -#include "gmp-impl.h" -#include "longlong.h" - -/* Convert the limb vector pointed to by MPTR and MSIZE long to a - char array, using base BASE for the result array. Store the - result in the character array STR. STR must point to an array with - space for the largest possible number represented by a MSIZE long - limb vector + 1 extra character. - - The result is NOT in Ascii, to convert it to printable format, add - '0' or 'A' depending on the base and range. - - Return the number of digits in the result string. - This may include some leading zeros. - - The limb vector pointed to by MPTR is clobbered. */ - -size_t -mpn_get_str (str, base, mptr, msize) - unsigned char *str; - int base; - mp_ptr mptr; - mp_size_t msize; -{ - mp_limb_t big_base; -#if UDIV_NEEDS_NORMALIZATION || UDIV_TIME > 2 * UMUL_TIME - int normalization_steps; -#endif -#if UDIV_TIME > 2 * UMUL_TIME - mp_limb_t big_base_inverted; -#endif - unsigned int dig_per_u; - mp_size_t out_len; - register unsigned char *s; - - big_base = __mp_bases[base].big_base; - - s = str; - - /* Special case zero, as the code below doesn't handle it. */ - if (msize == 0) - { - s[0] = 0; - return 1; - } - - if ((base & (base - 1)) == 0) - { - /* The base is a power of 2. Make conversion from most - significant side. */ - mp_limb_t n1, n0; - register int bits_per_digit = big_base; - register int x; - register int bit_pos; - register int i; - - n1 = mptr[msize - 1]; - count_leading_zeros (x, n1); - - /* BIT_POS should be R when input ends in least sign. nibble, - R + bits_per_digit * n when input ends in n:th least significant - nibble. */ - - { - int bits; - - bits = BITS_PER_MP_LIMB * msize - x; - x = bits % bits_per_digit; - if (x != 0) - bits += bits_per_digit - x; - bit_pos = bits - (msize - 1) * BITS_PER_MP_LIMB; - } - - /* Fast loop for bit output. */ - i = msize - 1; - for (;;) - { - bit_pos -= bits_per_digit; - while (bit_pos >= 0) - { - *s++ = (n1 >> bit_pos) & ((1 << bits_per_digit) - 1); - bit_pos -= bits_per_digit; - } - i--; - if (i < 0) - break; - n0 = (n1 << -bit_pos) & ((1 << bits_per_digit) - 1); - n1 = mptr[i]; - bit_pos += BITS_PER_MP_LIMB; - *s++ = n0 | (n1 >> bit_pos); - } - - *s = 0; - - return s - str; - } - else - { - /* General case. The base is not a power of 2. Make conversion - from least significant end. */ - - /* If udiv_qrnnd only handles divisors with the most significant bit - set, prepare BIG_BASE for being a divisor by shifting it to the - left exactly enough to set the most significant bit. */ -#if UDIV_NEEDS_NORMALIZATION || UDIV_TIME > 2 * UMUL_TIME - count_leading_zeros (normalization_steps, big_base); - big_base <<= normalization_steps; -#if UDIV_TIME > 2 * UMUL_TIME - /* Get the fixed-point approximation to 1/(BIG_BASE << NORMALIZATION_STEPS). */ - big_base_inverted = __mp_bases[base].big_base_inverted; -#endif -#endif - - dig_per_u = __mp_bases[base].chars_per_limb; - out_len = ((size_t) msize * BITS_PER_MP_LIMB - * __mp_bases[base].chars_per_bit_exactly) + 1; - s += out_len; - - while (msize != 0) - { - int i; - mp_limb_t n0, n1; - -#if UDIV_NEEDS_NORMALIZATION || UDIV_TIME > 2 * UMUL_TIME - /* If we shifted BIG_BASE above, shift the dividend too, to get - the right quotient. We need to do this every loop, - since the intermediate quotients are OK, but the quotient from - one turn in the loop is going to be the dividend in the - next turn, and the dividend needs to be up-shifted. */ - if (normalization_steps != 0) - { - n0 = mpn_lshift (mptr, mptr, msize, normalization_steps); - - /* If the shifting gave a carry out limb, store it and - increase the length. */ - if (n0 != 0) - { - mptr[msize] = n0; - msize++; - } - } -#endif - - /* Divide the number at TP with BIG_BASE to get a quotient and a - remainder. The remainder is our new digit in base BIG_BASE. */ - i = msize - 1; - n1 = mptr[i]; - - if (n1 >= big_base) - n1 = 0; - else - { - msize--; - i--; - } - - for (; i >= 0; i--) - { - n0 = mptr[i]; -#if UDIV_TIME > 2 * UMUL_TIME - udiv_qrnnd_preinv (mptr[i], n1, n1, n0, big_base, big_base_inverted); -#else - udiv_qrnnd (mptr[i], n1, n1, n0, big_base); -#endif - } - -#if UDIV_NEEDS_NORMALIZATION || UDIV_TIME > 2 * UMUL_TIME - /* If we shifted above (at previous UDIV_NEEDS_NORMALIZATION tests) - the remainder will be up-shifted here. Compensate. */ - n1 >>= normalization_steps; -#endif - - /* Convert N1 from BIG_BASE to a string of digits in BASE - using single precision operations. */ - for (i = dig_per_u - 1; i >= 0; i--) - { - *--s = n1 % base; - n1 /= base; - if (n1 == 0 && msize == 0) - break; - } - } - - while (s != str) - *--s = 0; - return out_len; - } -} diff --git a/lib/gmp/mpn/inlines.c b/lib/gmp/mpn/inlines.c deleted file mode 100644 index 5c137d34..00000000 --- a/lib/gmp/mpn/inlines.c +++ /dev/null @@ -1,4 +0,0 @@ -#include -#define _FORCE_INLINES -#define _EXTERN_INLINE /* empty */ -#include "gmp.h" diff --git a/lib/gmp/mpn/lshift.c b/lib/gmp/mpn/lshift.c deleted file mode 100644 index 1d73afbc..00000000 --- a/lib/gmp/mpn/lshift.c +++ /dev/null @@ -1,88 +0,0 @@ -/* mpn_lshift -- Shift left low level. - -Copyright (C) 1991, 1993, 1994, 1996 Free Software Foundation, Inc. - -This file is part of the GNU MP Library. - -The GNU MP Library is free software; you can redistribute it and/or modify -it under the terms of the GNU Library General Public License as published by -the Free Software Foundation; either version 2 of the License, or (at your -option) any later version. - -The GNU MP Library is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public -License for more details. - -You should have received a copy of the GNU Library General Public License -along with the GNU MP Library; see the file COPYING.LIB. If not, write to -the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -MA 02111-1307, USA. */ - -#include -#include "gmp.h" -#include "gmp-impl.h" - -/* Shift U (pointed to by UP and USIZE digits long) CNT bits to the left - and store the USIZE least significant digits of the result at WP. - Return the bits shifted out from the most significant digit. - - Argument constraints: - 1. 0 < CNT < BITS_PER_MP_LIMB - 2. If the result is to be written over the input, WP must be >= UP. -*/ - -mp_limb_t -#if __STDC__ -mpn_lshift (register mp_ptr wp, - register mp_srcptr up, mp_size_t usize, - register unsigned int cnt) -#else -mpn_lshift (wp, up, usize, cnt) - register mp_ptr wp; - register mp_srcptr up; - mp_size_t usize; - register unsigned int cnt; -#endif -{ - register mp_limb_t high_limb, low_limb; - register unsigned sh_1, sh_2; - register mp_size_t i; - mp_limb_t retval; - -#ifdef DEBUG - if (usize == 0 || cnt == 0) - abort (); -#endif - - sh_1 = cnt; -#if 0 - if (sh_1 == 0) - { - if (wp != up) - { - /* Copy from high end to low end, to allow specified input/output - overlapping. */ - for (i = usize - 1; i >= 0; i--) - wp[i] = up[i]; - } - return 0; - } -#endif - - wp += 1; - sh_2 = BITS_PER_MP_LIMB - sh_1; - i = usize - 1; - low_limb = up[i]; - retval = low_limb >> sh_2; - high_limb = low_limb; - while (--i >= 0) - { - low_limb = up[i]; - wp[i] = (high_limb << sh_1) | (low_limb >> sh_2); - high_limb = low_limb; - } - wp[i] = high_limb << sh_1; - - return retval; -} diff --git a/lib/gmp/mpn/mp_bases.c b/lib/gmp/mpn/mp_bases.c deleted file mode 100644 index f2f6daef..00000000 --- a/lib/gmp/mpn/mp_bases.c +++ /dev/null @@ -1,550 +0,0 @@ -/* __mp_bases -- Structure for conversion between internal binary - format and strings in base 2..255. The fields are explained in - gmp-impl.h. - - -Copyright (C) 1991, 1993, 1994, 1996 Free Software Foundation, Inc. - -This file is part of the GNU MP Library. - -The GNU MP Library is free software; you can redistribute it and/or modify -it under the terms of the GNU Library General Public License as published by -the Free Software Foundation; either version 2 of the License, or (at your -option) any later version. - -The GNU MP Library is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public -License for more details. - -You should have received a copy of the GNU Library General Public License -along with the GNU MP Library; see the file COPYING.LIB. If not, write to -the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -MA 02111-1307, USA. */ - -#include -#include "gmp.h" -#include "gmp-impl.h" - -#if BITS_PER_MP_LIMB == 32 -const struct bases __mp_bases[256] = -{ - /* 0 */ {0, 0.0, 0, 0}, - /* 1 */ {0, 1e38, 0, 0}, - /* 2 */ {32, 1.00000000, 0x1, 0x0}, - /* 3 */ {20, 0.63092975, 0xcfd41b91, 0x3b563c24}, - /* 4 */ {16, 0.50000000, 0x2, 0x0}, - /* 5 */ {13, 0.43067656, 0x48c27395, 0xc25c2684}, - /* 6 */ {12, 0.38685281, 0x81bf1000, 0xf91bd1b6}, - /* 7 */ {11, 0.35620719, 0x75db9c97, 0x1607a2cb}, - /* 8 */ {10, 0.33333333, 0x3, 0x0}, - /* 9 */ {10, 0.31546488, 0xcfd41b91, 0x3b563c24}, - /* 10 */ {9, 0.30103000, 0x3b9aca00, 0x12e0be82}, - /* 11 */ {9, 0.28906483, 0x8c8b6d2b, 0xd24cde04}, - /* 12 */ {8, 0.27894295, 0x19a10000, 0x3fa39ab5}, - /* 13 */ {8, 0.27023815, 0x309f1021, 0x50f8ac5f}, - /* 14 */ {8, 0.26264954, 0x57f6c100, 0x74843b1e}, - /* 15 */ {8, 0.25595802, 0x98c29b81, 0xad0326c2}, - /* 16 */ {8, 0.25000000, 0x4, 0x0}, - /* 17 */ {7, 0.24465054, 0x18754571, 0x4ef0b6bd}, - /* 18 */ {7, 0.23981247, 0x247dbc80, 0xc0fc48a1}, - /* 19 */ {7, 0.23540891, 0x3547667b, 0x33838942}, - /* 20 */ {7, 0.23137821, 0x4c4b4000, 0xad7f29ab}, - /* 21 */ {7, 0.22767025, 0x6b5a6e1d, 0x313c3d15}, - /* 22 */ {7, 0.22424382, 0x94ace180, 0xb8cca9e0}, - /* 23 */ {7, 0.22106473, 0xcaf18367, 0x42ed6de9}, - /* 24 */ {6, 0.21810429, 0xb640000, 0x67980e0b}, - /* 25 */ {6, 0.21533828, 0xe8d4a51, 0x19799812}, - /* 26 */ {6, 0.21274605, 0x1269ae40, 0xbce85396}, - /* 27 */ {6, 0.21030992, 0x17179149, 0x62c103a9}, - /* 28 */ {6, 0.20801460, 0x1cb91000, 0x1d353d43}, - /* 29 */ {6, 0.20584683, 0x23744899, 0xce1decea}, - /* 30 */ {6, 0.20379505, 0x2b73a840, 0x790fc511}, - /* 31 */ {6, 0.20184909, 0x34e63b41, 0x35b865a0}, - /* 32 */ {6, 0.20000000, 0x5, 0x0}, - /* 33 */ {6, 0.19823986, 0x4cfa3cc1, 0xa9aed1b3}, - /* 34 */ {6, 0.19656163, 0x5c13d840, 0x63dfc229}, - /* 35 */ {6, 0.19495902, 0x6d91b519, 0x2b0fee30}, - /* 36 */ {6, 0.19342640, 0x81bf1000, 0xf91bd1b6}, - /* 37 */ {6, 0.19195872, 0x98ede0c9, 0xac89c3a9}, - /* 38 */ {6, 0.19055141, 0xb3773e40, 0x6d2c32fe}, - /* 39 */ {6, 0.18920036, 0xd1bbc4d1, 0x387907c9}, - /* 40 */ {6, 0.18790182, 0xf4240000, 0xc6f7a0b}, - /* 41 */ {5, 0.18665241, 0x6e7d349, 0x28928154}, - /* 42 */ {5, 0.18544902, 0x7ca30a0, 0x6e8629d}, - /* 43 */ {5, 0.18428883, 0x8c32bbb, 0xd373dca0}, - /* 44 */ {5, 0.18316925, 0x9d46c00, 0xa0b17895}, - /* 45 */ {5, 0.18208790, 0xaffacfd, 0x746811a5}, - /* 46 */ {5, 0.18104260, 0xc46bee0, 0x4da6500f}, - /* 47 */ {5, 0.18003133, 0xdab86ef, 0x2ba23582}, - /* 48 */ {5, 0.17905223, 0xf300000, 0xdb20a88}, - /* 49 */ {5, 0.17810359, 0x10d63af1, 0xe68d5ce4}, - /* 50 */ {5, 0.17718382, 0x12a05f20, 0xb7cdfd9d}, - /* 51 */ {5, 0.17629143, 0x1490aae3, 0x8e583933}, - /* 52 */ {5, 0.17542506, 0x16a97400, 0x697cc3ea}, - /* 53 */ {5, 0.17458343, 0x18ed2825, 0x48a5ca6c}, - /* 54 */ {5, 0.17376534, 0x1b5e4d60, 0x2b52db16}, - /* 55 */ {5, 0.17296969, 0x1dff8297, 0x111586a6}, - /* 56 */ {5, 0.17219543, 0x20d38000, 0xf31d2b36}, - /* 57 */ {5, 0.17144160, 0x23dd1799, 0xc8d76d19}, - /* 58 */ {5, 0.17070728, 0x271f35a0, 0xa2cb1eb4}, - /* 59 */ {5, 0.16999162, 0x2a9ce10b, 0x807c3ec3}, - /* 60 */ {5, 0.16929381, 0x2e593c00, 0x617ec8bf}, - /* 61 */ {5, 0.16861310, 0x3257844d, 0x45746cbe}, - /* 62 */ {5, 0.16794878, 0x369b13e0, 0x2c0aa273}, - /* 63 */ {5, 0.16730018, 0x3b27613f, 0x14f90805}, - /* 64 */ {5, 0.16666667, 0x6, 0x0}, - /* 65 */ {5, 0.16604765, 0x4528a141, 0xd9cf0829}, - /* 66 */ {5, 0.16544255, 0x4aa51420, 0xb6fc4841}, - /* 67 */ {5, 0.16485086, 0x50794633, 0x973054cb}, - /* 68 */ {5, 0.16427205, 0x56a94400, 0x7a1dbe4b}, - /* 69 */ {5, 0.16370566, 0x5d393975, 0x5f7fcd7f}, - /* 70 */ {5, 0.16315122, 0x642d7260, 0x47196c84}, - /* 71 */ {5, 0.16260831, 0x6b8a5ae7, 0x30b43635}, - /* 72 */ {5, 0.16207652, 0x73548000, 0x1c1fa5f6}, - /* 73 */ {5, 0.16155547, 0x7b908fe9, 0x930634a}, - /* 74 */ {5, 0.16104477, 0x84435aa0, 0xef7f4a3c}, - /* 75 */ {5, 0.16054409, 0x8d71d25b, 0xcf5552d2}, - /* 76 */ {5, 0.16005307, 0x97210c00, 0xb1a47c8e}, - /* 77 */ {5, 0.15957142, 0xa1563f9d, 0x9634b43e}, - /* 78 */ {5, 0.15909881, 0xac16c8e0, 0x7cd3817d}, - /* 79 */ {5, 0.15863496, 0xb768278f, 0x65536761}, - /* 80 */ {5, 0.15817959, 0xc3500000, 0x4f8b588e}, - /* 81 */ {5, 0.15773244, 0xcfd41b91, 0x3b563c24}, - /* 82 */ {5, 0.15729325, 0xdcfa6920, 0x28928154}, - /* 83 */ {5, 0.15686177, 0xeac8fd83, 0x1721bfb0}, - /* 84 */ {5, 0.15643779, 0xf9461400, 0x6e8629d}, - /* 85 */ {4, 0.15602107, 0x31c84b1, 0x491cc17c}, - /* 86 */ {4, 0.15561139, 0x342ab10, 0x3a11d83b}, - /* 87 */ {4, 0.15520856, 0x36a2c21, 0x2be074cd}, - /* 88 */ {4, 0.15481238, 0x3931000, 0x1e7a02e7}, - /* 89 */ {4, 0.15442266, 0x3bd5ee1, 0x11d10edd}, - /* 90 */ {4, 0.15403922, 0x3e92110, 0x5d92c68}, - /* 91 */ {4, 0.15366189, 0x4165ef1, 0xf50dbfb2}, - /* 92 */ {4, 0.15329049, 0x4452100, 0xdf9f1316}, - /* 93 */ {4, 0.15292487, 0x4756fd1, 0xcb52a684}, - /* 94 */ {4, 0.15256487, 0x4a75410, 0xb8163e97}, - /* 95 */ {4, 0.15221035, 0x4dad681, 0xa5d8f269}, - /* 96 */ {4, 0.15186115, 0x5100000, 0x948b0fcd}, - /* 97 */ {4, 0.15151715, 0x546d981, 0x841e0215}, - /* 98 */ {4, 0.15117821, 0x57f6c10, 0x74843b1e}, - /* 99 */ {4, 0.15084420, 0x5b9c0d1, 0x65b11e6e}, - /* 100 */ {4, 0.15051500, 0x5f5e100, 0x5798ee23}, - /* 101 */ {4, 0.15019048, 0x633d5f1, 0x4a30b99b}, - /* 102 */ {4, 0.14987054, 0x673a910, 0x3d6e4d94}, - /* 103 */ {4, 0.14955506, 0x6b563e1, 0x314825b0}, - /* 104 */ {4, 0.14924394, 0x6f91000, 0x25b55f2e}, - /* 105 */ {4, 0.14893706, 0x73eb721, 0x1aadaccb}, - /* 106 */ {4, 0.14863434, 0x7866310, 0x10294ba2}, - /* 107 */ {4, 0.14833567, 0x7d01db1, 0x620f8f6}, - /* 108 */ {4, 0.14804096, 0x81bf100, 0xf91bd1b6}, - /* 109 */ {4, 0.14775011, 0x869e711, 0xe6d37b2a}, - /* 110 */ {4, 0.14746305, 0x8ba0a10, 0xd55cff6e}, - /* 111 */ {4, 0.14717969, 0x90c6441, 0xc4ad2db2}, - /* 112 */ {4, 0.14689994, 0x9610000, 0xb4b985cf}, - /* 113 */ {4, 0.14662372, 0x9b7e7c1, 0xa5782bef}, - /* 114 */ {4, 0.14635096, 0xa112610, 0x96dfdd2a}, - /* 115 */ {4, 0.14608158, 0xa6cc591, 0x88e7e509}, - /* 116 */ {4, 0.14581551, 0xacad100, 0x7b8813d3}, - /* 117 */ {4, 0.14555268, 0xb2b5331, 0x6eb8b595}, - /* 118 */ {4, 0.14529302, 0xb8e5710, 0x627289db}, - /* 119 */ {4, 0.14503647, 0xbf3e7a1, 0x56aebc07}, - /* 120 */ {4, 0.14478295, 0xc5c1000, 0x4b66dc33}, - /* 121 */ {4, 0.14453241, 0xcc6db61, 0x4094d8a3}, - /* 122 */ {4, 0.14428479, 0xd345510, 0x3632f7a5}, - /* 123 */ {4, 0.14404003, 0xda48871, 0x2c3bd1f0}, - /* 124 */ {4, 0.14379807, 0xe178100, 0x22aa4d5f}, - /* 125 */ {4, 0.14355885, 0xe8d4a51, 0x19799812}, - /* 126 */ {4, 0.14332233, 0xf05f010, 0x10a523e5}, - /* 127 */ {4, 0.14308844, 0xf817e01, 0x828a237}, - /* 128 */ {4, 0.14285714, 0x7, 0x0}, - /* 129 */ {4, 0.14262838, 0x10818201, 0xf04ec452}, - /* 130 */ {4, 0.14240211, 0x11061010, 0xe136444a}, - /* 131 */ {4, 0.14217828, 0x118db651, 0xd2af9589}, - /* 132 */ {4, 0.14195685, 0x12188100, 0xc4b42a83}, - /* 133 */ {4, 0.14173777, 0x12a67c71, 0xb73dccf5}, - /* 134 */ {4, 0.14152100, 0x1337b510, 0xaa4698c5}, - /* 135 */ {4, 0.14130649, 0x13cc3761, 0x9dc8f729}, - /* 136 */ {4, 0.14109421, 0x14641000, 0x91bf9a30}, - /* 137 */ {4, 0.14088412, 0x14ff4ba1, 0x86257887}, - /* 138 */ {4, 0.14067617, 0x159df710, 0x7af5c98c}, - /* 139 */ {4, 0.14047033, 0x16401f31, 0x702c01a0}, - /* 140 */ {4, 0.14026656, 0x16e5d100, 0x65c3ceb1}, - /* 141 */ {4, 0.14006482, 0x178f1991, 0x5bb91502}, - /* 142 */ {4, 0.13986509, 0x183c0610, 0x5207ec23}, - /* 143 */ {4, 0.13966731, 0x18eca3c1, 0x48ac9c19}, - /* 144 */ {4, 0.13947147, 0x19a10000, 0x3fa39ab5}, - /* 145 */ {4, 0.13927753, 0x1a592841, 0x36e98912}, - /* 146 */ {4, 0.13908545, 0x1b152a10, 0x2e7b3140}, - /* 147 */ {4, 0.13889521, 0x1bd51311, 0x2655840b}, - /* 148 */ {4, 0.13870677, 0x1c98f100, 0x1e7596ea}, - /* 149 */ {4, 0.13852011, 0x1d60d1b1, 0x16d8a20d}, - /* 150 */ {4, 0.13833519, 0x1e2cc310, 0xf7bfe87}, - /* 151 */ {4, 0.13815199, 0x1efcd321, 0x85d2492}, - /* 152 */ {4, 0.13797047, 0x1fd11000, 0x179a9f4}, - /* 153 */ {4, 0.13779062, 0x20a987e1, 0xf59e80eb}, - /* 154 */ {4, 0.13761241, 0x21864910, 0xe8b768db}, - /* 155 */ {4, 0.13743580, 0x226761f1, 0xdc39d6d5}, - /* 156 */ {4, 0.13726078, 0x234ce100, 0xd021c5d1}, - /* 157 */ {4, 0.13708732, 0x2436d4d1, 0xc46b5e37}, - /* 158 */ {4, 0.13691539, 0x25254c10, 0xb912f39c}, - /* 159 */ {4, 0.13674498, 0x26185581, 0xae150294}, - /* 160 */ {4, 0.13657605, 0x27100000, 0xa36e2eb1}, - /* 161 */ {4, 0.13640859, 0x280c5a81, 0x991b4094}, - /* 162 */ {4, 0.13624257, 0x290d7410, 0x8f19241e}, - /* 163 */ {4, 0.13607797, 0x2a135bd1, 0x8564e6b7}, - /* 164 */ {4, 0.13591477, 0x2b1e2100, 0x7bfbb5b4}, - /* 165 */ {4, 0.13575295, 0x2c2dd2f1, 0x72dadcc8}, - /* 166 */ {4, 0.13559250, 0x2d428110, 0x69ffc498}, - /* 167 */ {4, 0.13543338, 0x2e5c3ae1, 0x6167f154}, - /* 168 */ {4, 0.13527558, 0x2f7b1000, 0x5911016e}, - /* 169 */ {4, 0.13511908, 0x309f1021, 0x50f8ac5f}, - /* 170 */ {4, 0.13496386, 0x31c84b10, 0x491cc17c}, - /* 171 */ {4, 0.13480991, 0x32f6d0b1, 0x417b26d8}, - /* 172 */ {4, 0.13465720, 0x342ab100, 0x3a11d83b}, - /* 173 */ {4, 0.13450572, 0x3563fc11, 0x32dee622}, - /* 174 */ {4, 0.13435545, 0x36a2c210, 0x2be074cd}, - /* 175 */ {4, 0.13420637, 0x37e71341, 0x2514bb58}, - /* 176 */ {4, 0.13405847, 0x39310000, 0x1e7a02e7}, - /* 177 */ {4, 0.13391173, 0x3a8098c1, 0x180ea5d0}, - /* 178 */ {4, 0.13376614, 0x3bd5ee10, 0x11d10edd}, - /* 179 */ {4, 0.13362168, 0x3d311091, 0xbbfb88e}, - /* 180 */ {4, 0.13347832, 0x3e921100, 0x5d92c68}, - /* 181 */ {4, 0.13333607, 0x3ff90031, 0x1c024c}, - /* 182 */ {4, 0.13319491, 0x4165ef10, 0xf50dbfb2}, - /* 183 */ {4, 0.13305481, 0x42d8eea1, 0xea30efa3}, - /* 184 */ {4, 0.13291577, 0x44521000, 0xdf9f1316}, - /* 185 */ {4, 0.13277777, 0x45d16461, 0xd555c0c9}, - /* 186 */ {4, 0.13264079, 0x4756fd10, 0xcb52a684}, - /* 187 */ {4, 0.13250483, 0x48e2eb71, 0xc193881f}, - /* 188 */ {4, 0.13236988, 0x4a754100, 0xb8163e97}, - /* 189 */ {4, 0.13223591, 0x4c0e0f51, 0xaed8b724}, - /* 190 */ {4, 0.13210292, 0x4dad6810, 0xa5d8f269}, - /* 191 */ {4, 0.13197089, 0x4f535d01, 0x9d15039d}, - /* 192 */ {4, 0.13183981, 0x51000000, 0x948b0fcd}, - /* 193 */ {4, 0.13170967, 0x52b36301, 0x8c394d1d}, - /* 194 */ {4, 0.13158046, 0x546d9810, 0x841e0215}, - /* 195 */ {4, 0.13145216, 0x562eb151, 0x7c3784f8}, - /* 196 */ {4, 0.13132477, 0x57f6c100, 0x74843b1e}, - /* 197 */ {4, 0.13119827, 0x59c5d971, 0x6d02985d}, - /* 198 */ {4, 0.13107265, 0x5b9c0d10, 0x65b11e6e}, - /* 199 */ {4, 0.13094791, 0x5d796e61, 0x5e8e5c64}, - /* 200 */ {4, 0.13082402, 0x5f5e1000, 0x5798ee23}, - /* 201 */ {4, 0.13070099, 0x614a04a1, 0x50cf7bde}, - /* 202 */ {4, 0.13057879, 0x633d5f10, 0x4a30b99b}, - /* 203 */ {4, 0.13045743, 0x65383231, 0x43bb66bd}, - /* 204 */ {4, 0.13033688, 0x673a9100, 0x3d6e4d94}, - /* 205 */ {4, 0.13021715, 0x69448e91, 0x374842ee}, - /* 206 */ {4, 0.13009822, 0x6b563e10, 0x314825b0}, - /* 207 */ {4, 0.12998007, 0x6d6fb2c1, 0x2b6cde75}, - /* 208 */ {4, 0.12986271, 0x6f910000, 0x25b55f2e}, - /* 209 */ {4, 0.12974613, 0x71ba3941, 0x2020a2c5}, - /* 210 */ {4, 0.12963031, 0x73eb7210, 0x1aadaccb}, - /* 211 */ {4, 0.12951524, 0x7624be11, 0x155b891f}, - /* 212 */ {4, 0.12940092, 0x78663100, 0x10294ba2}, - /* 213 */ {4, 0.12928734, 0x7aafdeb1, 0xb160fe9}, - /* 214 */ {4, 0.12917448, 0x7d01db10, 0x620f8f6}, - /* 215 */ {4, 0.12906235, 0x7f5c3a21, 0x14930ef}, - /* 216 */ {4, 0.12895094, 0x81bf1000, 0xf91bd1b6}, - /* 217 */ {4, 0.12884022, 0x842a70e1, 0xefdcb0c7}, - /* 218 */ {4, 0.12873021, 0x869e7110, 0xe6d37b2a}, - /* 219 */ {4, 0.12862089, 0x891b24f1, 0xddfeb94a}, - /* 220 */ {4, 0.12851224, 0x8ba0a100, 0xd55cff6e}, - /* 221 */ {4, 0.12840428, 0x8e2ef9d1, 0xcceced50}, - /* 222 */ {4, 0.12829698, 0x90c64410, 0xc4ad2db2}, - /* 223 */ {4, 0.12819034, 0x93669481, 0xbc9c75f9}, - /* 224 */ {4, 0.12808435, 0x96100000, 0xb4b985cf}, - /* 225 */ {4, 0.12797901, 0x98c29b81, 0xad0326c2}, - /* 226 */ {4, 0.12787431, 0x9b7e7c10, 0xa5782bef}, - /* 227 */ {4, 0.12777024, 0x9e43b6d1, 0x9e1771a9}, - /* 228 */ {4, 0.12766680, 0xa1126100, 0x96dfdd2a}, - /* 229 */ {4, 0.12756398, 0xa3ea8ff1, 0x8fd05c41}, - /* 230 */ {4, 0.12746176, 0xa6cc5910, 0x88e7e509}, - /* 231 */ {4, 0.12736016, 0xa9b7d1e1, 0x8225759d}, - /* 232 */ {4, 0.12725915, 0xacad1000, 0x7b8813d3}, - /* 233 */ {4, 0.12715874, 0xafac2921, 0x750eccf9}, - /* 234 */ {4, 0.12705891, 0xb2b53310, 0x6eb8b595}, - /* 235 */ {4, 0.12695967, 0xb5c843b1, 0x6884e923}, - /* 236 */ {4, 0.12686100, 0xb8e57100, 0x627289db}, - /* 237 */ {4, 0.12676290, 0xbc0cd111, 0x5c80c07b}, - /* 238 */ {4, 0.12666537, 0xbf3e7a10, 0x56aebc07}, - /* 239 */ {4, 0.12656839, 0xc27a8241, 0x50fbb19b}, - /* 240 */ {4, 0.12647197, 0xc5c10000, 0x4b66dc33}, - /* 241 */ {4, 0.12637609, 0xc91209c1, 0x45ef7c7c}, - /* 242 */ {4, 0.12628075, 0xcc6db610, 0x4094d8a3}, - /* 243 */ {4, 0.12618595, 0xcfd41b91, 0x3b563c24}, - /* 244 */ {4, 0.12609168, 0xd3455100, 0x3632f7a5}, - /* 245 */ {4, 0.12599794, 0xd6c16d31, 0x312a60c3}, - /* 246 */ {4, 0.12590471, 0xda488710, 0x2c3bd1f0}, - /* 247 */ {4, 0.12581200, 0xdddab5a1, 0x2766aa45}, - /* 248 */ {4, 0.12571980, 0xe1781000, 0x22aa4d5f}, - /* 249 */ {4, 0.12562811, 0xe520ad61, 0x1e06233c}, - /* 250 */ {4, 0.12553692, 0xe8d4a510, 0x19799812}, - /* 251 */ {4, 0.12544622, 0xec940e71, 0x15041c33}, - /* 252 */ {4, 0.12535601, 0xf05f0100, 0x10a523e5}, - /* 253 */ {4, 0.12526629, 0xf4359451, 0xc5c2749}, - /* 254 */ {4, 0.12517705, 0xf817e010, 0x828a237}, - /* 255 */ {4, 0.12508829, 0xfc05fc01, 0x40a1423}, -}; -#endif -#if BITS_PER_MP_LIMB == 64 -const struct bases __mp_bases[256] = -{ - /* 0 */ {0, 0.0, 0, 0}, - /* 1 */ {0, 1e38, 0, 0}, - /* 2 */ {64, 1.00000000, 0x1, 0x0}, - /* 3 */ {40, 0.63092975, 0xa8b8b452291fe821L, 0x846d550e37b5063dL}, - /* 4 */ {32, 0.50000000, 0x2L, 0x0L}, - /* 5 */ {27, 0.43067656, 0x6765c793fa10079dL, 0x3ce9a36f23c0fc90L}, - /* 6 */ {24, 0.38685281, 0x41c21cb8e1000000L, 0xf24f62335024a295L}, - /* 7 */ {22, 0.35620719, 0x3642798750226111L, 0x2df495ccaa57147bL}, - /* 8 */ {21, 0.33333333, 0x3L, 0x0L}, - /* 9 */ {20, 0.31546488, 0xa8b8b452291fe821L, 0x846d550e37b5063dL}, - /* 10 */ {19, 0.30103000, 0x8ac7230489e80000L, 0xd83c94fb6d2ac34aL}, - /* 11 */ {18, 0.28906483, 0x4d28cb56c33fa539L, 0xa8adf7ae45e7577bL}, - /* 12 */ {17, 0.27894295, 0x1eca170c00000000L, 0xa10c2bec5da8f8fL}, - /* 13 */ {17, 0.27023815, 0x780c7372621bd74dL, 0x10f4becafe412ec3L}, - /* 14 */ {16, 0.26264954, 0x1e39a5057d810000L, 0xf08480f672b4e86L}, - /* 15 */ {16, 0.25595802, 0x5b27ac993df97701L, 0x6779c7f90dc42f48L}, - /* 16 */ {16, 0.25000000, 0x4L, 0x0L}, - /* 17 */ {15, 0.24465054, 0x27b95e997e21d9f1L, 0x9c71e11bab279323L}, - /* 18 */ {15, 0.23981247, 0x5da0e1e53c5c8000L, 0x5dfaa697ec6f6a1cL}, - /* 19 */ {15, 0.23540891, 0xd2ae3299c1c4aedbL, 0x3711783f6be7e9ecL}, - /* 20 */ {14, 0.23137821, 0x16bcc41e90000000L, 0x6849b86a12b9b01eL}, - /* 21 */ {14, 0.22767025, 0x2d04b7fdd9c0ef49L, 0x6bf097ba5ca5e239L}, - /* 22 */ {14, 0.22424382, 0x5658597bcaa24000L, 0x7b8015c8d7af8f08L}, - /* 23 */ {14, 0.22106473, 0xa0e2073737609371L, 0x975a24b3a3151b38L}, - /* 24 */ {13, 0.21810429, 0xc29e98000000000L, 0x50bd367972689db1L}, - /* 25 */ {13, 0.21533828, 0x14adf4b7320334b9L, 0x8c240c4aecb13bb5L}, - /* 26 */ {13, 0.21274605, 0x226ed36478bfa000L, 0xdbd2e56854e118c9L}, - /* 27 */ {13, 0.21030992, 0x383d9170b85ff80bL, 0x2351ffcaa9c7c4aeL}, - /* 28 */ {13, 0.20801460, 0x5a3c23e39c000000L, 0x6b24188ca33b0636L}, - /* 29 */ {13, 0.20584683, 0x8e65137388122bcdL, 0xcc3dceaf2b8ba99dL}, - /* 30 */ {13, 0.20379505, 0xdd41bb36d259e000L, 0x2832e835c6c7d6b6L}, - /* 31 */ {12, 0.20184909, 0xaee5720ee830681L, 0x76b6aa272e1873c5L}, - /* 32 */ {12, 0.20000000, 0x5L, 0x0L}, - /* 33 */ {12, 0.19823986, 0x172588ad4f5f0981L, 0x61eaf5d402c7bf4fL}, - /* 34 */ {12, 0.19656163, 0x211e44f7d02c1000L, 0xeeb658123ffb27ecL}, - /* 35 */ {12, 0.19495902, 0x2ee56725f06e5c71L, 0x5d5e3762e6fdf509L}, - /* 36 */ {12, 0.19342640, 0x41c21cb8e1000000L, 0xf24f62335024a295L}, - /* 37 */ {12, 0.19195872, 0x5b5b57f8a98a5dd1L, 0x66ae7831762efb6fL}, - /* 38 */ {12, 0.19055141, 0x7dcff8986ea31000L, 0x47388865a00f544L}, - /* 39 */ {12, 0.18920036, 0xabd4211662a6b2a1L, 0x7d673c33a123b54cL}, - /* 40 */ {12, 0.18790182, 0xe8d4a51000000000L, 0x19799812dea11197L}, - /* 41 */ {11, 0.18665241, 0x7a32956ad081b79L, 0xc27e62e0686feaeL}, - /* 42 */ {11, 0.18544902, 0x9f49aaff0e86800L, 0x9b6e7507064ce7c7L}, - /* 43 */ {11, 0.18428883, 0xce583bb812d37b3L, 0x3d9ac2bf66cfed94L}, - /* 44 */ {11, 0.18316925, 0x109b79a654c00000L, 0xed46bc50ce59712aL}, - /* 45 */ {11, 0.18208790, 0x1543beff214c8b95L, 0x813d97e2c89b8d46L}, - /* 46 */ {11, 0.18104260, 0x1b149a79459a3800L, 0x2e81751956af8083L}, - /* 47 */ {11, 0.18003133, 0x224edfb5434a830fL, 0xdd8e0a95e30c0988L}, - /* 48 */ {11, 0.17905223, 0x2b3fb00000000000L, 0x7ad4dd48a0b5b167L}, - /* 49 */ {11, 0.17810359, 0x3642798750226111L, 0x2df495ccaa57147bL}, - /* 50 */ {11, 0.17718382, 0x43c33c1937564800L, 0xe392010175ee5962L}, - /* 51 */ {11, 0.17629143, 0x54411b2441c3cd8bL, 0x84eaf11b2fe7738eL}, - /* 52 */ {11, 0.17542506, 0x6851455acd400000L, 0x3a1e3971e008995dL}, - /* 53 */ {11, 0.17458343, 0x80a23b117c8feb6dL, 0xfd7a462344ffce25L}, - /* 54 */ {11, 0.17376534, 0x9dff7d32d5dc1800L, 0x9eca40b40ebcef8aL}, - /* 55 */ {11, 0.17296969, 0xc155af6faeffe6a7L, 0x52fa161a4a48e43dL}, - /* 56 */ {11, 0.17219543, 0xebb7392e00000000L, 0x1607a2cbacf930c1L}, - /* 57 */ {10, 0.17144160, 0x50633659656d971L, 0x97a014f8e3be55f1L}, - /* 58 */ {10, 0.17070728, 0x5fa8624c7fba400L, 0x568df8b76cbf212cL}, - /* 59 */ {10, 0.16999162, 0x717d9faa73c5679L, 0x20ba7c4b4e6ef492L}, - /* 60 */ {10, 0.16929381, 0x86430aac6100000L, 0xe81ee46b9ef492f5L}, - /* 61 */ {10, 0.16861310, 0x9e64d9944b57f29L, 0x9dc0d10d51940416L}, - /* 62 */ {10, 0.16794878, 0xba5ca5392cb0400L, 0x5fa8ed2f450272a5L}, - /* 63 */ {10, 0.16730018, 0xdab2ce1d022cd81L, 0x2ba9eb8c5e04e641L}, - /* 64 */ {10, 0.16666667, 0x6L, 0x0L}, - /* 65 */ {10, 0.16604765, 0x12aeed5fd3e2d281L, 0xb67759cc00287bf1L}, - /* 66 */ {10, 0.16544255, 0x15c3da1572d50400L, 0x78621feeb7f4ed33L}, - /* 67 */ {10, 0.16485086, 0x194c05534f75ee29L, 0x43d55b5f72943bc0L}, - /* 68 */ {10, 0.16427205, 0x1d56299ada100000L, 0x173decb64d1d4409L}, - /* 69 */ {10, 0.16370566, 0x21f2a089a4ff4f79L, 0xe29fb54fd6b6074fL}, - /* 70 */ {10, 0.16315122, 0x2733896c68d9a400L, 0xa1f1f5c210d54e62L}, - /* 71 */ {10, 0.16260831, 0x2d2cf2c33b533c71L, 0x6aac7f9bfafd57b2L}, - /* 72 */ {10, 0.16207652, 0x33f506e440000000L, 0x3b563c2478b72ee2L}, - /* 73 */ {10, 0.16155547, 0x3ba43bec1d062211L, 0x12b536b574e92d1bL}, - /* 74 */ {10, 0.16104477, 0x4455872d8fd4e400L, 0xdf86c03020404fa5L}, - /* 75 */ {10, 0.16054409, 0x4e2694539f2f6c59L, 0xa34adf02234eea8eL}, - /* 76 */ {10, 0.16005307, 0x5938006c18900000L, 0x6f46eb8574eb59ddL}, - /* 77 */ {10, 0.15957142, 0x65ad9912474aa649L, 0x42459b481df47cecL}, - /* 78 */ {10, 0.15909881, 0x73ae9ff4241ec400L, 0x1b424b95d80ca505L}, - /* 79 */ {10, 0.15863496, 0x836612ee9c4ce1e1L, 0xf2c1b982203a0dacL}, - /* 80 */ {10, 0.15817959, 0x9502f90000000000L, 0xb7cdfd9d7bdbab7dL}, - /* 81 */ {10, 0.15773244, 0xa8b8b452291fe821L, 0x846d550e37b5063dL}, - /* 82 */ {10, 0.15729325, 0xbebf59a07dab4400L, 0x57931eeaf85cf64fL}, - /* 83 */ {10, 0.15686177, 0xd7540d4093bc3109L, 0x305a944507c82f47L}, - /* 84 */ {10, 0.15643779, 0xf2b96616f1900000L, 0xe007ccc9c22781aL}, - /* 85 */ {9, 0.15602107, 0x336de62af2bca35L, 0x3e92c42e000eeed4L}, - /* 86 */ {9, 0.15561139, 0x39235ec33d49600L, 0x1ebe59130db2795eL}, - /* 87 */ {9, 0.15520856, 0x3f674e539585a17L, 0x268859e90f51b89L}, - /* 88 */ {9, 0.15481238, 0x4645b6958000000L, 0xd24cde0463108cfaL}, - /* 89 */ {9, 0.15442266, 0x4dcb74afbc49c19L, 0xa536009f37adc383L}, - /* 90 */ {9, 0.15403922, 0x56064e1d18d9a00L, 0x7cea06ce1c9ace10L}, - /* 91 */ {9, 0.15366189, 0x5f04fe2cd8a39fbL, 0x58db032e72e8ba43L}, - /* 92 */ {9, 0.15329049, 0x68d74421f5c0000L, 0x388cc17cae105447L}, - /* 93 */ {9, 0.15292487, 0x738df1f6ab4827dL, 0x1b92672857620ce0L}, - /* 94 */ {9, 0.15256487, 0x7f3afbc9cfb5e00L, 0x18c6a9575c2ade4L}, - /* 95 */ {9, 0.15221035, 0x8bf187fba88f35fL, 0xd44da7da8e44b24fL}, - /* 96 */ {9, 0.15186115, 0x99c600000000000L, 0xaa2f78f1b4cc6794L}, - /* 97 */ {9, 0.15151715, 0xa8ce21eb6531361L, 0x843c067d091ee4ccL}, - /* 98 */ {9, 0.15117821, 0xb92112c1a0b6200L, 0x62005e1e913356e3L}, - /* 99 */ {9, 0.15084420, 0xcad7718b8747c43L, 0x4316eed01dedd518L}, - /* 100 */ {9, 0.15051500, 0xde0b6b3a7640000L, 0x2725dd1d243aba0eL}, - /* 101 */ {9, 0.15019048, 0xf2d8cf5fe6d74c5L, 0xddd9057c24cb54fL}, - /* 102 */ {9, 0.14987054, 0x1095d25bfa712600L, 0xedeee175a736d2a1L}, - /* 103 */ {9, 0.14955506, 0x121b7c4c3698faa7L, 0xc4699f3df8b6b328L}, - /* 104 */ {9, 0.14924394, 0x13c09e8d68000000L, 0x9ebbe7d859cb5a7cL}, - /* 105 */ {9, 0.14893706, 0x15876ccb0b709ca9L, 0x7c828b9887eb2179L}, - /* 106 */ {9, 0.14863434, 0x17723c2976da2a00L, 0x5d652ab99001adcfL}, - /* 107 */ {9, 0.14833567, 0x198384e9c259048bL, 0x4114f1754e5d7b32L}, - /* 108 */ {9, 0.14804096, 0x1bbde41dfeec0000L, 0x274b7c902f7e0188L}, - /* 109 */ {9, 0.14775011, 0x1e241d6e3337910dL, 0xfc9e0fbb32e210cL}, - /* 110 */ {9, 0.14746305, 0x20b91cee9901ee00L, 0xf4afa3e594f8ea1fL}, - /* 111 */ {9, 0.14717969, 0x237ff9079863dfefL, 0xcd85c32e9e4437b0L}, - /* 112 */ {9, 0.14689994, 0x267bf47000000000L, 0xa9bbb147e0dd92a8L}, - /* 113 */ {9, 0.14662372, 0x29b08039fbeda7f1L, 0x8900447b70e8eb82L}, - /* 114 */ {9, 0.14635096, 0x2d213df34f65f200L, 0x6b0a92adaad5848aL}, - /* 115 */ {9, 0.14608158, 0x30d201d957a7c2d3L, 0x4f990ad8740f0ee5L}, - /* 116 */ {9, 0.14581551, 0x34c6d52160f40000L, 0x3670a9663a8d3610L}, - /* 117 */ {9, 0.14555268, 0x3903f855d8f4c755L, 0x1f5c44188057be3cL}, - /* 118 */ {9, 0.14529302, 0x3d8de5c8ec59b600L, 0xa2bea956c4e4977L}, - /* 119 */ {9, 0.14503647, 0x4269541d1ff01337L, 0xed68b23033c3637eL}, - /* 120 */ {9, 0.14478295, 0x479b38e478000000L, 0xc99cf624e50549c5L}, - /* 121 */ {9, 0.14453241, 0x4d28cb56c33fa539L, 0xa8adf7ae45e7577bL}, - /* 122 */ {9, 0.14428479, 0x5317871fa13aba00L, 0x8a5bc740b1c113e5L}, - /* 123 */ {9, 0.14404003, 0x596d2f44de9fa71bL, 0x6e6c7efb81cfbb9bL}, - /* 124 */ {9, 0.14379807, 0x602fd125c47c0000L, 0x54aba5c5cada5f10L}, - /* 125 */ {9, 0.14355885, 0x6765c793fa10079dL, 0x3ce9a36f23c0fc90L}, - /* 126 */ {9, 0.14332233, 0x6f15be069b847e00L, 0x26fb43de2c8cd2a8L}, - /* 127 */ {9, 0.14308844, 0x7746b3e82a77047fL, 0x12b94793db8486a1L}, - /* 128 */ {9, 0.14285714, 0x7L, 0x0L}, - /* 129 */ {9, 0.14262838, 0x894953f7ea890481L, 0xdd5deca404c0156dL}, - /* 130 */ {9, 0.14240211, 0x932abffea4848200L, 0xbd51373330291de0L}, - /* 131 */ {9, 0.14217828, 0x9dacb687d3d6a163L, 0x9fa4025d66f23085L}, - /* 132 */ {9, 0.14195685, 0xa8d8102a44840000L, 0x842530ee2db4949dL}, - /* 133 */ {9, 0.14173777, 0xb4b60f9d140541e5L, 0x6aa7f2766b03dc25L}, - /* 134 */ {9, 0.14152100, 0xc15065d4856e4600L, 0x53035ba7ebf32e8dL}, - /* 135 */ {9, 0.14130649, 0xceb1363f396d23c7L, 0x3d12091fc9fb4914L}, - /* 136 */ {9, 0.14109421, 0xdce31b2488000000L, 0x28b1cb81b1ef1849L}, - /* 137 */ {9, 0.14088412, 0xebf12a24bca135c9L, 0x15c35be67ae3e2c9L}, - /* 138 */ {9, 0.14067617, 0xfbe6f8dbf88f4a00L, 0x42a17bd09be1ff0L}, - /* 139 */ {8, 0.14047033, 0x1ef156c084ce761L, 0x8bf461f03cf0bbfL}, - /* 140 */ {8, 0.14026656, 0x20c4e3b94a10000L, 0xf3fbb43f68a32d05L}, - /* 141 */ {8, 0.14006482, 0x22b0695a08ba421L, 0xd84f44c48564dc19L}, - /* 142 */ {8, 0.13986509, 0x24b4f35d7a4c100L, 0xbe58ebcce7956abeL}, - /* 143 */ {8, 0.13966731, 0x26d397284975781L, 0xa5fac463c7c134b7L}, - /* 144 */ {8, 0.13947147, 0x290d74100000000L, 0x8f19241e28c7d757L}, - /* 145 */ {8, 0.13927753, 0x2b63b3a37866081L, 0x799a6d046c0ae1aeL}, - /* 146 */ {8, 0.13908545, 0x2dd789f4d894100L, 0x6566e37d746a9e40L}, - /* 147 */ {8, 0.13889521, 0x306a35e51b58721L, 0x526887dbfb5f788fL}, - /* 148 */ {8, 0.13870677, 0x331d01712e10000L, 0x408af3382b8efd3dL}, - /* 149 */ {8, 0.13852011, 0x35f14200a827c61L, 0x2fbb374806ec05f1L}, - /* 150 */ {8, 0.13833519, 0x38e858b62216100L, 0x1fe7c0f0afce87feL}, - /* 151 */ {8, 0.13815199, 0x3c03b2c13176a41L, 0x11003d517540d32eL}, - /* 152 */ {8, 0.13797047, 0x3f44c9b21000000L, 0x2f5810f98eff0dcL}, - /* 153 */ {8, 0.13779062, 0x42ad23cef3113c1L, 0xeb72e35e7840d910L}, - /* 154 */ {8, 0.13761241, 0x463e546b19a2100L, 0xd27de19593dc3614L}, - /* 155 */ {8, 0.13743580, 0x49f9fc3f96684e1L, 0xbaf391fd3e5e6fc2L}, - /* 156 */ {8, 0.13726078, 0x4de1c9c5dc10000L, 0xa4bd38c55228c81dL}, - /* 157 */ {8, 0.13708732, 0x51f77994116d2a1L, 0x8fc5a8de8e1de782L}, - /* 158 */ {8, 0.13691539, 0x563cd6bb3398100L, 0x7bf9265bea9d3a3bL}, - /* 159 */ {8, 0.13674498, 0x5ab3bb270beeb01L, 0x69454b325983dccdL}, - /* 160 */ {8, 0.13657605, 0x5f5e10000000000L, 0x5798ee2308c39df9L}, - /* 161 */ {8, 0.13640859, 0x643dce0ec16f501L, 0x46e40ba0fa66a753L}, - /* 162 */ {8, 0.13624257, 0x6954fe21e3e8100L, 0x3717b0870b0db3a7L}, - /* 163 */ {8, 0.13607797, 0x6ea5b9755f440a1L, 0x2825e6775d11cdebL}, - /* 164 */ {8, 0.13591477, 0x74322a1c0410000L, 0x1a01a1c09d1b4dacL}, - /* 165 */ {8, 0.13575295, 0x79fc8b6ae8a46e1L, 0xc9eb0a8bebc8f3eL}, - /* 166 */ {8, 0.13559250, 0x80072a66d512100L, 0xffe357ff59e6a004L}, - /* 167 */ {8, 0.13543338, 0x86546633b42b9c1L, 0xe7dfd1be05fa61a8L}, - /* 168 */ {8, 0.13527558, 0x8ce6b0861000000L, 0xd11ed6fc78f760e5L}, - /* 169 */ {8, 0.13511908, 0x93c08e16a022441L, 0xbb8db609dd29ebfeL}, - /* 170 */ {8, 0.13496386, 0x9ae49717f026100L, 0xa71aec8d1813d532L}, - /* 171 */ {8, 0.13480991, 0xa25577ae24c1a61L, 0x93b612a9f20fbc02L}, - /* 172 */ {8, 0.13465720, 0xaa15f068e610000L, 0x814fc7b19a67d317L}, - /* 173 */ {8, 0.13450572, 0xb228d6bf7577921L, 0x6fd9a03f2e0a4b7cL}, - /* 174 */ {8, 0.13435545, 0xba91158ef5c4100L, 0x5f4615a38d0d316eL}, - /* 175 */ {8, 0.13420637, 0xc351ad9aec0b681L, 0x4f8876863479a286L}, - /* 176 */ {8, 0.13405847, 0xcc6db6100000000L, 0x4094d8a3041b60ebL}, - /* 177 */ {8, 0.13391173, 0xd5e85d09025c181L, 0x32600b8ed883a09bL}, - /* 178 */ {8, 0.13376614, 0xdfc4e816401c100L, 0x24df8c6eb4b6d1f1L}, - /* 179 */ {8, 0.13362168, 0xea06b4c72947221L, 0x18097a8ee151acefL}, - /* 180 */ {8, 0.13347832, 0xf4b139365210000L, 0xbd48cc8ec1cd8e3L}, - /* 181 */ {8, 0.13333607, 0xffc80497d520961L, 0x3807a8d67485fbL}, - /* 182 */ {8, 0.13319491, 0x10b4ebfca1dee100L, 0xea5768860b62e8d8L}, - /* 183 */ {8, 0.13305481, 0x117492de921fc141L, 0xd54faf5b635c5005L}, - /* 184 */ {8, 0.13291577, 0x123bb2ce41000000L, 0xc14a56233a377926L}, - /* 185 */ {8, 0.13277777, 0x130a8b6157bdecc1L, 0xae39a88db7cd329fL}, - /* 186 */ {8, 0.13264079, 0x13e15dede0e8a100L, 0x9c10bde69efa7ab6L}, - /* 187 */ {8, 0.13250483, 0x14c06d941c0ca7e1L, 0x8ac36c42a2836497L}, - /* 188 */ {8, 0.13236988, 0x15a7ff487a810000L, 0x7a463c8b84f5ef67L}, - /* 189 */ {8, 0.13223591, 0x169859ddc5c697a1L, 0x6a8e5f5ad090fd4bL}, - /* 190 */ {8, 0.13210292, 0x1791c60f6fed0100L, 0x5b91a2943596fc56L}, - /* 191 */ {8, 0.13197089, 0x18948e8c0e6fba01L, 0x4d4667b1c468e8f0L}, - /* 192 */ {8, 0.13183981, 0x19a1000000000000L, 0x3fa39ab547994dafL}, - /* 193 */ {8, 0.13170967, 0x1ab769203dafc601L, 0x32a0a9b2faee1e2aL}, - /* 194 */ {8, 0.13158046, 0x1bd81ab557f30100L, 0x26357ceac0e96962L}, - /* 195 */ {8, 0.13145216, 0x1d0367a69fed1ba1L, 0x1a5a6f65caa5859eL}, - /* 196 */ {8, 0.13132477, 0x1e39a5057d810000L, 0xf08480f672b4e86L}, - /* 197 */ {8, 0.13119827, 0x1f7b2a18f29ac3e1L, 0x4383340615612caL}, - /* 198 */ {8, 0.13107265, 0x20c850694c2aa100L, 0xf3c77969ee4be5a2L}, - /* 199 */ {8, 0.13094791, 0x222173cc014980c1L, 0xe00993cc187c5ec9L}, - /* 200 */ {8, 0.13082402, 0x2386f26fc1000000L, 0xcd2b297d889bc2b6L}, - /* 201 */ {8, 0.13070099, 0x24f92ce8af296d41L, 0xbb214d5064862b22L}, - /* 202 */ {8, 0.13057879, 0x2678863cd0ece100L, 0xa9e1a7ca7ea10e20L}, - /* 203 */ {8, 0.13045743, 0x280563f0a9472d61L, 0x99626e72b39ea0cfL}, - /* 204 */ {8, 0.13033688, 0x29a02e1406210000L, 0x899a5ba9c13fafd9L}, - /* 205 */ {8, 0.13021715, 0x2b494f4efe6d2e21L, 0x7a80a705391e96ffL}, - /* 206 */ {8, 0.13009822, 0x2d0134ef21cbc100L, 0x6c0cfe23de23042aL}, - /* 207 */ {8, 0.12998007, 0x2ec84ef4da2ef581L, 0x5e377df359c944ddL}, - /* 208 */ {8, 0.12986271, 0x309f102100000000L, 0x50f8ac5fc8f53985L}, - /* 209 */ {8, 0.12974613, 0x3285ee02a1420281L, 0x44497266278e35b7L}, - /* 210 */ {8, 0.12963031, 0x347d6104fc324100L, 0x382316831f7ee175L}, - /* 211 */ {8, 0.12951524, 0x3685e47dade53d21L, 0x2c7f377833b8946eL}, - /* 212 */ {8, 0.12940092, 0x389ff6bb15610000L, 0x2157c761ab4163efL}, - /* 213 */ {8, 0.12928734, 0x3acc1912ebb57661L, 0x16a7071803cc49a9L}, - /* 214 */ {8, 0.12917448, 0x3d0acff111946100L, 0xc6781d80f8224fcL}, - /* 215 */ {8, 0.12906235, 0x3f5ca2e692eaf841L, 0x294092d370a900bL}, - /* 216 */ {8, 0.12895094, 0x41c21cb8e1000000L, 0xf24f62335024a295L}, - /* 217 */ {8, 0.12884022, 0x443bcb714399a5c1L, 0xe03b98f103fad6d2L}, - /* 218 */ {8, 0.12873021, 0x46ca406c81af2100L, 0xcee3d32cad2a9049L}, - /* 219 */ {8, 0.12862089, 0x496e106ac22aaae1L, 0xbe3f9df9277fdadaL}, - /* 220 */ {8, 0.12851224, 0x4c27d39fa5410000L, 0xae46f0d94c05e933L}, - /* 221 */ {8, 0.12840428, 0x4ef825c296e43ca1L, 0x9ef2280fb437a33dL}, - /* 222 */ {8, 0.12829698, 0x51dfa61f5ad88100L, 0x9039ff426d3f284bL}, - /* 223 */ {8, 0.12819034, 0x54def7a6d2f16901L, 0x82178c6d6b51f8f4L}, - /* 224 */ {8, 0.12808435, 0x57f6c10000000000L, 0x74843b1ee4c1e053L}, - /* 225 */ {8, 0.12797901, 0x5b27ac993df97701L, 0x6779c7f90dc42f48L}, - /* 226 */ {8, 0.12787431, 0x5e7268b9bbdf8100L, 0x5af23c74f9ad9fe9L}, - /* 227 */ {8, 0.12777024, 0x61d7a7932ff3d6a1L, 0x4ee7eae2acdc617eL}, - /* 228 */ {8, 0.12766680, 0x65581f53c8c10000L, 0x43556aa2ac262a0bL}, - /* 229 */ {8, 0.12756398, 0x68f48a385b8320e1L, 0x3835949593b8ddd1L}, - /* 230 */ {8, 0.12746176, 0x6cada69ed07c2100L, 0x2d837fbe78458762L}, - /* 231 */ {8, 0.12736016, 0x70843718cdbf27c1L, 0x233a7e150a54a555L}, - /* 232 */ {8, 0.12725915, 0x7479027ea1000000L, 0x19561984a50ff8feL}, - /* 233 */ {8, 0.12715874, 0x788cd40268f39641L, 0xfd211159fe3490fL}, - /* 234 */ {8, 0.12705891, 0x7cc07b437ecf6100L, 0x6aa563e655033e3L}, - /* 235 */ {8, 0.12695967, 0x8114cc6220762061L, 0xfbb614b3f2d3b14cL}, - /* 236 */ {8, 0.12686100, 0x858aa0135be10000L, 0xeac0f8837fb05773L}, - /* 237 */ {8, 0.12676290, 0x8a22d3b53c54c321L, 0xda6e4c10e8615ca5L}, - /* 238 */ {8, 0.12666537, 0x8ede496339f34100L, 0xcab755a8d01fa67fL}, - /* 239 */ {8, 0.12656839, 0x93bde80aec3a1481L, 0xbb95a9ae71aa3e0cL}, - /* 240 */ {8, 0.12647197, 0x98c29b8100000000L, 0xad0326c296b4f529L}, - /* 241 */ {8, 0.12637609, 0x9ded549671832381L, 0x9ef9f21eed31b7c1L}, - /* 242 */ {8, 0.12628075, 0xa33f092e0b1ac100L, 0x91747422be14b0b2L}, - /* 243 */ {8, 0.12618595, 0xa8b8b452291fe821L, 0x846d550e37b5063dL}, - /* 244 */ {8, 0.12609168, 0xae5b564ac3a10000L, 0x77df79e9a96c06f6L}, - /* 245 */ {8, 0.12599794, 0xb427f4b3be74c361L, 0x6bc6019636c7d0c2L}, - /* 246 */ {8, 0.12590471, 0xba1f9a938041e100L, 0x601c4205aebd9e47L}, - /* 247 */ {8, 0.12581200, 0xc0435871d1110f41L, 0x54ddc59756f05016L}, - /* 248 */ {8, 0.12571980, 0xc694446f01000000L, 0x4a0648979c838c18L}, - /* 249 */ {8, 0.12562811, 0xcd137a5b57ac3ec1L, 0x3f91b6e0bb3a053dL}, - /* 250 */ {8, 0.12553692, 0xd3c21bcecceda100L, 0x357c299a88ea76a5L}, - /* 251 */ {8, 0.12544622, 0xdaa150410b788de1L, 0x2bc1e517aecc56e3L}, - /* 252 */ {8, 0.12535601, 0xe1b24521be010000L, 0x225f56ceb3da9f5dL}, - /* 253 */ {8, 0.12526629, 0xe8f62df12777c1a1L, 0x1951136d53ad63acL}, - /* 254 */ {8, 0.12517705, 0xf06e445906fc0100L, 0x1093d504b3cd7d93L}, - /* 255 */ {8, 0.12508829, 0xf81bc845c81bf801L, 0x824794d1ec1814fL}, -}; -#endif diff --git a/lib/gmp/mpn/mul.c b/lib/gmp/mpn/mul.c deleted file mode 100644 index 960eb94e..00000000 --- a/lib/gmp/mpn/mul.c +++ /dev/null @@ -1,153 +0,0 @@ -/* mpn_mul -- Multiply two natural numbers. - -Copyright (C) 1991, 1993, 1994, 1996 Free Software Foundation, Inc. - -This file is part of the GNU MP Library. - -The GNU MP Library is free software; you can redistribute it and/or modify -it under the terms of the GNU Library General Public License as published by -the Free Software Foundation; either version 2 of the License, or (at your -option) any later version. - -The GNU MP Library is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public -License for more details. - -You should have received a copy of the GNU Library General Public License -along with the GNU MP Library; see the file COPYING.LIB. If not, write to -the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -MA 02111-1307, USA. */ - -#include -#include "gmp.h" -#include "gmp-impl.h" - -/* Multiply the natural numbers u (pointed to by UP, with USIZE limbs) - and v (pointed to by VP, with VSIZE limbs), and store the result at - PRODP. USIZE + VSIZE limbs are always stored, but if the input - operands are normalized. Return the most significant limb of the - result. - - NOTE: The space pointed to by PRODP is overwritten before finished - with U and V, so overlap is an error. - - Argument constraints: - 1. USIZE >= VSIZE. - 2. PRODP != UP and PRODP != VP, i.e. the destination - must be distinct from the multiplier and the multiplicand. */ - -/* If KARATSUBA_THRESHOLD is not already defined, define it to a - value which is good on most machines. */ -#ifndef KARATSUBA_THRESHOLD -#define KARATSUBA_THRESHOLD 32 -#endif - -mp_limb_t -#if __STDC__ -mpn_mul (mp_ptr prodp, - mp_srcptr up, mp_size_t usize, - mp_srcptr vp, mp_size_t vsize) -#else -mpn_mul (prodp, up, usize, vp, vsize) - mp_ptr prodp; - mp_srcptr up; - mp_size_t usize; - mp_srcptr vp; - mp_size_t vsize; -#endif -{ - mp_ptr prod_endp = prodp + usize + vsize - 1; - mp_limb_t cy; - mp_ptr tspace; - TMP_DECL (marker); - - if (vsize < KARATSUBA_THRESHOLD) - { - /* Handle simple cases with traditional multiplication. - - This is the most critical code of the entire function. All - multiplies rely on this, both small and huge. Small ones arrive - here immediately. Huge ones arrive here as this is the base case - for Karatsuba's recursive algorithm below. */ - mp_size_t i; - mp_limb_t cy_limb; - mp_limb_t v_limb; - - if (vsize == 0) - return 0; - - /* Multiply by the first limb in V separately, as the result can be - stored (not added) to PROD. We also avoid a loop for zeroing. */ - v_limb = vp[0]; - if (v_limb <= 1) - { - if (v_limb == 1) - MPN_COPY (prodp, up, usize); - else - MPN_ZERO (prodp, usize); - cy_limb = 0; - } - else - cy_limb = mpn_mul_1 (prodp, up, usize, v_limb); - - prodp[usize] = cy_limb; - prodp++; - - /* For each iteration in the outer loop, multiply one limb from - U with one limb from V, and add it to PROD. */ - for (i = 1; i < vsize; i++) - { - v_limb = vp[i]; - if (v_limb <= 1) - { - cy_limb = 0; - if (v_limb == 1) - cy_limb = mpn_add_n (prodp, prodp, up, usize); - } - else - cy_limb = mpn_addmul_1 (prodp, up, usize, v_limb); - - prodp[usize] = cy_limb; - prodp++; - } - return cy_limb; - } - - TMP_MARK (marker); - - tspace = (mp_ptr) TMP_ALLOC (2 * vsize * BYTES_PER_MP_LIMB); - MPN_MUL_N_RECURSE (prodp, up, vp, vsize, tspace); - - prodp += vsize; - up += vsize; - usize -= vsize; - if (usize >= vsize) - { - mp_ptr tp = (mp_ptr) TMP_ALLOC (2 * vsize * BYTES_PER_MP_LIMB); - do - { - MPN_MUL_N_RECURSE (tp, up, vp, vsize, tspace); - cy = mpn_add_n (prodp, prodp, tp, vsize); - mpn_add_1 (prodp + vsize, tp + vsize, vsize, cy); - prodp += vsize; - up += vsize; - usize -= vsize; - } - while (usize >= vsize); - } - - /* True: usize < vsize. */ - - /* Make life simple: Recurse. */ - - if (usize != 0) - { - mpn_mul (tspace, vp, vsize, up, usize); - cy = mpn_add_n (prodp, prodp, tspace, vsize); - mpn_add_1 (prodp + vsize, tspace + vsize, usize, cy); - } - - TMP_FREE (marker); - return *prod_endp; -} diff --git a/lib/gmp/mpn/mul_1.c b/lib/gmp/mpn/mul_1.c deleted file mode 100644 index 21aa9510..00000000 --- a/lib/gmp/mpn/mul_1.c +++ /dev/null @@ -1,60 +0,0 @@ -/* mpn_mul_1 -- Multiply a limb vector with a single limb and - store the product in a second limb vector. - -Copyright (C) 1991, 1992, 1993, 1994, 1996 Free Software Foundation, Inc. - -This file is part of the GNU MP Library. - -The GNU MP Library is free software; you can redistribute it and/or modify -it under the terms of the GNU Library General Public License as published by -the Free Software Foundation; either version 2 of the License, or (at your -option) any later version. - -The GNU MP Library is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public -License for more details. - -You should have received a copy of the GNU Library General Public License -along with the GNU MP Library; see the file COPYING.LIB. If not, write to -the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -MA 02111-1307, USA. */ - -#include -#include "gmp.h" -#include "gmp-impl.h" -#include "longlong.h" - -mp_limb_t -mpn_mul_1 (res_ptr, s1_ptr, s1_size, s2_limb) - register mp_ptr res_ptr; - register mp_srcptr s1_ptr; - mp_size_t s1_size; - register mp_limb_t s2_limb; -{ - register mp_limb_t cy_limb; - register mp_size_t j; - register mp_limb_t prod_high, prod_low; - - /* The loop counter and index J goes from -S1_SIZE to -1. This way - the loop becomes faster. */ - j = -s1_size; - - /* Offset the base pointers to compensate for the negative indices. */ - s1_ptr -= j; - res_ptr -= j; - - cy_limb = 0; - do - { - umul_ppmm (prod_high, prod_low, s1_ptr[j], s2_limb); - - prod_low += cy_limb; - cy_limb = (prod_low < cy_limb) + prod_high; - - res_ptr[j] = prod_low; - } - while (++j != 0); - - return cy_limb; -} diff --git a/lib/gmp/mpn/mul_n.c b/lib/gmp/mpn/mul_n.c deleted file mode 100644 index 104d332f..00000000 --- a/lib/gmp/mpn/mul_n.c +++ /dev/null @@ -1,402 +0,0 @@ -/* mpn_mul_n -- Multiply two natural numbers of length n. - -Copyright (C) 1991, 1992, 1993, 1994, 1996 Free Software Foundation, Inc. - -This file is part of the GNU MP Library. - -The GNU MP Library is free software; you can redistribute it and/or modify -it under the terms of the GNU Library General Public License as published by -the Free Software Foundation; either version 2 of the License, or (at your -option) any later version. - -The GNU MP Library is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public -License for more details. - -You should have received a copy of the GNU Library General Public License -along with the GNU MP Library; see the file COPYING.LIB. If not, write to -the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -MA 02111-1307, USA. */ - -#include -#include "gmp.h" -#include "gmp-impl.h" - -/* Multiply the natural numbers u (pointed to by UP) and v (pointed to by VP), - both with SIZE limbs, and store the result at PRODP. 2 * SIZE limbs are - always stored. Return the most significant limb. - - Argument constraints: - 1. PRODP != UP and PRODP != VP, i.e. the destination - must be distinct from the multiplier and the multiplicand. */ - -/* If KARATSUBA_THRESHOLD is not already defined, define it to a - value which is good on most machines. */ -#ifndef KARATSUBA_THRESHOLD -#define KARATSUBA_THRESHOLD 32 -#endif - -/* The code can't handle KARATSUBA_THRESHOLD smaller than 2. */ -#if KARATSUBA_THRESHOLD < 2 -#undef KARATSUBA_THRESHOLD -#define KARATSUBA_THRESHOLD 2 -#endif - -/* Handle simple cases with traditional multiplication. - - This is the most critical code of multiplication. All multiplies rely - on this, both small and huge. Small ones arrive here immediately. Huge - ones arrive here as this is the base case for Karatsuba's recursive - algorithm below. */ - -void -#if __STDC__ -impn_mul_n_basecase (mp_ptr prodp, mp_srcptr up, mp_srcptr vp, mp_size_t size) -#else -impn_mul_n_basecase (prodp, up, vp, size) - mp_ptr prodp; - mp_srcptr up; - mp_srcptr vp; - mp_size_t size; -#endif -{ - mp_size_t i; - mp_limb_t cy_limb; - mp_limb_t v_limb; - - /* Multiply by the first limb in V separately, as the result can be - stored (not added) to PROD. We also avoid a loop for zeroing. */ - v_limb = vp[0]; - if (v_limb <= 1) - { - if (v_limb == 1) - MPN_COPY (prodp, up, size); - else - MPN_ZERO (prodp, size); - cy_limb = 0; - } - else - cy_limb = mpn_mul_1 (prodp, up, size, v_limb); - - prodp[size] = cy_limb; - prodp++; - - /* For each iteration in the outer loop, multiply one limb from - U with one limb from V, and add it to PROD. */ - for (i = 1; i < size; i++) - { - v_limb = vp[i]; - if (v_limb <= 1) - { - cy_limb = 0; - if (v_limb == 1) - cy_limb = mpn_add_n (prodp, prodp, up, size); - } - else - cy_limb = mpn_addmul_1 (prodp, up, size, v_limb); - - prodp[size] = cy_limb; - prodp++; - } -} - -void -#if __STDC__ -impn_mul_n (mp_ptr prodp, - mp_srcptr up, mp_srcptr vp, mp_size_t size, mp_ptr tspace) -#else -impn_mul_n (prodp, up, vp, size, tspace) - mp_ptr prodp; - mp_srcptr up; - mp_srcptr vp; - mp_size_t size; - mp_ptr tspace; -#endif -{ - if ((size & 1) != 0) - { - /* The size is odd, the code code below doesn't handle that. - Multiply the least significant (size - 1) limbs with a recursive - call, and handle the most significant limb of S1 and S2 - separately. */ - /* A slightly faster way to do this would be to make the Karatsuba - code below behave as if the size were even, and let it check for - odd size in the end. I.e., in essence move this code to the end. - Doing so would save us a recursive call, and potentially make the - stack grow a lot less. */ - - mp_size_t esize = size - 1; /* even size */ - mp_limb_t cy_limb; - - MPN_MUL_N_RECURSE (prodp, up, vp, esize, tspace); - cy_limb = mpn_addmul_1 (prodp + esize, up, esize, vp[esize]); - prodp[esize + esize] = cy_limb; - cy_limb = mpn_addmul_1 (prodp + esize, vp, size, up[esize]); - - prodp[esize + size] = cy_limb; - } - else - { - /* Anatolij Alekseevich Karatsuba's divide-and-conquer algorithm. - - Split U in two pieces, U1 and U0, such that - U = U0 + U1*(B**n), - and V in V1 and V0, such that - V = V0 + V1*(B**n). - - UV is then computed recursively using the identity - - 2n n n n - UV = (B + B )U V + B (U -U )(V -V ) + (B + 1)U V - 1 1 1 0 0 1 0 0 - - Where B = 2**BITS_PER_MP_LIMB. */ - - mp_size_t hsize = size >> 1; - mp_limb_t cy; - int negflg; - - /*** Product H. ________________ ________________ - |_____U1 x V1____||____U0 x V0_____| */ - /* Put result in upper part of PROD and pass low part of TSPACE - as new TSPACE. */ - MPN_MUL_N_RECURSE (prodp + size, up + hsize, vp + hsize, hsize, tspace); - - /*** Product M. ________________ - |_(U1-U0)(V0-V1)_| */ - if (mpn_cmp (up + hsize, up, hsize) >= 0) - { - mpn_sub_n (prodp, up + hsize, up, hsize); - negflg = 0; - } - else - { - mpn_sub_n (prodp, up, up + hsize, hsize); - negflg = 1; - } - if (mpn_cmp (vp + hsize, vp, hsize) >= 0) - { - mpn_sub_n (prodp + hsize, vp + hsize, vp, hsize); - negflg ^= 1; - } - else - { - mpn_sub_n (prodp + hsize, vp, vp + hsize, hsize); - /* No change of NEGFLG. */ - } - /* Read temporary operands from low part of PROD. - Put result in low part of TSPACE using upper part of TSPACE - as new TSPACE. */ - MPN_MUL_N_RECURSE (tspace, prodp, prodp + hsize, hsize, tspace + size); - - /*** Add/copy product H. */ - MPN_COPY (prodp + hsize, prodp + size, hsize); - cy = mpn_add_n (prodp + size, prodp + size, prodp + size + hsize, hsize); - - /*** Add product M (if NEGFLG M is a negative number). */ - if (negflg) - cy -= mpn_sub_n (prodp + hsize, prodp + hsize, tspace, size); - else - cy += mpn_add_n (prodp + hsize, prodp + hsize, tspace, size); - - /*** Product L. ________________ ________________ - |________________||____U0 x V0_____| */ - /* Read temporary operands from low part of PROD. - Put result in low part of TSPACE using upper part of TSPACE - as new TSPACE. */ - MPN_MUL_N_RECURSE (tspace, up, vp, hsize, tspace + size); - - /*** Add/copy Product L (twice). */ - - cy += mpn_add_n (prodp + hsize, prodp + hsize, tspace, size); - if (cy) - mpn_add_1 (prodp + hsize + size, prodp + hsize + size, hsize, cy); - - MPN_COPY (prodp, tspace, hsize); - cy = mpn_add_n (prodp + hsize, prodp + hsize, tspace + hsize, hsize); - if (cy) - mpn_add_1 (prodp + size, prodp + size, size, 1); - } -} - -void -#if __STDC__ -impn_sqr_n_basecase (mp_ptr prodp, mp_srcptr up, mp_size_t size) -#else -impn_sqr_n_basecase (prodp, up, size) - mp_ptr prodp; - mp_srcptr up; - mp_size_t size; -#endif -{ - mp_size_t i; - mp_limb_t cy_limb; - mp_limb_t v_limb; - - /* Multiply by the first limb in V separately, as the result can be - stored (not added) to PROD. We also avoid a loop for zeroing. */ - v_limb = up[0]; - if (v_limb <= 1) - { - if (v_limb == 1) - MPN_COPY (prodp, up, size); - else - MPN_ZERO (prodp, size); - cy_limb = 0; - } - else - cy_limb = mpn_mul_1 (prodp, up, size, v_limb); - - prodp[size] = cy_limb; - prodp++; - - /* For each iteration in the outer loop, multiply one limb from - U with one limb from V, and add it to PROD. */ - for (i = 1; i < size; i++) - { - v_limb = up[i]; - if (v_limb <= 1) - { - cy_limb = 0; - if (v_limb == 1) - cy_limb = mpn_add_n (prodp, prodp, up, size); - } - else - cy_limb = mpn_addmul_1 (prodp, up, size, v_limb); - - prodp[size] = cy_limb; - prodp++; - } -} - -void -#if __STDC__ -impn_sqr_n (mp_ptr prodp, - mp_srcptr up, mp_size_t size, mp_ptr tspace) -#else -impn_sqr_n (prodp, up, size, tspace) - mp_ptr prodp; - mp_srcptr up; - mp_size_t size; - mp_ptr tspace; -#endif -{ - if ((size & 1) != 0) - { - /* The size is odd, the code code below doesn't handle that. - Multiply the least significant (size - 1) limbs with a recursive - call, and handle the most significant limb of S1 and S2 - separately. */ - /* A slightly faster way to do this would be to make the Karatsuba - code below behave as if the size were even, and let it check for - odd size in the end. I.e., in essence move this code to the end. - Doing so would save us a recursive call, and potentially make the - stack grow a lot less. */ - - mp_size_t esize = size - 1; /* even size */ - mp_limb_t cy_limb; - - MPN_SQR_N_RECURSE (prodp, up, esize, tspace); - cy_limb = mpn_addmul_1 (prodp + esize, up, esize, up[esize]); - prodp[esize + esize] = cy_limb; - cy_limb = mpn_addmul_1 (prodp + esize, up, size, up[esize]); - - prodp[esize + size] = cy_limb; - } - else - { - mp_size_t hsize = size >> 1; - mp_limb_t cy; - - /*** Product H. ________________ ________________ - |_____U1 x U1____||____U0 x U0_____| */ - /* Put result in upper part of PROD and pass low part of TSPACE - as new TSPACE. */ - MPN_SQR_N_RECURSE (prodp + size, up + hsize, hsize, tspace); - - /*** Product M. ________________ - |_(U1-U0)(U0-U1)_| */ - if (mpn_cmp (up + hsize, up, hsize) >= 0) - { - mpn_sub_n (prodp, up + hsize, up, hsize); - } - else - { - mpn_sub_n (prodp, up, up + hsize, hsize); - } - - /* Read temporary operands from low part of PROD. - Put result in low part of TSPACE using upper part of TSPACE - as new TSPACE. */ - MPN_SQR_N_RECURSE (tspace, prodp, hsize, tspace + size); - - /*** Add/copy product H. */ - MPN_COPY (prodp + hsize, prodp + size, hsize); - cy = mpn_add_n (prodp + size, prodp + size, prodp + size + hsize, hsize); - - /*** Add product M (if NEGFLG M is a negative number). */ - cy -= mpn_sub_n (prodp + hsize, prodp + hsize, tspace, size); - - /*** Product L. ________________ ________________ - |________________||____U0 x U0_____| */ - /* Read temporary operands from low part of PROD. - Put result in low part of TSPACE using upper part of TSPACE - as new TSPACE. */ - MPN_SQR_N_RECURSE (tspace, up, hsize, tspace + size); - - /*** Add/copy Product L (twice). */ - - cy += mpn_add_n (prodp + hsize, prodp + hsize, tspace, size); - if (cy) - mpn_add_1 (prodp + hsize + size, prodp + hsize + size, hsize, cy); - - MPN_COPY (prodp, tspace, hsize); - cy = mpn_add_n (prodp + hsize, prodp + hsize, tspace + hsize, hsize); - if (cy) - mpn_add_1 (prodp + size, prodp + size, size, 1); - } -} - -/* This should be made into an inline function in gmp.h. */ -inline void -#if __STDC__ -mpn_mul_n (mp_ptr prodp, mp_srcptr up, mp_srcptr vp, mp_size_t size) -#else -mpn_mul_n (prodp, up, vp, size) - mp_ptr prodp; - mp_srcptr up; - mp_srcptr vp; - mp_size_t size; -#endif -{ - TMP_DECL (marker); - TMP_MARK (marker); - if (up == vp) - { - if (size < KARATSUBA_THRESHOLD) - { - impn_sqr_n_basecase (prodp, up, size); - } - else - { - mp_ptr tspace; - tspace = (mp_ptr) TMP_ALLOC (2 * size * BYTES_PER_MP_LIMB); - impn_sqr_n (prodp, up, size, tspace); - } - } - else - { - if (size < KARATSUBA_THRESHOLD) - { - impn_mul_n_basecase (prodp, up, vp, size); - } - else - { - mp_ptr tspace; - tspace = (mp_ptr) TMP_ALLOC (2 * size * BYTES_PER_MP_LIMB); - impn_mul_n (prodp, up, vp, size, tspace); - } - } - TMP_FREE (marker); -} diff --git a/lib/gmp/mpn/sub_n.c b/lib/gmp/mpn/sub_n.c deleted file mode 100644 index 09478577..00000000 --- a/lib/gmp/mpn/sub_n.c +++ /dev/null @@ -1,63 +0,0 @@ -/* mpn_sub_n -- Subtract two limb vectors of equal, non-zero length. - -Copyright (C) 1992, 1993, 1994, 1996 Free Software Foundation, Inc. - -This file is part of the GNU MP Library. - -The GNU MP Library is free software; you can redistribute it and/or modify -it under the terms of the GNU Library General Public License as published by -the Free Software Foundation; either version 2 of the License, or (at your -option) any later version. - -The GNU MP Library is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public -License for more details. - -You should have received a copy of the GNU Library General Public License -along with the GNU MP Library; see the file COPYING.LIB. If not, write to -the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -MA 02111-1307, USA. */ - -#include -#include "gmp.h" -#include "gmp-impl.h" - -mp_limb_t -#if __STDC__ -mpn_sub_n (mp_ptr res_ptr, mp_srcptr s1_ptr, mp_srcptr s2_ptr, mp_size_t size) -#else -mpn_sub_n (res_ptr, s1_ptr, s2_ptr, size) - register mp_ptr res_ptr; - register mp_srcptr s1_ptr; - register mp_srcptr s2_ptr; - mp_size_t size; -#endif -{ - register mp_limb_t x, y, cy; - register mp_size_t j; - - /* The loop counter and index J goes from -SIZE to -1. This way - the loop becomes faster. */ - j = -size; - - /* Offset the base pointers to compensate for the negative indices. */ - s1_ptr -= j; - s2_ptr -= j; - res_ptr -= j; - - cy = 0; - do - { - y = s2_ptr[j]; - x = s1_ptr[j]; - y += cy; /* add previous carry to subtrahend */ - cy = (y < cy); /* get out carry from that addition */ - y = x - y; /* main subtract */ - cy = (y > x) + cy; /* get out carry from the subtract, combine */ - res_ptr[j] = y; - } - while (++j != 0); - - return cy; -} diff --git a/lib/gmp/mpn/submul_1.c b/lib/gmp/mpn/submul_1.c deleted file mode 100644 index 8af60a7c..00000000 --- a/lib/gmp/mpn/submul_1.c +++ /dev/null @@ -1,66 +0,0 @@ -/* mpn_submul_1 -- multiply the S1_SIZE long limb vector pointed to by S1_PTR - by S2_LIMB, subtract the S1_SIZE least significant limbs of the product - from the limb vector pointed to by RES_PTR. Return the most significant - limb of the product, adjusted for carry-out from the subtraction. - -Copyright (C) 1992, 1993, 1994, 1996 Free Software Foundation, Inc. - -This file is part of the GNU MP Library. - -The GNU MP Library is free software; you can redistribute it and/or modify -it under the terms of the GNU Library General Public License as published by -the Free Software Foundation; either version 2 of the License, or (at your -option) any later version. - -The GNU MP Library is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public -License for more details. - -You should have received a copy of the GNU Library General Public License -along with the GNU MP Library; see the file COPYING.LIB. If not, write to -the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -MA 02111-1307, USA. */ - -#include -#include "gmp.h" -#include "gmp-impl.h" -#include "longlong.h" - -mp_limb_t -mpn_submul_1 (res_ptr, s1_ptr, s1_size, s2_limb) - register mp_ptr res_ptr; - register mp_srcptr s1_ptr; - mp_size_t s1_size; - register mp_limb_t s2_limb; -{ - register mp_limb_t cy_limb; - register mp_size_t j; - register mp_limb_t prod_high, prod_low; - register mp_limb_t x; - - /* The loop counter and index J goes from -SIZE to -1. This way - the loop becomes faster. */ - j = -s1_size; - - /* Offset the base pointers to compensate for the negative indices. */ - res_ptr -= j; - s1_ptr -= j; - - cy_limb = 0; - do - { - umul_ppmm (prod_high, prod_low, s1_ptr[j], s2_limb); - - prod_low += cy_limb; - cy_limb = (prod_low < cy_limb) + prod_high; - - x = res_ptr[j]; - prod_low = x - prod_low; - cy_limb += (prod_low > x); - res_ptr[j] = prod_low; - } - while (++j != 0); - - return cy_limb; -}