From 366c1ceb038b42ed8590486e1a3c3cebba87e9da Mon Sep 17 00:00:00 2001 From: Paul Eggert <eggert@cs.ucla.edu> Date: Fri, 28 Nov 2014 23:38:41 -0800 Subject: [PATCH] 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. --- src/ChangeLog | 9 +++++++++ src/lisp.h | 7 ++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index ed111bf3814..53834edffa8 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -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 diff --git a/src/lisp.h b/src/lisp.h index bdff0195eac..42bb33704fa 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -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 -- 2.39.5