aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2019-12-10 13:54:20 -0800
committerPaul Eggert2019-12-10 13:58:38 -0800
commit0940296ebe56ebdf9c32e94191d4f0b18006a910 (patch)
treefe3b61d17d673eae41604b786932ddca32189cd0
parentea93326cc046cb1beb7535cdf6d69b216b767685 (diff)
downloademacs-0940296ebe56ebdf9c32e94191d4f0b18006a910.tar.gz
emacs-0940296ebe56ebdf9c32e94191d4f0b18006a910.zip
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.
-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/>. */
20#ifndef EMACS_MODULE_H 20#ifndef EMACS_MODULE_H
21#define EMACS_MODULE_H 21#define EMACS_MODULE_H
22 22
23#include <limits.h>
24#include <stdint.h> 23#include <stdint.h>
25#include <stddef.h> 24#include <stddef.h>
26#include <time.h> 25#include <time.h>
@@ -97,22 +96,13 @@ enum emacs_process_input_result
97 emacs_process_input_quit = 1 96 emacs_process_input_quit = 1
98}; 97};
99 98
100/* 99/* Define emacs_limb_t so that it is likely to match GMP's mp_limb_t.
101Implementation note: We define emacs_limb_t so that it is likely to 100 This micro-optimization can help modules that use mpz_export and
102match the GMP mp_limb_t type. If the types match, GMP can use an 101 mpz_import, which operate more efficiently on mp_limb_t. It's OK
103optimization for mpz_import and mpz_export that boils down to a 102 (if perhaps a bit slower) if the two types do not match, and
104memcpy. According to https://gmplib.org/manual/ABI-and-ISA.html GMP 103 modules shouldn't rely on the two types matching. */
105will prefer a 64-bit limb and will default to unsigned long if that is 104typedef size_t emacs_limb_t;
106wide enough. Note that this is an internal micro-optimization. Users 105#define EMACS_LIMB_MAX SIZE_MAX
107shouldn't rely on the exact size of emacs_limb_t.
108*/
109#if ULONG_MAX == 0xFFFFFFFF
110typedef unsigned long long emacs_limb_t;
111# define EMACS_LIMB_MAX ULLONG_MAX
112#else
113typedef unsigned long emacs_limb_t;
114# define EMACS_LIMB_MAX ULONG_MAX
115#endif
116 106
117struct emacs_env_25 107struct emacs_env_25
118{ 108{