Tom Tromey
f822a2516d
Use mpz_sgn rather than comparisons against 0
...
* src/data.c (Fmod): Use mpz_sgn.
* src/lisp.h (NATNUMP): Use mpz_sgn.
2018-08-09 13:28:37 -06:00
Andy Moreton
f966753727
Do not use GMP_NUMB_BITS
...
* src/alloc.c (make_number): Use mp_bits_per_limb, not GMP_NUMB_BITS.
2018-08-09 13:28:37 -06:00
Charles A. Roelli
d0b279a505
Update src/{ns,mac}*.m to use bignum-compatible macros
...
* src/nsterm.m:
* src/nsselect.m:
* src/nsmenu.m:
* src/nsimage.m:
* src/nsfont.m:
* src/nsfns.m:
* src/macfont.m: Replace
"make_number" -> "make_fixnum",
"XINT" -> "XFIXNUM",
"XFASTINT" -> "XFIXNAT",
"TYPE_RANGED_INTEGERP" -> "TYPE_RANGED_FIXNUMP",
"RANGED_INTEGERP" -> "RANGED_FIXNUMP",
"CHECK_NATNUM" -> "CHECK_FIXNAT",
"CHECK_NUMBER" -> "CHECK_FIXNUM",
"INTEGERP" -> "FIXNUMP",
"NUMBERP" -> "FIXED_OR_FLOATP",
as done in the following changes:
2018-07-06 Rename integerp->fixnum, etc, in preparation
for bignums (42fe787b
)
2018-08-07 More macro renamings for bignum (d1ec3a0a
)
2018-08-09 16:00:20 +02:00
Tom Tromey
90dba077cf
Fix mod-test-sum-test for bignums
...
* test/src/emacs-module-tests.el (mod-test-sum-test): Update
for bignums.
2018-08-08 17:34:42 -06:00
Tom Tromey
5ebf062ebe
Handle leading "+" when converting string to bignum
...
* src/lread.c (string_to_number): Skip leading "+" when calling
make_bignum_str.
2018-08-08 17:33:24 -06:00
Tom Tromey
d3549c1901
Use mpz_import in mpz_set_uintmax_slow
...
* src/alloc.c (mpz_set_uintmax_slow): Use mpz_import.
2018-08-08 17:01:55 -06:00
Tom Tromey
fb26c9fd69
Make purecopy work for bignums
...
* src/alloc.c (make_pure_bignum): New function.
(purecopy): Use it.
2018-08-08 17:01:14 -06:00
Tom Tromey
d1ec3a0a8e
More macro renamings for bignum
...
* src/alloc.c, src/bidi.c, src/buffer.c, src/buffer.h, src/bytecode.c,
src/callint.c, src/callproc.c, src/casefiddle.c, src/casetab.c,
src/category.c, src/ccl.c, src/character.c, src/character.h,
src/charset.c, src/charset.h, src/chartab.c, src/cmds.c, src/coding.c,
src/composite.c, src/composite.h, src/data.c, src/dbusbind.c,
src/decompress.c, src/dired.c, src/dispextern.h, src/dispnew.c,
src/disptab.h, src/doc.c, src/dosfns.c, src/editfns.c,
src/emacs-module.c, src/emacs.c, src/eval.c, src/fileio.c,
src/floatfns.c, src/fns.c, src/font.c, src/font.h, src/fontset.c,
src/frame.c, src/frame.h, src/fringe.c, src/ftcrfont.c, src/ftfont.c,
src/gfilenotify.c, src/gnutls.c, src/gtkutil.c, src/image.c,
src/indent.c, src/insdel.c, src/intervals.c, src/json.c,
src/keyboard.c, src/keymap.c, src/kqueue.c, src/lcms.c, src/lisp.h,
src/lread.c, src/macros.c, src/marker.c, src/menu.c, src/minibuf.c,
src/msdos.c, src/print.c, src/process.c, src/profiler.c, src/search.c,
src/sound.c, src/syntax.c, src/syntax.h, src/sysdep.c, src/term.c,
src/termhooks.h, src/textprop.c, src/undo.c, src/w32.c,
src/w32console.c, src/w32fns.c, src/w32font.c, src/w32inevt.c,
src/w32proc.c, src/w32select.c, src/w32term.c, src/w32term.h,
src/w32uniscribe.c, src/window.c, src/xdisp.c, src/xfaces.c,
src/xfns.c, src/xfont.c, src/xftfont.c, src/xmenu.c, src/xml.c,
src/xrdb.c, src/xselect.c, src/xsettings.c, src/xterm.c, src/xwidget.c
Rename XINT->XFIXNUM, XFASTINT->XFIXNAT, XUINT->XUFIXNUM.
2018-08-07 18:08:53 -06:00
Andy Moreton
68ebff23f7
Fix test and comment in CCL change
...
* lisp/international/ccl.el (ccl-fixnum): Update comment.
* test/lisp/international/ccl-tests.el (prog-midi-dump): Add
trailing space to expected result.
2018-08-05 12:56:33 -06:00
Tom Tromey
1303f8a480
Fix hash functions for bignums
...
* src/fns.c (cmpfn_eql, hashfn_eql): Handle bignums.
(sxhash_bignum): New function.
(sxhash): Use it.
* test/src/fns-tests.el (test-bignum-hash): New test.
2018-08-04 11:08:31 -06:00
Tom Tromey
91d505d8e2
Fix bignum comparisons with NaN
...
* src/data.c (isnan): Move earlier.
(bignumcompare): Explicitly handle NaN.
* test/src/data-tests.el (data-tests-min): Add NaN tests
for bignum.
(data-check-sign): Fix for previous patch.
* test/src/fns-tests.el (test-bignum-eql): Add NaN test.
2018-08-04 10:50:35 -06:00
Andy Moreton
bc8ff54efe
Make bignums work better when EMACS_INT is larger than long
...
* lisp/international/ccl.el (ccl-fixnum): New function.
(ccl-embed-data, ccl-embed-current-address, ccl-dump): Use it.
* src/alloc.c (make_number): Handle case where EMACS_INT is
larger than long.
* src/data.c (bignumcompare): Handle case where EMACS_INT is
larger than long.
(arith_driver): Likewise. Coerce markers.
(float_arith_driver): Coerce markers.
(Flogcount): Use mpz_sgn.
(ash_lsh_impl): Fix bugs.
(Fsub1): Fix underflow check.
* src/lisp.h (NUMBERP): Don't check BIGNUMP.
(CHECK_FIXNUM_OR_FLOAT_COERCE_MARKER): Fix indentation.
* test/lisp/international/ccl-tests.el: New file.
2018-08-04 10:28:13 -06:00
Tom Tromey
76715f8921
Fix bignum creation when EMACS_INT is wider than long
...
* src/alloc.c (mpz_set_intmax_slow, mpz_set_uintmax_slow): New
functions.
* src/data.c (arith_driver, Frem, Fmod, ash_lsh_impl, Fadd1)
(Fsub1): Use mpz_set_intmax, mpz_set_uintmax.
* src/emacs-module.c (module_make_integer): Use mpz_set_intmax.
* src/floatfns.c (Fabs): Use mpz_set_intmax.
* src/lisp.h (mpz_set_intmax, mpz_set_uintmax): New inline
functions.
(mpz_set_uintmax_slow, mpz_set_intmax_slow): Declare.
2018-07-19 16:08:41 -06:00
Tom Tromey
678881e428
Add missing @end defun
...
* doc/lispref/numbers.texi (Bitwise Operations): Add missing @end defun.
2018-07-19 16:08:41 -06:00
Robert Pluim
155ec50969
Add GMP to emacs_config_features
...
* configure.ac : Add GMP to emacs_config_features. This allows us
to determine whether the built-in gmp-mini is being used or not.
2018-07-13 15:26:30 +02:00
Tom Tromey
cc3d7580fc
Document bignums
...
* doc/lispref/numbers.texi (Numbers, Integer Basics)
(Predicates on Numbers, Comparison of Numbers)
(Arithmetic Operations, Bitwise Operations): Update for bignums.
* doc/lispref/objects.texi (Integer Type, Type Predicates):
Update for bignums.
* etc/NEWS: Update for bigums.
2018-07-12 22:12:48 -06:00
Tom Tromey
e2a78b0d6d
Bignum fixes for byte-compiler and bytecode interpreter
...
* lisp/emacs-lisp/byte-opt.el: Mark bignump and fixnump as
side-effect-and-error-free-fns.
* src/bytecode.c (exec_byte_code): Handle bignums.
2018-07-12 22:12:28 -06:00
Tom Tromey
45eb3b3513
Use fixnump rather than integerp in some spots
...
* src/buffer.c (syms_of_buffer): Use Qfixnump, not Qintegerp.
* src/data.c (syms_of_data): Define fixnump symbol.
* src/lisp.h (lisp_h_CHECK_FIXNUM): Use Qfixnump.
(struct Lisp_Buffer_Objfwd): Update comment.
2018-07-12 22:12:28 -06:00
Tom Tromey
27980e3604
Make ash and lsh handle bignums
...
* src/data.c (ash_lsh_impl): Handle bignums.
* test/src/data-tests.el (data-tests-ash-lsh): New test.
2018-07-12 22:12:28 -06:00
Tom Tromey
cca0e79ea8
Make logb handle bignums
...
* src/floatfns.c (Flogb): Handle bignums.
* test/src/floatfns-tests.el (bignum-logb): New test.
2018-07-12 22:12:28 -06:00
Tom Tromey
3dea8f8f53
Make % and mod handle bignums
...
* src/data.c (Frem, Fmod): Handle bignums.
* src/lisp.h (CHECK_INTEGER_COERCE_MARKER): New macro.
* test/src/data-tests.el (data-tests-check-sign)
(data-tests-%-mod): New tests.
2018-07-12 22:12:28 -06:00
Tom Tromey
d0fac17abd
Let C modules access bignum values
...
* src/emacs-module.c (module_extract_integer, module_make_integer):
Handle bignums.
2018-07-12 22:12:28 -06:00
Tom Tromey
8fb995b9e3
Make min and max handle bignums
...
* src/data.c (minmax_driver): Handle bignums.
* test/src/data-tests.el (data-tests-minmax): New test.
2018-07-12 22:12:27 -06:00
Tom Tromey
a770fb4428
Make logcount handle bignums
...
* src/data.c (Flogcount): Handle bignums.
* test/src/data-tests.el (data-tests-logcount): New test.
2018-07-12 22:12:27 -06:00
Tom Tromey
c7e393bc41
Make lognot handle bignums
...
* src/data.c (Flognot): Handle bignums.
2018-07-12 22:12:27 -06:00
Tom Tromey
0d868917ef
Make 1+ and 1- handle bignums
...
* src/data.c (Fadd1, Fsub1): Handle bignums.
* test/src/data-tests.el (data-tests-1+, data-tests-1-): New tests.
2018-07-12 22:12:27 -06:00
Tom Tromey
025adce2cf
Make abs handle bignums
...
* src/floatfns.c (Fabs): Handle bignums.
* test/src/floatfns-tests.el (bignum-abs): New test.
2018-07-12 22:12:27 -06:00
Tom Tromey
872faabbd8
Allow conversion of bignums to floats
...
* src/floatfns.c (extract_float, Ffloat): Handle bignums.
* src/lisp.h (XFLOATINT): Handle bignums.
* test/src/floatfns-tests.el (bignum-to-float): New test.
2018-07-12 22:12:27 -06:00
Tom Tromey
d14808cd27
Make format handle bignums
...
* src/editfns.c (styled_format): Handle bignums.
* test/src/editfns-tests.el (read-large-integer): Update.
(format-bignum): New test.
2018-07-12 22:12:27 -06:00
Tom Tromey
23eab9a6a6
Make number-to-string work for bignums
...
* src/data.c (Fnumber_to_string): Handle bignum.
* test/src/data-tests.el (data-tests-number-to-string): New test.
2018-07-12 22:12:27 -06:00
Tom Tromey
6d4bf2ceda
Add some bignum tests
...
* test/src/data-tests.el (data-tests-bignum, data-tests-+)
(data-tests-/, data-tests-number-predicates): New tests.
* test/src/fns-tests (test-bignum-eql): New test.
* test/src/lread-tests (lread-long-hex-integer): Expect bignum.
* test/src/print-tests (print-bignum): New test.
2018-07-12 22:12:27 -06:00
Tom Tromey
5875fbaa2d
Make arithmetic work with bignums
...
* src/data.c (free_mpz_value): New function.
(arith_driver): Rewrite.
(float_arith_driver): Handle bignums.
2018-07-12 22:12:27 -06:00
Tom Tromey
eefa65e903
Make comparison operators handle bignums
...
* sc/data.c (bignumcompare): New function.
(arithcompare): Handle bignums.
2018-07-12 22:12:27 -06:00
Tom Tromey
1e8ae6ca23
Make the reader accept bignums
...
* src/data.c (Fstring_to_number): Update.
* src/lisp.h (S2N_OVERFLOW_TO_FLOAT): Remove.
* src/lread.c (free_contents): New function.
(read_integer): Handle bignums.
(read1): Update.
(string_to_number): Handle bignums.
(syms_of_lread): Remove read-integer-overflow-as-float.
* src/process.c (Fsignal_process): Update.
2018-07-12 22:12:27 -06:00
Tom Tromey
580d173b9a
Make eql work for bignums
...
* src/fns.c (Feql, internal_equal): Handle bignums.
2018-07-12 22:12:27 -06:00
Tom Tromey
b2f3f4ee29
Provide new functions to create bignums
...
* src/alloc.c (make_bignum_str, make_number): New functions.
* src/lisp.h (make_bignum_str, make_number): Declare.
2018-07-12 22:12:27 -06:00
Tom Tromey
a0f2adbfc9
Introduce the bignum type
...
* src/alloc.c (mark_object): Handle Lisp_Misc_Bignum.
(sweep_misc): Call mpz_clear for Lisp_Misc_Bignum.
* src/data.c (Ftype_of): Handle Lisp_Misc_Bignum.
(Fintegerp, Finteger_or_marker_p, Fnatnump, Fnumberp)
(Fnumber_or_marker_p): Update for bignum.
(Ffixnump, Fbignump): New defuns.
(syms_of_data): Update.
* src/emacs.c (xrealloc_for_gmp, xfree_for_gmp): New functions.
(main): Call mp_set_memory_functions.
* src/lisp.h (enum Lisp_Misc_Type) <Lisp_Misc_Bignum>: New constant.
(struct Lisp_Bignum): New.
(union Lisp_Misc): Add u_bignum.
(BIGNUMP, XBIGNUM, INTEGERP, NATNUMP, NUMBERP, CHECK_NUMBER)
(CHECK_INTEGER, CHECK_NUMBER_COERCE_MARKER): New functions.
* src/print.c (print_object): Handle Lisp_Misc_Bignum.
2018-07-12 22:12:27 -06:00
Tom Tromey
7cb45cd25e
Add configury for GMP library
...
* configure.ac (GMP_LIB, GMP_OBJ): New substs.
* src/Makefile.in (GMP_OBJ, GMP_OBJ): New variables.
(base_obj): Add GMP_OBJ.
(LIBES): Add GMP_LIB.
* src/mini-gmp.h: New file.
* src/mini-gmp.c: New file.
2018-07-12 22:12:27 -06:00
Tom Tromey
42fe787b0f
Rename integerp->fixnum, etc, in preparation for bignums
...
* src/json.c, src/keyboard.c, src/keyboard.h, src/keymap.c,
src/kqueue.c, src/lcms.c, src/lisp.h, src/lread.c, src/macros.c,
src/marker.c, src/menu.c, src/minibuf.c, src/msdos.c, src/print.c,
src/process.c, src/profiler.c, src/search.c, src/sound.c,
src/syntax.c, src/sysdep.c, src/term.c, src/terminal.c,
src/textprop.c, src/undo.c, src/w16select.c, src/w32.c,
src/w32console.c, src/w32cygwinx.c, src/w32fns.c, src/w32font.c,
src/w32inevt.c, src/w32proc.c, src/w32select.c, src/w32term.c,
src/w32uniscribe.c, src/widget.c, src/window.c, src/xdisp.c,
src/xfaces.c, src/xfns.c, src/xfont.c, src/xftfont.c, src/xmenu.c,
src/xrdb.c, src/xselect.c, src/xterm.c, src/xwidget.c: Rename
INTEGERP->FIXNUM, make_number->make_fixnum, CHECK_NUMBER->CHECK_FIXNUM,
make_natnum->make_fixed_natum, NUMBERP->FIXED_OR_FLOATP,
NATNUMP->FIXNATP, CHECK_NATNUM->CHECK_FIXNAT.
2018-07-12 22:12:27 -06:00
Noam Postavsky
01dbf2a347
Speed up smerge-refine-regions by avoiding fsync
...
* lisp/vc/smerge-mode.el (smerge-refine-regions): Bind
write-region-inhibit-fsync to t. This was reported in
https://github.com/magit/magit/pull/2834 to give a noticable speedup.
2018-07-12 21:45:31 -04:00
Noam Postavsky
1222ff5275
Don't skip epg-tests even with gpg 2.0 (Bug#23561)
...
* test/lisp/epg-tests.el (epg-tests--config-program-alist): New
constant, which allows gpg2 version 2.0+.
(epg-tests-find-usable-gpg-configuration): Pass it to
epg-find-configuration.
2018-07-12 21:45:30 -04:00
Stefan Monnier
aeefbc41be
Fix the bootstrap differently, so zerop can be where it belongs
...
Suggested by Robert Pluim <rpluim@gmail.com>.
* lisp/emacs-lisp/byte-run.el (defun-declarations-alist): Avoid cadr/cddr.
* lisp/subr.el (zerop): Un-revert 2018-07-10T23:08:58-07:00!contovob@tcd.ie.
2018-07-12 10:29:28 -04:00
Basil L. Contovounesios
84e5986902
; Add commentary on location of zerop
...
* lisp/subr.el (zerop): Add commentary explaining why moving the
function's location within the file broke bootstrap in
2018-07-10T23:08:58-07:00!contovob@tcd.ie.
2018-07-11 10:31:49 -07:00
Glenn Morris
78125f3744
Unbreak bootstrap
...
* lisp/subr.el (zerop): Revert previous change, which caused
bootstrap to fail with void function cadr.
2018-07-11 08:27:14 -07:00
Basil L. Contovounesios
babe0d4508
; Rearrange definition of zerop in subr.el
...
* lisp/subr.el (zerop): Move from under 'List functions' heading to
under 'Basic Lisp functions' heading.
2018-07-10 23:08:58 -07:00
Stefan Monnier
f8b1e40fb6
* lisp/vc/diff-mode.el: Perform hunk refinement from font-lock
...
Remove redundant :group arguments.
(diff-font-lock-refine): New var.
(diff--refine-hunk): New function, extracted from diff-refine-hunk.
(diff-refine-hunk): Use it.
(diff--font-lock-refine--refresh): New function.
(diff--font-lock-refined): New function.
(diff-font-lock-keywords): Use it.
2018-07-10 22:52:21 -04:00
Filipp Gunbin
1d7151e98e
Fix Bug#32107
...
* lisp/progmodes/sql.el (sql-buffer-live-p): Fix handling of optional
connection argument. (Bug#32107)
2018-07-11 05:30:10 +03:00
Jonathan Kyle Mitchell
39489f782e
Fix infinite recursion in eshell/clear (Bug#31326)
...
* lisp/eshell/esh-mode.el (eshell/clear): Bind
eshell-input-filter-functions to nil to prevent entries like
eshell-smart-display-setup from causing infinite recursion.
2018-07-10 21:22:52 -04:00
Noam Postavsky
c249e17324
* lisp/indent.el (indent-line-to): Fix dedenting of tabs.
2018-07-10 12:07:01 -04:00
Paul Eggert
cc74539a19
* lisp/format.el (format-annotate-single-property-change): Simplify.
2018-07-09 19:00:43 -07:00