diff options
| author | Paul Eggert | 2014-11-28 23:38:41 -0800 |
|---|---|---|
| committer | Paul Eggert | 2014-11-28 23:39:06 -0800 |
| commit | 366c1ceb038b42ed8590486e1a3c3cebba87e9da (patch) | |
| tree | 8afbee532cef5f6ff9ddca7e7b0eb4c80d615f37 | |
| parent | 0cce3623b169732a51f055a86fc926313b11a5ee (diff) | |
| download | emacs-366c1ceb038b42ed8590486e1a3c3cebba87e9da.tar.gz emacs-366c1ceb038b42ed8590486e1a3c3cebba87e9da.zip | |
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.
| -rw-r--r-- | src/ChangeLog | 9 | ||||
| -rw-r--r-- | 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 @@ | |||
| 1 | 2014-11-29 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Improve clarity of USE_LSB_TAG definition. | ||
| 4 | Problem reported by Lee Duhem. Suggestion by Andreas Schwab in: | ||
| 5 | http://lists.gnu.org/archive/html/emacs-devel/2014-11/msg02222.html | ||
| 6 | * lisp.h (USE_LSB_TAG): Define in terms of the (simpler) | ||
| 7 | VAL_MAX / 2 rather than in terms of the (more complicated) | ||
| 8 | EMACS_INT_MAX >> GCTYPEBITS, and adjust commentary to match. | ||
| 9 | |||
| 1 | 2014-11-29 Eli Zaretskii <eliz@gnu.org> | 10 | 2014-11-29 Eli Zaretskii <eliz@gnu.org> |
| 2 | 11 | ||
| 3 | * xdisp.c (handle_single_display_spec): When ignoring a fringe | 12 | * 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 | |||
| 257 | 257 | ||
| 258 | /* The maximum value that can be stored in a EMACS_INT, assuming all | 258 | /* The maximum value that can be stored in a EMACS_INT, assuming all |
| 259 | bits other than the type bits contribute to a nonnegative signed value. | 259 | bits other than the type bits contribute to a nonnegative signed value. |
| 260 | This can be used in #if, e.g., '#if VAL_MAX < UINTPTR_MAX' below. */ | 260 | This can be used in #if, e.g., '#if USB_TAG' below expands to an |
| 261 | expression involving VAL_MAX. */ | ||
| 261 | #define VAL_MAX (EMACS_INT_MAX >> (GCTYPEBITS - 1)) | 262 | #define VAL_MAX (EMACS_INT_MAX >> (GCTYPEBITS - 1)) |
| 262 | 263 | ||
| 263 | /* Whether the least-significant bits of an EMACS_INT contain the tag. | 264 | /* Whether the least-significant bits of an EMACS_INT contain the tag. |
| 264 | On hosts where pointers-as-ints do not exceed VAL_MAX, USE_LSB_TAG is: | 265 | On hosts where pointers-as-ints do not exceed VAL_MAX / 2, USE_LSB_TAG is: |
| 265 | a. unnecessary, because the top bits of an EMACS_INT are unused, and | 266 | a. unnecessary, because the top bits of an EMACS_INT are unused, and |
| 266 | b. slower, because it typically requires extra masking. | 267 | b. slower, because it typically requires extra masking. |
| 267 | So, USE_LSB_TAG is true only on hosts where it might be useful. */ | 268 | So, USE_LSB_TAG is true only on hosts where it might be useful. */ |
| 268 | DEFINE_GDB_SYMBOL_BEGIN (bool, USE_LSB_TAG) | 269 | DEFINE_GDB_SYMBOL_BEGIN (bool, USE_LSB_TAG) |
| 269 | #define USE_LSB_TAG (EMACS_INT_MAX >> GCTYPEBITS < INTPTR_MAX) | 270 | #define USE_LSB_TAG (VAL_MAX / 2 < INTPTR_MAX) |
| 270 | DEFINE_GDB_SYMBOL_END (USE_LSB_TAG) | 271 | DEFINE_GDB_SYMBOL_END (USE_LSB_TAG) |
| 271 | 272 | ||
| 272 | #if !USE_LSB_TAG && !defined WIDE_EMACS_INT | 273 | #if !USE_LSB_TAG && !defined WIDE_EMACS_INT |