1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-04-30 10:11:47 -07:00

Add module functions to convert from and to big integers.

* src/module-env-27.h: Add new module functions to convert big
integers.

* src/emacs-module.h.in (emacs_mpz): Define if GMP is available.

* src/emacs-module.c (module_extract_big_integer)
(module_make_big_integer): New functions.
(initialize_environment): Use them.

* test/data/emacs-module/mod-test.c (Fmod_test_double): New test
function.
(emacs_module_init): Define it.

* test/src/emacs-module-tests.el (mod-test-double): New unit test.

* doc/lispref/internals.texi (Module Values): Document new functions.
This commit is contained in:
Philipp Stephani 2019-04-18 22:38:29 +02:00
parent bffceab633
commit e290a7d173
8 changed files with 111 additions and 0 deletions

View file

@ -338,4 +338,11 @@ Interactively, you can try hitting \\[keyboard-quit] to quit."
(ert-info ((format "input: %s" input))
(should-error (mod-test-add-nanosecond input)))))
(ert-deftest mod-test-double ()
(dolist (input (list 0 1 2 -1 42 12345678901234567890
most-positive-fixnum (1+ most-positive-fixnum)
most-negative-fixnum (1- most-negative-fixnum)))
(ert-info ((format "input: %d" input))
(should (= (mod-test-double input) (* 2 input))))))
;;; emacs-module-tests.el ends here