[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 0bba1b8c3df: Port modiff changes to GCC 4.8.5
From: |
Paul Eggert |
Subject: |
master 0bba1b8c3df: Port modiff changes to GCC 4.8.5 |
Date: |
Wed, 17 May 2023 13:55:59 -0400 (EDT) |
branch: master
commit 0bba1b8c3df8b7b53e08fd69dcc832d253e7a2d1
Author: Paul Eggert <eggert@cs.ucla.edu>
Commit: Paul Eggert <eggert@cs.ucla.edu>
Port modiff changes to GCC 4.8.5
Problem reported by Spencer Baugh.
* src/lisp.h (elogb): Now simply a function on unsigned long long int.
This avoids problems porting to GCC 4.8.5 20150623 (Red Hat 4.8.5-44).
There may be a minor runtime cost on 32-bit platforms but it’s
not worth worrying about.
---
src/lisp.h | 17 +++++------------
1 file changed, 5 insertions(+), 12 deletions(-)
diff --git a/src/lisp.h b/src/lisp.h
index c9a64f07427..57c1c7395c1 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -3906,18 +3906,11 @@ integer_to_uintmax (Lisp_Object num, uintmax_t *n)
}
/* Return floor (log2 (N)) as an int, where 0 < N <= ULLONG_MAX. */
-#if (201112 <= __STDC_VERSION__ && INT_MAX <= UINT_MAX \
- && LONG_MAX <= ULONG_MAX && LLONG_MAX <= ULLONG_MAX)
-# define elogb(n) \
- _Generic (+(n), \
- int: UINT_WIDTH - 1 - count_leading_zeros (n), \
- unsigned int: UINT_WIDTH - 1 - count_leading_zeros (n), \
- long: ULONG_WIDTH - 1 - count_leading_zeros_l (n), \
- unsigned long: ULONG_WIDTH - 1 - count_leading_zeros_l (n), \
- default: ULLONG_WIDTH - 1 - count_leading_zeros_ll (n))
-#else
-# define elogb(n) (ULLONG_WIDTH - 1 - count_leading_zeros_ll (n))
-#endif
+INLINE int
+elogb (unsigned long long int n)
+{
+ return ULLONG_WIDTH - 1 - count_leading_zeros_ll (n);
+}
/* A modification count. These are wide enough, and incremented
rarely enough, so that they should never overflow a 60-bit counter
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 0bba1b8c3df: Port modiff changes to GCC 4.8.5,
Paul Eggert <=