diff options
| author | Philipp Stephani | 2019-12-23 15:37:49 +0100 |
|---|---|---|
| committer | Philipp Stephani | 2019-12-23 15:37:49 +0100 |
| commit | f8e83d73a259e1809020d47e920a96a1f5803f7a (patch) | |
| tree | ae5f8b17390a1090253025d69672f0eca52c5f28 /doc | |
| parent | 0abdb01be6c1adee1f179b1d5f7a9fb4ee670109 (diff) | |
| download | emacs-f8e83d73a259e1809020d47e920a96a1f5803f7a.tar.gz emacs-f8e83d73a259e1809020d47e920a96a1f5803f7a.zip | |
Document and verify that emacs_limb_t doesn’t have padding bits.
This is a useful property when doing further bit-twiddling with the
magnitude array before/after calling extract_big_integer or
make_big_integer. For example, constructing an emacs_limb_t object
using repeated shift-and-add should work as expected, but relies on
the type not having padding bits. Since the C standard already
guarantees that unsigned integers use a pure binary representation,
not having padding bits is enough to guarantee that the type has
unique object representations in the sense of C++’s
std::has_unique_object_representations.
* doc/lispref/internals.texi (Module Values): Document that
emacs_limb_t doesn’t have padding bits.
* src/emacs-module.c: Verify that emacs_limb_t doesn’t have padding
bits.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/lispref/internals.texi | 7 |
1 files changed, 4 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. | |||
| 1508 | @end deftypefn | 1508 | @end deftypefn |
| 1509 | 1509 | ||
| 1510 | @deftp {Type alias} emacs_limb_t | 1510 | @deftp {Type alias} emacs_limb_t |
| 1511 | This is an unsigned integer type, | 1511 | This is an unsigned integer type, used as the element type for the |
| 1512 | used as the element type for the magnitude arrays for the big | 1512 | magnitude arrays for the big integer conversion functions. The type |
| 1513 | integer conversion functions. | 1513 | is guaranteed to have unique object representations, i.e., no padding |
| 1514 | bits. | ||
| 1514 | @end deftp | 1515 | @end deftp |
| 1515 | 1516 | ||
| 1516 | @defvr Macro EMACS_LIMB_MAX | 1517 | @defvr Macro EMACS_LIMB_MAX |