]> code.delx.au - gnu-emacs/commitdiff
Improve clarity of USE_LSB_TAG definition.
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 29 Nov 2014 07:38:41 +0000 (23:38 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 29 Nov 2014 07:39:06 +0000 (23:39 -0800)
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
src/lisp.h

index ed111bf381415c3dc85f2ad348dab967893abab0..53834edffa8d441b1bdb6c33b8eb1e8a881fa9a9 100644 (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
index bdff0195eac6ef3d50a45f5911896cfac56d48b2..42bb33704fa438846e04c288b2dc9952bac0b1ba 100644 (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