integer-gmp 1.0.0.0 → 1.0.0.1
raw patch · 5 files changed
+629/−540 lines, 5 filesdep ~ghc-primPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: ghc-prim
API changes (from Hackage documentation)
Files
- changelog.md +10/−0
- configure +519/−455
- configure.ac +4/−5
- integer-gmp.cabal +2/−2
- src/GHC/Integer/Type.hs +94/−78
changelog.md view
@@ -1,5 +1,15 @@ # Changelog for [`integer-gmp` package](http://hackage.haskell.org/package/integer-gmp) +## 1.0.0.1 *Feb 2016*++ * Bundled with GHC 8.0.1++ * Optimise `bitBigNat`/`bigInteger`++ * Fix minor issue in `eqBigNatWord#`++ * Various minor optimisations+ ## 1.0.0.0 *Mar 2015* * Bundled with GHC 7.10.1
configure view
@@ -676,6 +676,7 @@ docdir oldincludedir includedir+runstatedir localstatedir sharedstatedir sysconfdir@@ -698,7 +699,6 @@ ac_subst_files='' ac_user_opts=' enable_option_checking-with_cc with_gmp_includes with_gmp_libraries with_gmp_framework_preferred@@ -751,6 +751,7 @@ sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var'+runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'@@ -1003,6 +1004,15 @@ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; + -runstatedir | --runstatedir | --runstatedi | --runstated \+ | --runstate | --runstat | --runsta | --runst | --runs \+ | --run | --ru | --r)+ ac_prev=runstatedir ;;+ -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \+ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \+ | --run=* | --ru=* | --r=*)+ runstatedir=$ac_optarg ;;+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \@@ -1140,7 +1150,7 @@ for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \- libdir localedir mandir+ libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes.@@ -1293,6 +1303,7 @@ --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var]+ --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include]@@ -1326,7 +1337,6 @@ Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)-C compiler --with-gmp-includes directory containing gmp.h --with-gmp-libraries directory containing gmp library --with-gmp-framework-preferred@@ -1461,52 +1471,6 @@ } # ac_fn_c_try_compile -# ac_fn_c_try_link LINENO-# ------------------------# Try to link conftest.$ac_ext, and return whether this succeeded.-ac_fn_c_try_link ()-{- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack- rm -f conftest.$ac_objext conftest$ac_exeext- if { { ac_try="$ac_link"-case "(($ac_try" in- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;- *) ac_try_echo=$ac_try;;-esac-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""-$as_echo "$ac_try_echo"; } >&5- (eval "$ac_link") 2>conftest.err- ac_status=$?- if test -s conftest.err; then- grep -v '^ *+' conftest.err >conftest.er1- cat conftest.er1 >&5- mv -f conftest.er1 conftest.err- fi- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5- test $ac_status = 0; } && {- test -z "$ac_c_werror_flag" ||- test ! -s conftest.err- } && test -s conftest$ac_exeext && {- test "$cross_compiling" = yes ||- test -x conftest$ac_exeext- }; then :- ac_retval=0-else- $as_echo "$as_me: failed program was:" >&5-sed 's/^/| /' conftest.$ac_ext >&5-- ac_retval=1-fi- # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information- # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would- # interfere with the next link command; also delete a directory that is- # left behind by Apple's compiler. We do this before executing the actions.- rm -rf conftest.dSYM conftest_ipa8_conftest.oo- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno- as_fn_set_status $ac_retval--} # ac_fn_c_try_link- # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded.@@ -1708,6 +1672,52 @@ } # ac_fn_c_check_header_compile +# ac_fn_c_try_link LINENO+# -----------------------+# Try to link conftest.$ac_ext, and return whether this succeeded.+ac_fn_c_try_link ()+{+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack+ rm -f conftest.$ac_objext conftest$ac_exeext+ if { { ac_try="$ac_link"+case "(($ac_try" in+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;+ *) ac_try_echo=$ac_try;;+esac+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""+$as_echo "$ac_try_echo"; } >&5+ (eval "$ac_link") 2>conftest.err+ ac_status=$?+ if test -s conftest.err; then+ grep -v '^ *+' conftest.err >conftest.er1+ cat conftest.er1 >&5+ mv -f conftest.er1 conftest.err+ fi+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5+ test $ac_status = 0; } && {+ test -z "$ac_c_werror_flag" ||+ test ! -s conftest.err+ } && test -s conftest$ac_exeext && {+ test "$cross_compiling" = yes ||+ test -x conftest$ac_exeext+ }; then :+ ac_retval=0+else+ $as_echo "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5++ ac_retval=1+fi+ # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information+ # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would+ # interfere with the next link command; also delete a directory that is+ # left behind by Apple's compiler. We do this before executing the actions.+ rm -rf conftest.dSYM conftest_ipa8_conftest.oo+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno+ as_fn_set_status $ac_retval++} # ac_fn_c_try_link+ # ac_fn_c_compute_int LINENO EXPR VAR INCLUDES # -------------------------------------------- # Tries to find the compile-time value of EXPR in a program that includes@@ -2243,7 +2253,6 @@ - # Safety check: Ensure that we are in the correct source directory. @@ -2387,12 +2396,6 @@ NONENONEs,x,x, && program_prefix=${target_alias}- --# Check whether --with-cc was given.-if test "${with_cc+set}" = set; then :- withval=$with_cc; CC=$withval-fi- ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'@@ -3183,9 +3186,468 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu +ac_ext=c+ac_cpp='$CPP $CPPFLAGS'+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'+ac_compiler_gnu=$ac_cv_c_compiler_gnu+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5+$as_echo_n "checking how to run the C preprocessor... " >&6; }+# On Suns, sometimes $CPP names a directory.+if test -n "$CPP" && test -d "$CPP"; then+ CPP=+fi+if test -z "$CPP"; then+ if ${ac_cv_prog_CPP+:} false; then :+ $as_echo_n "(cached) " >&6+else+ # Double quotes because CPP needs to be expanded+ for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"+ do+ ac_preproc_ok=false+for ac_c_preproc_warn_flag in '' yes+do+ # Use a header file that comes with gcc, so configuring glibc+ # with a fresh cross-compiler works.+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since+ # <limits.h> exists even on freestanding compilers.+ # On the NeXT, cc -E runs the code through the compiler's parser,+ # not just through cpp. "Syntax error" is here to catch this case.+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */+#ifdef __STDC__+# include <limits.h>+#else+# include <assert.h>+#endif+ Syntax error+_ACEOF+if ac_fn_c_try_cpp "$LINENO"; then : +else+ # Broken: fails on valid input.+continue+fi+rm -f conftest.err conftest.i conftest.$ac_ext + # OK, works on sane cases. Now check whether nonexistent headers+ # can be detected and how.+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */+#include <ac_nonexistent.h>+_ACEOF+if ac_fn_c_try_cpp "$LINENO"; then :+ # Broken: success on invalid input.+continue+else+ # Passes both tests.+ac_preproc_ok=:+break+fi+rm -f conftest.err conftest.i conftest.$ac_ext +done+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.+rm -f conftest.i conftest.err conftest.$ac_ext+if $ac_preproc_ok; then :+ break+fi++ done+ ac_cv_prog_CPP=$CPP++fi+ CPP=$ac_cv_prog_CPP+else+ ac_cv_prog_CPP=$CPP+fi+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5+$as_echo "$CPP" >&6; }+ac_preproc_ok=false+for ac_c_preproc_warn_flag in '' yes+do+ # Use a header file that comes with gcc, so configuring glibc+ # with a fresh cross-compiler works.+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since+ # <limits.h> exists even on freestanding compilers.+ # On the NeXT, cc -E runs the code through the compiler's parser,+ # not just through cpp. "Syntax error" is here to catch this case.+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */+#ifdef __STDC__+# include <limits.h>+#else+# include <assert.h>+#endif+ Syntax error+_ACEOF+if ac_fn_c_try_cpp "$LINENO"; then :++else+ # Broken: fails on valid input.+continue+fi+rm -f conftest.err conftest.i conftest.$ac_ext++ # OK, works on sane cases. Now check whether nonexistent headers+ # can be detected and how.+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */+#include <ac_nonexistent.h>+_ACEOF+if ac_fn_c_try_cpp "$LINENO"; then :+ # Broken: success on invalid input.+continue+else+ # Passes both tests.+ac_preproc_ok=:+break+fi+rm -f conftest.err conftest.i conftest.$ac_ext++done+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.+rm -f conftest.i conftest.err conftest.$ac_ext+if $ac_preproc_ok; then :++else+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}+as_fn_error $? "C preprocessor \"$CPP\" fails sanity check+See \`config.log' for more details" "$LINENO" 5; }+fi++ac_ext=c+ac_cpp='$CPP $CPPFLAGS'+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'+ac_compiler_gnu=$ac_cv_c_compiler_gnu+++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5+$as_echo_n "checking for grep that handles long lines and -e... " >&6; }+if ${ac_cv_path_GREP+:} false; then :+ $as_echo_n "(cached) " >&6+else+ if test -z "$GREP"; then+ ac_path_GREP_found=false+ # Loop through the user's path and test for each of PROGNAME-LIST+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin+do+ IFS=$as_save_IFS+ test -z "$as_dir" && as_dir=.+ for ac_prog in grep ggrep; do+ for ac_exec_ext in '' $ac_executable_extensions; do+ ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"+ as_fn_executable_p "$ac_path_GREP" || continue+# Check for GNU ac_path_GREP and select it if it is found.+ # Check for GNU $ac_path_GREP+case `"$ac_path_GREP" --version 2>&1` in+*GNU*)+ ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;+*)+ ac_count=0+ $as_echo_n 0123456789 >"conftest.in"+ while :+ do+ cat "conftest.in" "conftest.in" >"conftest.tmp"+ mv "conftest.tmp" "conftest.in"+ cp "conftest.in" "conftest.nl"+ $as_echo 'GREP' >> "conftest.nl"+ "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break+ as_fn_arith $ac_count + 1 && ac_count=$as_val+ if test $ac_count -gt ${ac_path_GREP_max-0}; then+ # Best one so far, save it but keep looking for a better one+ ac_cv_path_GREP="$ac_path_GREP"+ ac_path_GREP_max=$ac_count+ fi+ # 10*(2^10) chars as input seems more than enough+ test $ac_count -gt 10 && break+ done+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;+esac++ $ac_path_GREP_found && break 3+ done+ done+ done+IFS=$as_save_IFS+ if test -z "$ac_cv_path_GREP"; then+ as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5+ fi+else+ ac_cv_path_GREP=$GREP+fi++fi+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5+$as_echo "$ac_cv_path_GREP" >&6; }+ GREP="$ac_cv_path_GREP"+++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5+$as_echo_n "checking for egrep... " >&6; }+if ${ac_cv_path_EGREP+:} false; then :+ $as_echo_n "(cached) " >&6+else+ if echo a | $GREP -E '(a|b)' >/dev/null 2>&1+ then ac_cv_path_EGREP="$GREP -E"+ else+ if test -z "$EGREP"; then+ ac_path_EGREP_found=false+ # Loop through the user's path and test for each of PROGNAME-LIST+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin+do+ IFS=$as_save_IFS+ test -z "$as_dir" && as_dir=.+ for ac_prog in egrep; do+ for ac_exec_ext in '' $ac_executable_extensions; do+ ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"+ as_fn_executable_p "$ac_path_EGREP" || continue+# Check for GNU ac_path_EGREP and select it if it is found.+ # Check for GNU $ac_path_EGREP+case `"$ac_path_EGREP" --version 2>&1` in+*GNU*)+ ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;+*)+ ac_count=0+ $as_echo_n 0123456789 >"conftest.in"+ while :+ do+ cat "conftest.in" "conftest.in" >"conftest.tmp"+ mv "conftest.tmp" "conftest.in"+ cp "conftest.in" "conftest.nl"+ $as_echo 'EGREP' >> "conftest.nl"+ "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break+ as_fn_arith $ac_count + 1 && ac_count=$as_val+ if test $ac_count -gt ${ac_path_EGREP_max-0}; then+ # Best one so far, save it but keep looking for a better one+ ac_cv_path_EGREP="$ac_path_EGREP"+ ac_path_EGREP_max=$ac_count+ fi+ # 10*(2^10) chars as input seems more than enough+ test $ac_count -gt 10 && break+ done+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;+esac++ $ac_path_EGREP_found && break 3+ done+ done+ done+IFS=$as_save_IFS+ if test -z "$ac_cv_path_EGREP"; then+ as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5+ fi+else+ ac_cv_path_EGREP=$EGREP+fi++ fi+fi+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5+$as_echo "$ac_cv_path_EGREP" >&6; }+ EGREP="$ac_cv_path_EGREP"+++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5+$as_echo_n "checking for ANSI C header files... " >&6; }+if ${ac_cv_header_stdc+:} false; then :+ $as_echo_n "(cached) " >&6+else+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */+#include <stdlib.h>+#include <stdarg.h>+#include <string.h>+#include <float.h>++int+main ()+{++ ;+ return 0;+}+_ACEOF+if ac_fn_c_try_compile "$LINENO"; then :+ ac_cv_header_stdc=yes+else+ ac_cv_header_stdc=no+fi+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext++if test $ac_cv_header_stdc = yes; then+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */+#include <string.h>++_ACEOF+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |+ $EGREP "memchr" >/dev/null 2>&1; then :++else+ ac_cv_header_stdc=no+fi+rm -f conftest*++fi++if test $ac_cv_header_stdc = yes; then+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */+#include <stdlib.h>++_ACEOF+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |+ $EGREP "free" >/dev/null 2>&1; then :++else+ ac_cv_header_stdc=no+fi+rm -f conftest*++fi++if test $ac_cv_header_stdc = yes; then+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.+ if test "$cross_compiling" = yes; then :+ :+else+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */+#include <ctype.h>+#include <stdlib.h>+#if ((' ' & 0x0FF) == 0x020)+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))+#else+# define ISLOWER(c) \+ (('a' <= (c) && (c) <= 'i') \+ || ('j' <= (c) && (c) <= 'r') \+ || ('s' <= (c) && (c) <= 'z'))+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))+#endif++#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))+int+main ()+{+ int i;+ for (i = 0; i < 256; i++)+ if (XOR (islower (i), ISLOWER (i))+ || toupper (i) != TOUPPER (i))+ return 2;+ return 0;+}+_ACEOF+if ac_fn_c_try_run "$LINENO"; then :++else+ ac_cv_header_stdc=no+fi+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \+ conftest.$ac_objext conftest.beam conftest.$ac_ext+fi++fi+fi+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5+$as_echo "$ac_cv_header_stdc" >&6; }+if test $ac_cv_header_stdc = yes; then++$as_echo "#define STDC_HEADERS 1" >>confdefs.h++fi++# On IRIX 5.3, sys/types and inttypes.h are conflicting.+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \+ inttypes.h stdint.h unistd.h+do :+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default+"+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :+ cat >>confdefs.h <<_ACEOF+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1+_ACEOF++fi++done++++ ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default"+if test "x$ac_cv_header_minix_config_h" = xyes; then :+ MINIX=yes+else+ MINIX=+fi+++ if test "$MINIX" = yes; then++$as_echo "#define _POSIX_SOURCE 1" >>confdefs.h+++$as_echo "#define _POSIX_1_SOURCE 2" >>confdefs.h+++$as_echo "#define _MINIX 1" >>confdefs.h++ fi+++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5+$as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; }+if ${ac_cv_safe_to_define___extensions__+:} false; then :+ $as_echo_n "(cached) " >&6+else+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */++# define __EXTENSIONS__ 1+ $ac_includes_default+int+main ()+{++ ;+ return 0;+}+_ACEOF+if ac_fn_c_try_compile "$LINENO"; then :+ ac_cv_safe_to_define___extensions__=yes+else+ ac_cv_safe_to_define___extensions__=no+fi+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext+fi+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5+$as_echo "$ac_cv_safe_to_define___extensions__" >&6; }+ test $ac_cv_safe_to_define___extensions__ = yes &&+ $as_echo "#define __EXTENSIONS__ 1" >>confdefs.h++ $as_echo "#define _ALL_SOURCE 1" >>confdefs.h++ $as_echo "#define _GNU_SOURCE 1" >>confdefs.h++ $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h++ $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h++++++ # Check whether --with-gmp-includes was given. if test "${with_gmp_includes+set}" = set; then : withval=$with_gmp_includes; GMP_INCLUDE_DIRS=$withval; CPPFLAGS="-I$withval"@@ -3233,7 +3695,6 @@ if test "$GMP_PREFER_FRAMEWORK" = "YES" then - if test "$HaveLibGmp" = "NO" then case $target_os in@@ -3588,404 +4049,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } UseIntreeGmp=0- ac_ext=c-ac_cpp='$CPP $CPPFLAGS'-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'-ac_compiler_gnu=$ac_cv_c_compiler_gnu-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5-$as_echo_n "checking how to run the C preprocessor... " >&6; }-# On Suns, sometimes $CPP names a directory.-if test -n "$CPP" && test -d "$CPP"; then- CPP=-fi-if test -z "$CPP"; then- if ${ac_cv_prog_CPP+:} false; then :- $as_echo_n "(cached) " >&6-else- # Double quotes because CPP needs to be expanded- for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"- do- ac_preproc_ok=false-for ac_c_preproc_warn_flag in '' yes-do- # Use a header file that comes with gcc, so configuring glibc- # with a fresh cross-compiler works.- # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since- # <limits.h> exists even on freestanding compilers.- # On the NeXT, cc -E runs the code through the compiler's parser,- # not just through cpp. "Syntax error" is here to catch this case.- cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */-#ifdef __STDC__-# include <limits.h>-#else-# include <assert.h>-#endif- Syntax error-_ACEOF-if ac_fn_c_try_cpp "$LINENO"; then :--else- # Broken: fails on valid input.-continue-fi-rm -f conftest.err conftest.i conftest.$ac_ext-- # OK, works on sane cases. Now check whether nonexistent headers- # can be detected and how.- cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */-#include <ac_nonexistent.h>-_ACEOF-if ac_fn_c_try_cpp "$LINENO"; then :- # Broken: success on invalid input.-continue-else- # Passes both tests.-ac_preproc_ok=:-break-fi-rm -f conftest.err conftest.i conftest.$ac_ext--done-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.-rm -f conftest.i conftest.err conftest.$ac_ext-if $ac_preproc_ok; then :- break-fi-- done- ac_cv_prog_CPP=$CPP--fi- CPP=$ac_cv_prog_CPP-else- ac_cv_prog_CPP=$CPP-fi-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5-$as_echo "$CPP" >&6; }-ac_preproc_ok=false-for ac_c_preproc_warn_flag in '' yes-do- # Use a header file that comes with gcc, so configuring glibc- # with a fresh cross-compiler works.- # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since- # <limits.h> exists even on freestanding compilers.- # On the NeXT, cc -E runs the code through the compiler's parser,- # not just through cpp. "Syntax error" is here to catch this case.- cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */-#ifdef __STDC__-# include <limits.h>-#else-# include <assert.h>-#endif- Syntax error-_ACEOF-if ac_fn_c_try_cpp "$LINENO"; then :--else- # Broken: fails on valid input.-continue-fi-rm -f conftest.err conftest.i conftest.$ac_ext-- # OK, works on sane cases. Now check whether nonexistent headers- # can be detected and how.- cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */-#include <ac_nonexistent.h>-_ACEOF-if ac_fn_c_try_cpp "$LINENO"; then :- # Broken: success on invalid input.-continue-else- # Passes both tests.-ac_preproc_ok=:-break-fi-rm -f conftest.err conftest.i conftest.$ac_ext--done-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.-rm -f conftest.i conftest.err conftest.$ac_ext-if $ac_preproc_ok; then :--else- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}-as_fn_error $? "C preprocessor \"$CPP\" fails sanity check-See \`config.log' for more details" "$LINENO" 5; }-fi--ac_ext=c-ac_cpp='$CPP $CPPFLAGS'-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'-ac_compiler_gnu=$ac_cv_c_compiler_gnu---{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5-$as_echo_n "checking for grep that handles long lines and -e... " >&6; }-if ${ac_cv_path_GREP+:} false; then :- $as_echo_n "(cached) " >&6-else- if test -z "$GREP"; then- ac_path_GREP_found=false- # Loop through the user's path and test for each of PROGNAME-LIST- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin-do- IFS=$as_save_IFS- test -z "$as_dir" && as_dir=.- for ac_prog in grep ggrep; do- for ac_exec_ext in '' $ac_executable_extensions; do- ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"- as_fn_executable_p "$ac_path_GREP" || continue-# Check for GNU ac_path_GREP and select it if it is found.- # Check for GNU $ac_path_GREP-case `"$ac_path_GREP" --version 2>&1` in-*GNU*)- ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;-*)- ac_count=0- $as_echo_n 0123456789 >"conftest.in"- while :- do- cat "conftest.in" "conftest.in" >"conftest.tmp"- mv "conftest.tmp" "conftest.in"- cp "conftest.in" "conftest.nl"- $as_echo 'GREP' >> "conftest.nl"- "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break- diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break- as_fn_arith $ac_count + 1 && ac_count=$as_val- if test $ac_count -gt ${ac_path_GREP_max-0}; then- # Best one so far, save it but keep looking for a better one- ac_cv_path_GREP="$ac_path_GREP"- ac_path_GREP_max=$ac_count- fi- # 10*(2^10) chars as input seems more than enough- test $ac_count -gt 10 && break- done- rm -f conftest.in conftest.tmp conftest.nl conftest.out;;-esac-- $ac_path_GREP_found && break 3- done- done- done-IFS=$as_save_IFS- if test -z "$ac_cv_path_GREP"; then- as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5- fi-else- ac_cv_path_GREP=$GREP-fi--fi-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5-$as_echo "$ac_cv_path_GREP" >&6; }- GREP="$ac_cv_path_GREP"---{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5-$as_echo_n "checking for egrep... " >&6; }-if ${ac_cv_path_EGREP+:} false; then :- $as_echo_n "(cached) " >&6-else- if echo a | $GREP -E '(a|b)' >/dev/null 2>&1- then ac_cv_path_EGREP="$GREP -E"- else- if test -z "$EGREP"; then- ac_path_EGREP_found=false- # Loop through the user's path and test for each of PROGNAME-LIST- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin-do- IFS=$as_save_IFS- test -z "$as_dir" && as_dir=.- for ac_prog in egrep; do- for ac_exec_ext in '' $ac_executable_extensions; do- ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"- as_fn_executable_p "$ac_path_EGREP" || continue-# Check for GNU ac_path_EGREP and select it if it is found.- # Check for GNU $ac_path_EGREP-case `"$ac_path_EGREP" --version 2>&1` in-*GNU*)- ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;-*)- ac_count=0- $as_echo_n 0123456789 >"conftest.in"- while :- do- cat "conftest.in" "conftest.in" >"conftest.tmp"- mv "conftest.tmp" "conftest.in"- cp "conftest.in" "conftest.nl"- $as_echo 'EGREP' >> "conftest.nl"- "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break- diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break- as_fn_arith $ac_count + 1 && ac_count=$as_val- if test $ac_count -gt ${ac_path_EGREP_max-0}; then- # Best one so far, save it but keep looking for a better one- ac_cv_path_EGREP="$ac_path_EGREP"- ac_path_EGREP_max=$ac_count- fi- # 10*(2^10) chars as input seems more than enough- test $ac_count -gt 10 && break- done- rm -f conftest.in conftest.tmp conftest.nl conftest.out;;-esac-- $ac_path_EGREP_found && break 3- done- done- done-IFS=$as_save_IFS- if test -z "$ac_cv_path_EGREP"; then- as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5- fi-else- ac_cv_path_EGREP=$EGREP-fi-- fi-fi-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5-$as_echo "$ac_cv_path_EGREP" >&6; }- EGREP="$ac_cv_path_EGREP"---{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5-$as_echo_n "checking for ANSI C header files... " >&6; }-if ${ac_cv_header_stdc+:} false; then :- $as_echo_n "(cached) " >&6-else- cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */-#include <stdlib.h>-#include <stdarg.h>-#include <string.h>-#include <float.h>--int-main ()-{-- ;- return 0;-}-_ACEOF-if ac_fn_c_try_compile "$LINENO"; then :- ac_cv_header_stdc=yes-else- ac_cv_header_stdc=no-fi-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext--if test $ac_cv_header_stdc = yes; then- # SunOS 4.x string.h does not declare mem*, contrary to ANSI.- cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */-#include <string.h>--_ACEOF-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |- $EGREP "memchr" >/dev/null 2>&1; then :--else- ac_cv_header_stdc=no-fi-rm -f conftest*--fi--if test $ac_cv_header_stdc = yes; then- # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.- cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */-#include <stdlib.h>--_ACEOF-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |- $EGREP "free" >/dev/null 2>&1; then :--else- ac_cv_header_stdc=no-fi-rm -f conftest*--fi--if test $ac_cv_header_stdc = yes; then- # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.- if test "$cross_compiling" = yes; then :- :-else- cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */-#include <ctype.h>-#include <stdlib.h>-#if ((' ' & 0x0FF) == 0x020)-# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')-# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))-#else-# define ISLOWER(c) \- (('a' <= (c) && (c) <= 'i') \- || ('j' <= (c) && (c) <= 'r') \- || ('s' <= (c) && (c) <= 'z'))-# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))-#endif--#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))-int-main ()-{- int i;- for (i = 0; i < 256; i++)- if (XOR (islower (i), ISLOWER (i))- || toupper (i) != TOUPPER (i))- return 2;- return 0;-}-_ACEOF-if ac_fn_c_try_run "$LINENO"; then :--else- ac_cv_header_stdc=no-fi-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \- conftest.$ac_objext conftest.beam conftest.$ac_ext-fi--fi-fi-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5-$as_echo "$ac_cv_header_stdc" >&6; }-if test $ac_cv_header_stdc = yes; then--$as_echo "#define STDC_HEADERS 1" >>confdefs.h--fi--# On IRIX 5.3, sys/types and inttypes.h are conflicting.-for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \- inttypes.h stdint.h unistd.h-do :- as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`-ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default-"-if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :- cat >>confdefs.h <<_ACEOF-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1-_ACEOF--fi--done---ac_fn_c_check_header_mongrel "$LINENO" "gmp.h" "ac_cv_header_gmp_h" "$ac_includes_default"+ ac_fn_c_check_header_mongrel "$LINENO" "gmp.h" "ac_cv_header_gmp_h" "$ac_includes_default" if test "x$ac_cv_header_gmp_h" = xyes; then : else
configure.ac view
@@ -1,15 +1,14 @@+AC_PREREQ(2.60) AC_INIT([Haskell integer (GMP)], [1.0], [libraries@haskell.org], [integer])-AC_PREREQ(2.52) # Safety check: Ensure that we are in the correct source directory. AC_CONFIG_SRCDIR([cbits/wrappers.c]) AC_CANONICAL_TARGET -AC_ARG_WITH([cc],- [C compiler],- [CC=$withval])-AC_PROG_CC()+AC_PROG_CC+dnl make extensions visible to allow feature-tests to detect them lateron+AC_USE_SYSTEM_EXTENSIONS dnl--------------------------------------------------------------------
integer-gmp.cabal view
@@ -1,5 +1,5 @@ name: integer-gmp-version: 1.0.0.0+version: 1.0.0.1 synopsis: Integer library based on GMP license: BSD3 license-file: LICENSE@@ -48,7 +48,7 @@ UnliftedFFITypes build-depends: ghc-prim hs-source-dirs: src/- ghc-options: -this-package-key integer-gmp -Wall+ ghc-options: -this-unit-id integer-gmp -Wall cc-options: -std=c99 -Wall include-dirs: include
src/GHC/Integer/Type.hs view
@@ -426,7 +426,7 @@ -- | Multiply two 'Integer's timesInteger :: Integer -> Integer -> Integer-timesInteger _ (S# 0#) = S# 0#+timesInteger !_ (S# 0#) = S# 0# timesInteger (S# 0#) _ = S# 0# timesInteger x (S# 1#) = x timesInteger (S# 1#) y = y@@ -460,23 +460,23 @@ -- | Construct 'Integer' from the product of two 'Int#'s timesInt2Integer :: Int# -> Int# -> Integer-timesInt2Integer x# y# = case (# x# >=# 0#, y# >=# 0# #) of- (# 0#, 0# #) -> case timesWord2# (int2Word# (negateInt# x#))+timesInt2Integer x# y# = case (# isTrue# (x# >=# 0#), isTrue# (y# >=# 0#) #) of+ (# False, False #) -> case timesWord2# (int2Word# (negateInt# x#)) (int2Word# (negateInt# y#)) of (# 0##,l #) -> inline wordToInteger l (# h ,l #) -> Jp# (wordToBigNat2 h l) - (# _, 0# #) -> case timesWord2# (int2Word# x#)+ (# True, False #) -> case timesWord2# (int2Word# x#) (int2Word# (negateInt# y#)) of (# 0##,l #) -> wordToNegInteger l (# h ,l #) -> Jn# (wordToBigNat2 h l) - (# 0#, _ #) -> case timesWord2# (int2Word# (negateInt# x#))+ (# False, True #) -> case timesWord2# (int2Word# (negateInt# x#)) (int2Word# y#) of (# 0##,l #) -> wordToNegInteger l (# h ,l #) -> Jn# (wordToBigNat2 h l) - (# _, _ #) -> case timesWord2# (int2Word# x#)+ (# True, True #) -> case timesWord2# (int2Word# x#) (int2Word# y#) of (# 0##,l #) -> inline wordToInteger l (# h ,l #) -> Jp# (wordToBigNat2 h l)@@ -515,7 +515,7 @@ -- | Test if /n/-th bit is set. testBitInteger :: Integer -> Int# -> Bool-testBitInteger _ n# | isTrue# (n# <# 0#) = False+testBitInteger !_ n# | isTrue# (n# <# 0#) = False testBitInteger (S# i#) n# | isTrue# (n# <# GMP_LIMB_BITS#) = isTrue# (((uncheckedIShiftL# 1# n#) `andI#` i#) /=# 0#)@@ -614,7 +614,7 @@ -- | Bitwise AND operation andInteger :: Integer -> Integer -> Integer -- short-cuts-andInteger (S# 0#) _ = S# 0#+andInteger (S# 0#) !_ = S# 0# andInteger _ (S# 0#) = S# 0# andInteger (S# -1#) y = y andInteger x (S# -1#) = x@@ -646,7 +646,7 @@ quotRemInteger :: Integer -> Integer -> (# Integer, Integer #) quotRemInteger n (S# 1#) = (# n, S# 0# #) quotRemInteger n (S# -1#) = let !q = negateInteger n in (# q, (S# 0#) #)-quotRemInteger _ (S# 0#) = (# S# (quotInt# 0# 0#),S# (remInt# 0# 0#) #)+quotRemInteger !_ (S# 0#) = (# S# (quotInt# 0# 0#),S# (remInt# 0# 0#) #) quotRemInteger (S# 0#) _ = (# S# 0#, S# 0# #) quotRemInteger (S# n#) (S# d#) = case quotRemInt# n# d# of (# q#, r# #) -> (# S# q#, S# r# #)@@ -679,7 +679,7 @@ quotInteger :: Integer -> Integer -> Integer quotInteger n (S# 1#) = n quotInteger n (S# -1#) = negateInteger n-quotInteger _ (S# 0#) = S# (quotInt# 0# 0#)+quotInteger !_ (S# 0#) = S# (quotInt# 0# 0#) quotInteger (S# 0#) _ = S# 0# quotInteger (S# n#) (S# d#) = S# (quotInt# n# d#) quotInteger (Jp# n) (S# d#)@@ -699,7 +699,7 @@ {-# CONSTANT_FOLDED quotInteger #-} remInteger :: Integer -> Integer -> Integer-remInteger _ (S# 1#) = S# 0#+remInteger !_ (S# 1#) = S# 0# remInteger _ (S# -1#) = S# 0# remInteger _ (S# 0#) = S# (remInt# 0# 0#) remInteger (S# 0#) _ = S# 0#@@ -763,7 +763,7 @@ -- | Compute least common multiple. lcmInteger :: Integer -> Integer -> Integer-lcmInteger (S# 0#) _ = S# 0#+lcmInteger (S# 0#) !_ = S# 0# lcmInteger (S# 1#) b = absInteger b lcmInteger (S# -1#) b = absInteger b lcmInteger _ (S# 0#) = S# 0#@@ -835,7 +835,7 @@ eqBigNatWord# :: BigNat -> GmpLimb# -> Int# eqBigNatWord# bn w#- = sizeofBigNat# bn ==# 1# `andI#` (bigNatToWord bn `eqWord#` w#)+ = (sizeofBigNat# bn ==# 1#) `andI#` (bigNatToWord bn `eqWord#` w#) -- | Same as @'indexBigNat#' bn 0\#@@@ -998,7 +998,7 @@ sqrBigNat x = timesBigNat x x -- TODO: mpn_sqr timesBigNatWord :: BigNat -> GmpLimb# -> BigNat-timesBigNatWord _ 0## = zeroBigNat+timesBigNatWord !_ 0## = zeroBigNat timesBigNatWord x 1## = x timesBigNatWord x@(BN# x#) y# | isTrue# (nx# ==# 1#) =@@ -1014,8 +1014,25 @@ where nx# = sizeofBigNat# x +-- | Specialised version of+--+-- > bitBigNat = shiftLBigNat (wordToBigNat 1##)+--+-- avoiding a few redundant allocations bitBigNat :: Int# -> BigNat-bitBigNat i# = shiftLBigNat (wordToBigNat 1##) i# -- FIXME+bitBigNat i#+ | isTrue# (i# <# 0#) = zeroBigNat -- or maybe 'nullBigNat'?+ | isTrue# (i# ==# 0#) = oneBigNat+ | True = runS $ do+ mbn@(MBN# mba#) <- newBigNat# (li# +# 1#)+ -- FIXME: do we really need to zero-init MBAs returned by 'newByteArray#'?+ -- clear all limbs (except for the most-significant limb)+ _ <- svoid (setByteArray# mba# 0# (li# `uncheckedIShiftL#` GMP_LIMB_SHIFT#) 0#)+ -- set single bit in most-significant limb+ _ <- svoid (writeBigNat# mbn li# (uncheckedShiftL# 1## bi#))+ unsafeFreezeBigNat# mbn+ where+ (# li#, bi# #) = quotRemInt# i# GMP_LIMB_BITS# testBitBigNat :: BigNat -> Int# -> Bool testBitBigNat bn i#@@ -1104,9 +1121,9 @@ ior' a# na# b# nb# = do -- na >= nb mbn@(MBN# mba#) <- newBigNat# na# _ <- liftIO (c_mpn_ior_n mba# a# b# nb#)- _ <- case na# ==# nb# of- 0# -> svoid (copyWordArray# a# nb# mba# nb# (na# -# nb#))- _ -> return ()+ _ <- case isTrue# (na# ==# nb#) of+ False -> svoid (copyWordArray# a# nb# mba# nb# (na# -# nb#))+ True -> return () unsafeFreezeBigNat# mbn nx# = sizeofBigNat# x@@ -1123,10 +1140,10 @@ xor' a# na# b# nb# = do -- na >= nb mbn@(MBN# mba#) <- newBigNat# na# _ <- liftIO (c_mpn_xor_n mba# a# b# nb#)- case na# ==# nb# of- 0# -> do _ <- svoid (copyWordArray# a# nb# mba# nb# (na# -# nb#))- unsafeFreezeBigNat# mbn- _ -> unsafeRenormFreezeBigNat# mbn+ case isTrue# (na# ==# nb#) of+ False -> do _ <- svoid (copyWordArray# a# nb# mba# nb# (na# -# nb#))+ unsafeFreezeBigNat# mbn+ True -> unsafeRenormFreezeBigNat# mbn nx# = sizeofBigNat# x ny# = sizeofBigNat# y@@ -1139,9 +1156,9 @@ | True = runS $ do mbn@(MBN# mba#) <- newBigNat# nx# _ <- liftIO (c_mpn_andn_n mba# x# y# n#)- _ <- case nx# ==# n# of- 0# -> svoid (copyWordArray# x# n# mba# n# (nx# -# n#))- _ -> return ()+ _ <- case isTrue# (nx# ==# n#) of+ False -> svoid (copyWordArray# x# n# mba# n# (nx# -# n#))+ True -> return () unsafeRenormFreezeBigNat# mbn where n# | isTrue# (nx# <# ny#) = nx#@@ -1214,7 +1231,7 @@ -- | Note: Result of div/0 undefined quotRemBigNatWord :: BigNat -> GmpLimb# -> (# BigNat, GmpLimb# #)-quotRemBigNatWord _ 0## = (# nullBigNat, 0## #)+quotRemBigNatWord !_ 0## = (# nullBigNat, 0## #) quotRemBigNatWord n 1## = (# n, 0## #) quotRemBigNatWord n@(BN# nba#) d# = case compareBigNatWord n d# of LT -> (# zeroBigNat, bigNatToWord n #)@@ -1249,9 +1266,9 @@ mbn@(MBN# mba#) <- newBigNat# nb# I# rn'# <- liftIO (c_mpn_gcd# mba# a# na# b# nb#) let rn# = narrowGmpSize# rn'#- case rn# ==# nb# of- 0# -> unsafeShrinkFreezeBigNat# mbn rn#- _ -> unsafeFreezeBigNat# mbn+ case isTrue# (rn# ==# nb#) of+ False -> unsafeShrinkFreezeBigNat# mbn rn#+ True -> unsafeFreezeBigNat# mbn nx# = sizeofBigNat# x ny# = sizeofBigNat# y@@ -1284,9 +1301,9 @@ sn# = absI# ssn# s' <- unsafeShrinkFreezeBigNat# s sn# g' <- unsafeRenormFreezeBigNat# g- case ssn# >=# 0# of- 0# -> return ( g', NegBN s' )- _ -> return ( g', PosBN s' )+ case isTrue# (ssn# >=# 0#) of+ False -> return ( g', NegBN s' )+ True -> return ( g', PosBN s' ) !(BN# x#) = absSBigNat x !(BN# y#) = absSBigNat y@@ -1351,9 +1368,9 @@ r@(MBN# r#) <- newBigNat# mn# I# rn_# <- liftIO (integer_gmp_powm# r# b# bn# e# en# m# mn#) let rn# = narrowGmpSize# rn_#- case rn# ==# mn# of- 0# -> unsafeShrinkFreezeBigNat# r rn#- _ -> unsafeFreezeBigNat# r+ case isTrue# (rn# ==# mn#) of+ False -> unsafeShrinkFreezeBigNat# r rn#+ True -> unsafeFreezeBigNat# r where !(BN# b#) = absSBigNat b !(BN# e#) = absSBigNat e@@ -1413,9 +1430,9 @@ r@(MBN# r#) <- newBigNat# mn# I# rn_# <- liftIO (integer_gmp_invert# r# x# xn# m# mn#) let rn# = narrowGmpSize# rn_#- case rn# ==# mn# of- 0# -> unsafeShrinkFreezeBigNat# r rn#- _ -> unsafeFreezeBigNat# r+ case isTrue# (rn# ==# mn#) of+ False -> unsafeShrinkFreezeBigNat# r rn#+ True -> unsafeFreezeBigNat# r where !(BN# x#) = absSBigNat x xn# = ssizeofSBigNat# x@@ -1611,9 +1628,11 @@ data MutBigNat s = MBN# !(MutableByteArray# s) -sizeofMutBigNat# :: MutBigNat s -> GmpSize#-sizeofMutBigNat# (MBN# x#)- = sizeofMutableByteArray# x# `uncheckedIShiftRL#` GMP_LIMB_SHIFT#+getSizeofMutBigNat# :: MutBigNat s -> State# s -> (# State# s, GmpSize# #)+--getSizeofMutBigNat# :: MutBigNat s -> S s GmpSize#+getSizeofMutBigNat# (MBN# x#) s =+ case getSizeofMutableByteArray# x# s of+ (# s', n# #) -> (# s', n# `uncheckedIShiftRL#` GMP_LIMB_SHIFT# #) newBigNat# :: GmpSize# -> S s (MutBigNat s) newBigNat# limbs# s =@@ -1634,40 +1653,42 @@ resizeMutBigNat# :: MutBigNat s -> GmpSize# -> S s (MutBigNat s) resizeMutBigNat# (MBN# mba0#) nsz# s- | isTrue# (bsz# ==# sizeofMutableByteArray# mba0#) = (# s, MBN# mba0# #)- | True = case resizeMutableByteArray# mba0# bsz# s of- (# s', mba# #) -> (# s' , MBN# mba# #)+ | isTrue# (bsz# ==# n#) = (# s', MBN# mba0# #)+ | True =+ case resizeMutableByteArray# mba0# bsz# s' of+ (# s'', mba# #) -> (# s'', MBN# mba# #) where bsz# = nsz# `uncheckedIShiftL#` GMP_LIMB_SHIFT#+ (# s', n# #) = getSizeofMutableByteArray# mba0# s shrinkMutBigNat# :: MutBigNat s -> GmpSize# -> State# s -> State# s-shrinkMutBigNat# (MBN# mba0#) nsz#- | isTrue# (bsz# ==# sizeofMutableByteArray# mba0#) = \s -> s -- no-op- | True = shrinkMutableByteArray# mba0# bsz#+shrinkMutBigNat# (MBN# mba0#) nsz# s+ | isTrue# (bsz# ==# n#) = s' -- no-op+ | True = shrinkMutableByteArray# mba0# bsz# s' where bsz# = nsz# `uncheckedIShiftL#` GMP_LIMB_SHIFT#+ (# s', n# #) = getSizeofMutableByteArray# mba0# s unsafeSnocFreezeBigNat# :: MutBigNat s -> GmpLimb# -> S s BigNat-unsafeSnocFreezeBigNat# mbn0@(MBN# mba0#) limb# = do- -- (MBN# mba#) <- newBigNat# (n# +# 1#)- -- _ <- svoid (copyMutableByteArray# mba0# 0# mba# 0# nb0#)- (MBN# mba#) <- resizeMutBigNat# mbn0 (n# +# 1#)- _ <- svoid (writeWordArray# mba# n# limb#)- unsafeFreezeBigNat# (MBN# mba#)+unsafeSnocFreezeBigNat# mbn0@(MBN# mba0#) limb# s = go s' where n# = nb0# `uncheckedIShiftRL#` GMP_LIMB_SHIFT#- nb0# = sizeofMutableByteArray# mba0#+ (# s', nb0# #) = getSizeofMutableByteArray# mba0# s+ go = do+ (MBN# mba#) <- resizeMutBigNat# mbn0 (n# +# 1#)+ _ <- svoid (writeWordArray# mba# n# limb#)+ unsafeFreezeBigNat# (MBN# mba#) -- | May shrink underlyng 'ByteArray#' if needed to satisfy BigNat invariant unsafeRenormFreezeBigNat# :: MutBigNat s -> S s BigNat unsafeRenormFreezeBigNat# mbn s- | isTrue# (n0# ==# 0#) = (# s', nullBigNat #)- | isTrue# (n# ==# 0#) = (# s', zeroBigNat #)- | isTrue# (n# ==# n0#) = (unsafeFreezeBigNat# mbn) s'- | True = (unsafeShrinkFreezeBigNat# mbn n#) s'+ | isTrue# (n0# ==# 0#) = (# s'', nullBigNat #)+ | isTrue# (n# ==# 0#) = (# s'', zeroBigNat #)+ | isTrue# (n# ==# n0#) = (unsafeFreezeBigNat# mbn) s''+ | True = (unsafeShrinkFreezeBigNat# mbn n#) s'' where- (# s', n# #) = normSizeofMutBigNat'# mbn n0# s- n0# = sizeofMutBigNat# mbn+ (# s', n0# #) = getSizeofMutBigNat# mbn s+ (# s'', n# #) = normSizeofMutBigNat'# mbn n0# s' -- | Shrink MBN unsafeShrinkFreezeBigNat# :: MutBigNat s -> GmpSize# -> S s BigNat@@ -1695,9 +1716,10 @@ -- | Version of 'normSizeofMutBigNat'#' which scans all allocated 'MutBigNat#' normSizeofMutBigNat# :: MutBigNat s -> State# s -> (# State# s, Int# #)-normSizeofMutBigNat# mbn@(MBN# mba) = normSizeofMutBigNat'# mbn sz#+normSizeofMutBigNat# mbn@(MBN# mba) s = normSizeofMutBigNat'# mbn sz# s' where- sz# = sizeofMutableByteArray# mba `uncheckedIShiftRA#` GMP_LIMB_SHIFT#+ (# s', n# #) = getSizeofMutableByteArray# mba s+ sz# = n# `uncheckedIShiftRA#` GMP_LIMB_SHIFT# -- | Find most-significant non-zero limb and return its index-position -- plus one. Start scanning downward from the initial limb-size@@ -1726,10 +1748,12 @@ | isTrue# (n# ==# 0#) = zeroBigNat | isTrue# (baszr# ==# 0#) -- i.e. ba# is multiple of limb-size , isTrue# (baszq# ==# n#) = (BN# ba#)- | True = runS $ do- mbn@(MBN# mba#) <- newBigNat# n#- _ <- svoid (copyByteArray# ba# 0# mba# 0# (sizeofMutableByteArray# mba#))- unsafeFreezeBigNat# mbn+ | True = runS $ \s ->+ let (# s', mbn@(MBN# mba#) #) = newBigNat# n# s+ (# s'', ba_sz# #) = getSizeofMutableByteArray# mba# s'+ go = do _ <- svoid (copyByteArray# ba# 0# mba# 0# ba_sz# )+ unsafeFreezeBigNat# mbn+ in go s'' where (# baszq#, baszr# #) = quotRemInt# (sizeofByteArray# ba#) GMP_LIMB_BYTES# @@ -1850,9 +1874,9 @@ isValidBigNat# (BN# ba#) = (szq# ># 0#) `andI#` (szr# ==# 0#) `andI#` isNorm# where- isNorm# = case szq# ># 1# of- 1# -> (indexWordArray# ba# (szq# -# 1#)) `neWord#` 0##- _ -> 1#+ isNorm#+ | isTrue# (szq# ># 1#) = (indexWordArray# ba# (szq# -# 1#)) `neWord#` 0##+ | True = 1# sz# = sizeofByteArray# ba# @@ -1910,8 +1934,7 @@ -- NB: equivalent of GHC.IO.unsafeDupablePerformIO, see notes there runS :: S RealWorld a -> a-runS m = lazy (case m realWorld# of (# _, r #) -> r)-{-# NOINLINE runS #-}+runS m = case runRW# m of (# _, a #) -> a -- stupid hack fail :: [Char] -> S s a@@ -1963,13 +1986,6 @@ | isTrue# (x# `eqWord#` y#) = EQ | True = GT {-# INLINE cmpW# #-}--subWordC# :: Word# -> Word# -> (# Word#, Int# #)-subWordC# x# y# = (# d#, c# #)- where- d# = x# `minusWord#` y#- c# = d# `gtWord#` x#-{-# INLINE subWordC# #-} bitWord# :: Int# -> Word# bitWord# = uncheckedShiftL# 1##