summaryrefslogtreecommitdiff
path: root/src/emacs-module.h.in
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2019-12-10 13:54:20 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2019-12-10 13:58:38 -0800
commit0940296ebe56ebdf9c32e94191d4f0b18006a910 (patch)
treefe3b61d17d673eae41604b786932ddca32189cd0 /src/emacs-module.h.in
parentea93326cc046cb1beb7535cdf6d69b216b767685 (diff)
downloademacs-0940296ebe56ebdf9c32e94191d4f0b18006a910.tar.gz
Just use size_t for emacs_limb_t
* src/emacs-module.h.in: Do not include limits.h; no longer needed. (emacs_limb_t, EMACS_LIMB_MAX): Now size_t and SIZE_MAX.
Diffstat (limited to 'src/emacs-module.h.in')
-rw-r--r--src/emacs-module.h.in24
1 files changed, 7 insertions, 17 deletions
diff --git a/src/emacs-module.h.in b/src/emacs-module.h.in
index 800c0188ff5..0891b1aa28a 100644
--- a/src/emacs-module.h.in
+++ b/src/emacs-module.h.in
@@ -20,7 +20,6 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
#ifndef EMACS_MODULE_H
#define EMACS_MODULE_H
-#include <limits.h>
#include <stdint.h>
#include <stddef.h>
#include <time.h>
@@ -97,22 +96,13 @@ enum emacs_process_input_result
emacs_process_input_quit = 1
};
-/*
-Implementation note: We define emacs_limb_t so that it is likely to
-match the GMP mp_limb_t type. If the types match, GMP can use an
-optimization for mpz_import and mpz_export that boils down to a
-memcpy. According to https://gmplib.org/manual/ABI-and-ISA.html GMP
-will prefer a 64-bit limb and will default to unsigned long if that is
-wide enough. Note that this is an internal micro-optimization. Users
-shouldn't rely on the exact size of emacs_limb_t.
-*/
-#if ULONG_MAX == 0xFFFFFFFF
-typedef unsigned long long emacs_limb_t;
-# define EMACS_LIMB_MAX ULLONG_MAX
-#else
-typedef unsigned long emacs_limb_t;
-# define EMACS_LIMB_MAX ULONG_MAX
-#endif
+/* Define emacs_limb_t so that it is likely to match GMP's mp_limb_t.
+ This micro-optimization can help modules that use mpz_export and
+ mpz_import, which operate more efficiently on mp_limb_t. It's OK
+ (if perhaps a bit slower) if the two types do not match, and
+ modules shouldn't rely on the two types matching. */
+typedef size_t emacs_limb_t;
+#define EMACS_LIMB_MAX SIZE_MAX
struct emacs_env_25
{