Improve clarity of USE_LSB_TAG definition.

Problem reported by Lee Duhem.  Suggestion by Andreas Schwab in:
http://lists.gnu.org/archive/html/emacs-devel/2014-11/msg02222.html
* lisp.h (USE_LSB_TAG): Define in terms of the (simpler)
VAL_MAX / 2 rather than in terms of the (more complicated)
EMACS_INT_MAX >> GCTYPEBITS, and adjust commentary to match.
This commit is contained in:
Paul Eggert 2014-11-28 23:38:41 -08:00
parent 0cce3623b1
commit 366c1ceb03
2 changed files with 13 additions and 3 deletions

View file

@ -1,3 +1,12 @@
2014-11-29 Paul Eggert <eggert@cs.ucla.edu>
Improve clarity of USE_LSB_TAG definition.
Problem reported by Lee Duhem. Suggestion by Andreas Schwab in:
http://lists.gnu.org/archive/html/emacs-devel/2014-11/msg02222.html
* lisp.h (USE_LSB_TAG): Define in terms of the (simpler)
VAL_MAX / 2 rather than in terms of the (more complicated)
EMACS_INT_MAX >> GCTYPEBITS, and adjust commentary to match.
2014-11-29 Eli Zaretskii <eliz@gnu.org>
* xdisp.c (handle_single_display_spec): When ignoring a fringe

View file

@ -257,16 +257,17 @@ enum Lisp_Bits
/* The maximum value that can be stored in a EMACS_INT, assuming all
bits other than the type bits contribute to a nonnegative signed value.
This can be used in #if, e.g., '#if VAL_MAX < UINTPTR_MAX' below. */
This can be used in #if, e.g., '#if USB_TAG' below expands to an
expression involving VAL_MAX. */
#define VAL_MAX (EMACS_INT_MAX >> (GCTYPEBITS - 1))
/* Whether the least-significant bits of an EMACS_INT contain the tag.
On hosts where pointers-as-ints do not exceed VAL_MAX, USE_LSB_TAG is:
On hosts where pointers-as-ints do not exceed VAL_MAX / 2, USE_LSB_TAG is:
a. unnecessary, because the top bits of an EMACS_INT are unused, and
b. slower, because it typically requires extra masking.
So, USE_LSB_TAG is true only on hosts where it might be useful. */
DEFINE_GDB_SYMBOL_BEGIN (bool, USE_LSB_TAG)
#define USE_LSB_TAG (EMACS_INT_MAX >> GCTYPEBITS < INTPTR_MAX)
#define USE_LSB_TAG (VAL_MAX / 2 < INTPTR_MAX)
DEFINE_GDB_SYMBOL_END (USE_LSB_TAG)
#if !USE_LSB_TAG && !defined WIDE_EMACS_INT