diff options
| author | Paul Eggert | 2019-12-10 13:54:20 -0800 |
|---|---|---|
| committer | Paul Eggert | 2019-12-10 13:58:38 -0800 |
| commit | 0940296ebe56ebdf9c32e94191d4f0b18006a910 (patch) | |
| tree | fe3b61d17d673eae41604b786932ddca32189cd0 /src | |
| parent | ea93326cc046cb1beb7535cdf6d69b216b767685 (diff) | |
| download | emacs-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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/emacs-module.h.in | 24 |
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. |
| 101 | Implementation note: We define emacs_limb_t so that it is likely to | 100 | This micro-optimization can help modules that use mpz_export and |
| 102 | match 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 |
| 103 | optimization 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 |
| 104 | memcpy. According to https://gmplib.org/manual/ABI-and-ISA.html GMP | 103 | modules shouldn't rely on the two types matching. */ |
| 105 | will prefer a 64-bit limb and will default to unsigned long if that is | 104 | typedef size_t emacs_limb_t; |
| 106 | wide enough. Note that this is an internal micro-optimization. Users | 105 | #define EMACS_LIMB_MAX SIZE_MAX |
| 107 | shouldn't rely on the exact size of emacs_limb_t. | ||
| 108 | */ | ||
| 109 | #if ULONG_MAX == 0xFFFFFFFF | ||
| 110 | typedef unsigned long long emacs_limb_t; | ||
| 111 | # define EMACS_LIMB_MAX ULLONG_MAX | ||
| 112 | #else | ||
| 113 | typedef unsigned long emacs_limb_t; | ||
| 114 | # define EMACS_LIMB_MAX ULONG_MAX | ||
| 115 | #endif | ||
| 116 | 106 | ||
| 117 | struct emacs_env_25 | 107 | struct emacs_env_25 |
| 118 | { | 108 | { |