diff options
-rw-r--r-- | doc/lispref/internals.texi | 7 | ||||
-rw-r--r-- | src/emacs-module.c | 7 |
2 files changed, 11 insertions, 3 deletions
diff --git a/doc/lispref/internals.texi b/doc/lispref/internals.texi index 2a4e64dbb56..bccdca65e4e 100644 --- a/doc/lispref/internals.texi +++ b/doc/lispref/internals.texi @@ -1508,9 +1508,10 @@ overflow in the size calculation. @end deftypefn @deftp {Type alias} emacs_limb_t -This is an unsigned integer type, -used as the element type for the magnitude arrays for the big -integer conversion functions. +This is an unsigned integer type, used as the element type for the +magnitude arrays for the big integer conversion functions. The type +is guaranteed to have unique object representations, i.e., no padding +bits. @end deftp @defvr Macro EMACS_LIMB_MAX diff --git a/src/emacs-module.c b/src/emacs-module.c index f372a153ccf..f2e3f627756 100644 --- a/src/emacs-module.c +++ b/src/emacs-module.c @@ -827,6 +827,13 @@ enum module_bignum_count_max = min (SIZE_MAX, PTRDIFF_MAX) / sizeof (emacs_limb_t) }; +/* Verify that emacs_limb_t indeed has unique object + representations. */ +verify (CHAR_BIT == 8); +verify ((sizeof (emacs_limb_t) == 4 && EMACS_LIMB_MAX == 0xFFFFFFFF) + || (sizeof (emacs_limb_t) == 8 + && EMACS_LIMB_MAX == 0xFFFFFFFFFFFFFFFF)); + static bool module_extract_big_integer (emacs_env *env, emacs_value arg, int *sign, ptrdiff_t *count, emacs_limb_t *magnitude) |