Add Chromium-only Blender WebEngine parity work
This commit is contained in:
41
blender-5.2.0/extern/gmp-source/mpq/Makefile.am
vendored
Normal file
41
blender-5.2.0/extern/gmp-source/mpq/Makefile.am
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
## Process this file with automake to generate Makefile.in
|
||||
|
||||
# Copyright 1996, 1998, 2000-2002 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 either:
|
||||
#
|
||||
# * the GNU Lesser General Public License as published by the Free
|
||||
# Software Foundation; either version 3 of the License, or (at your
|
||||
# option) any later version.
|
||||
#
|
||||
# or
|
||||
#
|
||||
# * the GNU General Public License as published by the Free Software
|
||||
# Foundation; either version 2 of the License, or (at your option) any
|
||||
# later version.
|
||||
#
|
||||
# or both in parallel, as here.
|
||||
#
|
||||
# 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 General Public License
|
||||
# for more details.
|
||||
#
|
||||
# You should have received copies of the GNU General Public License and the
|
||||
# GNU Lesser General Public License along with the GNU MP Library. If not,
|
||||
# see https://www.gnu.org/licenses/.
|
||||
|
||||
|
||||
AM_CPPFLAGS = -D__GMP_WITHIN_GMP -I$(top_srcdir)
|
||||
|
||||
noinst_LTLIBRARIES = libmpq.la
|
||||
libmpq_la_SOURCES = \
|
||||
abs.c aors.c canonicalize.c clear.c clears.c \
|
||||
cmp.c cmp_si.c cmp_ui.c div.c equal.c \
|
||||
get_d.c get_den.c get_num.c get_str.c \
|
||||
init.c inits.c inp_str.c inv.c md_2exp.c mul.c neg.c out_str.c \
|
||||
set.c set_den.c set_num.c set_si.c set_str.c set_ui.c set_z.c set_d.c \
|
||||
set_f.c swap.c
|
||||
650
blender-5.2.0/extern/gmp-source/mpq/Makefile.in
vendored
Normal file
650
blender-5.2.0/extern/gmp-source/mpq/Makefile.in
vendored
Normal file
@@ -0,0 +1,650 @@
|
||||
# Makefile.in generated by automake 1.15 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2014 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.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
# Copyright 1996, 1998, 2000-2002 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 either:
|
||||
#
|
||||
# * the GNU Lesser General Public License as published by the Free
|
||||
# Software Foundation; either version 3 of the License, or (at your
|
||||
# option) any later version.
|
||||
#
|
||||
# or
|
||||
#
|
||||
# * the GNU General Public License as published by the Free Software
|
||||
# Foundation; either version 2 of the License, or (at your option) any
|
||||
# later version.
|
||||
#
|
||||
# or both in parallel, as here.
|
||||
#
|
||||
# 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 General Public License
|
||||
# for more details.
|
||||
#
|
||||
# You should have received copies of the GNU General Public License and the
|
||||
# GNU Lesser General Public License along with the GNU MP Library. If not,
|
||||
# see https://www.gnu.org/licenses/.
|
||||
|
||||
VPATH = @srcdir@
|
||||
am__is_gnu_make = { \
|
||||
if test -z '$(MAKELEVEL)'; then \
|
||||
false; \
|
||||
elif test -n '$(MAKE_HOST)'; then \
|
||||
true; \
|
||||
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
|
||||
true; \
|
||||
else \
|
||||
false; \
|
||||
fi; \
|
||||
}
|
||||
am__make_running_with_option = \
|
||||
case $${target_option-} in \
|
||||
?) ;; \
|
||||
*) echo "am__make_running_with_option: internal error: invalid" \
|
||||
"target option '$${target_option-}' specified" >&2; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
has_opt=no; \
|
||||
sane_makeflags=$$MAKEFLAGS; \
|
||||
if $(am__is_gnu_make); then \
|
||||
sane_makeflags=$$MFLAGS; \
|
||||
else \
|
||||
case $$MAKEFLAGS in \
|
||||
*\\[\ \ ]*) \
|
||||
bs=\\; \
|
||||
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
|
||||
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
|
||||
esac; \
|
||||
fi; \
|
||||
skip_next=no; \
|
||||
strip_trailopt () \
|
||||
{ \
|
||||
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
|
||||
}; \
|
||||
for flg in $$sane_makeflags; do \
|
||||
test $$skip_next = yes && { skip_next=no; continue; }; \
|
||||
case $$flg in \
|
||||
*=*|--*) continue;; \
|
||||
-*I) strip_trailopt 'I'; skip_next=yes;; \
|
||||
-*I?*) strip_trailopt 'I';; \
|
||||
-*O) strip_trailopt 'O'; skip_next=yes;; \
|
||||
-*O?*) strip_trailopt 'O';; \
|
||||
-*l) strip_trailopt 'l'; skip_next=yes;; \
|
||||
-*l?*) strip_trailopt 'l';; \
|
||||
-[dEDm]) skip_next=yes;; \
|
||||
-[JT]) skip_next=yes;; \
|
||||
esac; \
|
||||
case $$flg in \
|
||||
*$$target_option*) has_opt=yes; break;; \
|
||||
esac; \
|
||||
done; \
|
||||
test $$has_opt = yes
|
||||
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
|
||||
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = mpq
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
LTLIBRARIES = $(noinst_LTLIBRARIES)
|
||||
libmpq_la_LIBADD =
|
||||
am_libmpq_la_OBJECTS = abs.lo aors.lo canonicalize.lo clear.lo \
|
||||
clears.lo cmp.lo cmp_si.lo cmp_ui.lo div.lo equal.lo get_d.lo \
|
||||
get_den.lo get_num.lo get_str.lo init.lo inits.lo inp_str.lo \
|
||||
inv.lo md_2exp.lo mul.lo neg.lo out_str.lo set.lo set_den.lo \
|
||||
set_num.lo set_si.lo set_str.lo set_ui.lo set_z.lo set_d.lo \
|
||||
set_f.lo swap.lo
|
||||
libmpq_la_OBJECTS = $(am_libmpq_la_OBJECTS)
|
||||
AM_V_lt = $(am__v_lt_@AM_V@)
|
||||
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
|
||||
am__v_lt_0 = --silent
|
||||
am__v_lt_1 =
|
||||
AM_V_P = $(am__v_P_@AM_V@)
|
||||
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
|
||||
am__v_P_0 = false
|
||||
am__v_P_1 = :
|
||||
AM_V_GEN = $(am__v_GEN_@AM_V@)
|
||||
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
|
||||
am__v_GEN_0 = @echo " GEN " $@;
|
||||
am__v_GEN_1 =
|
||||
AM_V_at = $(am__v_at_@AM_V@)
|
||||
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
|
||||
am__v_at_0 = @
|
||||
am__v_at_1 =
|
||||
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
|
||||
depcomp =
|
||||
am__depfiles_maybe =
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
|
||||
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
|
||||
$(AM_CFLAGS) $(CFLAGS)
|
||||
AM_V_CC = $(am__v_CC_@AM_V@)
|
||||
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
|
||||
am__v_CC_0 = @echo " CC " $@;
|
||||
am__v_CC_1 =
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
|
||||
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
|
||||
am__v_CCLD_0 = @echo " CCLD " $@;
|
||||
am__v_CCLD_1 =
|
||||
SOURCES = $(libmpq_la_SOURCES)
|
||||
DIST_SOURCES = $(libmpq_la_SOURCES)
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
*) (install-info --version) >/dev/null 2>&1;; \
|
||||
esac
|
||||
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
|
||||
# Read a list of newline-separated strings from the standard input,
|
||||
# and print each of them once, without duplicates. Input order is
|
||||
# *not* preserved.
|
||||
am__uniquify_input = $(AWK) '\
|
||||
BEGIN { nonempty = 0; } \
|
||||
{ items[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in items) print i; }; } \
|
||||
'
|
||||
# Make sure the list of sources is unique. This is necessary because,
|
||||
# e.g., the same source file might be shared among _SOURCES variables
|
||||
# for different programs/libraries.
|
||||
am__define_uniq_tagged_files = \
|
||||
list='$(am__tagged_files)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | $(am__uniquify_input)`
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
am__DIST_COMMON = $(srcdir)/Makefile.in
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ABI = @ABI@
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
AR = @AR@
|
||||
AS = @AS@
|
||||
ASMFLAGS = @ASMFLAGS@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CALLING_CONVENTIONS_OBJS = @CALLING_CONVENTIONS_OBJS@
|
||||
CC = @CC@
|
||||
CCAS = @CCAS@
|
||||
CC_FOR_BUILD = @CC_FOR_BUILD@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CPP_FOR_BUILD = @CPP_FOR_BUILD@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFN_LONG_LONG_LIMB = @DEFN_LONG_LONG_LIMB@
|
||||
DEFS = @DEFS@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
|
||||
FGREP = @FGREP@
|
||||
GMP_LDFLAGS = @GMP_LDFLAGS@
|
||||
GMP_LIMB_BITS = @GMP_LIMB_BITS@
|
||||
GMP_NAIL_BITS = @GMP_NAIL_BITS@
|
||||
GREP = @GREP@
|
||||
HAVE_CLOCK_01 = @HAVE_CLOCK_01@
|
||||
HAVE_CPUTIME_01 = @HAVE_CPUTIME_01@
|
||||
HAVE_GETRUSAGE_01 = @HAVE_GETRUSAGE_01@
|
||||
HAVE_GETTIMEOFDAY_01 = @HAVE_GETTIMEOFDAY_01@
|
||||
HAVE_HOST_CPU_FAMILY_power = @HAVE_HOST_CPU_FAMILY_power@
|
||||
HAVE_HOST_CPU_FAMILY_powerpc = @HAVE_HOST_CPU_FAMILY_powerpc@
|
||||
HAVE_SIGACTION_01 = @HAVE_SIGACTION_01@
|
||||
HAVE_SIGALTSTACK_01 = @HAVE_SIGALTSTACK_01@
|
||||
HAVE_SIGSTACK_01 = @HAVE_SIGSTACK_01@
|
||||
HAVE_STACK_T_01 = @HAVE_STACK_T_01@
|
||||
HAVE_SYS_RESOURCE_H_01 = @HAVE_SYS_RESOURCE_H_01@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LEX = @LEX@
|
||||
LEXLIB = @LEXLIB@
|
||||
LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
|
||||
LIBCURSES = @LIBCURSES@
|
||||
LIBGMPXX_LDFLAGS = @LIBGMPXX_LDFLAGS@
|
||||
LIBGMP_DLL = @LIBGMP_DLL@
|
||||
LIBGMP_LDFLAGS = @LIBGMP_LDFLAGS@
|
||||
LIBM = @LIBM@
|
||||
LIBM_FOR_BUILD = @LIBM_FOR_BUILD@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBREADLINE = @LIBREADLINE@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
|
||||
M4 = @M4@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
SPEED_CYCLECOUNTER_OBJ = @SPEED_CYCLECOUNTER_OBJ@
|
||||
STRIP = @STRIP@
|
||||
TAL_OBJECT = @TAL_OBJECT@
|
||||
TUNE_LIBS = @TUNE_LIBS@
|
||||
TUNE_SQR_OBJ = @TUNE_SQR_OBJ@
|
||||
U_FOR_BUILD = @U_FOR_BUILD@
|
||||
VERSION = @VERSION@
|
||||
WITH_READLINE_01 = @WITH_READLINE_01@
|
||||
YACC = @YACC@
|
||||
YFLAGS = @YFLAGS@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_AR = @ac_ct_AR@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
gmp_srclinks = @gmp_srclinks@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
mpn_objects = @mpn_objects@
|
||||
mpn_objs_in_libgmp = @mpn_objs_in_libgmp@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
AM_CPPFLAGS = -D__GMP_WITHIN_GMP -I$(top_srcdir)
|
||||
noinst_LTLIBRARIES = libmpq.la
|
||||
libmpq_la_SOURCES = \
|
||||
abs.c aors.c canonicalize.c clear.c clears.c \
|
||||
cmp.c cmp_si.c cmp_ui.c div.c equal.c \
|
||||
get_d.c get_den.c get_num.c get_str.c \
|
||||
init.c inits.c inp_str.c inv.c md_2exp.c mul.c neg.c out_str.c \
|
||||
set.c set_den.c set_num.c set_si.c set_str.c set_ui.c set_z.c set_d.c \
|
||||
set_f.c swap.c
|
||||
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .lo .o .obj
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps mpq/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu --ignore-deps mpq/Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
clean-noinstLTLIBRARIES:
|
||||
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
|
||||
@list='$(noinst_LTLIBRARIES)'; \
|
||||
locs=`for p in $$list; do echo $$p; done | \
|
||||
sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
|
||||
sort -u`; \
|
||||
test -z "$$locs" || { \
|
||||
echo rm -f $${locs}; \
|
||||
rm -f $${locs}; \
|
||||
}
|
||||
|
||||
libmpq.la: $(libmpq_la_OBJECTS) $(libmpq_la_DEPENDENCIES) $(EXTRA_libmpq_la_DEPENDENCIES)
|
||||
$(AM_V_CCLD)$(LINK) $(libmpq_la_OBJECTS) $(libmpq_la_LIBADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
.c.o:
|
||||
$(AM_V_CC)$(COMPILE) -c -o $@ $<
|
||||
|
||||
.c.obj:
|
||||
$(AM_V_CC)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
|
||||
.c.lo:
|
||||
$(AM_V_CC)$(LTCOMPILE) -c -o $@ $<
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
ID: $(am__tagged_files)
|
||||
$(am__define_uniq_tagged_files); mkid -fID $$unique
|
||||
tags: tags-am
|
||||
TAGS: tags
|
||||
|
||||
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
$(am__define_uniq_tagged_files); \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: ctags-am
|
||||
|
||||
CTAGS: ctags
|
||||
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||
$(am__define_uniq_tagged_files); \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
cscopelist: cscopelist-am
|
||||
|
||||
cscopelist-am: $(am__tagged_files)
|
||||
list='$(am__tagged_files)'; \
|
||||
case "$(srcdir)" in \
|
||||
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
|
||||
*) sdir=$(subdir)/$(srcdir) ;; \
|
||||
esac; \
|
||||
for i in $$list; do \
|
||||
if test -f "$$i"; then \
|
||||
echo "$(subdir)/$$i"; \
|
||||
else \
|
||||
echo "$$sdir/$$i"; \
|
||||
fi; \
|
||||
done >> $(top_builddir)/cscope.files
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(LTLIBRARIES)
|
||||
installdirs:
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
if test -z '$(STRIP)'; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
install; \
|
||||
else \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
|
||||
fi
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
|
||||
mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
|
||||
mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am:
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
|
||||
clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \
|
||||
ctags-am distclean distclean-compile distclean-generic \
|
||||
distclean-libtool distclean-tags distdir dvi dvi-am html \
|
||||
html-am info info-am install install-am install-data \
|
||||
install-data-am install-dvi install-dvi-am install-exec \
|
||||
install-exec-am install-html install-html-am install-info \
|
||||
install-info-am install-man install-pdf install-pdf-am \
|
||||
install-ps install-ps-am install-strip installcheck \
|
||||
installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-compile \
|
||||
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
|
||||
tags tags-am uninstall uninstall-am
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
|
||||
# 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:
|
||||
55
blender-5.2.0/extern/gmp-source/mpq/abs.c
vendored
Normal file
55
blender-5.2.0/extern/gmp-source/mpq/abs.c
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
/* mpq_abs -- absolute value of a rational.
|
||||
|
||||
Copyright 2000, 2001, 2012 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 either:
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
or
|
||||
|
||||
* the GNU General Public License as published by the Free Software
|
||||
Foundation; either version 2 of the License, or (at your option) any
|
||||
later version.
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received copies of the GNU General Public License and the
|
||||
GNU Lesser General Public License along with the GNU MP Library. If not,
|
||||
see https://www.gnu.org/licenses/. */
|
||||
|
||||
#define __GMP_FORCE_mpq_abs 1
|
||||
|
||||
#include "gmp-impl.h"
|
||||
|
||||
|
||||
void
|
||||
mpq_abs (mpq_ptr dst, mpq_srcptr src)
|
||||
{
|
||||
mp_size_t num_abs_size = ABSIZ(NUM(src));
|
||||
|
||||
if (dst != src)
|
||||
{
|
||||
mp_size_t den_size = SIZ(DEN(src));
|
||||
mp_ptr dp;
|
||||
|
||||
dp = MPZ_NEWALLOC (NUM(dst), num_abs_size);
|
||||
MPN_COPY (dp, PTR(NUM(src)), num_abs_size);
|
||||
|
||||
dp = MPZ_NEWALLOC (DEN(dst), den_size);
|
||||
SIZ(DEN(dst)) = den_size;
|
||||
MPN_COPY (dp, PTR(DEN(src)), den_size);
|
||||
}
|
||||
|
||||
SIZ(NUM(dst)) = num_abs_size;
|
||||
}
|
||||
112
blender-5.2.0/extern/gmp-source/mpq/aors.c
vendored
Normal file
112
blender-5.2.0/extern/gmp-source/mpq/aors.c
vendored
Normal file
@@ -0,0 +1,112 @@
|
||||
/* mpq_add, mpq_sub -- add or subtract rational numbers.
|
||||
|
||||
Copyright 1991, 1994-1997, 2000, 2001, 2004, 2005 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 either:
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
or
|
||||
|
||||
* the GNU General Public License as published by the Free Software
|
||||
Foundation; either version 2 of the License, or (at your option) any
|
||||
later version.
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received copies of the GNU General Public License and the
|
||||
GNU Lesser General Public License along with the GNU MP Library. If not,
|
||||
see https://www.gnu.org/licenses/. */
|
||||
|
||||
#include "gmp-impl.h"
|
||||
|
||||
|
||||
static void __gmpq_aors (REGPARM_3_1 (mpq_ptr, mpq_srcptr, mpq_srcptr, void (*) (mpz_ptr, mpz_srcptr, mpz_srcptr))) REGPARM_ATTR (1);
|
||||
#define mpq_aors(w,x,y,fun) __gmpq_aors (REGPARM_3_1 (w, x, y, fun))
|
||||
|
||||
REGPARM_ATTR (1) static void
|
||||
mpq_aors (mpq_ptr rop, mpq_srcptr op1, mpq_srcptr op2,
|
||||
void (*fun) (mpz_ptr, mpz_srcptr, mpz_srcptr))
|
||||
{
|
||||
mpz_t gcd;
|
||||
mpz_t tmp1, tmp2;
|
||||
mp_size_t op1_num_size = ABSIZ(NUM(op1));
|
||||
mp_size_t op1_den_size = SIZ(DEN(op1));
|
||||
mp_size_t op2_num_size = ABSIZ(NUM(op2));
|
||||
mp_size_t op2_den_size = SIZ(DEN(op2));
|
||||
TMP_DECL;
|
||||
|
||||
TMP_MARK;
|
||||
MPZ_TMP_INIT (gcd, MIN (op1_den_size, op2_den_size));
|
||||
MPZ_TMP_INIT (tmp1, op1_num_size + op2_den_size);
|
||||
MPZ_TMP_INIT (tmp2, op2_num_size + op1_den_size);
|
||||
|
||||
/* ROP might be identical to either operand, so don't store the
|
||||
result there until we are finished with the input operands. We
|
||||
dare to overwrite the numerator of ROP when we are finished
|
||||
with the numerators of OP1 and OP2. */
|
||||
|
||||
mpz_gcd (gcd, DEN(op1), DEN(op2));
|
||||
if (! MPZ_EQUAL_1_P (gcd))
|
||||
{
|
||||
mpz_t t;
|
||||
|
||||
MPZ_TMP_INIT (t, MAX (op1_num_size + op2_den_size,
|
||||
op2_num_size + op1_den_size) + 2 - SIZ(gcd));
|
||||
|
||||
mpz_divexact_gcd (t, DEN(op2), gcd);
|
||||
mpz_divexact_gcd (tmp2, DEN(op1), gcd);
|
||||
|
||||
mpz_mul (tmp1, NUM(op1), t);
|
||||
mpz_mul (t, NUM(op2), tmp2);
|
||||
|
||||
(*fun) (t, tmp1, t);
|
||||
|
||||
mpz_gcd (gcd, t, gcd);
|
||||
if (MPZ_EQUAL_1_P (gcd))
|
||||
{
|
||||
mpz_set (NUM(rop), t);
|
||||
mpz_mul (DEN(rop), DEN(op2), tmp2);
|
||||
}
|
||||
else
|
||||
{
|
||||
mpz_divexact_gcd (NUM(rop), t, gcd);
|
||||
mpz_divexact_gcd (tmp1, DEN(op2), gcd);
|
||||
mpz_mul (DEN(rop), tmp1, tmp2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The common divisor is 1. This is the case (for random input) with
|
||||
probability 6/(pi**2), which is about 60.8%. */
|
||||
mpz_mul (tmp1, NUM(op1), DEN(op2));
|
||||
mpz_mul (tmp2, NUM(op2), DEN(op1));
|
||||
(*fun) (NUM(rop), tmp1, tmp2);
|
||||
mpz_mul (DEN(rop), DEN(op1), DEN(op2));
|
||||
}
|
||||
TMP_FREE;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
mpq_add (mpq_ptr rop, mpq_srcptr op1, mpq_srcptr op2)
|
||||
{
|
||||
mpq_aors (rop, op1, op2, mpz_add);
|
||||
}
|
||||
|
||||
void
|
||||
mpq_sub (mpq_ptr rop, mpq_srcptr op1, mpq_srcptr op2)
|
||||
{
|
||||
mpq_aors (rop, op1, op2, mpz_sub);
|
||||
}
|
||||
61
blender-5.2.0/extern/gmp-source/mpq/canonicalize.c
vendored
Normal file
61
blender-5.2.0/extern/gmp-source/mpq/canonicalize.c
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
/* mpq_canonicalize(op) -- Remove common factors of the denominator and
|
||||
numerator in OP.
|
||||
|
||||
Copyright 1991, 1994-1996, 2000, 2001, 2005, 2014 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 either:
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
or
|
||||
|
||||
* the GNU General Public License as published by the Free Software
|
||||
Foundation; either version 2 of the License, or (at your option) any
|
||||
later version.
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received copies of the GNU General Public License and the
|
||||
GNU Lesser General Public License along with the GNU MP Library. If not,
|
||||
see https://www.gnu.org/licenses/. */
|
||||
|
||||
#include "gmp-impl.h"
|
||||
|
||||
void
|
||||
mpq_canonicalize (mpq_ptr op)
|
||||
{
|
||||
mpz_t gcd;
|
||||
TMP_DECL;
|
||||
|
||||
if (SIZ(DEN(op)) < 0)
|
||||
{
|
||||
SIZ(NUM(op)) = -SIZ(NUM(op));
|
||||
SIZ(DEN(op)) = -SIZ(DEN(op));
|
||||
}
|
||||
else if (UNLIKELY (SIZ(DEN(op)) == 0))
|
||||
DIVIDE_BY_ZERO;
|
||||
|
||||
TMP_MARK;
|
||||
|
||||
/* ??? Dunno if the 1+ is needed. */
|
||||
MPZ_TMP_INIT (gcd, 1 + MAX (ABSIZ(NUM(op)),
|
||||
SIZ(DEN(op))));
|
||||
|
||||
mpz_gcd (gcd, NUM(op), DEN(op));
|
||||
if (! MPZ_EQUAL_1_P (gcd))
|
||||
{
|
||||
mpz_divexact_gcd (NUM(op), NUM(op), gcd);
|
||||
mpz_divexact_gcd (DEN(op), DEN(op), gcd);
|
||||
}
|
||||
TMP_FREE;
|
||||
}
|
||||
41
blender-5.2.0/extern/gmp-source/mpq/clear.c
vendored
Normal file
41
blender-5.2.0/extern/gmp-source/mpq/clear.c
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
/* mpq_clear -- free the space occupied by an mpq_t.
|
||||
|
||||
Copyright 1991, 1994, 1995, 2000, 2001, 2015, 2018 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 either:
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
or
|
||||
|
||||
* the GNU General Public License as published by the Free Software
|
||||
Foundation; either version 2 of the License, or (at your option) any
|
||||
later version.
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received copies of the GNU General Public License and the
|
||||
GNU Lesser General Public License along with the GNU MP Library. If not,
|
||||
see https://www.gnu.org/licenses/. */
|
||||
|
||||
#include "gmp-impl.h"
|
||||
|
||||
void
|
||||
mpq_clear (mpq_ptr x)
|
||||
{
|
||||
if (ALLOC (NUM(x)))
|
||||
__GMP_FREE_FUNC_LIMBS (PTR(NUM(x)), ALLOC(NUM(x)));
|
||||
if (ALLOC (DEN(x)))
|
||||
__GMP_FREE_FUNC_LIMBS (PTR(DEN(x)), ALLOC(DEN(x)));
|
||||
}
|
||||
52
blender-5.2.0/extern/gmp-source/mpq/clears.c
vendored
Normal file
52
blender-5.2.0/extern/gmp-source/mpq/clears.c
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
/* mpq_clears() -- Clear multiple mpq_t variables.
|
||||
|
||||
Copyright 2009, 2014, 2015, 2018 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 either:
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
or
|
||||
|
||||
* the GNU General Public License as published by the Free Software
|
||||
Foundation; either version 2 of the License, or (at your option) any
|
||||
later version.
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received copies of the GNU General Public License and the
|
||||
GNU Lesser General Public License along with the GNU MP Library. If not,
|
||||
see https://www.gnu.org/licenses/. */
|
||||
|
||||
#include <stdarg.h>
|
||||
#include "gmp-impl.h"
|
||||
|
||||
void
|
||||
mpq_clears (mpq_ptr x, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start (ap, x);
|
||||
|
||||
do
|
||||
{
|
||||
if (ALLOC (NUM(x)))
|
||||
__GMP_FREE_FUNC_LIMBS (PTR(NUM(x)), ALLOC(NUM(x)));
|
||||
if (ALLOC (DEN(x)))
|
||||
__GMP_FREE_FUNC_LIMBS (PTR(DEN(x)), ALLOC(DEN(x)));
|
||||
x = va_arg (ap, mpq_ptr);
|
||||
}
|
||||
while (x != NULL);
|
||||
|
||||
va_end (ap);
|
||||
}
|
||||
169
blender-5.2.0/extern/gmp-source/mpq/cmp.c
vendored
Normal file
169
blender-5.2.0/extern/gmp-source/mpq/cmp.c
vendored
Normal file
@@ -0,0 +1,169 @@
|
||||
/* mpq_cmp(u,v) -- Compare U, V. Return positive, zero, or negative
|
||||
based on if U > V, U == V, or U < V.
|
||||
|
||||
Copyright 1991, 1994, 1996, 2001, 2002, 2005, 2015 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 either:
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
or
|
||||
|
||||
* the GNU General Public License as published by the Free Software
|
||||
Foundation; either version 2 of the License, or (at your option) any
|
||||
later version.
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received copies of the GNU General Public License and the
|
||||
GNU Lesser General Public License along with the GNU MP Library. If not,
|
||||
see https://www.gnu.org/licenses/. */
|
||||
|
||||
#include "gmp-impl.h"
|
||||
#include "longlong.h"
|
||||
|
||||
static int
|
||||
mpq_cmp_numden (mpq_srcptr op1, mpz_srcptr num_op2, mpz_srcptr den_op2)
|
||||
{
|
||||
mp_size_t num1_size = SIZ(NUM(op1));
|
||||
mp_size_t den1_size = SIZ(DEN(op1));
|
||||
mp_size_t num2_size = SIZ(num_op2);
|
||||
mp_size_t den2_size = SIZ(den_op2);
|
||||
int op2_is_int;
|
||||
mp_limb_t d1h, d2h;
|
||||
mp_size_t tmp1_size, tmp2_size;
|
||||
mp_ptr tmp1_ptr, tmp2_ptr;
|
||||
mp_size_t num1_sign;
|
||||
int cc;
|
||||
TMP_DECL;
|
||||
|
||||
/* need canonical signs to get right result */
|
||||
ASSERT (den1_size > 0);
|
||||
ASSERT (den2_size > 0);
|
||||
|
||||
if (num1_size == 0)
|
||||
return -num2_size;
|
||||
if (num2_size == 0)
|
||||
return num1_size;
|
||||
if ((num1_size ^ num2_size) < 0) /* I.e. are the signs different? */
|
||||
return num1_size;
|
||||
|
||||
num1_sign = num1_size;
|
||||
num1_size = ABS (num1_size);
|
||||
|
||||
/* THINK: Does storing d1h and d2h make sense? */
|
||||
d1h = PTR(DEN(op1))[den1_size - 1];
|
||||
d2h = PTR(den_op2)[den2_size - 1];
|
||||
op2_is_int = (den2_size | d2h) == 1;
|
||||
if ((unsigned) op2_is_int == (den1_size | d1h)) /* Both ops are integers */
|
||||
/* return mpz_cmp (NUM (op1), num_op2); */
|
||||
{
|
||||
int cmp;
|
||||
|
||||
/* Cannot use num1_sign - num2_size, may overflow an "int" */
|
||||
if (num1_sign != num2_size)
|
||||
return (num1_sign > num2_size) ? 1 : -1;
|
||||
|
||||
cmp = mpn_cmp (PTR(NUM(op1)), PTR(num_op2), num1_size);
|
||||
return (num1_sign > 0 ? cmp : -cmp);
|
||||
}
|
||||
|
||||
num2_size = ABS (num2_size);
|
||||
|
||||
tmp1_size = num1_size + den2_size;
|
||||
tmp2_size = num2_size + den1_size;
|
||||
|
||||
/* 1. Check to see if we can tell which operand is larger by just looking at
|
||||
the number of limbs. */
|
||||
|
||||
/* NUM1 x DEN2 is either TMP1_SIZE limbs or TMP1_SIZE-1 limbs.
|
||||
Same for NUM1 x DEN1 with respect to TMP2_SIZE. */
|
||||
if (tmp1_size > tmp2_size + 1)
|
||||
/* NUM1 x DEN2 is surely larger in magnitude than NUM2 x DEN1. */
|
||||
return num1_sign;
|
||||
if (tmp2_size + op2_is_int > tmp1_size + 1)
|
||||
/* NUM1 x DEN2 is surely smaller in magnitude than NUM2 x DEN1. */
|
||||
return -num1_sign;
|
||||
|
||||
/* 2. Same, but compare the number of significant bits. */
|
||||
{
|
||||
int cnt1, cnt2;
|
||||
mp_bitcnt_t bits1, bits2;
|
||||
|
||||
count_leading_zeros (cnt1, PTR(NUM(op1))[num1_size - 1]);
|
||||
count_leading_zeros (cnt2, d2h);
|
||||
bits1 = (mp_bitcnt_t) tmp1_size * GMP_NUMB_BITS - cnt1 - cnt2 + 2 * GMP_NAIL_BITS;
|
||||
|
||||
count_leading_zeros (cnt1, PTR(num_op2)[num2_size - 1]);
|
||||
count_leading_zeros (cnt2, d1h);
|
||||
bits2 = (mp_bitcnt_t) tmp2_size * GMP_NUMB_BITS - cnt1 - cnt2 + 2 * GMP_NAIL_BITS;
|
||||
|
||||
if (bits1 > bits2 + 1)
|
||||
return num1_sign;
|
||||
if (bits2 + op2_is_int > bits1 + 1)
|
||||
return -num1_sign;
|
||||
}
|
||||
|
||||
/* 3. Finally, cross multiply and compare. */
|
||||
|
||||
TMP_MARK;
|
||||
if (op2_is_int)
|
||||
{
|
||||
tmp2_ptr = TMP_ALLOC_LIMBS (tmp2_size);
|
||||
tmp1_ptr = PTR(NUM(op1));
|
||||
--tmp1_size;
|
||||
}
|
||||
else
|
||||
{
|
||||
TMP_ALLOC_LIMBS_2 (tmp1_ptr,tmp1_size, tmp2_ptr,tmp2_size);
|
||||
|
||||
if (num1_size >= den2_size)
|
||||
tmp1_size -= 0 == mpn_mul (tmp1_ptr,
|
||||
PTR(NUM(op1)), num1_size,
|
||||
PTR(den_op2), den2_size);
|
||||
else
|
||||
tmp1_size -= 0 == mpn_mul (tmp1_ptr,
|
||||
PTR(den_op2), den2_size,
|
||||
PTR(NUM(op1)), num1_size);
|
||||
}
|
||||
|
||||
if (num2_size >= den1_size)
|
||||
tmp2_size -= 0 == mpn_mul (tmp2_ptr,
|
||||
PTR(num_op2), num2_size,
|
||||
PTR(DEN(op1)), den1_size);
|
||||
else
|
||||
tmp2_size -= 0 == mpn_mul (tmp2_ptr,
|
||||
PTR(DEN(op1)), den1_size,
|
||||
PTR(num_op2), num2_size);
|
||||
|
||||
|
||||
cc = tmp1_size - tmp2_size != 0
|
||||
? tmp1_size - tmp2_size : mpn_cmp (tmp1_ptr, tmp2_ptr, tmp1_size);
|
||||
TMP_FREE;
|
||||
return num1_sign < 0 ? -cc : cc;
|
||||
}
|
||||
|
||||
int
|
||||
mpq_cmp (mpq_srcptr op1, mpq_srcptr op2)
|
||||
{
|
||||
return mpq_cmp_numden (op1, NUM(op2), DEN(op2));
|
||||
}
|
||||
|
||||
int
|
||||
mpq_cmp_z (mpq_srcptr op1, mpz_srcptr op2)
|
||||
{
|
||||
const static mp_limb_t one = 1;
|
||||
const static mpz_t den = MPZ_ROINIT_N ((mp_limb_t *) &one, 1);
|
||||
|
||||
return mpq_cmp_numden (op1, op2, den);
|
||||
}
|
||||
60
blender-5.2.0/extern/gmp-source/mpq/cmp_si.c
vendored
Normal file
60
blender-5.2.0/extern/gmp-source/mpq/cmp_si.c
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
/* _mpq_cmp_si -- compare mpq and long/ulong fraction.
|
||||
|
||||
Copyright 2001, 2013, 2014 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 either:
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
or
|
||||
|
||||
* the GNU General Public License as published by the Free Software
|
||||
Foundation; either version 2 of the License, or (at your option) any
|
||||
later version.
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received copies of the GNU General Public License and the
|
||||
GNU Lesser General Public License along with the GNU MP Library. If not,
|
||||
see https://www.gnu.org/licenses/. */
|
||||
|
||||
#include "gmp-impl.h"
|
||||
|
||||
|
||||
/* Something like mpq_cmpabs_ui would be more useful for the neg/neg case,
|
||||
and perhaps a version accepting a parameter to reverse the test, to make
|
||||
it a tail call here. */
|
||||
|
||||
int
|
||||
_mpq_cmp_si (mpq_srcptr q, long n, unsigned long d)
|
||||
{
|
||||
/* need canonical sign to get right result */
|
||||
ASSERT (SIZ(DEN(q)) > 0);
|
||||
|
||||
if (n >= 0)
|
||||
return _mpq_cmp_ui (q, n, d);
|
||||
if (SIZ(NUM(q)) >= 0)
|
||||
{
|
||||
return 1; /* >=0 cmp <0 */
|
||||
}
|
||||
else
|
||||
{
|
||||
mpq_t qabs;
|
||||
SIZ(NUM(qabs)) = -SIZ(NUM(q));
|
||||
PTR(NUM(qabs)) = PTR(NUM(q));
|
||||
SIZ(DEN(qabs)) = SIZ(DEN(q));
|
||||
PTR(DEN(qabs)) = PTR(DEN(q));
|
||||
|
||||
return - _mpq_cmp_ui (qabs, NEG_CAST (unsigned long, n), d); /* <0 cmp <0 */
|
||||
}
|
||||
}
|
||||
99
blender-5.2.0/extern/gmp-source/mpq/cmp_ui.c
vendored
Normal file
99
blender-5.2.0/extern/gmp-source/mpq/cmp_ui.c
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
/* mpq_cmp_ui(u,vn,vd) -- Compare U with Vn/Vd. Return positive, zero, or
|
||||
negative based on if U > V, U == V, or U < V. Vn and Vd may have
|
||||
common factors.
|
||||
|
||||
Copyright 1993, 1994, 1996, 2000-2003, 2005, 2014, 2018 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 either:
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
or
|
||||
|
||||
* the GNU General Public License as published by the Free Software
|
||||
Foundation; either version 2 of the License, or (at your option) any
|
||||
later version.
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received copies of the GNU General Public License and the
|
||||
GNU Lesser General Public License along with the GNU MP Library. If not,
|
||||
see https://www.gnu.org/licenses/. */
|
||||
|
||||
#include "gmp-impl.h"
|
||||
|
||||
int
|
||||
_mpq_cmp_ui (mpq_srcptr op1, unsigned long int num2, unsigned long int den2)
|
||||
{
|
||||
mp_size_t num1_size = SIZ(NUM(op1));
|
||||
mp_size_t den1_size = SIZ(DEN(op1));
|
||||
mp_size_t tmp1_size, tmp2_size;
|
||||
mp_ptr tmp1_ptr, tmp2_ptr;
|
||||
mp_limb_t cy_limb;
|
||||
int cc;
|
||||
TMP_DECL;
|
||||
|
||||
#if GMP_NAIL_BITS != 0
|
||||
if ((num2 | den2) > GMP_NUMB_MAX)
|
||||
{
|
||||
mpq_t op2;
|
||||
mpq_init (op2);
|
||||
mpz_set_ui (mpq_numref (op2), num2);
|
||||
mpz_set_ui (mpq_denref (op2), den2);
|
||||
cc = mpq_cmp (op1, op2);
|
||||
mpq_clear (op2);
|
||||
return cc;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* need canonical sign to get right result */
|
||||
ASSERT (den1_size > 0);
|
||||
|
||||
if (UNLIKELY (den2 == 0))
|
||||
DIVIDE_BY_ZERO;
|
||||
|
||||
if (num2 == 0)
|
||||
return num1_size;
|
||||
if (num1_size <= 0)
|
||||
return -1;
|
||||
|
||||
/* NUM1 x DEN2 is either TMP1_SIZE limbs or TMP1_SIZE-1 limbs.
|
||||
Same for NUM2 x DEN1 with respect to TMP2_SIZE. */
|
||||
/* If frac2 <= 1 (i.e. num2 <= den2), shortcut with a simpler
|
||||
condition: num1 > den1. Here we only test sizes. */
|
||||
if (num1_size > den1_size + (num2 > den2))
|
||||
/* NUM1 x DEN2 is surely larger in magnitude than NUM2 x DEN1. */
|
||||
return num1_size;
|
||||
if (den1_size > num1_size + (den2 > num2))
|
||||
/* NUM1 x DEN2 is surely smaller in magnitude than NUM2 x DEN1. */
|
||||
return -num1_size;
|
||||
|
||||
TMP_MARK;
|
||||
TMP_ALLOC_LIMBS_2 (tmp1_ptr, num1_size + 1, tmp2_ptr, den1_size + 1);
|
||||
|
||||
cy_limb = mpn_mul_1 (tmp1_ptr, PTR(NUM(op1)), num1_size,
|
||||
(mp_limb_t) den2);
|
||||
tmp1_ptr[num1_size] = cy_limb;
|
||||
tmp1_size = num1_size + (cy_limb != 0);
|
||||
|
||||
cy_limb = mpn_mul_1 (tmp2_ptr, PTR(DEN(op1)), den1_size,
|
||||
(mp_limb_t) num2);
|
||||
tmp2_ptr[den1_size] = cy_limb;
|
||||
tmp2_size = den1_size + (cy_limb != 0);
|
||||
|
||||
cc = tmp1_size - tmp2_size;
|
||||
cc = cc != 0 ? cc : mpn_cmp (tmp1_ptr, tmp2_ptr, tmp1_size);
|
||||
TMP_FREE;
|
||||
return cc;
|
||||
}
|
||||
133
blender-5.2.0/extern/gmp-source/mpq/div.c
vendored
Normal file
133
blender-5.2.0/extern/gmp-source/mpq/div.c
vendored
Normal file
@@ -0,0 +1,133 @@
|
||||
/* mpq_div -- divide two rational numbers.
|
||||
|
||||
Copyright 1991, 1994-1996, 2000, 2001, 2015, 2018 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 either:
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
or
|
||||
|
||||
* the GNU General Public License as published by the Free Software
|
||||
Foundation; either version 2 of the License, or (at your option) any
|
||||
later version.
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received copies of the GNU General Public License and the
|
||||
GNU Lesser General Public License along with the GNU MP Library. If not,
|
||||
see https://www.gnu.org/licenses/. */
|
||||
|
||||
#include "gmp-impl.h"
|
||||
|
||||
|
||||
void
|
||||
mpq_div (mpq_ptr quot, mpq_srcptr op1, mpq_srcptr op2)
|
||||
{
|
||||
mpz_t gcd1, gcd2;
|
||||
mpz_t tmp1, tmp2;
|
||||
mp_size_t op1_size;
|
||||
mp_size_t op2_size;
|
||||
mp_size_t alloc;
|
||||
TMP_DECL;
|
||||
|
||||
op2_size = SIZ(NUM(op2));
|
||||
|
||||
if (UNLIKELY (op2_size == 0))
|
||||
DIVIDE_BY_ZERO;
|
||||
|
||||
if (UNLIKELY (quot == op2))
|
||||
{
|
||||
if (UNLIKELY (op1 == op2))
|
||||
{
|
||||
mpq_set_ui (quot, 1, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
/* We checked for op1 == op2: we are not in the x=x/x case.
|
||||
We compute x=y/x by computing x=inv(x)*y */
|
||||
MPN_PTR_SWAP (PTR(NUM(quot)), ALLOC(NUM(quot)),
|
||||
PTR(DEN(quot)), ALLOC(DEN(quot)));
|
||||
if (op2_size > 0)
|
||||
{
|
||||
SIZ(NUM(quot)) = SIZ(DEN(quot));
|
||||
SIZ(DEN(quot)) = op2_size;
|
||||
}
|
||||
else
|
||||
{
|
||||
SIZ(NUM(quot)) = - SIZ(DEN(quot));
|
||||
SIZ(DEN(quot)) = - op2_size;
|
||||
}
|
||||
mpq_mul (quot, quot, op1);
|
||||
return;
|
||||
}
|
||||
|
||||
op1_size = ABSIZ(NUM(op1));
|
||||
|
||||
if (op1_size == 0)
|
||||
{
|
||||
/* We special case this to simplify allocation logic; gcd(0,x) = x
|
||||
is a singular case for the allocations. */
|
||||
SIZ(NUM(quot)) = 0;
|
||||
MPZ_NEWALLOC (DEN(quot), 1)[0] = 1;
|
||||
SIZ(DEN(quot)) = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
op2_size = ABS(op2_size);
|
||||
|
||||
TMP_MARK;
|
||||
|
||||
alloc = MIN (op1_size, op2_size);
|
||||
MPZ_TMP_INIT (gcd1, alloc);
|
||||
|
||||
alloc = MAX (op1_size, op2_size);
|
||||
MPZ_TMP_INIT (tmp1, alloc);
|
||||
|
||||
op2_size = SIZ(DEN(op2));
|
||||
op1_size = SIZ(DEN(op1));
|
||||
|
||||
alloc = MIN (op1_size, op2_size);
|
||||
MPZ_TMP_INIT (gcd2, alloc);
|
||||
|
||||
alloc = MAX (op1_size, op2_size);
|
||||
MPZ_TMP_INIT (tmp2, alloc);
|
||||
|
||||
/* QUOT might be identical to OP1, so don't store the result there
|
||||
until we are finished with the input operand. We can overwrite
|
||||
the numerator of QUOT when we are finished with the numerator of
|
||||
OP1. */
|
||||
|
||||
mpz_gcd (gcd1, NUM(op1), NUM(op2));
|
||||
mpz_gcd (gcd2, DEN(op2), DEN(op1));
|
||||
|
||||
mpz_divexact_gcd (tmp1, NUM(op1), gcd1);
|
||||
mpz_divexact_gcd (tmp2, DEN(op2), gcd2);
|
||||
|
||||
mpz_mul (NUM(quot), tmp1, tmp2);
|
||||
|
||||
mpz_divexact_gcd (tmp1, NUM(op2), gcd1);
|
||||
mpz_divexact_gcd (tmp2, DEN(op1), gcd2);
|
||||
|
||||
mpz_mul (DEN(quot), tmp1, tmp2);
|
||||
|
||||
/* Keep the denominator positive. */
|
||||
if (SIZ(DEN(quot)) < 0)
|
||||
{
|
||||
SIZ(DEN(quot)) = -SIZ(DEN(quot));
|
||||
SIZ(NUM(quot)) = -SIZ(NUM(quot));
|
||||
}
|
||||
|
||||
TMP_FREE;
|
||||
}
|
||||
68
blender-5.2.0/extern/gmp-source/mpq/equal.c
vendored
Normal file
68
blender-5.2.0/extern/gmp-source/mpq/equal.c
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
/* mpq_equal(u,v) -- Compare U, V. Return non-zero if they are equal, zero
|
||||
if they are non-equal.
|
||||
|
||||
Copyright 1996, 2001, 2002, 2018 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 either:
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
or
|
||||
|
||||
* the GNU General Public License as published by the Free Software
|
||||
Foundation; either version 2 of the License, or (at your option) any
|
||||
later version.
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received copies of the GNU General Public License and the
|
||||
GNU Lesser General Public License along with the GNU MP Library. If not,
|
||||
see https://www.gnu.org/licenses/. */
|
||||
|
||||
#include "gmp-impl.h"
|
||||
|
||||
int
|
||||
mpq_equal (mpq_srcptr op1, mpq_srcptr op2) __GMP_NOTHROW
|
||||
{
|
||||
mp_size_t num1_size, num2_size, den1_size, den2_size, i;
|
||||
mp_srcptr num1_ptr, num2_ptr, den1_ptr, den2_ptr;
|
||||
|
||||
/* need fully canonical for correct results */
|
||||
ASSERT_MPQ_CANONICAL (op1);
|
||||
ASSERT_MPQ_CANONICAL (op2);
|
||||
|
||||
num1_size = SIZ(NUM(op1));
|
||||
num2_size = SIZ(NUM(op2));
|
||||
if (num1_size != num2_size)
|
||||
return 0;
|
||||
|
||||
den1_size = SIZ(DEN(op1));
|
||||
den2_size = SIZ(DEN(op2));
|
||||
if (den1_size != den2_size)
|
||||
return 0;
|
||||
|
||||
num1_ptr = PTR(NUM(op1));
|
||||
num2_ptr = PTR(NUM(op2));
|
||||
num1_size = ABS (num1_size);
|
||||
for (i = 0; i < num1_size; i++)
|
||||
if (num1_ptr[i] != num2_ptr[i])
|
||||
return 0;
|
||||
|
||||
den1_ptr = PTR(DEN(op1));
|
||||
den2_ptr = PTR(DEN(op2));
|
||||
for (i = 0; i < den1_size; i++)
|
||||
if (den1_ptr[i] != den2_ptr[i])
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
162
blender-5.2.0/extern/gmp-source/mpq/get_d.c
vendored
Normal file
162
blender-5.2.0/extern/gmp-source/mpq/get_d.c
vendored
Normal file
@@ -0,0 +1,162 @@
|
||||
/* double mpq_get_d (mpq_t src) -- mpq to double, rounding towards zero.
|
||||
|
||||
Copyright 1995, 1996, 2001-2005, 2018, 2019 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 either:
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
or
|
||||
|
||||
* the GNU General Public License as published by the Free Software
|
||||
Foundation; either version 2 of the License, or (at your option) any
|
||||
later version.
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received copies of the GNU General Public License and the
|
||||
GNU Lesser General Public License along with the GNU MP Library. If not,
|
||||
see https://www.gnu.org/licenses/. */
|
||||
|
||||
#include <stdio.h> /* for NULL */
|
||||
#include "gmp-impl.h"
|
||||
#include "longlong.h"
|
||||
|
||||
|
||||
/* All that's needed is to get the high 53 bits of the quotient num/den,
|
||||
rounded towards zero. More than 53 bits is fine, any excess is ignored
|
||||
by mpn_get_d.
|
||||
|
||||
N_QLIMBS is how many quotient limbs we need to satisfy the mantissa of a
|
||||
double, assuming the highest of those limbs is non-zero. The target
|
||||
qsize for mpn_tdiv_qr is then 1 more than this, since that function may
|
||||
give a zero in the high limb (and non-zero in the second highest).
|
||||
|
||||
The use of 8*sizeof(double) in N_QLIMBS is an overestimate of the
|
||||
mantissa bits, but it gets the same result as the true value (53 or 48 or
|
||||
whatever) when rounded up to a multiple of GMP_NUMB_BITS, for non-nails.
|
||||
|
||||
Enhancements:
|
||||
|
||||
Use the true mantissa size in the N_QLIMBS formula, to save a divide step
|
||||
in nails.
|
||||
|
||||
Examine the high limbs of num and den to see if the highest 1 bit of the
|
||||
quotient will fall high enough that just N_QLIMBS-1 limbs is enough to
|
||||
get the necessary bits, thereby saving a division step.
|
||||
|
||||
Bit shift either num or den to arrange for the above condition on the
|
||||
high 1 bit of the quotient, to save a division step always. A shift to
|
||||
save a division step is definitely worthwhile with mpn_tdiv_qr, though we
|
||||
may want to reassess this on big num/den when a quotient-only division
|
||||
exists.
|
||||
|
||||
Maybe we could estimate the final exponent using nsize-dsize (and
|
||||
possibly the high limbs of num and den), so as to detect overflow and
|
||||
return infinity or zero quickly. Overflow is never very helpful to an
|
||||
application, and can therefore probably be regarded as abnormal, but we
|
||||
may still like to optimize it if the conditions are easy. (This would
|
||||
only be for float formats we know, unknown formats are not important and
|
||||
can be left to mpn_get_d.)
|
||||
|
||||
Future:
|
||||
|
||||
If/when mpn_tdiv_qr supports its qxn parameter we can use that instead of
|
||||
padding n with zeros in temporary space.
|
||||
|
||||
Alternatives:
|
||||
|
||||
An alternative algorithm, that may be faster:
|
||||
0. Let n be somewhat larger than the number of significant bits in a double.
|
||||
1. Extract the most significant n bits of the denominator, and an equal
|
||||
number of bits from the numerator.
|
||||
2. Interpret the extracted numbers as integers, call them a and b
|
||||
respectively, and develop n bits of the fractions ((a + 1) / b) and
|
||||
(a / (b + 1)) using mpn_divrem.
|
||||
3. If the computed values are identical UP TO THE POSITION WE CARE ABOUT,
|
||||
we are done. If they are different, repeat the algorithm from step 1,
|
||||
but first let n = n * 2.
|
||||
4. If we end up using all bits from the numerator and denominator, fall
|
||||
back to a plain division.
|
||||
5. Just to make life harder, The computation of a + 1 and b + 1 above
|
||||
might give carry-out... Needs special handling. It might work to
|
||||
subtract 1 in both cases instead.
|
||||
|
||||
Not certain if this approach would be faster than a quotient-only
|
||||
division. Presumably such optimizations are the sort of thing we would
|
||||
like to have helping everywhere that uses a quotient-only division. */
|
||||
|
||||
double
|
||||
mpq_get_d (mpq_srcptr src)
|
||||
{
|
||||
double res;
|
||||
mp_srcptr np, dp;
|
||||
mp_ptr temp;
|
||||
mp_size_t nsize = SIZ(NUM(src));
|
||||
mp_size_t dsize = SIZ(DEN(src));
|
||||
mp_size_t qsize, prospective_qsize, zeros;
|
||||
mp_size_t sign_quotient = nsize;
|
||||
long exp;
|
||||
#define N_QLIMBS (1 + (sizeof (double) + GMP_LIMB_BYTES-1) / GMP_LIMB_BYTES)
|
||||
mp_limb_t qarr[N_QLIMBS + 1];
|
||||
mp_ptr qp = qarr;
|
||||
TMP_DECL;
|
||||
|
||||
ASSERT (dsize > 0); /* canonical src */
|
||||
|
||||
/* mpn_get_d below requires a non-zero operand */
|
||||
if (UNLIKELY (nsize == 0))
|
||||
return 0.0;
|
||||
|
||||
TMP_MARK;
|
||||
nsize = ABS (nsize);
|
||||
dsize = ABS (dsize);
|
||||
np = PTR(NUM(src));
|
||||
dp = PTR(DEN(src));
|
||||
|
||||
prospective_qsize = nsize - dsize; /* from using given n,d */
|
||||
qsize = N_QLIMBS; /* desired qsize */
|
||||
|
||||
zeros = qsize - prospective_qsize; /* padding n to get qsize */
|
||||
exp = (long) -zeros * GMP_NUMB_BITS; /* relative to low of qp */
|
||||
|
||||
/* zero extend n into temporary space, if necessary */
|
||||
if (zeros > 0)
|
||||
{
|
||||
mp_size_t tsize;
|
||||
tsize = nsize + zeros; /* size for copy of n */
|
||||
|
||||
temp = TMP_ALLOC_LIMBS (tsize + 1);
|
||||
MPN_FILL (temp, zeros, 0);
|
||||
MPN_COPY (temp + zeros, np, nsize);
|
||||
np = temp;
|
||||
nsize = tsize;
|
||||
}
|
||||
else /* negative zeros means shorten n */
|
||||
{
|
||||
np -= zeros;
|
||||
nsize += zeros;
|
||||
|
||||
temp = TMP_ALLOC_LIMBS (nsize + 1);
|
||||
}
|
||||
|
||||
ASSERT (qsize == nsize - dsize);
|
||||
mpn_div_q (qp, np, nsize, dp, dsize, temp);
|
||||
|
||||
/* strip possible zero high limb */
|
||||
qsize += (qp[qsize] != 0);
|
||||
|
||||
res = mpn_get_d (qp, qsize, sign_quotient, exp);
|
||||
TMP_FREE;
|
||||
return res;
|
||||
}
|
||||
42
blender-5.2.0/extern/gmp-source/mpq/get_den.c
vendored
Normal file
42
blender-5.2.0/extern/gmp-source/mpq/get_den.c
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
/* mpq_get_den(den,rat_src) -- Set DEN to the denominator of RAT_SRC.
|
||||
|
||||
Copyright 1991, 1994, 1995, 2001, 2012 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 either:
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
or
|
||||
|
||||
* the GNU General Public License as published by the Free Software
|
||||
Foundation; either version 2 of the License, or (at your option) any
|
||||
later version.
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received copies of the GNU General Public License and the
|
||||
GNU Lesser General Public License along with the GNU MP Library. If not,
|
||||
see https://www.gnu.org/licenses/. */
|
||||
|
||||
#include "gmp-impl.h"
|
||||
|
||||
void
|
||||
mpq_get_den (mpz_ptr den, mpq_srcptr src)
|
||||
{
|
||||
mp_size_t size = SIZ(DEN(src));
|
||||
mp_ptr dp;
|
||||
|
||||
dp = MPZ_NEWALLOC (den, size);
|
||||
SIZ(den) = size;
|
||||
MPN_COPY (dp, PTR(DEN(src)), size);
|
||||
}
|
||||
44
blender-5.2.0/extern/gmp-source/mpq/get_num.c
vendored
Normal file
44
blender-5.2.0/extern/gmp-source/mpq/get_num.c
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
/* mpq_get_num(num,rat_src) -- Set NUM to the numerator of RAT_SRC.
|
||||
|
||||
Copyright 1991, 1994, 1995, 2001, 2012 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 either:
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
or
|
||||
|
||||
* the GNU General Public License as published by the Free Software
|
||||
Foundation; either version 2 of the License, or (at your option) any
|
||||
later version.
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received copies of the GNU General Public License and the
|
||||
GNU Lesser General Public License along with the GNU MP Library. If not,
|
||||
see https://www.gnu.org/licenses/. */
|
||||
|
||||
#include "gmp-impl.h"
|
||||
|
||||
void
|
||||
mpq_get_num (mpz_ptr num, mpq_srcptr src)
|
||||
{
|
||||
mp_size_t size = SIZ(NUM(src));
|
||||
mp_size_t abs_size = ABS (size);
|
||||
mp_ptr dp;
|
||||
|
||||
dp = MPZ_NEWALLOC (num, abs_size);
|
||||
SIZ(num) = size;
|
||||
|
||||
MPN_COPY (dp, PTR(NUM(src)), abs_size);
|
||||
}
|
||||
80
blender-5.2.0/extern/gmp-source/mpq/get_str.c
vendored
Normal file
80
blender-5.2.0/extern/gmp-source/mpq/get_str.c
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
/* mpq_get_str -- mpq to string conversion.
|
||||
|
||||
Copyright 2001, 2002, 2006, 2011, 2018 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 either:
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
or
|
||||
|
||||
* the GNU General Public License as published by the Free Software
|
||||
Foundation; either version 2 of the License, or (at your option) any
|
||||
later version.
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received copies of the GNU General Public License and the
|
||||
GNU Lesser General Public License along with the GNU MP Library. If not,
|
||||
see https://www.gnu.org/licenses/. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "gmp-impl.h"
|
||||
#include "longlong.h"
|
||||
|
||||
char *
|
||||
mpq_get_str (char *str, int base, mpq_srcptr q)
|
||||
{
|
||||
size_t str_alloc, len;
|
||||
|
||||
if (base > 62 || base < -36)
|
||||
return NULL;
|
||||
|
||||
str_alloc = 0;
|
||||
if (str == NULL)
|
||||
{
|
||||
/* This is an overestimate since we don't bother checking how much of
|
||||
the high limbs of num and den are used. +2 for rounding up the
|
||||
chars per bit of num and den. +3 for sign, slash and '\0'. */
|
||||
if (ABS(base) < 2)
|
||||
base = 10;
|
||||
DIGITS_IN_BASE_PER_LIMB (str_alloc, ABSIZ(NUM(q)) + SIZ(DEN(q)), ABS(base));
|
||||
str_alloc += 6;
|
||||
|
||||
str = __GMP_ALLOCATE_FUNC_TYPE (str_alloc, char);
|
||||
}
|
||||
|
||||
mpz_get_str (str, base, mpq_numref(q));
|
||||
len = strlen (str);
|
||||
if (! MPZ_EQUAL_1_P (mpq_denref (q)))
|
||||
{
|
||||
str[len++] = '/';
|
||||
mpz_get_str (str+len, base, mpq_denref(q));
|
||||
len += strlen (str+len);
|
||||
}
|
||||
|
||||
ASSERT (len == strlen(str));
|
||||
ASSERT (str_alloc == 0 || len+1 <= str_alloc);
|
||||
ASSERT (len+1 <= 3 + /* size recommended to applications */
|
||||
(ABS(base) < 2 ?
|
||||
mpz_sizeinbase (mpq_numref(q), 10) +
|
||||
mpz_sizeinbase (mpq_denref(q), 10)
|
||||
: mpz_sizeinbase (mpq_numref(q), ABS(base)) +
|
||||
mpz_sizeinbase (mpq_denref(q), ABS(base))));
|
||||
|
||||
if (str_alloc != 0)
|
||||
__GMP_REALLOCATE_FUNC_MAYBE_TYPE (str, str_alloc, len+1, char);
|
||||
|
||||
return str;
|
||||
}
|
||||
45
blender-5.2.0/extern/gmp-source/mpq/init.c
vendored
Normal file
45
blender-5.2.0/extern/gmp-source/mpq/init.c
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
/* mpq_init -- Make a new rational number with value 0/1.
|
||||
|
||||
Copyright 1991, 1994, 1995, 2000-2002, 2015, 2018 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 either:
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
or
|
||||
|
||||
* the GNU General Public License as published by the Free Software
|
||||
Foundation; either version 2 of the License, or (at your option) any
|
||||
later version.
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received copies of the GNU General Public License and the
|
||||
GNU Lesser General Public License along with the GNU MP Library. If not,
|
||||
see https://www.gnu.org/licenses/. */
|
||||
|
||||
#include "gmp-impl.h"
|
||||
|
||||
void
|
||||
mpq_init (mpq_ptr x)
|
||||
{
|
||||
static const mp_limb_t dummy_limb=0xc1a0;
|
||||
ALLOC(NUM(x)) = 0;
|
||||
PTR(NUM(x)) = (mp_ptr) &dummy_limb;
|
||||
SIZ(NUM(x)) = 0;
|
||||
ALLOC(DEN(x)) = 1;
|
||||
PTR(DEN(x)) = __GMP_ALLOCATE_FUNC_LIMBS (1);
|
||||
PTR(DEN(x))[0] = 1;
|
||||
SIZ(DEN(x)) = 1;
|
||||
}
|
||||
49
blender-5.2.0/extern/gmp-source/mpq/inits.c
vendored
Normal file
49
blender-5.2.0/extern/gmp-source/mpq/inits.c
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
/* mpq_inits() -- Initialize multiple mpq_t variables and set them to 0.
|
||||
|
||||
Copyright 2009, 2015 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 either:
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
or
|
||||
|
||||
* the GNU General Public License as published by the Free Software
|
||||
Foundation; either version 2 of the License, or (at your option) any
|
||||
later version.
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received copies of the GNU General Public License and the
|
||||
GNU Lesser General Public License along with the GNU MP Library. If not,
|
||||
see https://www.gnu.org/licenses/. */
|
||||
|
||||
#include <stdarg.h>
|
||||
#include "gmp-impl.h"
|
||||
|
||||
void
|
||||
mpq_inits (mpq_ptr x, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start (ap, x);
|
||||
|
||||
do
|
||||
{
|
||||
mpq_init (x);
|
||||
x = va_arg (ap, mpq_ptr);
|
||||
}
|
||||
while (x != NULL);
|
||||
|
||||
va_end (ap);
|
||||
}
|
||||
75
blender-5.2.0/extern/gmp-source/mpq/inp_str.c
vendored
Normal file
75
blender-5.2.0/extern/gmp-source/mpq/inp_str.c
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
/* mpq_inp_str -- read an mpq from a FILE.
|
||||
|
||||
Copyright 2001, 2018 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 either:
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
or
|
||||
|
||||
* the GNU General Public License as published by the Free Software
|
||||
Foundation; either version 2 of the License, or (at your option) any
|
||||
later version.
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received copies of the GNU General Public License and the
|
||||
GNU Lesser General Public License along with the GNU MP Library. If not,
|
||||
see https://www.gnu.org/licenses/. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include "gmp-impl.h"
|
||||
|
||||
|
||||
size_t
|
||||
mpq_inp_str (mpq_ptr q, FILE *fp, int base)
|
||||
{
|
||||
size_t nread;
|
||||
int c;
|
||||
|
||||
if (fp == NULL)
|
||||
fp = stdin;
|
||||
|
||||
SIZ(DEN(q)) = 1;
|
||||
MPZ_NEWALLOC (DEN(q), 1)[0] = 1;
|
||||
|
||||
nread = mpz_inp_str (mpq_numref(q), fp, base);
|
||||
if (nread == 0)
|
||||
return 0;
|
||||
|
||||
c = getc (fp);
|
||||
nread++;
|
||||
|
||||
if (c == '/')
|
||||
{
|
||||
c = getc (fp);
|
||||
nread++;
|
||||
|
||||
nread = mpz_inp_str_nowhite (mpq_denref(q), fp, base, c, nread);
|
||||
if (nread == 0)
|
||||
{
|
||||
SIZ(NUM(q)) = 0;
|
||||
SIZ(DEN(q)) = 1;
|
||||
PTR(DEN(q))[0] = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ungetc (c, fp);
|
||||
nread--;
|
||||
}
|
||||
|
||||
return nread;
|
||||
}
|
||||
70
blender-5.2.0/extern/gmp-source/mpq/inv.c
vendored
Normal file
70
blender-5.2.0/extern/gmp-source/mpq/inv.c
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
/* mpq_inv(dest,src) -- invert a rational number, i.e. set DEST to SRC
|
||||
with the numerator and denominator swapped.
|
||||
|
||||
Copyright 1991, 1994, 1995, 2000, 2001, 2012 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 either:
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
or
|
||||
|
||||
* the GNU General Public License as published by the Free Software
|
||||
Foundation; either version 2 of the License, or (at your option) any
|
||||
later version.
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received copies of the GNU General Public License and the
|
||||
GNU Lesser General Public License along with the GNU MP Library. If not,
|
||||
see https://www.gnu.org/licenses/. */
|
||||
|
||||
#include "gmp-impl.h"
|
||||
|
||||
void
|
||||
mpq_inv (mpq_ptr dest, mpq_srcptr src)
|
||||
{
|
||||
mp_size_t num_size = SIZ(NUM(src));
|
||||
mp_size_t den_size = SIZ(DEN(src));
|
||||
|
||||
if (num_size < 0)
|
||||
{
|
||||
num_size = -num_size;
|
||||
den_size = -den_size;
|
||||
}
|
||||
else if (UNLIKELY (num_size == 0))
|
||||
DIVIDE_BY_ZERO;
|
||||
|
||||
SIZ(DEN(dest)) = num_size;
|
||||
SIZ(NUM(dest)) = den_size;
|
||||
|
||||
/* If dest == src we may just swap the numerator and denominator;
|
||||
we ensured that the new denominator is positive. */
|
||||
|
||||
if (dest == src)
|
||||
{
|
||||
MP_PTR_SWAP (PTR(NUM(dest)), PTR(DEN(dest)));
|
||||
MP_SIZE_T_SWAP (ALLOC(NUM(dest)), ALLOC(DEN(dest)));
|
||||
}
|
||||
else
|
||||
{
|
||||
mp_ptr dp;
|
||||
|
||||
den_size = ABS (den_size);
|
||||
dp = MPZ_NEWALLOC (NUM(dest), den_size);
|
||||
MPN_COPY (dp, PTR(DEN(src)), den_size);
|
||||
|
||||
dp = MPZ_NEWALLOC (DEN(dest), num_size);
|
||||
MPN_COPY (dp, PTR(NUM(src)), num_size);
|
||||
}
|
||||
}
|
||||
110
blender-5.2.0/extern/gmp-source/mpq/md_2exp.c
vendored
Normal file
110
blender-5.2.0/extern/gmp-source/mpq/md_2exp.c
vendored
Normal file
@@ -0,0 +1,110 @@
|
||||
/* mpq_mul_2exp, mpq_div_2exp - multiply or divide by 2^N */
|
||||
|
||||
/*
|
||||
Copyright 2000, 2002, 2012, 2018 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 either:
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
or
|
||||
|
||||
* the GNU General Public License as published by the Free Software
|
||||
Foundation; either version 2 of the License, or (at your option) any
|
||||
later version.
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received copies of the GNU General Public License and the
|
||||
GNU Lesser General Public License along with the GNU MP Library. If not,
|
||||
see https://www.gnu.org/licenses/. */
|
||||
|
||||
#include "gmp-impl.h"
|
||||
#include "longlong.h"
|
||||
|
||||
|
||||
/* The multiplier/divisor "n", representing 2^n, is applied by right shifting
|
||||
"r" until it's odd (if it isn't already), and left shifting "l" for the
|
||||
rest. */
|
||||
|
||||
static void
|
||||
mord_2exp (mpz_ptr ldst, mpz_ptr rdst, mpz_srcptr lsrc, mpz_srcptr rsrc,
|
||||
mp_bitcnt_t n)
|
||||
{
|
||||
mp_size_t rsrc_size = SIZ(rsrc);
|
||||
mp_size_t len = ABS (rsrc_size);
|
||||
mp_ptr rsrc_ptr = PTR(rsrc);
|
||||
mp_ptr p, rdst_ptr;
|
||||
mp_limb_t plow;
|
||||
|
||||
p = rsrc_ptr;
|
||||
plow = *p;
|
||||
while (n >= GMP_NUMB_BITS && plow == 0)
|
||||
{
|
||||
n -= GMP_NUMB_BITS;
|
||||
p++;
|
||||
plow = *p;
|
||||
}
|
||||
|
||||
/* no realloc here if rsrc==rdst, so p and rsrc_ptr remain valid */
|
||||
len -= (p - rsrc_ptr);
|
||||
rdst_ptr = MPZ_REALLOC (rdst, len);
|
||||
|
||||
if ((plow & 1) || n == 0)
|
||||
{
|
||||
/* need INCR when src==dst */
|
||||
if (p != rdst_ptr)
|
||||
MPN_COPY_INCR (rdst_ptr, p, len);
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned long shift;
|
||||
if (plow == 0)
|
||||
shift = n;
|
||||
else
|
||||
{
|
||||
count_trailing_zeros (shift, plow);
|
||||
shift = MIN (shift, n);
|
||||
}
|
||||
mpn_rshift (rdst_ptr, p, len, shift);
|
||||
len -= (rdst_ptr[len-1] == 0);
|
||||
n -= shift;
|
||||
}
|
||||
SIZ(rdst) = (rsrc_size >= 0) ? len : -len;
|
||||
|
||||
if (n)
|
||||
mpz_mul_2exp (ldst, lsrc, n);
|
||||
else if (ldst != lsrc)
|
||||
mpz_set (ldst, lsrc);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
mpq_mul_2exp (mpq_ptr dst, mpq_srcptr src, mp_bitcnt_t n)
|
||||
{
|
||||
mord_2exp (NUM(dst), DEN(dst), NUM(src), DEN(src), n);
|
||||
}
|
||||
|
||||
void
|
||||
mpq_div_2exp (mpq_ptr dst, mpq_srcptr src, mp_bitcnt_t n)
|
||||
{
|
||||
if (SIZ(NUM(src)) == 0)
|
||||
{
|
||||
SIZ(NUM(dst)) = 0;
|
||||
SIZ(DEN(dst)) = 1;
|
||||
MPZ_NEWALLOC (DEN(dst), 1)[0] = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
mord_2exp (DEN(dst), NUM(dst), DEN(src), NUM(src), n);
|
||||
}
|
||||
102
blender-5.2.0/extern/gmp-source/mpq/mul.c
vendored
Normal file
102
blender-5.2.0/extern/gmp-source/mpq/mul.c
vendored
Normal file
@@ -0,0 +1,102 @@
|
||||
/* mpq_mul -- multiply two rational numbers.
|
||||
|
||||
Copyright 1991, 1994-1996, 2000-2002 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 either:
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
or
|
||||
|
||||
* the GNU General Public License as published by the Free Software
|
||||
Foundation; either version 2 of the License, or (at your option) any
|
||||
later version.
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received copies of the GNU General Public License and the
|
||||
GNU Lesser General Public License along with the GNU MP Library. If not,
|
||||
see https://www.gnu.org/licenses/. */
|
||||
|
||||
#include "gmp-impl.h"
|
||||
|
||||
|
||||
void
|
||||
mpq_mul (mpq_ptr prod, mpq_srcptr op1, mpq_srcptr op2)
|
||||
{
|
||||
mpz_t gcd1, gcd2;
|
||||
mpz_t tmp1, tmp2;
|
||||
mp_size_t op1_num_size;
|
||||
mp_size_t op1_den_size;
|
||||
mp_size_t op2_num_size;
|
||||
mp_size_t op2_den_size;
|
||||
mp_size_t alloc;
|
||||
TMP_DECL;
|
||||
|
||||
if (op1 == op2)
|
||||
{
|
||||
/* No need for any GCDs when squaring. */
|
||||
mpz_mul (mpq_numref (prod), mpq_numref (op1), mpq_numref (op1));
|
||||
mpz_mul (mpq_denref (prod), mpq_denref (op1), mpq_denref (op1));
|
||||
return;
|
||||
}
|
||||
|
||||
op1_num_size = ABSIZ(NUM(op1));
|
||||
op1_den_size = SIZ(DEN(op1));
|
||||
op2_num_size = ABSIZ(NUM(op2));
|
||||
op2_den_size = SIZ(DEN(op2));
|
||||
|
||||
if (op1_num_size == 0 || op2_num_size == 0)
|
||||
{
|
||||
/* We special case this to simplify allocation logic; gcd(0,x) = x
|
||||
is a singular case for the allocations. */
|
||||
SIZ(NUM(prod)) = 0;
|
||||
MPZ_NEWALLOC (DEN(prod), 1)[0] = 1;
|
||||
SIZ(DEN(prod)) = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
TMP_MARK;
|
||||
|
||||
alloc = MIN (op1_num_size, op2_den_size);
|
||||
MPZ_TMP_INIT (gcd1, alloc);
|
||||
|
||||
alloc = MIN (op2_num_size, op1_den_size);
|
||||
MPZ_TMP_INIT (gcd2, alloc);
|
||||
|
||||
alloc = MAX (op1_num_size, op2_den_size);
|
||||
MPZ_TMP_INIT (tmp1, alloc);
|
||||
|
||||
alloc = MAX (op2_num_size, op1_den_size);
|
||||
MPZ_TMP_INIT (tmp2, alloc);
|
||||
|
||||
/* PROD might be identical to either operand, so don't store the result there
|
||||
until we are finished with the input operands. We can overwrite the
|
||||
numerator of PROD when we are finished with the numerators of OP1 and
|
||||
OP2. */
|
||||
|
||||
mpz_gcd (gcd1, NUM(op1), DEN(op2));
|
||||
mpz_gcd (gcd2, NUM(op2), DEN(op1));
|
||||
|
||||
mpz_divexact_gcd (tmp1, NUM(op1), gcd1);
|
||||
mpz_divexact_gcd (tmp2, NUM(op2), gcd2);
|
||||
|
||||
mpz_mul (NUM(prod), tmp1, tmp2);
|
||||
|
||||
mpz_divexact_gcd (tmp1, DEN(op2), gcd1);
|
||||
mpz_divexact_gcd (tmp2, DEN(op1), gcd2);
|
||||
|
||||
mpz_mul (DEN(prod), tmp1, tmp2);
|
||||
|
||||
TMP_FREE;
|
||||
}
|
||||
57
blender-5.2.0/extern/gmp-source/mpq/neg.c
vendored
Normal file
57
blender-5.2.0/extern/gmp-source/mpq/neg.c
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
/* mpq_neg -- negate a rational.
|
||||
|
||||
Copyright 2000, 2001, 2012 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 either:
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
or
|
||||
|
||||
* the GNU General Public License as published by the Free Software
|
||||
Foundation; either version 2 of the License, or (at your option) any
|
||||
later version.
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received copies of the GNU General Public License and the
|
||||
GNU Lesser General Public License along with the GNU MP Library. If not,
|
||||
see https://www.gnu.org/licenses/. */
|
||||
|
||||
#define __GMP_FORCE_mpq_neg 1
|
||||
|
||||
#include "gmp-impl.h"
|
||||
|
||||
|
||||
void
|
||||
mpq_neg (mpq_ptr dst, mpq_srcptr src)
|
||||
{
|
||||
mp_size_t num_size = SIZ(NUM(src));
|
||||
|
||||
if (src != dst)
|
||||
{
|
||||
mp_size_t size;
|
||||
mp_ptr dp;
|
||||
|
||||
size = ABS(num_size);
|
||||
dp = MPZ_NEWALLOC (NUM(dst), size);
|
||||
MPN_COPY (dp, PTR(NUM(src)), size);
|
||||
|
||||
size = SIZ(DEN(src));
|
||||
dp = MPZ_NEWALLOC (DEN(dst), size);
|
||||
SIZ(DEN(dst)) = size;
|
||||
MPN_COPY (dp, PTR(DEN(src)), size);
|
||||
}
|
||||
|
||||
SIZ(NUM(dst)) = -num_size;
|
||||
}
|
||||
53
blender-5.2.0/extern/gmp-source/mpq/out_str.c
vendored
Normal file
53
blender-5.2.0/extern/gmp-source/mpq/out_str.c
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
/* mpq_out_str(stream,base,integer) */
|
||||
|
||||
/*
|
||||
Copyright 2000, 2001 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 either:
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
or
|
||||
|
||||
* the GNU General Public License as published by the Free Software
|
||||
Foundation; either version 2 of the License, or (at your option) any
|
||||
later version.
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received copies of the GNU General Public License and the
|
||||
GNU Lesser General Public License along with the GNU MP Library. If not,
|
||||
see https://www.gnu.org/licenses/. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include "gmp-impl.h"
|
||||
|
||||
|
||||
size_t
|
||||
mpq_out_str (FILE *stream, int base, mpq_srcptr q)
|
||||
{
|
||||
size_t written;
|
||||
|
||||
if (stream == NULL)
|
||||
stream = stdout;
|
||||
|
||||
written = mpz_out_str (stream, base, mpq_numref (q));
|
||||
|
||||
if (mpz_cmp_ui (mpq_denref (q), 1) != 0)
|
||||
{
|
||||
putc ('/', stream);
|
||||
written += 1 + mpz_out_str (stream, base, mpq_denref (q));
|
||||
}
|
||||
|
||||
return ferror (stream) ? 0 : written;
|
||||
}
|
||||
51
blender-5.2.0/extern/gmp-source/mpq/set.c
vendored
Normal file
51
blender-5.2.0/extern/gmp-source/mpq/set.c
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
/* mpq_set(dest,src) -- Set DEST to SRC.
|
||||
|
||||
Copyright 1991, 1994, 1995, 2001, 2012, 2015 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 either:
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
or
|
||||
|
||||
* the GNU General Public License as published by the Free Software
|
||||
Foundation; either version 2 of the License, or (at your option) any
|
||||
later version.
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received copies of the GNU General Public License and the
|
||||
GNU Lesser General Public License along with the GNU MP Library. If not,
|
||||
see https://www.gnu.org/licenses/. */
|
||||
|
||||
#include "gmp-impl.h"
|
||||
|
||||
void
|
||||
mpq_set (mpq_ptr dest, mpq_srcptr src)
|
||||
{
|
||||
mp_size_t num_size, den_size;
|
||||
mp_size_t abs_num_size;
|
||||
mp_ptr dp;
|
||||
|
||||
num_size = SIZ(NUM(src));
|
||||
SIZ(NUM(dest)) = num_size;
|
||||
abs_num_size = ABS (num_size);
|
||||
dp = MPZ_NEWALLOC (NUM(dest), abs_num_size);
|
||||
MPN_COPY (dp, PTR(NUM(src)), abs_num_size);
|
||||
|
||||
den_size = SIZ(DEN(src));
|
||||
SIZ(DEN(dest)) = den_size;
|
||||
dp = MPZ_NEWALLOC (DEN(dest), den_size);
|
||||
MPN_COPY (dp, PTR(DEN(src)), den_size);
|
||||
}
|
||||
165
blender-5.2.0/extern/gmp-source/mpq/set_d.c
vendored
Normal file
165
blender-5.2.0/extern/gmp-source/mpq/set_d.c
vendored
Normal file
@@ -0,0 +1,165 @@
|
||||
/* mpq_set_d(mpq_t q, double d) -- Set q to d without rounding.
|
||||
|
||||
Copyright 2000, 2002, 2003, 2012, 2014, 2018 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 either:
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
or
|
||||
|
||||
* the GNU General Public License as published by the Free Software
|
||||
Foundation; either version 2 of the License, or (at your option) any
|
||||
later version.
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received copies of the GNU General Public License and the
|
||||
GNU Lesser General Public License along with the GNU MP Library. If not,
|
||||
see https://www.gnu.org/licenses/. */
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#if HAVE_FLOAT_H
|
||||
#include <float.h> /* for DBL_MAX */
|
||||
#endif
|
||||
|
||||
#include "gmp-impl.h"
|
||||
#include "longlong.h"
|
||||
|
||||
#if LIMBS_PER_DOUBLE > 4
|
||||
choke me
|
||||
#endif
|
||||
|
||||
void
|
||||
mpq_set_d (mpq_ptr dest, double d)
|
||||
{
|
||||
int negative;
|
||||
mp_exp_t exp;
|
||||
mp_limb_t tp[LIMBS_PER_DOUBLE];
|
||||
mp_ptr np, dp;
|
||||
mp_size_t nn, dn;
|
||||
int c;
|
||||
|
||||
DOUBLE_NAN_INF_ACTION (d,
|
||||
__gmp_invalid_operation (),
|
||||
__gmp_invalid_operation ());
|
||||
|
||||
negative = d < 0;
|
||||
d = ABS (d);
|
||||
|
||||
exp = __gmp_extract_double (tp, d);
|
||||
|
||||
/* There are two main version of the conversion. The `then' arm handles
|
||||
numbers with a fractional part, while the `else' arm handles integers. */
|
||||
#if LIMBS_PER_DOUBLE == 4
|
||||
if (exp <= 1 || (exp == 2 && (tp[0] | tp[1]) != 0))
|
||||
#endif
|
||||
#if LIMBS_PER_DOUBLE == 3
|
||||
if (exp <= 1 || (exp == 2 && tp[0] != 0))
|
||||
#endif
|
||||
#if LIMBS_PER_DOUBLE == 2
|
||||
if (exp <= 1)
|
||||
#endif
|
||||
{
|
||||
if (d == 0.0)
|
||||
{
|
||||
SIZ(NUM(dest)) = 0;
|
||||
SIZ(DEN(dest)) = 1;
|
||||
MPZ_NEWALLOC (DEN(dest), 1)[0] = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
#if LIMBS_PER_DOUBLE == 4
|
||||
np = MPZ_NEWALLOC (NUM(dest), 4);
|
||||
if ((tp[0] | tp[1] | tp[2]) == 0)
|
||||
np[0] = tp[3], nn = 1;
|
||||
else if ((tp[0] | tp[1]) == 0)
|
||||
np[1] = tp[3], np[0] = tp[2], nn = 2;
|
||||
else if (tp[0] == 0)
|
||||
np[2] = tp[3], np[1] = tp[2], np[0] = tp[1], nn = 3;
|
||||
else
|
||||
np[3] = tp[3], np[2] = tp[2], np[1] = tp[1], np[0] = tp[0], nn = 4;
|
||||
#endif
|
||||
#if LIMBS_PER_DOUBLE == 3
|
||||
np = MPZ_NEWALLOC (NUM(dest), 3);
|
||||
if ((tp[0] | tp[1]) == 0)
|
||||
np[0] = tp[2], nn = 1;
|
||||
else if (tp[0] == 0)
|
||||
np[1] = tp[2], np[0] = tp[1], nn = 2;
|
||||
else
|
||||
np[2] = tp[2], np[1] = tp[1], np[0] = tp[0], nn = 3;
|
||||
#endif
|
||||
#if LIMBS_PER_DOUBLE == 2
|
||||
np = MPZ_NEWALLOC (NUM(dest), 2);
|
||||
if (tp[0] == 0)
|
||||
np[0] = tp[1], nn = 1;
|
||||
else
|
||||
np[1] = tp[1], np[0] = tp[0], nn = 2;
|
||||
#endif
|
||||
dn = nn + 1 - exp;
|
||||
ASSERT (dn > 0); /* -exp >= -1; nn >= 1*/
|
||||
dp = MPZ_NEWALLOC (DEN(dest), dn);
|
||||
MPN_ZERO (dp, dn - 1);
|
||||
dp[dn - 1] = 1;
|
||||
count_trailing_zeros (c, np[0] | dp[0]);
|
||||
if (c != 0)
|
||||
{
|
||||
mpn_rshift (np, np, nn, c);
|
||||
nn -= np[nn - 1] == 0;
|
||||
--dn;
|
||||
dp[dn - 1] = CNST_LIMB(1) << (GMP_LIMB_BITS - c);
|
||||
}
|
||||
SIZ(DEN(dest)) = dn;
|
||||
}
|
||||
else
|
||||
{
|
||||
nn = exp;
|
||||
np = MPZ_NEWALLOC (NUM(dest), nn);
|
||||
switch (nn)
|
||||
{
|
||||
default:
|
||||
MPN_ZERO (np, nn - LIMBS_PER_DOUBLE);
|
||||
np += nn - LIMBS_PER_DOUBLE;
|
||||
/* fall through */
|
||||
#if LIMBS_PER_DOUBLE == 2
|
||||
case 2:
|
||||
np[1] = tp[1], np[0] = tp[0];
|
||||
break;
|
||||
#endif
|
||||
#if LIMBS_PER_DOUBLE == 3
|
||||
case 3:
|
||||
np[2] = tp[2], np[1] = tp[1], np[0] = tp[0];
|
||||
break;
|
||||
case 2:
|
||||
np[1] = tp[2], np[0] = tp[1];
|
||||
break;
|
||||
#endif
|
||||
#if LIMBS_PER_DOUBLE == 4
|
||||
case 4:
|
||||
np[3] = tp[3], np[2] = tp[2], np[1] = tp[1], np[0] = tp[0];
|
||||
break;
|
||||
case 3:
|
||||
np[2] = tp[3], np[1] = tp[2], np[0] = tp[1];
|
||||
break;
|
||||
case 2:
|
||||
np[1] = tp[3], np[0] = tp[2];
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
MPZ_NEWALLOC (DEN(dest), 1)[0] = 1;
|
||||
SIZ(DEN(dest)) = 1;
|
||||
}
|
||||
SIZ(NUM(dest)) = negative ? -nn : nn;
|
||||
}
|
||||
45
blender-5.2.0/extern/gmp-source/mpq/set_den.c
vendored
Normal file
45
blender-5.2.0/extern/gmp-source/mpq/set_den.c
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
/* mpq_set_den(dest,den) -- Set the denominator of DEST from DEN.
|
||||
|
||||
Copyright 1991, 1994-1996, 2000, 2001, 2012, 2015 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 either:
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
or
|
||||
|
||||
* the GNU General Public License as published by the Free Software
|
||||
Foundation; either version 2 of the License, or (at your option) any
|
||||
later version.
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received copies of the GNU General Public License and the
|
||||
GNU Lesser General Public License along with the GNU MP Library. If not,
|
||||
see https://www.gnu.org/licenses/. */
|
||||
|
||||
#include "gmp-impl.h"
|
||||
|
||||
void
|
||||
mpq_set_den (mpq_ptr dest, mpz_srcptr den)
|
||||
{
|
||||
mp_size_t size = SIZ (den);
|
||||
mp_size_t abs_size = ABS (size);
|
||||
mp_ptr dp;
|
||||
|
||||
SIZ(DEN(dest)) = size;
|
||||
dp = MPZ_NEWALLOC (DEN(dest), abs_size);
|
||||
|
||||
MPN_COPY (dp, PTR(den), abs_size);
|
||||
}
|
||||
106
blender-5.2.0/extern/gmp-source/mpq/set_f.c
vendored
Normal file
106
blender-5.2.0/extern/gmp-source/mpq/set_f.c
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
/* mpq_set_f -- set an mpq from an mpf.
|
||||
|
||||
Copyright 2000-2002, 2018 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 either:
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
or
|
||||
|
||||
* the GNU General Public License as published by the Free Software
|
||||
Foundation; either version 2 of the License, or (at your option) any
|
||||
later version.
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received copies of the GNU General Public License and the
|
||||
GNU Lesser General Public License along with the GNU MP Library. If not,
|
||||
see https://www.gnu.org/licenses/. */
|
||||
|
||||
#include "gmp-impl.h"
|
||||
#include "longlong.h"
|
||||
|
||||
|
||||
void
|
||||
mpq_set_f (mpq_ptr q, mpf_srcptr f)
|
||||
{
|
||||
mp_size_t fexp = EXP(f);
|
||||
mp_ptr fptr = PTR(f);
|
||||
mp_size_t fsize = SIZ(f);
|
||||
mp_size_t abs_fsize = ABS(fsize);
|
||||
mp_limb_t flow;
|
||||
|
||||
if (fsize == 0)
|
||||
{
|
||||
/* set q=0 */
|
||||
SIZ(NUM(q)) = 0;
|
||||
SIZ(DEN(q)) = 1;
|
||||
MPZ_NEWALLOC (DEN(q), 1)[0] = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
/* strip low zero limbs from f */
|
||||
flow = *fptr;
|
||||
MPN_STRIP_LOW_ZEROS_NOT_ZERO (fptr, abs_fsize, flow);
|
||||
|
||||
if (fexp >= abs_fsize)
|
||||
{
|
||||
/* radix point is to the right of the limbs, no denominator */
|
||||
mp_ptr num_ptr;
|
||||
|
||||
num_ptr = MPZ_NEWALLOC (mpq_numref (q), fexp);
|
||||
MPN_ZERO (num_ptr, fexp - abs_fsize);
|
||||
MPN_COPY (num_ptr + fexp - abs_fsize, fptr, abs_fsize);
|
||||
|
||||
SIZ(NUM(q)) = fsize >= 0 ? fexp : -fexp;
|
||||
SIZ(DEN(q)) = 1;
|
||||
MPZ_NEWALLOC (DEN(q), 1)[0] = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* radix point is within or to the left of the limbs, use denominator */
|
||||
mp_ptr num_ptr, den_ptr;
|
||||
mp_size_t den_size;
|
||||
|
||||
den_size = abs_fsize - fexp;
|
||||
num_ptr = MPZ_NEWALLOC (mpq_numref (q), abs_fsize);
|
||||
den_ptr = MPZ_NEWALLOC (mpq_denref (q), den_size+1);
|
||||
|
||||
if (flow & 1)
|
||||
{
|
||||
/* no powers of two to strip from numerator */
|
||||
|
||||
MPN_COPY (num_ptr, fptr, abs_fsize);
|
||||
MPN_ZERO (den_ptr, den_size);
|
||||
den_ptr[den_size] = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* right shift numerator, adjust denominator accordingly */
|
||||
int shift;
|
||||
|
||||
den_size--;
|
||||
count_trailing_zeros (shift, flow);
|
||||
|
||||
mpn_rshift (num_ptr, fptr, abs_fsize, shift);
|
||||
abs_fsize -= (num_ptr[abs_fsize-1] == 0);
|
||||
|
||||
MPN_ZERO (den_ptr, den_size);
|
||||
den_ptr[den_size] = GMP_LIMB_HIGHBIT >> (shift-1);
|
||||
}
|
||||
|
||||
SIZ(NUM(q)) = fsize >= 0 ? abs_fsize : -abs_fsize;
|
||||
SIZ(DEN(q)) = den_size + 1;
|
||||
}
|
||||
}
|
||||
45
blender-5.2.0/extern/gmp-source/mpq/set_num.c
vendored
Normal file
45
blender-5.2.0/extern/gmp-source/mpq/set_num.c
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
/* mpq_set_num(dest,num) -- Set the numerator of DEST from NUM.
|
||||
|
||||
Copyright 1991, 1994, 1995, 2001, 2012, 2015 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 either:
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
or
|
||||
|
||||
* the GNU General Public License as published by the Free Software
|
||||
Foundation; either version 2 of the License, or (at your option) any
|
||||
later version.
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received copies of the GNU General Public License and the
|
||||
GNU Lesser General Public License along with the GNU MP Library. If not,
|
||||
see https://www.gnu.org/licenses/. */
|
||||
|
||||
#include "gmp-impl.h"
|
||||
|
||||
void
|
||||
mpq_set_num (mpq_ptr dest, mpz_srcptr num)
|
||||
{
|
||||
mp_size_t size = SIZ (num);
|
||||
mp_size_t abs_size = ABS (size);
|
||||
mp_ptr dp;
|
||||
|
||||
SIZ(NUM(dest)) = size;
|
||||
dp = MPZ_NEWALLOC (NUM(dest), abs_size);
|
||||
|
||||
MPN_COPY (dp, PTR(num), abs_size);
|
||||
}
|
||||
60
blender-5.2.0/extern/gmp-source/mpq/set_si.c
vendored
Normal file
60
blender-5.2.0/extern/gmp-source/mpq/set_si.c
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
/* mpq_set_si(dest,ulong_num,ulong_den) -- Set DEST to the rational number
|
||||
ULONG_NUM/ULONG_DEN.
|
||||
|
||||
Copyright 1991, 1994, 1995, 2001, 2003, 2018 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 either:
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
or
|
||||
|
||||
* the GNU General Public License as published by the Free Software
|
||||
Foundation; either version 2 of the License, or (at your option) any
|
||||
later version.
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received copies of the GNU General Public License and the
|
||||
GNU Lesser General Public License along with the GNU MP Library. If not,
|
||||
see https://www.gnu.org/licenses/. */
|
||||
|
||||
#include "gmp-impl.h"
|
||||
|
||||
void
|
||||
mpq_set_si (mpq_ptr dest, signed long int num, unsigned long int den)
|
||||
{
|
||||
if (GMP_NUMB_BITS < BITS_PER_ULONG)
|
||||
{
|
||||
if (num == 0) /* Canonicalize 0/d to 0/1. */
|
||||
den = 1;
|
||||
mpz_set_si (mpq_numref (dest), num);
|
||||
mpz_set_ui (mpq_denref (dest), den);
|
||||
return;
|
||||
}
|
||||
|
||||
if (num == 0)
|
||||
{
|
||||
/* Canonicalize 0/d to 0/1. */
|
||||
den = 1;
|
||||
SIZ(NUM(dest)) = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
MPZ_NEWALLOC (NUM(dest), 1)[0] = ABS_CAST (unsigned long, num);
|
||||
SIZ(NUM(dest)) = num > 0 ? 1 : -1;
|
||||
}
|
||||
|
||||
MPZ_NEWALLOC (DEN(dest), 1)[0] = den;
|
||||
SIZ(DEN(dest)) = (den != 0);
|
||||
}
|
||||
68
blender-5.2.0/extern/gmp-source/mpq/set_str.c
vendored
Normal file
68
blender-5.2.0/extern/gmp-source/mpq/set_str.c
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
/* mpq_set_str -- string to mpq conversion.
|
||||
|
||||
Copyright 2001, 2002, 2015, 2018 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 either:
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
or
|
||||
|
||||
* the GNU General Public License as published by the Free Software
|
||||
Foundation; either version 2 of the License, or (at your option) any
|
||||
later version.
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received copies of the GNU General Public License and the
|
||||
GNU Lesser General Public License along with the GNU MP Library. If not,
|
||||
see https://www.gnu.org/licenses/. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "gmp-impl.h"
|
||||
|
||||
|
||||
/* FIXME: Would like an mpz_set_mem (or similar) accepting a pointer and
|
||||
length so we wouldn't have to copy the numerator just to null-terminate
|
||||
it. */
|
||||
|
||||
int
|
||||
mpq_set_str (mpq_ptr q, const char *str, int base)
|
||||
{
|
||||
const char *slash;
|
||||
char *num;
|
||||
size_t numlen;
|
||||
int ret;
|
||||
|
||||
slash = strchr (str, '/');
|
||||
if (slash == NULL)
|
||||
{
|
||||
SIZ(DEN(q)) = 1;
|
||||
MPZ_NEWALLOC (DEN(q), 1)[0] = 1;
|
||||
|
||||
return mpz_set_str (mpq_numref(q), str, base);
|
||||
}
|
||||
|
||||
numlen = slash - str;
|
||||
num = __GMP_ALLOCATE_FUNC_TYPE (numlen+1, char);
|
||||
memcpy (num, str, numlen);
|
||||
num[numlen] = '\0';
|
||||
ret = mpz_set_str (mpq_numref(q), num, base);
|
||||
__GMP_FREE_FUNC_TYPE (num, numlen+1, char);
|
||||
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
return mpz_set_str (mpq_denref(q), slash+1, base);
|
||||
}
|
||||
60
blender-5.2.0/extern/gmp-source/mpq/set_ui.c
vendored
Normal file
60
blender-5.2.0/extern/gmp-source/mpq/set_ui.c
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
/* mpq_set_ui(dest,ulong_num,ulong_den) -- Set DEST to the rational number
|
||||
ULONG_NUM/ULONG_DEN.
|
||||
|
||||
Copyright 1991, 1994, 1995, 2001-2003, 2018 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 either:
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
or
|
||||
|
||||
* the GNU General Public License as published by the Free Software
|
||||
Foundation; either version 2 of the License, or (at your option) any
|
||||
later version.
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received copies of the GNU General Public License and the
|
||||
GNU Lesser General Public License along with the GNU MP Library. If not,
|
||||
see https://www.gnu.org/licenses/. */
|
||||
|
||||
#include "gmp-impl.h"
|
||||
|
||||
void
|
||||
mpq_set_ui (mpq_ptr dest, unsigned long int num, unsigned long int den)
|
||||
{
|
||||
if (GMP_NUMB_BITS < BITS_PER_ULONG)
|
||||
{
|
||||
if (num == 0) /* Canonicalize 0/d to 0/1. */
|
||||
den = 1;
|
||||
mpz_set_ui (mpq_numref (dest), num);
|
||||
mpz_set_ui (mpq_denref (dest), den);
|
||||
return;
|
||||
}
|
||||
|
||||
if (num == 0)
|
||||
{
|
||||
/* Canonicalize 0/d to 0/1. */
|
||||
den = 1;
|
||||
SIZ(NUM(dest)) = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
MPZ_NEWALLOC (NUM(dest), 1)[0] = num;
|
||||
SIZ(NUM(dest)) = 1;
|
||||
}
|
||||
|
||||
MPZ_NEWALLOC (DEN(dest), 1)[0] = den;
|
||||
SIZ(DEN(dest)) = (den != 0);
|
||||
}
|
||||
48
blender-5.2.0/extern/gmp-source/mpq/set_z.c
vendored
Normal file
48
blender-5.2.0/extern/gmp-source/mpq/set_z.c
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
/* mpq_set_z (dest,src) -- Set DEST to SRC.
|
||||
|
||||
Copyright 1996, 2001, 2012, 2015, 2018 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 either:
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
or
|
||||
|
||||
* the GNU General Public License as published by the Free Software
|
||||
Foundation; either version 2 of the License, or (at your option) any
|
||||
later version.
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received copies of the GNU General Public License and the
|
||||
GNU Lesser General Public License along with the GNU MP Library. If not,
|
||||
see https://www.gnu.org/licenses/. */
|
||||
|
||||
#include "gmp-impl.h"
|
||||
|
||||
void
|
||||
mpq_set_z (mpq_ptr dest, mpz_srcptr src)
|
||||
{
|
||||
mp_size_t num_size;
|
||||
mp_size_t abs_num_size;
|
||||
mp_ptr dp;
|
||||
|
||||
num_size = SIZ (src);
|
||||
SIZ(NUM(dest)) = num_size;
|
||||
abs_num_size = ABS (num_size);
|
||||
dp = MPZ_NEWALLOC (NUM(dest), abs_num_size);
|
||||
MPN_COPY (dp, PTR(src), abs_num_size);
|
||||
|
||||
MPZ_NEWALLOC (DEN(dest), 1)[0] = 1;
|
||||
SIZ(DEN(dest)) = 1;
|
||||
}
|
||||
42
blender-5.2.0/extern/gmp-source/mpq/swap.c
vendored
Normal file
42
blender-5.2.0/extern/gmp-source/mpq/swap.c
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
/* mpq_swap (U, V) -- Swap U and V.
|
||||
|
||||
Copyright 1997, 1998, 2000, 2001, 2018 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 either:
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
or
|
||||
|
||||
* the GNU General Public License as published by the Free Software
|
||||
Foundation; either version 2 of the License, or (at your option) any
|
||||
later version.
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received copies of the GNU General Public License and the
|
||||
GNU Lesser General Public License along with the GNU MP Library. If not,
|
||||
see https://www.gnu.org/licenses/. */
|
||||
|
||||
#include "gmp-impl.h"
|
||||
|
||||
void
|
||||
mpq_swap (mpq_ptr u, mpq_ptr v) __GMP_NOTHROW
|
||||
{
|
||||
MP_SIZE_T_SWAP (ALLOC(NUM(u)), ALLOC(NUM(v)));
|
||||
MP_SIZE_T_SWAP (ALLOC(DEN(u)), ALLOC(DEN(v)));
|
||||
MP_SIZE_T_SWAP (SIZ(NUM(u)), SIZ(NUM(v)));
|
||||
MP_SIZE_T_SWAP (SIZ(DEN(u)), SIZ(DEN(v)));
|
||||
MP_PTR_SWAP (PTR(NUM(u)), PTR(NUM(v)));
|
||||
MP_PTR_SWAP (PTR(DEN(u)), PTR(DEN(v)));
|
||||
}
|
||||
Reference in New Issue
Block a user