diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2018-08-18 19:40:24 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2018-08-18 19:41:33 -0700 |
commit | 6eade1efde873d0b048d8f2841646924cb2ceb16 (patch) | |
tree | 6d4e3304cf8acedb9b3d841d6de35a3c868ec029 /lisp/emacs-lisp/cursor-sensor.el | |
parent | 1d2df2fd03f35ca8d8dfc8b999d8bba3c7c13157 (diff) | |
download | emacs-6eade1efde873d0b048d8f2841646924cb2ceb16.tar.gz emacs-6eade1efde873d0b048d8f2841646924cb2ceb16.tar.bz2 emacs-6eade1efde873d0b048d8f2841646924cb2ceb16.zip |
Improve --with-wide-int mpz_t→fixnum conversion
These tuneups and minor simplifications should affect only
platforms with EMACS_INT wider than ‘long’.
* src/alloc.c (make_number): If the number fits in long but
not in fixnum, do not attempt to convert to fixnum again.
Tighten the compile-time check for whether the second attempt
is worth trying, from sizeof (long) < sizeof (EMACS_INT) to
LONG_WIDTH < FIXNUM_BITS. Do not bother computing the sign of
the value to tighten the bounds for whether to try the second
attempt, as it’s not worth the effort. Do not call mpz_size,
which is unnecessary since the number of bits is already known
and the loop can iterate over a shift count instead. Avoid
unnecessary casts. Use + instead of | where either will do,
as + is typically better for optimization.
Improve mpz_t to fixnum when --with-wide-int
* src/alloc.c (make_number): Avoid undefined behavior
when shifting an EMACS_UINT by more than EMACS_UINT_WIDTH bits.
Check for integer overflow when shifting.
Diffstat (limited to 'lisp/emacs-lisp/cursor-sensor.el')
0 files changed, 0 insertions, 0 deletions